aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2019-12-30 03:55:42 +0100
committerGitHub <noreply@github.com>2019-12-30 03:55:42 +0100
commitfa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89 (patch)
treeb9f75736d90eb228de26ad8dcf9956bd1e6bd7e8 /src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java
parenta731e939c6b9a70ac9fd444dbf06243f63f29c06 (diff)
parentd2ab710218628d51cd2ede566d50492238d797cf (diff)
downloadGT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.tar.gz
GT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.tar.bz2
GT5-Unofficial-fa1a1f4a6cd8dee8011a8f04fa6afbcc71d8db89.zip
Merge pull request #5 from alkcorp/master
sync fork
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java')
-rw-r--r--src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java247
1 files changed, 247 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java
new file mode 100644
index 0000000000..201da99488
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java
@@ -0,0 +1,247 @@
+package gtPlusPlus.plugin.agrichem.item.algae;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.OreDictUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.renderer.texture.TextureAtlasSprite;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class ItemAgrichemBase extends Item {
+
+ final protected IIcon base[];
+
+ /*
+ * 0 - Algae Biomass
+ * 1 - Green Algae Biomass
+ * 2 - Brown Algae Biomass
+ * 3 - Golden-Brown Algae Biomass
+ * 4 - Red Algae Biomass
+ * 5 - Cellulose Fiber
+ * 6 - Golden-Brown Cellulose Fiber
+ * 7 - Red Cellulose Fiber
+ * 8 - Compost
+ * 9 - Wood Pellet
+ * 10 - Wood Brick
+ * 11 - Cellulose Pulp
+ * 12 - Raw Bio Resin
+ * 13 - Catalyst Carrier
+ * 14 - Green Metal Catalyst
+ * 15 - Alginic Acid
+ * 16 - Alumina
+ * 17 - Aluminium Pellet
+ * 18 - Sodium Aluminate
+ * 19 - Sodium Hydroxide // Exists in Newer GT
+ * 20 - Sodium Carbonate
+ * 21 - Lithium Chloride
+ * 22 - Pellet Mold
+ * 23 - Clean Aluminium Mix
+ */
+
+ public ItemAgrichemBase() {
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ base = new IIcon[24];
+ this.setUnlocalizedName("BasicAgrichemItem");
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ try {
+
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ super.addInformation(aStack, p_77624_2_, aList, p_77624_4_);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack p_77613_1_) {
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return false;
+ }
+
+ private static boolean mHasCheckedForSodiumHydroxide = false;
+ private static boolean mShowSodiumHydroxide = true;
+
+ private static boolean checkSodiumHydroxide() {
+ if (mHasCheckedForSodiumHydroxide) {
+ return mShowSodiumHydroxide;
+ }
+ else {
+ if (OreDictUtils.containsValidEntries("dustSodiumHydroxide_GT5U")
+ || OreDictUtils.containsValidEntries("dustSodiumHydroxide")) {
+ List<ItemStack> aTest = OreDictionary.getOres(
+ "dustSodiumHydroxide", false
+ );
+ if (aTest.isEmpty()) {
+ aTest = OreDictionary.getOres(
+ "dustSodiumHydroxide_GT5U", false
+ );
+ if (!aTest.isEmpty()) {
+ mShowSodiumHydroxide = false;
+ }
+ }
+ else {
+ mShowSodiumHydroxide = false;
+ }
+ }
+ }
+ mHasCheckedForSodiumHydroxide = true;
+ return mShowSodiumHydroxide;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int i=0;i<base.length;i++) {
+ if (i == 19) {
+ // Only show if it doesn't exist.
+ if (checkSodiumHydroxide()) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+ else {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ for (int i=0;i<this.base.length;i++) {
+ String aPath = CORE.MODID + ":" + "bioscience/MetaItem1/"+i;
+ this.base[i] = u.registerIcon(aPath);
+ }
+ }
+
+
+ private boolean isTextureValid(String aPath) {
+ if (aPath == null) {
+ return false;
+ }
+ else if (aPath.indexOf(92) == -1) {
+ Constructor aTextureAtlasSprite = ReflectionUtils.getConstructor(
+ TextureAtlasSprite.class, String.class
+ );
+ if (aTextureAtlasSprite != null) {
+ try {
+ TextureAtlasSprite aTestAtlas = (TextureAtlasSprite) aTextureAtlasSprite.newInstance(
+ aPath
+ );
+ if (aTestAtlas != null) {
+ return true;
+ }
+ }
+ catch (InstantiationException | IllegalAccessException
+ | IllegalArgumentException
+ | InvocationTargetException e) {
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+
+}