From 7224ac4299098c70efae9dbd04c50a97e3f5f583 Mon Sep 17 00:00:00 2001 From: Blood Asp Date: Thu, 23 Apr 2015 18:14:22 +0200 Subject: Initial Commit --- .../common/items/behaviors/Behaviour_Arrow.java | 135 +++++++++++++++ .../items/behaviors/Behaviour_Arrow_Potion.java | 72 ++++++++ .../common/items/behaviors/Behaviour_Crowbar.java | 69 ++++++++ .../common/items/behaviors/Behaviour_DataOrb.java | 121 ++++++++++++++ .../items/behaviors/Behaviour_DataStick.java | 43 +++++ .../common/items/behaviors/Behaviour_Hoe.java | 74 +++++++++ .../common/items/behaviors/Behaviour_Lighter.java | 143 ++++++++++++++++ .../common/items/behaviors/Behaviour_None.java | 88 ++++++++++ .../behaviors/Behaviour_Plunger_Essentia.java | 59 +++++++ .../items/behaviors/Behaviour_Plunger_Fluid.java | 62 +++++++ .../items/behaviors/Behaviour_Plunger_Item.java | 82 ++++++++++ .../items/behaviors/Behaviour_PrintedPages.java | 46 ++++++ .../items/behaviors/Behaviour_Prospecting.java | 149 +++++++++++++++++ .../common/items/behaviors/Behaviour_Scanner.java | 50 ++++++ .../common/items/behaviors/Behaviour_Scoop.java | 63 +++++++ .../items/behaviors/Behaviour_Screwdriver.java | 62 +++++++ .../common/items/behaviors/Behaviour_Sense.java | 59 +++++++ .../items/behaviors/Behaviour_SensorKit.java | 58 +++++++ .../items/behaviors/Behaviour_SoftHammer.java | 131 +++++++++++++++ .../items/behaviors/Behaviour_Sonictron.java | 147 +++++++++++++++++ .../items/behaviors/Behaviour_Spray_Color.java | 143 ++++++++++++++++ .../common/items/behaviors/Behaviour_Wrench.java | 182 +++++++++++++++++++++ .../items/behaviors/Behaviour_WrittenBook.java | 44 +++++ 23 files changed, 2082 insertions(+) create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_None.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Sense.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java create mode 100644 main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java (limited to 'main/java/gregtech/common/items/behaviors') diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java new file mode 100644 index 0000000000..0b59f2772a --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java @@ -0,0 +1,135 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.enums.SubTag; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.util.GT_Utility; +/* 6: */ import gregtech.api.util.GT_Utility.GT_EnchantmentHelper; +/* 7: */ import gregtech.api.util.GT_Utility.ItemNBT; +/* 8: */ import gregtech.common.entities.GT_Entity_Arrow; +/* 9: */ import net.minecraft.block.BlockDispenser; +/* 10: */ import net.minecraft.dispenser.IBlockSource; +/* 11: */ import net.minecraft.dispenser.IPosition; +/* 12: */ import net.minecraft.enchantment.Enchantment; +/* 13: */ import net.minecraft.entity.Entity; +/* 14: */ import net.minecraft.entity.EntityLivingBase; +/* 15: */ import net.minecraft.entity.player.EntityPlayer; +/* 16: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 17: */ import net.minecraft.entity.projectile.EntityArrow; +/* 18: */ import net.minecraft.item.ItemStack; +/* 19: */ import net.minecraft.nbt.NBTTagCompound; +/* 20: */ import net.minecraft.util.EnumFacing; +/* 21: */ import net.minecraft.world.World; +/* 22: */ +/* 23: */ public class Behaviour_Arrow +/* 24: */ extends Behaviour_None +/* 25: */ { +/* 26: 22 */ public static Behaviour_Arrow DEFAULT_WOODEN = new Behaviour_Arrow(GT_Entity_Arrow.class, 1.0F, 6.0F); +/* 27: 23 */ public static Behaviour_Arrow DEFAULT_PLASTIC = new Behaviour_Arrow(GT_Entity_Arrow.class, 1.5F, 6.0F); +/* 28: */ private final int mLevel; +/* 29: */ private final Enchantment mEnchantment; +/* 30: */ private final float mSpeedMultiplier; +/* 31: */ private final float mPrecision; +/* 32: */ private final Class mArrow; +/* 33: */ +/* 34: */ public Behaviour_Arrow(Class aArrow, float aSpeed, float aPrecision) +/* 35: */ { +/* 36: 31 */ this(aArrow, aSpeed, aPrecision, null, 0); +/* 37: */ } +/* 38: */ +/* 39: */ public Behaviour_Arrow(Class aArrow, float aSpeed, float aPrecision, Enchantment aEnchantment, int aLevel) +/* 40: */ { +/* 41: 35 */ this.mArrow = aArrow; +/* 42: 36 */ this.mSpeedMultiplier = aSpeed; +/* 43: 37 */ this.mPrecision = aPrecision; +/* 44: 38 */ this.mEnchantment = aEnchantment; +/* 45: 39 */ this.mLevel = aLevel; +/* 46: */ } +/* 47: */ +/* 48: */ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) +/* 49: */ { +/* 50: 44 */ if ((aEntity instanceof EntityLivingBase)) +/* 51: */ { +/* 52: 45 */ GT_Utility.GT_EnchantmentHelper.applyBullshitA((EntityLivingBase)aEntity, aPlayer, aStack); +/* 53: 46 */ GT_Utility.GT_EnchantmentHelper.applyBullshitB(aPlayer, aEntity, aStack); +/* 54: 47 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 55: 47 */ aStack.stackSize -= 1; +/* 56: */ } +/* 57: 48 */ if (aStack.stackSize <= 0) { +/* 58: 48 */ aPlayer.destroyCurrentEquippedItem(); +/* 59: */ } +/* 60: 49 */ return false; +/* 61: */ } +/* 62: 51 */ return false; +/* 63: */ } +/* 64: */ +/* 65: */ public boolean isItemStackUsable(GT_MetaBase_Item aItem, ItemStack aStack) +/* 66: */ { +/* 67: 56 */ if ((this.mEnchantment != null) && (this.mLevel > 0)) +/* 68: */ { +/* 69: 57 */ NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack); +/* 70: 58 */ if (!tNBT.getBoolean("GT.HasBeenUpdated")) +/* 71: */ { +/* 72: 59 */ tNBT.setBoolean("GT.HasBeenUpdated", true); +/* 73: 60 */ GT_Utility.ItemNBT.setNBT(aStack, tNBT); +/* 74: 61 */ GT_Utility.ItemNBT.addEnchantment(aStack, this.mEnchantment, this.mLevel); +/* 75: */ } +/* 76: */ } +/* 77: 64 */ return true; +/* 78: */ } +/* 79: */ +/* 80: */ public boolean canDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack) +/* 81: */ { +/* 82: 69 */ return true; +/* 83: */ } +/* 84: */ +/* 85: */ public ItemStack onDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack) +/* 86: */ { +/* 87: 74 */ World aWorld = aSource.getWorld(); +/* 88: 75 */ IPosition tPosition = BlockDispenser.func_149939_a(aSource); +/* 89: 76 */ EnumFacing tFacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); +/* 90: 77 */ GT_Entity_Arrow tEntityArrow = (GT_Entity_Arrow)getProjectile(aItem, SubTag.PROJECTILE_ARROW, aStack, aWorld, tPosition.getX(), tPosition.getY(), tPosition.getZ()); +/* 91: 78 */ if (tEntityArrow != null) +/* 92: */ { +/* 93: 79 */ tEntityArrow.setThrowableHeading(tFacing.getFrontOffsetX(), tFacing.getFrontOffsetY() + 0.1F, tFacing.getFrontOffsetZ(), this.mSpeedMultiplier * 1.1F, this.mPrecision); +/* 94: 80 */ tEntityArrow.setArrowItem(aStack); +/* 95: 81 */ tEntityArrow.canBePickedUp = 1; +/* 96: 82 */ aWorld.spawnEntityInWorld(tEntityArrow); +/* 97: 83 */ if (aStack.stackSize < 100) { +/* 98: 83 */ aStack.stackSize -= 1; +/* 99: */ } +/* 100: 84 */ return aStack; +/* 101: */ } +/* 102: 86 */ return super.onDispense(aItem, aSource, aStack); +/* 103: */ } +/* 104: */ +/* 105: */ public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack) +/* 106: */ { +/* 107: 91 */ return aProjectileType == SubTag.PROJECTILE_ARROW; +/* 108: */ } +/* 109: */ +/* 110: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) +/* 111: */ { +/* 112: 96 */ if (!hasProjectile(aItem, aProjectileType, aStack)) { +/* 113: 96 */ return null; +/* 114: */ } +/* 115: 97 */ GT_Entity_Arrow rArrow = (GT_Entity_Arrow)GT_Utility.callConstructor(this.mArrow.getName(), -1, null, true, new Object[] { aWorld, Double.valueOf(aX), Double.valueOf(aY), Double.valueOf(aZ) }); +/* 116: 98 */ rArrow.setArrowItem(aStack); +/* 117: 99 */ return rArrow; +/* 118: */ } +/* 119: */ +/* 120: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) +/* 121: */ { +/* 122:104 */ if (!hasProjectile(aItem, aProjectileType, aStack)) { +/* 123:104 */ return null; +/* 124: */ } +/* 125:105 */ GT_Entity_Arrow rArrow = (GT_Entity_Arrow)GT_Utility.callConstructor(this.mArrow.getName(), -1, null, true, new Object[] { aWorld, aEntity, Float.valueOf(this.mSpeedMultiplier * aSpeed) }); +/* 126:106 */ rArrow.setArrowItem(aStack); +/* 127:107 */ return rArrow; +/* 128: */ } +/* 129: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Arrow + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java new file mode 100644 index 0000000000..ac0d341e73 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java @@ -0,0 +1,72 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.enums.SubTag; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.common.entities.GT_Entity_Arrow_Potion; +/* 6: */ import java.util.Random; +/* 7: */ import net.minecraft.enchantment.Enchantment; +/* 8: */ import net.minecraft.entity.Entity; +/* 9: */ import net.minecraft.entity.EntityLivingBase; +/* 10: */ import net.minecraft.entity.player.EntityPlayer; +/* 11: */ import net.minecraft.entity.projectile.EntityArrow; +/* 12: */ import net.minecraft.item.ItemStack; +/* 13: */ import net.minecraft.potion.PotionEffect; +/* 14: */ import net.minecraft.world.World; +/* 15: */ +/* 16: */ public class Behaviour_Arrow_Potion +/* 17: */ extends Behaviour_Arrow +/* 18: */ { +/* 19: */ private final int[] mPotions; +/* 20: */ +/* 21: */ public Behaviour_Arrow_Potion(float aSpeed, float aPrecision, int... aPotions) +/* 22: */ { +/* 23:19 */ super(GT_Entity_Arrow_Potion.class, aSpeed, aPrecision); +/* 24:20 */ this.mPotions = aPotions; +/* 25: */ } +/* 26: */ +/* 27: */ public Behaviour_Arrow_Potion(float aSpeed, float aPrecision, Enchantment aEnchantment, int aLevel, int... aPotions) +/* 28: */ { +/* 29:24 */ super(GT_Entity_Arrow_Potion.class, aSpeed, aPrecision, aEnchantment, aLevel); +/* 30:25 */ this.mPotions = aPotions; +/* 31: */ } +/* 32: */ +/* 33: */ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) +/* 34: */ { +/* 35:30 */ if ((aEntity instanceof EntityLivingBase)) { +/* 36:30 */ for (int i = 3; i < this.mPotions.length; i += 4) { +/* 37:30 */ if (aEntity.worldObj.rand.nextInt(100) < this.mPotions[i]) { +/* 38:30 */ ((EntityLivingBase)aEntity).addPotionEffect(new PotionEffect(this.mPotions[(i - 3)], this.mPotions[(i - 2)], this.mPotions[(i - 1)], false)); +/* 39: */ } +/* 40: */ } +/* 41: */ } +/* 42:31 */ return super.onLeftClickEntity(aItem, aStack, aPlayer, aEntity); +/* 43: */ } +/* 44: */ +/* 45: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) +/* 46: */ { +/* 47:36 */ if (!hasProjectile(aItem, aProjectileType, aStack)) { +/* 48:36 */ return null; +/* 49: */ } +/* 50:37 */ GT_Entity_Arrow_Potion rArrow = new GT_Entity_Arrow_Potion(aWorld, aX, aY, aZ); +/* 51:38 */ rArrow.setArrowItem(aStack); +/* 52:39 */ rArrow.setPotions(this.mPotions); +/* 53:40 */ return rArrow; +/* 54: */ } +/* 55: */ +/* 56: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) +/* 57: */ { +/* 58:45 */ if (!hasProjectile(aItem, aProjectileType, aStack)) { +/* 59:45 */ return null; +/* 60: */ } +/* 61:46 */ GT_Entity_Arrow_Potion rArrow = new GT_Entity_Arrow_Potion(aWorld, aEntity, aSpeed); +/* 62:47 */ rArrow.setArrowItem(aStack); +/* 63:48 */ rArrow.setPotions(this.mPotions); +/* 64:49 */ return rArrow; +/* 65: */ } +/* 66: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Arrow_Potion + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java b/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java new file mode 100644 index 0000000000..7fb185a7a4 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java @@ -0,0 +1,69 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.util.GT_ModHandler; +/* 6: */ import gregtech.api.util.GT_Utility; +/* 7: */ import java.util.Map; +/* 8: */ import net.minecraft.block.Block; +/* 9: */ import net.minecraft.entity.player.EntityPlayer; +/* 10: */ import net.minecraft.init.Blocks; +/* 11: */ import net.minecraft.item.ItemStack; +/* 12: */ import net.minecraft.world.World; +/* 13: */ +/* 14: */ public class Behaviour_Crowbar +/* 15: */ extends Behaviour_None +/* 16: */ { +/* 17: */ private final int mVanillaCosts; +/* 18: */ private final int mEUCosts; +/* 19: */ +/* 20: */ public Behaviour_Crowbar(int aVanillaCosts, int aEUCosts) +/* 21: */ { +/* 22:18 */ this.mVanillaCosts = aVanillaCosts; +/* 23:19 */ this.mEUCosts = aEUCosts; +/* 24: */ } +/* 25: */ +/* 26: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 27: */ { +/* 28:24 */ if (aWorld.isRemote) { +/* 29:25 */ return false; +/* 30: */ } +/* 31:27 */ if (GT_ModHandler.getModItem("Railcraft", "fluid.creosote.bucket", 1L) != null) { +/* 32:27 */ return false; +/* 33: */ } +/* 34:28 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 35:29 */ if (aBlock == null) { +/* 36:29 */ return false; +/* 37: */ } +/* 38:30 */ byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); +/* 39:33 */ if (aBlock == Blocks.rail) +/* 40: */ { +/* 41:34 */ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) +/* 42: */ { +/* 43:35 */ aWorld.isRemote = true; +/* 44:36 */ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 1) % 10, 0); +/* 45:37 */ aWorld.isRemote = false; +/* 46:38 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(0)), 1.0F, -1.0F, aX, aY, aZ); +/* 47: */ } +/* 48:40 */ return true; +/* 49: */ } +/* 50:42 */ if ((aBlock == Blocks.detector_rail) || (aBlock == Blocks.activator_rail) || (aBlock == Blocks.golden_rail)) +/* 51: */ { +/* 52:43 */ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) +/* 53: */ { +/* 54:44 */ aWorld.isRemote = true; +/* 55:45 */ aWorld.setBlock(aX, aY, aZ, aBlock, aMeta / 8 * 8 + (aMeta % 8 + 1) % 6, 0); +/* 56:46 */ aWorld.isRemote = false; +/* 57:47 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(0)), 1.0F, -1.0F, aX, aY, aZ); +/* 58: */ } +/* 59:49 */ return true; +/* 60: */ } +/* 61:51 */ return false; +/* 62: */ } +/* 63: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Crowbar + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java new file mode 100644 index 0000000000..3d0107180c --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java @@ -0,0 +1,121 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.items.GT_MetaBase_Item; +/* 4: */ import gregtech.api.util.GT_Utility; +/* 5: */ import java.util.List; +/* 6: */ import net.minecraft.item.ItemStack; +/* 7: */ import net.minecraft.nbt.NBTTagCompound; +/* 8: */ import net.minecraft.nbt.NBTTagList; +/* 9: */ +/* 10: */ public class Behaviour_DataOrb +/* 11: */ extends Behaviour_None +/* 12: */ { +/* 13: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 14: */ { +/* 15:15 */ if (!getDataTitle(aStack).equals("")) +/* 16: */ { +/* 17:16 */ aList.add(getDataTitle(aStack)); +/* 18:17 */ aList.add(getDataName(aStack)); +/* 19: */ } +/* 20:19 */ return aList; +/* 21: */ } +/* 22: */ +/* 23: */ public static void copyInventory(ItemStack[] aInventory, ItemStack[] aNewContent, int aIndexlength) +/* 24: */ { +/* 25:23 */ for (int i = 0; i < aIndexlength; i++) { +/* 26:24 */ if (aNewContent[i] == null) { +/* 27:25 */ aInventory[i] = null; +/* 28: */ } else { +/* 29:27 */ aInventory[i] = GT_Utility.copy(new Object[] { aNewContent[i] }); +/* 30: */ } +/* 31: */ } +/* 32: */ } +/* 33: */ +/* 34: */ public static String getDataName(ItemStack aStack) +/* 35: */ { +/* 36:32 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 37:33 */ if (tNBT == null) { +/* 38:33 */ return ""; +/* 39: */ } +/* 40:34 */ return tNBT.getString("mDataName"); +/* 41: */ } +/* 42: */ +/* 43: */ public static String getDataTitle(ItemStack aStack) +/* 44: */ { +/* 45:38 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 46:39 */ if (tNBT == null) { +/* 47:39 */ return ""; +/* 48: */ } +/* 49:40 */ return tNBT.getString("mDataTitle"); +/* 50: */ } +/* 51: */ +/* 52: */ public static NBTTagCompound setDataName(ItemStack aStack, String aDataName) +/* 53: */ { +/* 54:44 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 55:45 */ if (tNBT == null) { +/* 56:45 */ tNBT = new NBTTagCompound(); +/* 57: */ } +/* 58:46 */ tNBT.setString("mDataName", aDataName); +/* 59:47 */ aStack.setTagCompound(tNBT); +/* 60:48 */ return tNBT; +/* 61: */ } +/* 62: */ +/* 63: */ public static NBTTagCompound setDataTitle(ItemStack aStack, String aDataTitle) +/* 64: */ { +/* 65:52 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 66:53 */ if (tNBT == null) { +/* 67:53 */ tNBT = new NBTTagCompound(); +/* 68: */ } +/* 69:54 */ tNBT.setString("mDataTitle", aDataTitle); +/* 70:55 */ aStack.setTagCompound(tNBT); +/* 71:56 */ return tNBT; +/* 72: */ } +/* 73: */ +/* 74: */ public static ItemStack[] getNBTInventory(ItemStack aStack) +/* 75: */ { +/* 76:60 */ ItemStack[] tInventory = new ItemStack[256]; +/* 77:61 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 78:62 */ if (tNBT == null) { +/* 79:62 */ return tInventory; +/* 80: */ } +/* 81:64 */ NBTTagList tNBT_ItemList = tNBT.getTagList("Inventory", 10); +/* 82:65 */ for (int i = 0; i < tNBT_ItemList.tagCount(); i++) +/* 83: */ { +/* 84:66 */ NBTTagCompound tag = tNBT_ItemList.getCompoundTagAt(i); +/* 85:67 */ byte slot = tag.getByte("Slot"); +/* 86:68 */ if ((slot >= 0) && (slot < tInventory.length)) { +/* 87:69 */ tInventory[slot] = GT_Utility.loadItem(tag); +/* 88: */ } +/* 89: */ } +/* 90:72 */ return tInventory; +/* 91: */ } +/* 92: */ +/* 93: */ public static NBTTagCompound setNBTInventory(ItemStack aStack, ItemStack[] aInventory) +/* 94: */ { +/* 95:76 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 96:77 */ if (tNBT == null) { +/* 97:77 */ tNBT = new NBTTagCompound(); +/* 98: */ } +/* 99:79 */ NBTTagList tNBT_ItemList = new NBTTagList(); +/* :0:80 */ for (int i = 0; i < aInventory.length; i++) +/* :1: */ { +/* :2:81 */ ItemStack stack = aInventory[i]; +/* :3:82 */ if (stack != null) +/* :4: */ { +/* :5:83 */ NBTTagCompound tag = new NBTTagCompound(); +/* :6:84 */ tag.setByte("Slot", (byte)i); +/* :7:85 */ stack.writeToNBT(tag); +/* :8:86 */ tNBT_ItemList.appendTag(tag); +/* :9: */ } +/* ;0: */ } +/* ;1:89 */ tNBT.setTag("Inventory", tNBT_ItemList); +/* ;2:90 */ aStack.setTagCompound(tNBT); +/* ;3:91 */ return tNBT; +/* ;4: */ } +/* ;5: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_DataOrb + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java new file mode 100644 index 0000000000..99de403586 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java @@ -0,0 +1,43 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.items.GT_MetaBase_Item; +/* 4: */ import gregtech.api.util.GT_Utility; +/* 5: */ import gregtech.api.util.GT_Utility.ItemNBT; +/* 6: */ import java.util.List; +/* 7: */ import net.minecraft.item.ItemStack; +/* 8: */ +/* 9: */ public class Behaviour_DataStick +/* 10: */ extends Behaviour_None +/* 11: */ { +/* 12: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 13: */ { +/* 14:14 */ String tString = GT_Utility.ItemNBT.getBookTitle(aStack); +/* 15:15 */ if (GT_Utility.isStringValid(tString)) { +/* 16:15 */ aList.add(tString); +/* 17: */ } +/* 18:16 */ tString = GT_Utility.ItemNBT.getBookAuthor(aStack); +/* 19:17 */ if (GT_Utility.isStringValid(tString)) { +/* 20:17 */ aList.add("by " + tString); +/* 21: */ } +/* 22:19 */ short tMapID = GT_Utility.ItemNBT.getMapID(aStack); +/* 23:20 */ if (tMapID >= 0) { +/* 24:20 */ aList.add("Map ID: " + tMapID); +/* 25: */ } +/* 26:21 */ tString = GT_Utility.ItemNBT.getPunchCardData(aStack); +/* 27:22 */ if (GT_Utility.isStringValid(tString)) +/* 28: */ { +/* 29:23 */ aList.add("Punch Card Data"); +/* 30:24 */ int i = 0; +/* 31:24 */ for (int j = tString.length(); i < j; i += 64) { +/* 32:24 */ aList.add(tString.substring(i, Math.min(i + 64, j))); +/* 33: */ } +/* 34: */ } +/* 35:26 */ return aList; +/* 36: */ } +/* 37: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_DataStick + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java new file mode 100644 index 0000000000..f2b2591a00 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -0,0 +1,74 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import cpw.mods.fml.common.eventhandler.*; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 7: */ import gregtech.api.util.GT_LanguageManager; +/* 8: */ import gregtech.api.util.GT_Utility; +/* 9: */ import java.util.List; +/* 10: */ import net.minecraft.block.Block; +/* 11: */ import net.minecraft.block.Block.SoundType; +/* 12: */ import net.minecraft.entity.player.EntityPlayer; +/* 13: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 14: */ import net.minecraft.init.Blocks; +/* 15: */ import net.minecraft.item.ItemStack; +/* 16: */ import net.minecraft.world.World; +/* 17: */ import net.minecraftforge.common.MinecraftForge; +/* 18: */ import net.minecraftforge.event.entity.player.UseHoeEvent; +/* 19: */ +/* 20: */ public class Behaviour_Hoe +/* 21: */ extends Behaviour_None +/* 22: */ { +/* 23: */ private final int mCosts; +/* 24: */ +/* 25: */ public Behaviour_Hoe(int aCosts) +/* 26: */ { +/* 27:23 */ this.mCosts = aCosts; +/* 28: */ } +/* 29: */ +/* 30: */ public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 31: */ { +/* 32:28 */ if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { +/* 33:28 */ return false; +/* 34: */ } +/* 35:29 */ UseHoeEvent event = new UseHoeEvent(aPlayer, aStack, aWorld, aX, aY, aZ); +/* 36:30 */ if (MinecraftForge.EVENT_BUS.post(event)) { +/* 37:30 */ return false; +/* 38: */ } +/* 39:32 */ if (event.getResult() == Event.Result.ALLOW) +/* 40: */ { +/* 41:33 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 42:33 */ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts); +/* 43: */ } +/* 44:34 */ return true; +/* 45: */ } +/* 46:37 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 47:39 */ if ((aSide != 0) && (GT_Utility.isAirBlock(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt))) +/* 48: */ { +/* 49:40 */ aWorld.playSoundEffect(aX + 0.5F, aY + 0.5F, aZ + 0.5F, Blocks.farmland.stepSound.getStepResourcePath(), (Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); +/* 50:41 */ if (aWorld.isRemote) { +/* 51:41 */ return true; +/* 52: */ } +/* 53:42 */ aWorld.setBlock(aX, aY, aZ, Blocks.farmland); +/* 54:43 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 55:43 */ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts); +/* 56: */ } +/* 57:44 */ return true; +/* 58: */ } +/* 59:46 */ return false; +/* 60: */ } +/* 61: */ +/* 62:49 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.hoe", "Can till Dirt"); +/* 63: */ +/* 64: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 65: */ { +/* 66:53 */ aList.add(this.mTooltip); +/* 67:54 */ return aList; +/* 68: */ } +/* 69: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Hoe + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java b/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java new file mode 100644 index 0000000000..09e8525b0a --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java @@ -0,0 +1,143 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import codechicken.lib.math.MathHelper; +/* 4: */ import gregtech.api.GregTech_API; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import gregtech.api.util.GT_Utility.ItemNBT; +/* 9: */ import java.util.List; +/* 10: */ import java.util.Map; +/* 11: */ import net.minecraft.entity.Entity; +/* 12: */ import net.minecraft.entity.monster.EntityCreeper; +/* 13: */ import net.minecraft.entity.player.EntityPlayer; +/* 14: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 15: */ import net.minecraft.init.Blocks; +/* 16: */ import net.minecraft.init.Items; +/* 17: */ import net.minecraft.item.Item; +/* 18: */ import net.minecraft.item.ItemStack; +/* 19: */ import net.minecraft.nbt.NBTTagCompound; +/* 20: */ import net.minecraft.world.World; +/* 21: */ import net.minecraftforge.common.util.ForgeDirection; +/* 22: */ +/* 23: */ public class Behaviour_Lighter +/* 24: */ extends Behaviour_None +/* 25: */ { +/* 26: */ private final ItemStack mEmptyLighter; +/* 27: */ private final ItemStack mUsedLighter; +/* 28: */ private final ItemStack mFullLighter; +/* 29: */ private final long mFuelAmount; +/* 30: */ +/* 31: */ public Behaviour_Lighter(ItemStack aEmptyLighter, ItemStack aUsedLighter, ItemStack aFullLighter, long aFuelAmount) +/* 32: */ { +/* 33: 26 */ this.mFullLighter = aFullLighter; +/* 34: 27 */ this.mUsedLighter = aUsedLighter; +/* 35: 28 */ this.mEmptyLighter = aEmptyLighter; +/* 36: 29 */ this.mFuelAmount = aFuelAmount; +/* 37: */ } +/* 38: */ +/* 39: */ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) +/* 40: */ { +/* 41: 34 */ if ((aPlayer.worldObj.isRemote) || (aStack.stackSize != 1)) { +/* 42: 34 */ return false; +/* 43: */ } +/* 44: 36 */ boolean rOutput = false; +/* 45: 38 */ if ((aEntity instanceof EntityCreeper)) +/* 46: */ { +/* 47: 39 */ prepare(aStack); +/* 48: 40 */ long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack); +/* 49: 41 */ if (GT_Utility.areStacksEqual(aStack, this.mUsedLighter, true)) +/* 50: */ { +/* 51: 42 */ GT_Utility.sendSoundToPlayers(aPlayer.worldObj, (String)GregTech_API.sSoundList.get(Integer.valueOf(6)), 1.0F, 1.0F, MathHelper.floor_double(aEntity.posX), MathHelper.floor_double(aEntity.posY), MathHelper.floor_double(aEntity.posZ)); +/* 52: 43 */ ((EntityCreeper)aEntity).func_146079_cb(); +/* 53: 44 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 54: 44 */ tFuelAmount -= 1L; +/* 55: */ } +/* 56: 45 */ rOutput = true; +/* 57: */ } +/* 58: 47 */ GT_Utility.ItemNBT.setLighterFuel(aStack, tFuelAmount); +/* 59: 48 */ if (tFuelAmount <= 0L) { +/* 60: 48 */ useUp(aStack); +/* 61: */ } +/* 62: */ } +/* 63: 50 */ return rOutput; +/* 64: */ } +/* 65: */ +/* 66: */ public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 67: */ { +/* 68: 55 */ return false; +/* 69: */ } +/* 70: */ +/* 71: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 72: */ { +/* 73: 60 */ if ((aWorld.isRemote) || (aStack.stackSize != 1)) { +/* 74: 60 */ return false; +/* 75: */ } +/* 76: 62 */ boolean rOutput = false; +/* 77: */ +/* 78: 64 */ ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); +/* 79: 65 */ aX += tDirection.offsetX;aY += tDirection.offsetY;aZ += tDirection.offsetZ; +/* 80: 67 */ if ((!GT_Utility.isAirBlock(aWorld, aX, aY, aZ)) || (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) { +/* 81: 67 */ return false; +/* 82: */ } +/* 83: 68 */ prepare(aStack); +/* 84: 69 */ long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack); +/* 85: 70 */ if (GT_Utility.areStacksEqual(aStack, this.mUsedLighter, true)) +/* 86: */ { +/* 87: 71 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(6)), 1.0F, 1.0F, aX, aY, aZ); +/* 88: 72 */ aWorld.setBlock(aX, aY, aZ, Blocks.fire); +/* 89: 73 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 90: 73 */ tFuelAmount -= 1L; +/* 91: */ } +/* 92: 74 */ rOutput = true; +/* 93: */ } +/* 94: 76 */ GT_Utility.ItemNBT.setLighterFuel(aStack, tFuelAmount); +/* 95: 77 */ if (tFuelAmount <= 0L) { +/* 96: 77 */ useUp(aStack); +/* 97: */ } +/* 98: 78 */ return rOutput; +/* 99: */ } +/* 100: */ +/* 101: */ private void prepare(ItemStack aStack) +/* 102: */ { +/* 103: 82 */ if (GT_Utility.areStacksEqual(aStack, this.mFullLighter, true)) +/* 104: */ { +/* 105: 83 */ aStack.func_150996_a(this.mUsedLighter.getItem()); +/* 106: 84 */ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mUsedLighter)); +/* 107: 85 */ GT_Utility.ItemNBT.setLighterFuel(aStack, this.mFuelAmount); +/* 108: */ } +/* 109: */ } +/* 110: */ +/* 111: */ private void useUp(ItemStack aStack) +/* 112: */ { +/* 113: 90 */ if (this.mEmptyLighter == null) +/* 114: */ { +/* 115: 91 */ aStack.stackSize -= 1; +/* 116: */ } +/* 117: */ else +/* 118: */ { +/* 119: 93 */ aStack.func_150996_a(this.mEmptyLighter.getItem()); +/* 120: 94 */ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mEmptyLighter)); +/* 121: */ } +/* 122: */ } +/* 123: */ +/* 124: 98 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip", "Can light things on Fire"); +/* 125: 99 */ private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses", "Remaining Uses:"); +/* 126:100 */ private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!"); +/* 127: */ +/* 128: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 129: */ { +/* 130:104 */ aList.add(this.mTooltip); +/* 131:105 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 132:106 */ long tFuelAmount = tNBT == null ? 0L : GT_Utility.areStacksEqual(aStack, this.mFullLighter, true) ? this.mFuelAmount : tNBT.getLong("GT.LighterFuel"); +/* 133:107 */ aList.add(this.mTooltipUses + " " + tFuelAmount); +/* 134:108 */ aList.add(this.mTooltipUnstackable); +/* 135:109 */ return aList; +/* 136: */ } +/* 137: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Lighter + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/main/java/gregtech/common/items/behaviors/Behaviour_None.java new file mode 100644 index 0000000000..3e55af1e97 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_None.java @@ -0,0 +1,88 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.enums.SubTag; +/* 4: */ import gregtech.api.interfaces.IItemBehaviour; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import java.util.List; +/* 7: */ import net.minecraft.block.BlockDispenser; +/* 8: */ import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +/* 9: */ import net.minecraft.dispenser.IBlockSource; +/* 10: */ import net.minecraft.dispenser.IPosition; +/* 11: */ import net.minecraft.entity.Entity; +/* 12: */ import net.minecraft.entity.EntityLivingBase; +/* 13: */ import net.minecraft.entity.player.EntityPlayer; +/* 14: */ import net.minecraft.entity.projectile.EntityArrow; +/* 15: */ import net.minecraft.item.ItemStack; +/* 16: */ import net.minecraft.util.EnumFacing; +/* 17: */ import net.minecraft.world.World; +/* 18: */ +/* 19: */ public class Behaviour_None +/* 20: */ implements IItemBehaviour +/* 21: */ { +/* 22: */ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) +/* 23: */ { +/* 24:24 */ return false; +/* 25: */ } +/* 26: */ +/* 27: */ public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 28: */ { +/* 29:29 */ return false; +/* 30: */ } +/* 31: */ +/* 32: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 33: */ { +/* 34:34 */ return false; +/* 35: */ } +/* 36: */ +/* 37: */ public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) +/* 38: */ { +/* 39:39 */ return aStack; +/* 40: */ } +/* 41: */ +/* 42: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 43: */ { +/* 44:44 */ return aList; +/* 45: */ } +/* 46: */ +/* 47: */ public void onUpdate(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) {} +/* 48: */ +/* 49: */ public boolean isItemStackUsable(GT_MetaBase_Item aItem, ItemStack aStack) +/* 50: */ { +/* 51:54 */ return true; +/* 52: */ } +/* 53: */ +/* 54: */ public boolean canDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack) +/* 55: */ { +/* 56:59 */ return false; +/* 57: */ } +/* 58: */ +/* 59: */ public ItemStack onDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack) +/* 60: */ { +/* 61:64 */ EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); +/* 62:65 */ IPosition iposition = BlockDispenser.func_149939_a(aSource); +/* 63:66 */ ItemStack itemstack1 = aStack.splitStack(1); +/* 64:67 */ BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); +/* 65:68 */ return aStack; +/* 66: */ } +/* 67: */ +/* 68: */ public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack) +/* 69: */ { +/* 70:73 */ return false; +/* 71: */ } +/* 72: */ +/* 73: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) +/* 74: */ { +/* 75:78 */ return null; +/* 76: */ } +/* 77: */ +/* 78: */ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) +/* 79: */ { +/* 80:83 */ return null; +/* 81: */ } +/* 82: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_None + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java new file mode 100644 index 0000000000..3f52bfc4f4 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java @@ -0,0 +1,59 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import java.util.List; +/* 9: */ import java.util.Map; +/* 10: */ import net.minecraft.entity.player.EntityPlayer; +/* 11: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 12: */ import net.minecraft.item.ItemStack; +/* 13: */ import net.minecraft.tileentity.TileEntity; +/* 14: */ import net.minecraft.world.World; +/* 15: */ import net.minecraftforge.common.util.ForgeDirection; +/* 16: */ import thaumcraft.api.aspects.IEssentiaTransport; +/* 17: */ +/* 18: */ public class Behaviour_Plunger_Essentia +/* 19: */ extends Behaviour_None +/* 20: */ { +/* 21: */ private final int mCosts; +/* 22: */ +/* 23: */ public Behaviour_Plunger_Essentia(int aCosts) +/* 24: */ { +/* 25:22 */ this.mCosts = aCosts; +/* 26: */ } +/* 27: */ +/* 28: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 29: */ { +/* 30:27 */ if (aWorld.isRemote) { +/* 31:27 */ return false; +/* 32: */ } +/* 33:28 */ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); +/* 34:29 */ if (((aTileEntity instanceof IEssentiaTransport)) && ( +/* 35:30 */ (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) +/* 36: */ { +/* 37:31 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 38:32 */ for (ForgeDirection tDirection : ForgeDirection.VALID_DIRECTIONS) { +/* 39:32 */ ((IEssentiaTransport)aTileEntity).takeEssentia(((IEssentiaTransport)aTileEntity).getEssentiaType(tDirection), ((IEssentiaTransport)aTileEntity).getEssentiaAmount(tDirection), tDirection); +/* 40: */ } +/* 41:33 */ return true; +/* 42: */ } +/* 43:36 */ return false; +/* 44: */ } +/* 45: */ +/* 46:39 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.essentia", "Clears Essentia from Containers and Tubes"); +/* 47: */ +/* 48: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 49: */ { +/* 50:43 */ aList.add(this.mTooltip); +/* 51:44 */ return aList; +/* 52: */ } +/* 53: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Plunger_Essentia + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java new file mode 100644 index 0000000000..79bb2defb0 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java @@ -0,0 +1,62 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import java.util.List; +/* 9: */ import java.util.Map; +/* 10: */ import net.minecraft.entity.player.EntityPlayer; +/* 11: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 12: */ import net.minecraft.item.ItemStack; +/* 13: */ import net.minecraft.tileentity.TileEntity; +/* 14: */ import net.minecraft.world.World; +/* 15: */ import net.minecraftforge.common.util.ForgeDirection; +/* 16: */ import net.minecraftforge.fluids.IFluidHandler; +/* 17: */ +/* 18: */ public class Behaviour_Plunger_Fluid +/* 19: */ extends Behaviour_None +/* 20: */ { +/* 21: */ private final int mCosts; +/* 22: */ +/* 23: */ public Behaviour_Plunger_Fluid(int aCosts) +/* 24: */ { +/* 25:22 */ this.mCosts = aCosts; +/* 26: */ } +/* 27: */ +/* 28: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 29: */ { +/* 30:27 */ if (aWorld.isRemote) { +/* 31:27 */ return false; +/* 32: */ } +/* 33:28 */ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); +/* 34:29 */ if ((aTileEntity instanceof IFluidHandler)) { +/* 35:30 */ for (ForgeDirection tDirection : ForgeDirection.VALID_DIRECTIONS) { +/* 36:30 */ if (((IFluidHandler)aTileEntity).drain(tDirection, 1000, false) != null) { +/* 37:31 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 38: */ { +/* 39:32 */ ((IFluidHandler)aTileEntity).drain(tDirection, 1000, true); +/* 40:33 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 41:34 */ return true; +/* 42: */ } +/* 43: */ } +/* 44: */ } +/* 45: */ } +/* 46:38 */ return false; +/* 47: */ } +/* 48: */ +/* 49:41 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.fluid", "Clears 1000 Liters of Fluid from Tanks"); +/* 50: */ +/* 51: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 52: */ { +/* 53:45 */ aList.add(this.mTooltip); +/* 54:46 */ return aList; +/* 55: */ } +/* 56: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Plunger_Fluid + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java new file mode 100644 index 0000000000..a2c2b8d9b5 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java @@ -0,0 +1,82 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +/* 5: */ import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe; +/* 6: */ import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe.Util; +/* 7: */ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +/* 8: */ import gregtech.api.items.GT_MetaBase_Item; +/* 9: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 10: */ import gregtech.api.util.GT_LanguageManager; +/* 11: */ import gregtech.api.util.GT_Utility; +/* 12: */ import java.util.HashMap; +/* 13: */ import java.util.LinkedHashMap; +/* 14: */ import java.util.List; +/* 15: */ import java.util.Map; +/* 16: */ import net.minecraft.entity.item.EntityItem; +/* 17: */ import net.minecraft.entity.player.EntityPlayer; +/* 18: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 19: */ import net.minecraft.item.ItemStack; +/* 20: */ import net.minecraft.tileentity.TileEntity; +/* 21: */ import net.minecraft.world.World; +/* 22: */ +/* 23: */ public class Behaviour_Plunger_Item +/* 24: */ extends Behaviour_None +/* 25: */ { +/* 26: */ private final int mCosts; +/* 27: */ +/* 28: */ public Behaviour_Plunger_Item(int aCosts) +/* 29: */ { +/* 30:25 */ this.mCosts = aCosts; +/* 31: */ } +/* 32: */ +/* 33: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 34: */ { +/* 35:30 */ if (aWorld.isRemote) { +/* 36:30 */ return false; +/* 37: */ } +/* 38:31 */ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); +/* 39:32 */ if ((aTileEntity instanceof IGregTechTileEntity)) +/* 40: */ { +/* 41:33 */ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity)aTileEntity).getMetaTileEntity(); +/* 42:34 */ if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) { +/* 43:35 */ for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe)tMetaTileEntity, new HashMap(), 0L, false, true)).keySet()) +/* 44: */ { +/* 45:36 */ int i = 0; +/* 46:36 */ for (int j = tTileEntity.getSizeInventory(); i < j; i++) { +/* 47:36 */ if (tTileEntity.isValidSlot(i)) { +/* 48:37 */ if ((tTileEntity.getStackInSlot(i) != null) && ( +/* 49:38 */ (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) +/* 50: */ { +/* 51:39 */ ItemStack tStack = tTileEntity.decrStackSize(i, 64); +/* 52:40 */ if (tStack != null) +/* 53: */ { +/* 54:41 */ EntityItem tEntity = new EntityItem(aWorld, ((IGregTechTileEntity)aTileEntity).getOffsetX((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetY((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetZ((byte)aSide, 1) + 0.5D, tStack); +/* 55:42 */ tEntity.motionX = 0.0D;tEntity.motionY = 0.0D;tEntity.motionZ = 0.0D; +/* 56:43 */ aWorld.spawnEntityInWorld(tEntity); +/* 57:44 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 58: */ } +/* 59:46 */ return true; +/* 60: */ } +/* 61: */ } +/* 62: */ } +/* 63: */ } +/* 64: */ } +/* 65: */ } +/* 66:53 */ return false; +/* 67: */ } +/* 68: */ +/* 69:56 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.item", "Clears Items from Pipes"); +/* 70: */ +/* 71: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 72: */ { +/* 73:60 */ aList.add(this.mTooltip); +/* 74:61 */ return aList; +/* 75: */ } +/* 76: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Plunger_Item + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java b/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java new file mode 100644 index 0000000000..03516a8758 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java @@ -0,0 +1,46 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.items.GT_MetaBase_Item; +/* 4: */ import gregtech.api.util.GT_Utility; +/* 5: */ import java.util.List; +/* 6: */ import net.minecraft.item.ItemStack; +/* 7: */ import net.minecraft.nbt.NBTTagCompound; +/* 8: */ +/* 9: */ public class Behaviour_PrintedPages +/* 10: */ extends Behaviour_None +/* 11: */ { +/* 12: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 13: */ { +/* 14:14 */ if (GT_Utility.isStringValid(getTitle(aStack))) { +/* 15:14 */ aList.add(getTitle(aStack)); +/* 16: */ } +/* 17:15 */ if (GT_Utility.isStringValid(getAuthor(aStack))) { +/* 18:15 */ aList.add("by " + getAuthor(aStack)); +/* 19: */ } +/* 20:16 */ return aList; +/* 21: */ } +/* 22: */ +/* 23: */ public static String getTitle(ItemStack aStack) +/* 24: */ { +/* 25:20 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 26:21 */ if (tNBT == null) { +/* 27:21 */ return ""; +/* 28: */ } +/* 29:22 */ return tNBT.getString("title"); +/* 30: */ } +/* 31: */ +/* 32: */ public static String getAuthor(ItemStack aStack) +/* 33: */ { +/* 34:26 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 35:27 */ if (tNBT == null) { +/* 36:27 */ return ""; +/* 37: */ } +/* 38:28 */ return tNBT.getString("author"); +/* 39: */ } +/* 40: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_PrintedPages + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java new file mode 100644 index 0000000000..7769fd9201 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java @@ -0,0 +1,149 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.enums.Materials; +/* 5: */ import gregtech.api.enums.OrePrefixes; +/* 6: */ import gregtech.api.items.GT_MetaBase_Item; +/* 7: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 8: */ import gregtech.api.objects.ItemData; +/* 9: */ import gregtech.api.objects.MaterialStack; +/* 10: */ import gregtech.api.util.GT_LanguageManager; +/* 11: */ import gregtech.api.util.GT_ModHandler; +/* 12: */ import gregtech.api.util.GT_OreDictUnificator; +/* 13: */ import gregtech.api.util.GT_Utility; +/* 14: */ import gregtech.common.blocks.GT_Block_Ores; +/* 15: */ import gregtech.common.blocks.GT_TileEntity_Ores; +/* 16: */ import java.util.List; +/* 17: */ import java.util.Map; +/* 18: */ import java.util.Random; +/* 19: */ import net.minecraft.block.Block; +/* 20: */ import net.minecraft.entity.player.EntityPlayer; +/* 21: */ import net.minecraft.init.Blocks; +/* 22: */ import net.minecraft.item.ItemStack; +/* 23: */ import net.minecraft.tileentity.TileEntity; +/* 24: */ import net.minecraft.world.World; +/* 25: */ import net.minecraftforge.common.util.ForgeDirection; +/* 26: */ import net.minecraftforge.fluids.IFluidBlock; +/* 27: */ +/* 28: */ public class Behaviour_Prospecting +/* 29: */ extends Behaviour_None +/* 30: */ { +/* 31: */ private final int mVanillaCosts; +/* 32: */ private final int mEUCosts; +/* 33: */ +/* 34: */ public Behaviour_Prospecting(int aVanillaCosts, int aEUCosts) +/* 35: */ { +/* 36: 31 */ this.mVanillaCosts = aVanillaCosts; +/* 37: 32 */ this.mEUCosts = aEUCosts; +/* 38: */ } +/* 39: */ +/* 40: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 41: */ { +/* 42: 37 */ if (aWorld.isRemote) { +/* 43: 38 */ return false; +/* 44: */ } +/* 45: 40 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 46: 41 */ if (aBlock == null) { +/* 47: 41 */ return false; +/* 48: */ } +/* 49: 42 */ byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); +/* 50: */ +/* 51: */ +/* 52: 45 */ ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); +/* 53: 46 */ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) +/* 54: */ { +/* 55: 47 */ GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); +/* 56: 48 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); +/* 57: 49 */ return true; +/* 58: */ } +/* 59: 52 */ if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) +/* 60: */ { +/* 61: 53 */ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) +/* 62: */ { +/* 63: 54 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); +/* 64: 55 */ int tX = aX;int tY = aY;int tZ = aZ;int tMetaID = 0;int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool)aItem).getHarvestLevel(aStack, "") : 0; +/* 65: */ +/* 66: 57 */ int i = 0; +/* 67: 57 */ for (int j = 6 + tQuality; i < j; i++) +/* 68: */ { +/* 69: 58 */ tX -= ForgeDirection.getOrientation(aSide).offsetX; +/* 70: 59 */ tY -= ForgeDirection.getOrientation(aSide).offsetY; +/* 71: 60 */ tZ -= ForgeDirection.getOrientation(aSide).offsetZ; +/* 72: */ +/* 73: 62 */ Block tBlock = aWorld.getBlock(tX, tY, tZ); +/* 74: 63 */ if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) +/* 75: */ { +/* 76: 64 */ GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); +/* 77: 65 */ break; +/* 78: */ } +/* 79: 67 */ if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) +/* 80: */ { +/* 81: 68 */ GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); +/* 82: 69 */ break; +/* 83: */ } +/* 84: 71 */ if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) +/* 85: */ { +/* 86: 72 */ GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock."); +/* 87: 73 */ break; +/* 88: */ } +/* 89: 75 */ if (tBlock != aBlock) +/* 90: */ { +/* 91: 76 */ if (i >= 4) { +/* 92: */ break; +/* 93: */ } +/* 94: 76 */ GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); break; +/* 95: */ } +/* 96: */ } +/* 97: 81 */ Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); +/* 98: 82 */ i = 0; +/* 99: 82 */ for (int j = 9 + 2 * tQuality; i < j; i++) +/* 100: */ { +/* 101: 83 */ tX = aX - 4 - tQuality + tRandom.nextInt(j); +/* 102: 84 */ tY = aY - 4 - tQuality + tRandom.nextInt(j); +/* 103: 85 */ tZ = aZ - 4 - tQuality + tRandom.nextInt(j); +/* 104: 86 */ Block tBlock = aWorld.getBlock(tX, tY, tZ); +/* 105: 87 */ if ((tBlock instanceof GT_Block_Ores)) +/* 106: */ { +/* 107: 88 */ TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); +/* 108: 89 */ if ((tTileEntity instanceof GT_TileEntity_Ores)) +/* 109: */ { +/* 110: 90 */ Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores)tTileEntity).mMetaData % 1000)]; +/* 111: 91 */ if ((tMaterial != null) && (tMaterial != Materials._NULL)) +/* 112: */ { +/* 113: 92 */ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); +/* 114: 93 */ return true; +/* 115: */ } +/* 116: */ } +/* 117: */ } +/* 118: */ else +/* 119: */ { +/* 120: 97 */ tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); +/* 121: 98 */ tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); +/* 122: 99 */ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) +/* 123: */ { +/* 124:100 */ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); +/* 125:101 */ return true; +/* 126: */ } +/* 127: */ } +/* 128: */ } +/* 129:105 */ GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); +/* 130: */ } +/* 131:107 */ return true; +/* 132: */ } +/* 133:109 */ return false; +/* 134: */ } +/* 135: */ +/* 136:112 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); +/* 137: */ +/* 138: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 139: */ { +/* 140:116 */ aList.add(this.mTooltip); +/* 141:117 */ return aList; +/* 142: */ } +/* 143: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Prospecting + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java b/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java new file mode 100644 index 0000000000..dc7d09a1e4 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java @@ -0,0 +1,50 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.interfaces.IItemBehaviour; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import java.util.ArrayList; +/* 9: */ import java.util.List; +/* 10: */ import java.util.Map; +/* 11: */ import net.minecraft.entity.player.EntityPlayer; +/* 12: */ import net.minecraft.entity.player.EntityPlayerMP; +/* 13: */ import net.minecraft.item.ItemStack; +/* 14: */ import net.minecraft.world.World; +/* 15: */ +/* 16: */ public class Behaviour_Scanner +/* 17: */ extends Behaviour_None +/* 18: */ { +/* 19:18 */ public static final IItemBehaviour INSTANCE = new Behaviour_Scanner(); +/* 20: */ +/* 21: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 22: */ { +/* 23:22 */ if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) +/* 24: */ { +/* 25:23 */ ArrayList tList = new ArrayList(); +/* 26:24 */ if (aItem.use(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), aPlayer)) { +/* 27:24 */ for (int i = 0; i < tList.size(); i++) { +/* 28:24 */ GT_Utility.sendChatToPlayer(aPlayer, (String)tList.get(i)); +/* 29: */ } +/* 30: */ } +/* 31:25 */ return true; +/* 32: */ } +/* 33:27 */ GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(108)), 1, 1.0F, aX, aY, aZ); +/* 34:28 */ return aPlayer instanceof EntityPlayerMP; +/* 35: */ } +/* 36: */ +/* 37:31 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scanning", "Can scan Blocks in World"); +/* 38: */ +/* 39: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 40: */ { +/* 41:35 */ aList.add(this.mTooltip); +/* 42:36 */ return aList; +/* 43: */ } +/* 44: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Scanner + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java b/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java new file mode 100644 index 0000000000..3e1f0bd45b --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java @@ -0,0 +1,63 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import forestry.api.lepidopterology.EnumFlutterType; +/* 4: */ import forestry.api.lepidopterology.IAlleleButterflySpecies; +/* 5: */ import forestry.api.lepidopterology.IButterfly; +/* 6: */ import forestry.api.lepidopterology.IButterflyGenome; +/* 7: */ import forestry.api.lepidopterology.IButterflyRoot; +/* 8: */ import forestry.api.lepidopterology.IEntityButterfly; +/* 9: */ import forestry.api.lepidopterology.ILepidopteristTracker; +/* 10: */ import gregtech.api.items.GT_MetaBase_Item; +/* 11: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 12: */ import gregtech.api.util.GT_LanguageManager; +/* 13: */ import java.util.List; +/* 14: */ import net.minecraft.entity.Entity; +/* 15: */ import net.minecraft.entity.item.EntityItem; +/* 16: */ import net.minecraft.entity.player.EntityPlayer; +/* 17: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 18: */ import net.minecraft.item.ItemStack; +/* 19: */ import net.minecraft.world.World; +/* 20: */ +/* 21: */ public class Behaviour_Scoop +/* 22: */ extends Behaviour_None +/* 23: */ { +/* 24: */ private final int mCosts; +/* 25: */ +/* 26: */ public Behaviour_Scoop(int aCosts) +/* 27: */ { +/* 28:21 */ this.mCosts = aCosts; +/* 29: */ } +/* 30: */ +/* 31: */ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) +/* 32: */ { +/* 33:26 */ if ((aEntity instanceof IEntityButterfly)) +/* 34: */ { +/* 35:27 */ if (aPlayer.worldObj.isRemote) { +/* 36:27 */ return true; +/* 37: */ } +/* 38:28 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 39: */ { +/* 40:29 */ Object tButterfly = ((IEntityButterfly)aEntity).getButterfly(); +/* 41:30 */ ((IButterfly)tButterfly).getGenome().getPrimary().getRoot().getBreedingTracker(aEntity.worldObj, aPlayer.getGameProfile()).registerCatch((IButterfly)tButterfly); +/* 42:31 */ aPlayer.worldObj.spawnEntityInWorld(new EntityItem(aPlayer.worldObj, aEntity.posX, aEntity.posY, aEntity.posZ, ((IButterfly)tButterfly).getGenome().getPrimary().getRoot().getMemberStack(((IButterfly)tButterfly).copy(), EnumFlutterType.BUTTERFLY.ordinal()))); +/* 43:32 */ aEntity.setDead(); +/* 44: */ } +/* 45:34 */ return true; +/* 46: */ } +/* 47:36 */ return false; +/* 48: */ } +/* 49: */ +/* 50:39 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scoop", "Catches Butterflies on Leftclick"); +/* 51: */ +/* 52: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 53: */ { +/* 54:43 */ aList.add(this.mTooltip); +/* 55:44 */ return aList; +/* 56: */ } +/* 57: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Scoop + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java b/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java new file mode 100644 index 0000000000..4813635828 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java @@ -0,0 +1,62 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.util.GT_ModHandler; +/* 6: */ import gregtech.api.util.GT_Utility; +/* 7: */ import java.util.Map; +/* 8: */ import net.minecraft.block.Block; +/* 9: */ import net.minecraft.entity.player.EntityPlayer; +/* 10: */ import net.minecraft.init.Blocks; +/* 11: */ import net.minecraft.item.ItemStack; +/* 12: */ import net.minecraft.world.World; +/* 13: */ +/* 14: */ public class Behaviour_Screwdriver +/* 15: */ extends Behaviour_None +/* 16: */ { +/* 17: */ private final int mVanillaCosts; +/* 18: */ private final int mEUCosts; +/* 19: */ +/* 20: */ public Behaviour_Screwdriver(int aVanillaCosts, int aEUCosts) +/* 21: */ { +/* 22:17 */ this.mVanillaCosts = aVanillaCosts; +/* 23:18 */ this.mEUCosts = aEUCosts; +/* 24: */ } +/* 25: */ +/* 26: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 27: */ { +/* 28:23 */ if (aWorld.isRemote) { +/* 29:24 */ return false; +/* 30: */ } +/* 31:26 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 32:27 */ if (aBlock == null) { +/* 33:27 */ return false; +/* 34: */ } +/* 35:28 */ byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); +/* 36:31 */ if ((aBlock == Blocks.unpowered_repeater) || (aBlock == Blocks.powered_repeater)) +/* 37: */ { +/* 38:32 */ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) +/* 39: */ { +/* 40:33 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); +/* 41:34 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); +/* 42: */ } +/* 43:36 */ return true; +/* 44: */ } +/* 45:38 */ if ((aBlock == Blocks.unpowered_comparator) || (aBlock == Blocks.powered_comparator)) +/* 46: */ { +/* 47:39 */ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) +/* 48: */ { +/* 49:40 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); +/* 50:41 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); +/* 51: */ } +/* 52:43 */ return true; +/* 53: */ } +/* 54:45 */ return false; +/* 55: */ } +/* 56: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Screwdriver + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java b/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java new file mode 100644 index 0000000000..6a27bab094 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java @@ -0,0 +1,59 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.items.GT_MetaBase_Item; +/* 4: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 5: */ import gregtech.api.util.GT_LanguageManager; +/* 6: */ import ic2.api.crops.ICropTile; +/* 7: */ import java.util.List; +/* 8: */ import net.minecraft.entity.player.EntityPlayer; +/* 9: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 10: */ import net.minecraft.item.ItemStack; +/* 11: */ import net.minecraft.tileentity.TileEntity; +/* 12: */ import net.minecraft.world.World; +/* 13: */ +/* 14: */ public class Behaviour_Sense +/* 15: */ extends Behaviour_None +/* 16: */ { +/* 17: */ private final int mCosts; +/* 18: */ +/* 19: */ public Behaviour_Sense(int aCosts) +/* 20: */ { +/* 21:19 */ this.mCosts = aCosts; +/* 22: */ } +/* 23: */ +/* 24: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 25: */ { +/* 26:24 */ if (aWorld.isRemote) { +/* 27:24 */ return false; +/* 28: */ } +/* 29:25 */ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); +/* 30:26 */ if ((tTileEntity instanceof ICropTile)) +/* 31: */ { +/* 32:27 */ for (int i = -1; i < 2; i++) { +/* 33:27 */ for (int j = -1; j < 2; j++) { +/* 34:27 */ for (int k = -1; k < 2; k++) { +/* 35:27 */ if ((aStack.stackSize > 0) && (((tTileEntity = aWorld.getTileEntity(aX + i, aY + j, aZ + k)) instanceof ICropTile)) && (((ICropTile)tTileEntity).harvest(true)) && (!aPlayer.capabilities.isCreativeMode)) { +/* 36:27 */ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts); +/* 37: */ } +/* 38: */ } +/* 39: */ } +/* 40: */ } +/* 41:28 */ return true; +/* 42: */ } +/* 43:30 */ return false; +/* 44: */ } +/* 45: */ +/* 46:33 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sense", "Rightclick to harvest Crop Sticks"); +/* 47: */ +/* 48: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 49: */ { +/* 50:37 */ aList.add(this.mTooltip); +/* 51:38 */ return aList; +/* 52: */ } +/* 53: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Sense + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java b/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java new file mode 100644 index 0000000000..52fafbaca8 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java @@ -0,0 +1,58 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.enums.ItemList; +/* 4: */ import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import java.util.List; +/* 9: */ import net.minecraft.entity.player.EntityPlayer; +/* 10: */ import net.minecraft.entity.player.EntityPlayerMP; +/* 11: */ import net.minecraft.inventory.IInventory; +/* 12: */ import net.minecraft.item.ItemStack; +/* 13: */ import net.minecraft.nbt.NBTTagCompound; +/* 14: */ import net.minecraft.tileentity.TileEntity; +/* 15: */ import net.minecraft.world.World; +/* 16: */ +/* 17: */ public class Behaviour_SensorKit +/* 18: */ extends Behaviour_None +/* 19: */ { +/* 20: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 21: */ { +/* 22:22 */ if ((aPlayer instanceof EntityPlayerMP)) +/* 23: */ { +/* 24:23 */ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); +/* 25:24 */ if (((tTileEntity instanceof IInventory)) && (!((IInventory)tTileEntity).isUseableByPlayer(aPlayer))) { +/* 26:24 */ return false; +/* 27: */ } +/* 28:25 */ if (((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) +/* 29: */ { +/* 30:26 */ GT_Utility.setStack(aStack, ItemList.NC_SensorCard.get(aStack.stackSize, new Object[0])); +/* 31:27 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 32:28 */ if (tNBT == null) { +/* 33:28 */ tNBT = new NBTTagCompound(); +/* 34: */ } +/* 35:29 */ tNBT.setInteger("x", aX); +/* 36:30 */ tNBT.setInteger("y", aY); +/* 37:31 */ tNBT.setInteger("z", aZ); +/* 38:32 */ aStack.setTagCompound(tNBT); +/* 39: */ } +/* 40:34 */ return true; +/* 41: */ } +/* 42:36 */ return false; +/* 43: */ } +/* 44: */ +/* 45:39 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sensorkit.tooltip", "Used to display Information using the Mod Nuclear Control"); +/* 46: */ +/* 47: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 48: */ { +/* 49:43 */ aList.add(this.mTooltip); +/* 50:44 */ return aList; +/* 51: */ } +/* 52: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_SensorKit + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java b/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java new file mode 100644 index 0000000000..ab21a6f7fa --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java @@ -0,0 +1,131 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.items.GT_MetaBase_Item; +/* 5: */ import gregtech.api.items.GT_MetaGenerated_Tool; +/* 6: */ import gregtech.api.util.GT_LanguageManager; +/* 7: */ import gregtech.api.util.GT_Utility; +/* 8: */ import java.util.List; +/* 9: */ import java.util.Map; +/* 10: */ import net.minecraft.block.Block; +/* 11: */ import net.minecraft.entity.player.EntityPlayer; +/* 12: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 13: */ import net.minecraft.init.Blocks; +/* 14: */ import net.minecraft.item.ItemStack; +/* 15: */ import net.minecraft.world.World; +/* 16: */ +/* 17: */ public class Behaviour_SoftHammer +/* 18: */ extends Behaviour_None +/* 19: */ { +/* 20: */ private final int mCosts; +/* 21: */ +/* 22: */ public Behaviour_SoftHammer(int aCosts) +/* 23: */ { +/* 24: 21 */ this.mCosts = aCosts; +/* 25: */ } +/* 26: */ +/* 27: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 28: */ { +/* 29: 26 */ if (aWorld.isRemote) { +/* 30: 27 */ return false; +/* 31: */ } +/* 32: 29 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 33: 30 */ if (aBlock == null) { +/* 34: 30 */ return false; +/* 35: */ } +/* 36: 31 */ byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); +/* 37: 34 */ if (aBlock == Blocks.lit_redstone_lamp) +/* 38: */ { +/* 39: 35 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 40: */ { +/* 41: 36 */ aWorld.isRemote = true; +/* 42: 37 */ aWorld.setBlock(aX, aY, aZ, Blocks.redstone_lamp, 0, 0); +/* 43: 38 */ aWorld.isRemote = false; +/* 44: 39 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 45: */ } +/* 46: 41 */ return true; +/* 47: */ } +/* 48: 43 */ if (aBlock == Blocks.redstone_lamp) +/* 49: */ { +/* 50: 44 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 51: */ { +/* 52: 45 */ aWorld.isRemote = true; +/* 53: 46 */ aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 0); +/* 54: 47 */ aWorld.isRemote = false; +/* 55: 48 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 56: */ } +/* 57: 50 */ return true; +/* 58: */ } +/* 59: 52 */ if (aBlock == Blocks.golden_rail) +/* 60: */ { +/* 61: 53 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 62: */ { +/* 63: 54 */ aWorld.isRemote = true; +/* 64: 55 */ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 8) % 16, 0); +/* 65: 56 */ aWorld.isRemote = false; +/* 66: 57 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 67: */ } +/* 68: 59 */ return true; +/* 69: */ } +/* 70: 61 */ if (aBlock == Blocks.activator_rail) +/* 71: */ { +/* 72: 62 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 73: */ { +/* 74: 63 */ aWorld.isRemote = true; +/* 75: 64 */ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 8) % 16, 0); +/* 76: 65 */ aWorld.isRemote = false; +/* 77: 66 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 78: */ } +/* 79: 68 */ return true; +/* 80: */ } +/* 81: 70 */ if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) +/* 82: */ { +/* 83: 71 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) { +/* 84: 72 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); +/* 85: */ } +/* 86: 74 */ return true; +/* 87: */ } +/* 88: 76 */ if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) +/* 89: */ { +/* 90: 77 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 91: */ { +/* 92: 78 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 1) % 6, 3); +/* 93: 79 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 94: */ } +/* 95: 81 */ return true; +/* 96: */ } +/* 97: 83 */ if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest)) +/* 98: */ { +/* 99: 84 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 100: */ { +/* 101: 85 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta - 1) % 4 + 2, 3); +/* 102: 86 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 103: */ } +/* 104: 88 */ return true; +/* 105: */ } +/* 106: 90 */ if (aBlock == Blocks.hopper) +/* 107: */ { +/* 108: 91 */ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) +/* 109: */ { +/* 110: 92 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 1) % 6 == 1 ? (aMeta + 1) % 6 : 2, 3); +/* 111: 93 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); +/* 112: */ } +/* 113: 95 */ return true; +/* 114: */ } +/* 115: 97 */ return false; +/* 116: */ } +/* 117: */ +/* 118:100 */ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.softhammer", "Activates and Deactivates Machines"); +/* 119: */ +/* 120: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 121: */ { +/* 122:104 */ aList.add(this.mTooltip); +/* 123:105 */ return aList; +/* 124: */ } +/* 125: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_SoftHammer + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java b/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java new file mode 100644 index 0000000000..8ce829a3d5 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java @@ -0,0 +1,147 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.enums.GT_Values; +/* 5: */ import gregtech.api.interfaces.IItemBehaviour; +/* 6: */ import gregtech.api.interfaces.internal.IGT_Mod; +/* 7: */ import gregtech.api.items.GT_MetaBase_Item; +/* 8: */ import gregtech.api.util.GT_Utility; +/* 9: */ import net.minecraft.entity.Entity; +/* 10: */ import net.minecraft.entity.player.EntityPlayer; +/* 11: */ import net.minecraft.item.ItemStack; +/* 12: */ import net.minecraft.nbt.NBTTagCompound; +/* 13: */ import net.minecraft.nbt.NBTTagList; +/* 14: */ import net.minecraft.world.World; +/* 15: */ +/* 16: */ public class Behaviour_Sonictron +/* 17: */ extends Behaviour_None +/* 18: */ { +/* 19: 16 */ public static final IItemBehaviour INSTANCE = new Behaviour_Sonictron(); +/* 20: */ +/* 21: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 22: */ { +/* 23: 20 */ if ((!aWorld.isRemote) && (aWorld.getBlock(aX, aY, aZ) == GregTech_API.sBlockMachines) && (aWorld.getBlockMetadata(aX, aY, aZ) == 6)) {} +/* 24: 36 */ setCurrentIndex(aStack, -1); +/* 25: 37 */ return false; +/* 26: */ } +/* 27: */ +/* 28: */ public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) +/* 29: */ { +/* 30: 42 */ setCurrentIndex(aStack, 0); +/* 31: 43 */ return aStack; +/* 32: */ } +/* 33: */ +/* 34: */ public void onUpdate(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) +/* 35: */ { +/* 36: 48 */ int tTickTimer = getTickTimer(aStack); +/* 37: 49 */ int tCurrentIndex = getCurrentIndex(aStack); +/* 38: 51 */ if ((tTickTimer++ % 2 == 0) && (tCurrentIndex > -1)) +/* 39: */ { +/* 40: 52 */ ItemStack[] tInventory = getNBTInventory(aStack); +/* 41: 53 */ GT_Values.GT.doSonictronSound(tInventory[tCurrentIndex], aPlayer.worldObj, aPlayer.posX, aPlayer.posY, aPlayer.posZ); +/* 42: 54 */ tCurrentIndex++; +/* 43: 54 */ if (tCurrentIndex > 63) { +/* 44: 54 */ tCurrentIndex = -1; +/* 45: */ } +/* 46: */ } +/* 47: 57 */ setTickTimer(aStack, tTickTimer); +/* 48: 58 */ setCurrentIndex(aStack, tCurrentIndex); +/* 49: */ } +/* 50: */ +/* 51: */ public static int getCurrentIndex(ItemStack aStack) +/* 52: */ { +/* 53: 62 */ NBTTagCompound tNBTTagCompound = aStack.getTagCompound(); +/* 54: 63 */ if (tNBTTagCompound == null) { +/* 55: 63 */ tNBTTagCompound = new NBTTagCompound(); +/* 56: */ } +/* 57: 64 */ return tNBTTagCompound.getInteger("mCurrentIndex"); +/* 58: */ } +/* 59: */ +/* 60: */ public static int getTickTimer(ItemStack aStack) +/* 61: */ { +/* 62: 68 */ NBTTagCompound tNBTTagCompound = aStack.getTagCompound(); +/* 63: 69 */ if (tNBTTagCompound == null) { +/* 64: 69 */ tNBTTagCompound = new NBTTagCompound(); +/* 65: */ } +/* 66: 70 */ return tNBTTagCompound.getInteger("mTickTimer"); +/* 67: */ } +/* 68: */ +/* 69: */ public static NBTTagCompound setCurrentIndex(ItemStack aStack, int aIndex) +/* 70: */ { +/* 71: 74 */ NBTTagCompound tNBTTagCompound = aStack.getTagCompound(); +/* 72: 75 */ if (tNBTTagCompound == null) { +/* 73: 75 */ tNBTTagCompound = new NBTTagCompound(); +/* 74: */ } +/* 75: 76 */ tNBTTagCompound.setInteger("mCurrentIndex", aIndex); +/* 76: 77 */ return tNBTTagCompound; +/* 77: */ } +/* 78: */ +/* 79: */ public static NBTTagCompound setTickTimer(ItemStack aStack, int aTime) +/* 80: */ { +/* 81: 81 */ NBTTagCompound tNBTTagCompound = aStack.getTagCompound(); +/* 82: 82 */ if (tNBTTagCompound == null) { +/* 83: 82 */ tNBTTagCompound = new NBTTagCompound(); +/* 84: */ } +/* 85: 83 */ tNBTTagCompound.setInteger("mTickTimer", aTime); +/* 86: 84 */ return tNBTTagCompound; +/* 87: */ } +/* 88: */ +/* 89: */ public static ItemStack[] getNBTInventory(ItemStack aStack) +/* 90: */ { +/* 91: 88 */ ItemStack[] tInventory = new ItemStack[64]; +/* 92: 89 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 93: 90 */ if (tNBT == null) { +/* 94: 90 */ return tInventory; +/* 95: */ } +/* 96: 92 */ NBTTagList tNBT_ItemList = tNBT.getTagList("Inventory", 10); +/* 97: 93 */ for (int i = 0; i < tNBT_ItemList.tagCount(); i++) +/* 98: */ { +/* 99: 94 */ NBTTagCompound tag = tNBT_ItemList.getCompoundTagAt(i); +/* 100: 95 */ byte slot = tag.getByte("Slot"); +/* 101: 96 */ if ((slot >= 0) && (slot < tInventory.length)) { +/* 102: 97 */ tInventory[slot] = GT_Utility.loadItem(tag); +/* 103: */ } +/* 104: */ } +/* 105:100 */ return tInventory; +/* 106: */ } +/* 107: */ +/* 108: */ public static NBTTagCompound setNBTInventory(ItemStack aStack, ItemStack[] aInventory) +/* 109: */ { +/* 110:104 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 111:105 */ if (tNBT == null) { +/* 112:105 */ tNBT = new NBTTagCompound(); +/* 113: */ } +/* 114:107 */ NBTTagList tNBT_ItemList = new NBTTagList(); +/* 115:108 */ for (int i = 0; i < aInventory.length; i++) +/* 116: */ { +/* 117:109 */ ItemStack stack = aInventory[i]; +/* 118:110 */ if (stack != null) +/* 119: */ { +/* 120:111 */ NBTTagCompound tag = new NBTTagCompound(); +/* 121:112 */ tag.setByte("Slot", (byte)i); +/* 122:113 */ stack.writeToNBT(tag); +/* 123:114 */ tNBT_ItemList.appendTag(tag); +/* 124: */ } +/* 125: */ } +/* 126:117 */ tNBT.setTag("Inventory", tNBT_ItemList); +/* 127:118 */ aStack.setTagCompound(tNBT); +/* 128:119 */ return tNBT; +/* 129: */ } +/* 130: */ +/* 131: */ public static void copyInventory(ItemStack[] aInventory, ItemStack[] aNewContent, int aIndexlength) +/* 132: */ { +/* 133:123 */ for (int i = 0; i < aIndexlength; i++) { +/* 134:124 */ if (aNewContent[i] == null) { +/* 135:125 */ aInventory[i] = null; +/* 136: */ } else { +/* 137:127 */ aInventory[i] = GT_Utility.copy(new Object[] { aNewContent[i] }); +/* 138: */ } +/* 139: */ } +/* 140: */ } +/* 141: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Sonictron + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java b/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java new file mode 100644 index 0000000000..4051afa5bf --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java @@ -0,0 +1,143 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import gregtech.api.GregTech_API; +/* 4: */ import gregtech.api.enums.Dyes; +/* 5: */ import gregtech.api.enums.ItemList; +/* 6: */ import gregtech.api.items.GT_MetaBase_Item; +/* 7: */ import gregtech.api.util.GT_LanguageManager; +/* 8: */ import gregtech.api.util.GT_Utility; +/* 9: */ import java.util.Arrays; +/* 10: */ import java.util.Collection; +/* 11: */ import java.util.List; +/* 12: */ import java.util.Map; +/* 13: */ import net.minecraft.block.Block; +/* 14: */ import net.minecraft.block.BlockColored; +/* 15: */ import net.minecraft.entity.player.EntityPlayer; +/* 16: */ import net.minecraft.entity.player.PlayerCapabilities; +/* 17: */ import net.minecraft.init.Blocks; +/* 18: */ import net.minecraft.init.Items; +/* 19: */ import net.minecraft.item.Item; +/* 20: */ import net.minecraft.item.ItemStack; +/* 21: */ import net.minecraft.nbt.NBTTagCompound; +/* 22: */ import net.minecraft.world.World; +/* 23: */ import net.minecraftforge.common.util.ForgeDirection; +/* 24: */ +/* 25: */ public class Behaviour_Spray_Color +/* 26: */ extends Behaviour_None +/* 27: */ { +/* 28: */ private final ItemStack mEmpty; +/* 29: */ private final ItemStack mUsed; +/* 30: */ private final ItemStack mFull; +/* 31: */ private final long mUses; +/* 32: */ private final byte mColor; +/* 33: */ +/* 34: */ public Behaviour_Spray_Color(ItemStack aEmpty, ItemStack aUsed, ItemStack aFull, long aUses, int aColor) +/* 35: */ { +/* 36: 30 */ this.mEmpty = aEmpty; +/* 37: 31 */ this.mUsed = aUsed; +/* 38: 32 */ this.mFull = aFull; +/* 39: 33 */ this.mUses = aUses; +/* 40: 34 */ this.mColor = ((byte)aColor); +/* 41: 35 */ this.mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.paintspray." + this.mColor + ".tooltip", "Can Color things in " + Dyes.get(this.mColor).mName); +/* 42: */ } +/* 43: */ +/* 44: */ public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 45: */ { +/* 46: 40 */ if ((aWorld.isRemote) || (aStack.stackSize != 1)) { +/* 47: 40 */ return false; +/* 48: */ } +/* 49: 42 */ boolean rOutput = false; +/* 50: 44 */ if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { +/* 51: 44 */ return false; +/* 52: */ } +/* 53: 46 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 54: 47 */ if (tNBT == null) { +/* 55: 47 */ tNBT = new NBTTagCompound(); +/* 56: */ } +/* 57: 48 */ long tUses = tNBT.getLong("GT.RemainingPaint"); +/* 58: 50 */ if (GT_Utility.areStacksEqual(aStack, this.mFull, true)) +/* 59: */ { +/* 60: 51 */ aStack.func_150996_a(this.mUsed.getItem()); +/* 61: 52 */ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mUsed)); +/* 62: 53 */ tUses = this.mUses; +/* 63: */ } +/* 64: 55 */ if ((GT_Utility.areStacksEqual(aStack, this.mUsed, true)) && +/* 65: 56 */ (colorize(aWorld, aX, aY, aZ, aSide))) +/* 66: */ { +/* 67: 57 */ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(102)), 1.0F, 1.0F, aX, aY, aZ); +/* 68: 58 */ if (!aPlayer.capabilities.isCreativeMode) { +/* 69: 58 */ tUses -= 1L; +/* 70: */ } +/* 71: 59 */ rOutput = true; +/* 72: */ } +/* 73: 62 */ tNBT.removeTag("GT.RemainingPaint"); +/* 74: 63 */ if (tUses > 0L) { +/* 75: 63 */ tNBT.setLong("GT.RemainingPaint", tUses); +/* 76: */ } +/* 77: 64 */ if (tNBT.hasNoTags()) { +/* 78: 64 */ aStack.setTagCompound(null); +/* 79: */ } else { +/* 80: 64 */ aStack.setTagCompound(tNBT); +/* 81: */ } +/* 82: 66 */ if (tUses <= 0L) { +/* 83: 67 */ if (this.mEmpty == null) +/* 84: */ { +/* 85: 68 */ aStack.stackSize -= 1; +/* 86: */ } +/* 87: */ else +/* 88: */ { +/* 89: 70 */ aStack.func_150996_a(this.mEmpty.getItem()); +/* 90: 71 */ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mEmpty)); +/* 91: */ } +/* 92: */ } +/* 93: 74 */ return rOutput; +/* 94: */ } +/* 95: */ +/* 96: 77 */ private final Collection mAllowedVanillaBlocks = Arrays.asList(new Block[] { Blocks.glass, Blocks.glass_pane, Blocks.stained_glass, Blocks.stained_glass_pane, Blocks.carpet, Blocks.hardened_clay, ItemList.TE_Rockwool.getBlock() }); +/* 97: */ private final String mTooltip; +/* 98: */ +/* 99: */ private boolean colorize(World aWorld, int aX, int aY, int aZ, int aSide) +/* 100: */ { +/* 101: 80 */ Block aBlock = aWorld.getBlock(aX, aY, aZ); +/* 102: 81 */ if ((aBlock != Blocks.air) && ((this.mAllowedVanillaBlocks.contains(aBlock)) || ((aBlock instanceof BlockColored)))) +/* 103: */ { +/* 104: 82 */ if (aBlock == Blocks.hardened_clay) +/* 105: */ { +/* 106: 82 */ aWorld.setBlock(aX, aY, aZ, Blocks.stained_hardened_clay, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true; +/* 107: */ } +/* 108: 83 */ if (aBlock == Blocks.glass_pane) +/* 109: */ { +/* 110: 83 */ aWorld.setBlock(aX, aY, aZ, Blocks.stained_glass_pane, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true; +/* 111: */ } +/* 112: 84 */ if (aBlock == Blocks.glass) +/* 113: */ { +/* 114: 84 */ aWorld.setBlock(aX, aY, aZ, Blocks.stained_glass, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true; +/* 115: */ } +/* 116: 85 */ if (aWorld.getBlockMetadata(aX, aY, aZ) == ((this.mColor ^ 0xFFFFFFFF) & 0xF)) { +/* 117: 85 */ return false; +/* 118: */ } +/* 119: 86 */ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3); +/* 120: 87 */ return true; +/* 121: */ } +/* 122: 89 */ return aBlock.recolourBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aSide), (this.mColor ^ 0xFFFFFFFF) & 0xF); +/* 123: */ } +/* 124: */ +/* 125: 92 */ private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.paintspray.uses", "Remaining Uses:"); +/* 126: 93 */ private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!"); +/* 127: */ +/* 128: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 129: */ { +/* 130: 97 */ aList.add(this.mTooltip); +/* 131: 98 */ NBTTagCompound tNBT = aStack.getTagCompound(); +/* 132: 99 */ long tRemainingPaint = tNBT == null ? 0L : GT_Utility.areStacksEqual(aStack, this.mFull, true) ? this.mUses : tNBT.getLong("GT.RemainingPaint"); +/* 133:100 */ aList.add(this.mTooltipUses + " " + tRemainingPaint); +/* 134:101 */ aList.add(this.mTooltipUnstackable); +/* 135:102 */ return aList; +/* 136: */ } +/* 137: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_Spray_Color + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java b/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java new file mode 100644 index 0000000000..2d84495038 --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java @@ -0,0 +1,182 @@ +package gregtech.common.items.behaviors; + +import gregtech.api.GregTech_API; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import ic2.api.tile.IWrenchable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class Behaviour_Wrench + extends Behaviour_None +{ + private final int mCosts; + + public Behaviour_Wrench(int aCosts) + { + this.mCosts = aCosts; + } + + public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) + { + if (aWorld.isRemote) { + return false; + } + Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) { + return false; + } + byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ);byte aTargetSide = GT_Utility.determineWrenchingSide((byte)aSide, hitX, hitY, hitZ); + TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + try + { + if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) + { + if (((IWrenchable)aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + ((IWrenchable)aTileEntity).setFacing((short)aTargetSide); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (((IWrenchable)aTileEntity).wrenchCanRemove(aPlayer)) + { + int tDamage = ((IWrenchable)aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, tDamage * this.mCosts))) + { + ItemStack tOutput = ((IWrenchable)aTileEntity).getWrenchDrop(aPlayer); + for (ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { + if (tOutput == null) + { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); + } + else + { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput)); + tOutput = null; + } + } + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + return true; + } + } + catch (Throwable e) {} + if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (aMeta == aTargetSide) + { + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) + { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))) + { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + } + else + { + if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) + { + if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) + { + if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (aBlock == Blocks.hopper) + { + if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) + { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + } + if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && + ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && + (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) + { + if (!aPlayer.capabilities.isCreativeMode) { + ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts); + } + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return false; + } + + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); + + public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) + { + aList.add(this.mTooltip); + return aList; + } +} diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java b/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java new file mode 100644 index 0000000000..b7aaafb3dc --- /dev/null +++ b/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java @@ -0,0 +1,44 @@ +/* 1: */ package gregtech.common.items.behaviors; +/* 2: */ +/* 3: */ import cpw.mods.fml.relauncher.Side; +/* 4: */ import cpw.mods.fml.relauncher.SideOnly; +/* 5: */ import gregtech.api.items.GT_MetaBase_Item; +/* 6: */ import gregtech.api.util.GT_Utility; +/* 7: */ import gregtech.api.util.GT_Utility.ItemNBT; +/* 8: */ import java.util.List; +/* 9: */ import net.minecraft.client.Minecraft; +/* 10: */ import net.minecraft.client.entity.EntityPlayerSP; +/* 11: */ import net.minecraft.client.gui.GuiScreenBook; +/* 12: */ import net.minecraft.entity.player.EntityPlayer; +/* 13: */ import net.minecraft.item.ItemStack; +/* 14: */ import net.minecraft.world.World; +/* 15: */ +/* 16: */ public class Behaviour_WrittenBook +/* 17: */ extends Behaviour_None +/* 18: */ { +/* 19: */ @SideOnly(Side.CLIENT) +/* 20: */ public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) +/* 21: */ { +/* 22:25 */ if ((GT_Utility.isStringValid(GT_Utility.ItemNBT.getBookTitle(aStack))) && ((aPlayer instanceof EntityPlayerSP))) { +/* 23:25 */ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(aPlayer, aStack, false)); +/* 24: */ } +/* 25:26 */ return true; +/* 26: */ } +/* 27: */ +/* 28: */ public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) +/* 29: */ { +/* 30:31 */ String tTitle = GT_Utility.ItemNBT.getBookTitle(aStack); +/* 31:32 */ if (GT_Utility.isStringValid(tTitle)) +/* 32: */ { +/* 33:33 */ aList.add(tTitle); +/* 34:34 */ aList.add("by " + GT_Utility.ItemNBT.getBookAuthor(aStack)); +/* 35: */ } +/* 36:36 */ return aList; +/* 37: */ } +/* 38: */ } + + +/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar + * Qualified Name: gregtech.common.items.behaviors.Behaviour_WrittenBook + * JD-Core Version: 0.7.0.1 + */ \ No newline at end of file -- cgit