diff options
author | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 20:46:52 -0400 |
---|---|---|
committer | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 20:46:52 -0400 |
commit | 1185424fa7c692f9932623b965a99392d969e3c5 (patch) | |
tree | 39e19727dac27a4eff09a036fc27a1ee827d18a7 /src/main/java/gregtech/common/items/behaviors | |
parent | 9d85f43d5642c7683ad2877c66c6fc70b5be8928 (diff) | |
download | GT5-Unofficial-1185424fa7c692f9932623b965a99392d969e3c5.tar.gz GT5-Unofficial-1185424fa7c692f9932623b965a99392d969e3c5.tar.bz2 GT5-Unofficial-1185424fa7c692f9932623b965a99392d969e3c5.zip |
Move source files
Diffstat (limited to 'src/main/java/gregtech/common/items/behaviors')
23 files changed, 2083 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java new file mode 100644 index 0000000000..ff13e1287b --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java @@ -0,0 +1,135 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.SubTag;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Utility.GT_EnchantmentHelper;
+import gregtech.api.util.GT_Utility.ItemNBT;
+import gregtech.common.entities.GT_Entity_Arrow;
+import net.minecraft.block.BlockDispenser;
+import net.minecraft.dispenser.IBlockSource;
+import net.minecraft.dispenser.IPosition;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.World;
+
+public class Behaviour_Arrow
+ extends Behaviour_None
+{
+ public static Behaviour_Arrow DEFAULT_WOODEN = new Behaviour_Arrow(GT_Entity_Arrow.class, 1.0F, 6.0F);
+ public static Behaviour_Arrow DEFAULT_PLASTIC = new Behaviour_Arrow(GT_Entity_Arrow.class, 1.5F, 6.0F);
+ private final int mLevel;
+ private final Enchantment mEnchantment;
+ private final float mSpeedMultiplier;
+ private final float mPrecision;
+ private final Class<? extends GT_Entity_Arrow> mArrow;
+
+ public Behaviour_Arrow(Class<? extends GT_Entity_Arrow> aArrow, float aSpeed, float aPrecision)
+ {
+ this(aArrow, aSpeed, aPrecision, null, 0);
+ }
+
+ public Behaviour_Arrow(Class<? extends GT_Entity_Arrow> aArrow, float aSpeed, float aPrecision, Enchantment aEnchantment, int aLevel)
+ {
+ this.mArrow = aArrow;
+ this.mSpeedMultiplier = aSpeed;
+ this.mPrecision = aPrecision;
+ this.mEnchantment = aEnchantment;
+ this.mLevel = aLevel;
+ }
+
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity)
+ {
+ if ((aEntity instanceof EntityLivingBase))
+ {
+ GT_Utility.GT_EnchantmentHelper.applyBullshitA((EntityLivingBase)aEntity, aPlayer, aStack);
+ GT_Utility.GT_EnchantmentHelper.applyBullshitB(aPlayer, aEntity, aStack);
+ if (!aPlayer.capabilities.isCreativeMode) {
+ aStack.stackSize -= 1;
+ }
+ if (aStack.stackSize <= 0) {
+ aPlayer.destroyCurrentEquippedItem();
+ }
+ return false;
+ }
+ return false;
+ }
+
+ public boolean isItemStackUsable(GT_MetaBase_Item aItem, ItemStack aStack)
+ {
+ if ((this.mEnchantment != null) && (this.mLevel > 0))
+ {
+ NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack);
+ if (!tNBT.getBoolean("GT.HasBeenUpdated"))
+ {
+ tNBT.setBoolean("GT.HasBeenUpdated", true);
+ GT_Utility.ItemNBT.setNBT(aStack, tNBT);
+ GT_Utility.ItemNBT.addEnchantment(aStack, this.mEnchantment, this.mLevel);
+ }
+ }
+ return true;
+ }
+
+ public boolean canDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack)
+ {
+ return true;
+ }
+
+ public ItemStack onDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack)
+ {
+ World aWorld = aSource.getWorld();
+ IPosition tPosition = BlockDispenser.func_149939_a(aSource);
+ EnumFacing tFacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata());
+ GT_Entity_Arrow tEntityArrow = (GT_Entity_Arrow)getProjectile(aItem, SubTag.PROJECTILE_ARROW, aStack, aWorld, tPosition.getX(), tPosition.getY(), tPosition.getZ());
+ if (tEntityArrow != null)
+ {
+ tEntityArrow.setThrowableHeading(tFacing.getFrontOffsetX(), tFacing.getFrontOffsetY() + 0.1F, tFacing.getFrontOffsetZ(), this.mSpeedMultiplier * 1.1F, this.mPrecision);
+ tEntityArrow.setArrowItem(aStack);
+ tEntityArrow.canBePickedUp = 1;
+ aWorld.spawnEntityInWorld(tEntityArrow);
+ if (aStack.stackSize < 100) {
+ aStack.stackSize -= 1;
+ }
+ return aStack;
+ }
+ return super.onDispense(aItem, aSource, aStack);
+ }
+
+ public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack)
+ {
+ return aProjectileType == SubTag.PROJECTILE_ARROW;
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ)
+ {
+ if (!hasProjectile(aItem, aProjectileType, aStack)) {
+ return null;
+ }
+ 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) });
+ rArrow.setArrowItem(aStack);
+ return rArrow;
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed)
+ {
+ if (!hasProjectile(aItem, aProjectileType, aStack)) {
+ return null;
+ }
+ 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) });
+ rArrow.setArrowItem(aStack);
+ return rArrow;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java new file mode 100644 index 0000000000..a6c8b139ab --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java @@ -0,0 +1,72 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.SubTag;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.common.entities.GT_Entity_Arrow_Potion;
+import java.util.Random;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+public class Behaviour_Arrow_Potion
+ extends Behaviour_Arrow
+{
+ private final int[] mPotions;
+
+ public Behaviour_Arrow_Potion(float aSpeed, float aPrecision, int... aPotions)
+ {
+ super(GT_Entity_Arrow_Potion.class, aSpeed, aPrecision);
+ this.mPotions = aPotions;
+ }
+
+ public Behaviour_Arrow_Potion(float aSpeed, float aPrecision, Enchantment aEnchantment, int aLevel, int... aPotions)
+ {
+ super(GT_Entity_Arrow_Potion.class, aSpeed, aPrecision, aEnchantment, aLevel);
+ this.mPotions = aPotions;
+ }
+
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity)
+ {
+ if ((aEntity instanceof EntityLivingBase)) {
+ for (int i = 3; i < this.mPotions.length; i += 4) {
+ if (aEntity.worldObj.rand.nextInt(100) < this.mPotions[i]) {
+ ((EntityLivingBase)aEntity).addPotionEffect(new PotionEffect(this.mPotions[(i - 3)], this.mPotions[(i - 2)], this.mPotions[(i - 1)], false));
+ }
+ }
+ }
+ return super.onLeftClickEntity(aItem, aStack, aPlayer, aEntity);
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ)
+ {
+ if (!hasProjectile(aItem, aProjectileType, aStack)) {
+ return null;
+ }
+ GT_Entity_Arrow_Potion rArrow = new GT_Entity_Arrow_Potion(aWorld, aX, aY, aZ);
+ rArrow.setArrowItem(aStack);
+ rArrow.setPotions(this.mPotions);
+ return rArrow;
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed)
+ {
+ if (!hasProjectile(aItem, aProjectileType, aStack)) {
+ return null;
+ }
+ GT_Entity_Arrow_Potion rArrow = new GT_Entity_Arrow_Potion(aWorld, aEntity, aSpeed);
+ rArrow.setArrowItem(aStack);
+ rArrow.setPotions(this.mPotions);
+ return rArrow;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java new file mode 100644 index 0000000000..07fa993422 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java @@ -0,0 +1,69 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import java.util.Map;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_Crowbar
+ extends Behaviour_None
+{
+ private final int mVanillaCosts;
+ private final int mEUCosts;
+
+ public Behaviour_Crowbar(int aVanillaCosts, int aEUCosts)
+ {
+ this.mVanillaCosts = aVanillaCosts;
+ this.mEUCosts = aEUCosts;
+ }
+
+ 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;
+ }
+ if (GT_ModHandler.getModItem("Railcraft", "fluid.creosote.bucket", 1L) != null) {
+ return false;
+ }
+ Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if (aBlock == null) {
+ return false;
+ }
+ byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ);
+ if (aBlock == Blocks.rail)
+ {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 1) % 10, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(0)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.detector_rail) || (aBlock == Blocks.activator_rail) || (aBlock == Blocks.golden_rail))
+ {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, aBlock, aMeta / 8 * 8 + (aMeta % 8 + 1) % 6, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(0)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ return false;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java new file mode 100644 index 0000000000..5738962c10 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java @@ -0,0 +1,121 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class Behaviour_DataOrb
+ extends Behaviour_None
+{
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ if (!getDataTitle(aStack).equals(""))
+ {
+ aList.add(getDataTitle(aStack));
+ aList.add(getDataName(aStack));
+ }
+ return aList;
+ }
+
+ public static void copyInventory(ItemStack[] aInventory, ItemStack[] aNewContent, int aIndexlength)
+ {
+ for (int i = 0; i < aIndexlength; i++) {
+ if (aNewContent[i] == null) {
+ aInventory[i] = null;
+ } else {
+ aInventory[i] = GT_Utility.copy(new Object[] { aNewContent[i] });
+ }
+ }
+ }
+
+ public static String getDataName(ItemStack aStack)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return "";
+ }
+ return tNBT.getString("mDataName");
+ }
+
+ public static String getDataTitle(ItemStack aStack)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return "";
+ }
+ return tNBT.getString("mDataTitle");
+ }
+
+ public static NBTTagCompound setDataName(ItemStack aStack, String aDataName)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ tNBT.setString("mDataName", aDataName);
+ aStack.setTagCompound(tNBT);
+ return tNBT;
+ }
+
+ public static NBTTagCompound setDataTitle(ItemStack aStack, String aDataTitle)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ tNBT.setString("mDataTitle", aDataTitle);
+ aStack.setTagCompound(tNBT);
+ return tNBT;
+ }
+
+ public static ItemStack[] getNBTInventory(ItemStack aStack)
+ {
+ ItemStack[] tInventory = new ItemStack[256];
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return tInventory;
+ }
+ NBTTagList tNBT_ItemList = tNBT.getTagList("Inventory", 10);
+ for (int i = 0; i < tNBT_ItemList.tagCount(); i++)
+ {
+ NBTTagCompound tag = tNBT_ItemList.getCompoundTagAt(i);
+ byte slot = tag.getByte("Slot");
+ if ((slot >= 0) && (slot < tInventory.length)) {
+ tInventory[slot] = GT_Utility.loadItem(tag);
+ }
+ }
+ return tInventory;
+ }
+
+ public static NBTTagCompound setNBTInventory(ItemStack aStack, ItemStack[] aInventory)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ NBTTagList tNBT_ItemList = new NBTTagList();
+ for (int i = 0; i < aInventory.length; i++)
+ {
+ ItemStack stack = aInventory[i];
+ if (stack != null)
+ {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setByte("Slot", (byte)i);
+ stack.writeToNBT(tag);
+ tNBT_ItemList.appendTag(tag);
+ }
+ }
+ tNBT.setTag("Inventory", tNBT_ItemList);
+ aStack.setTagCompound(tNBT);
+ return tNBT;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java new file mode 100644 index 0000000000..d5b5e0b867 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java @@ -0,0 +1,43 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Utility.ItemNBT;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+
+public class Behaviour_DataStick
+ extends Behaviour_None
+{
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ String tString = GT_Utility.ItemNBT.getBookTitle(aStack);
+ if (GT_Utility.isStringValid(tString)) {
+ aList.add(tString);
+ }
+ tString = GT_Utility.ItemNBT.getBookAuthor(aStack);
+ if (GT_Utility.isStringValid(tString)) {
+ aList.add("by " + tString);
+ }
+ short tMapID = GT_Utility.ItemNBT.getMapID(aStack);
+ if (tMapID >= 0) {
+ aList.add("Map ID: " + tMapID);
+ }
+ tString = GT_Utility.ItemNBT.getPunchCardData(aStack);
+ if (GT_Utility.isStringValid(tString))
+ {
+ aList.add("Punch Card Data");
+ int i = 0;
+ for (int j = tString.length(); i < j; i += 64) {
+ aList.add(tString.substring(i, Math.min(i + 64, j)));
+ }
+ }
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java new file mode 100644 index 0000000000..24a22ef331 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -0,0 +1,74 @@ +package gregtech.common.items.behaviors;
+
+import cpw.mods.fml.common.eventhandler.*;
+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_Utility;
+import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.block.Block.SoundType;
+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.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.UseHoeEvent;
+
+public class Behaviour_Hoe
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Hoe(int aCosts)
+ {
+ this.mCosts = aCosts;
+ }
+
+ 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)
+ {
+ if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) {
+ return false;
+ }
+ UseHoeEvent event = new UseHoeEvent(aPlayer, aStack, aWorld, aX, aY, aZ);
+ if (MinecraftForge.EVENT_BUS.post(event)) {
+ return false;
+ }
+ if (event.getResult() == Event.Result.ALLOW)
+ {
+ if (!aPlayer.capabilities.isCreativeMode) {
+ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts);
+ }
+ return true;
+ }
+ Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if ((aSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt)))
+ {
+ 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);
+ if (aWorld.isRemote) {
+ return true;
+ }
+ aWorld.setBlock(aX, aY, aZ, Blocks.farmland);
+ if (!aPlayer.capabilities.isCreativeMode) {
+ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.hoe", "Can till Dirt");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java new file mode 100644 index 0000000000..b8ef7d323e --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java @@ -0,0 +1,143 @@ +package gregtech.common.items.behaviors;
+
+import codechicken.lib.math.MathHelper;
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Utility.ItemNBT;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.monster.EntityCreeper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class Behaviour_Lighter
+ extends Behaviour_None
+{
+ private final ItemStack mEmptyLighter;
+ private final ItemStack mUsedLighter;
+ private final ItemStack mFullLighter;
+ private final long mFuelAmount;
+
+ public Behaviour_Lighter(ItemStack aEmptyLighter, ItemStack aUsedLighter, ItemStack aFullLighter, long aFuelAmount)
+ {
+ this.mFullLighter = aFullLighter;
+ this.mUsedLighter = aUsedLighter;
+ this.mEmptyLighter = aEmptyLighter;
+ this.mFuelAmount = aFuelAmount;
+ }
+
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity)
+ {
+ if ((aPlayer.worldObj.isRemote) || (aStack.stackSize != 1)) {
+ return false;
+ }
+ boolean rOutput = false;
+ if ((aEntity instanceof EntityCreeper))
+ {
+ prepare(aStack);
+ long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack);
+ if (GT_Utility.areStacksEqual(aStack, this.mUsedLighter, true))
+ {
+ 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));
+ ((EntityCreeper)aEntity).func_146079_cb();
+ if (!aPlayer.capabilities.isCreativeMode) {
+ tFuelAmount -= 1L;
+ }
+ rOutput = true;
+ }
+ GT_Utility.ItemNBT.setLighterFuel(aStack, tFuelAmount);
+ if (tFuelAmount <= 0L) {
+ useUp(aStack);
+ }
+ }
+ return rOutput;
+ }
+
+ 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)
+ {
+ return false;
+ }
+
+ 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) || (aStack.stackSize != 1)) {
+ return false;
+ }
+ boolean rOutput = false;
+
+ ForgeDirection tDirection = ForgeDirection.getOrientation(aSide);
+ aX += tDirection.offsetX;aY += tDirection.offsetY;aZ += tDirection.offsetZ;
+ if ((!GT_Utility.isBlockAir(aWorld, aX, aY, aZ)) || (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack))) {
+ return false;
+ }
+ prepare(aStack);
+ long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack);
+ if (GT_Utility.areStacksEqual(aStack, this.mUsedLighter, true))
+ {
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(6)), 1.0F, 1.0F, aX, aY, aZ);
+ aWorld.setBlock(aX, aY, aZ, Blocks.fire);
+ if (!aPlayer.capabilities.isCreativeMode) {
+ tFuelAmount -= 1L;
+ }
+ rOutput = true;
+ }
+ GT_Utility.ItemNBT.setLighterFuel(aStack, tFuelAmount);
+ if (tFuelAmount <= 0L) {
+ useUp(aStack);
+ }
+ return rOutput;
+ }
+
+ private void prepare(ItemStack aStack)
+ {
+ if (GT_Utility.areStacksEqual(aStack, this.mFullLighter, true))
+ {
+ aStack.func_150996_a(this.mUsedLighter.getItem());
+ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mUsedLighter));
+ GT_Utility.ItemNBT.setLighterFuel(aStack, this.mFuelAmount);
+ }
+ }
+
+ private void useUp(ItemStack aStack)
+ {
+ if (this.mEmptyLighter == null)
+ {
+ aStack.stackSize -= 1;
+ }
+ else
+ {
+ aStack.func_150996_a(this.mEmptyLighter.getItem());
+ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mEmptyLighter));
+ }
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip", "Can light things on Fire");
+ private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses", "Remaining Uses:");
+ private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ long tFuelAmount = tNBT == null ? 0L : GT_Utility.areStacksEqual(aStack, this.mFullLighter, true) ? this.mFuelAmount : tNBT.getLong("GT.LighterFuel");
+ aList.add(this.mTooltipUses + " " + tFuelAmount);
+ aList.add(this.mTooltipUnstackable);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java new file mode 100644 index 0000000000..caf6325e1d --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java @@ -0,0 +1,88 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.SubTag;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.items.GT_MetaBase_Item;
+import java.util.List;
+import net.minecraft.block.BlockDispenser;
+import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
+import net.minecraft.dispenser.IBlockSource;
+import net.minecraft.dispenser.IPosition;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.World;
+
+public class Behaviour_None
+ implements IItemBehaviour<GT_MetaBase_Item>
+{
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity)
+ {
+ return false;
+ }
+
+ 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)
+ {
+ return false;
+ }
+
+ 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)
+ {
+ return false;
+ }
+
+ public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer)
+ {
+ return aStack;
+ }
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ return aList;
+ }
+
+ public void onUpdate(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) {}
+
+ public boolean isItemStackUsable(GT_MetaBase_Item aItem, ItemStack aStack)
+ {
+ return true;
+ }
+
+ public boolean canDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack)
+ {
+ return false;
+ }
+
+ public ItemStack onDispense(GT_MetaBase_Item aItem, IBlockSource aSource, ItemStack aStack)
+ {
+ EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata());
+ IPosition iposition = BlockDispenser.func_149939_a(aSource);
+ ItemStack itemstack1 = aStack.splitStack(1);
+ BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition);
+ return aStack;
+ }
+
+ public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack)
+ {
+ return false;
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ)
+ {
+ return null;
+ }
+
+ public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed)
+ {
+ return null;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java new file mode 100644 index 0000000000..3545949138 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java @@ -0,0 +1,59 @@ +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_Utility;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import thaumcraft.api.aspects.IEssentiaTransport;
+
+public class Behaviour_Plunger_Essentia
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Plunger_Essentia(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;
+ }
+ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((aTileEntity instanceof IEssentiaTransport)) && (
+ (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))))
+ {
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ for (ForgeDirection tDirection : ForgeDirection.VALID_DIRECTIONS) {
+ ((IEssentiaTransport)aTileEntity).takeEssentia(((IEssentiaTransport)aTileEntity).getEssentiaType(tDirection), ((IEssentiaTransport)aTileEntity).getEssentiaAmount(tDirection), tDirection);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.essentia", "Clears Essentia from Containers and Tubes");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java new file mode 100644 index 0000000000..a237fe70fd --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java @@ -0,0 +1,62 @@ +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_Utility;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class Behaviour_Plunger_Fluid
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Plunger_Fluid(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;
+ }
+ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((aTileEntity instanceof IFluidHandler)) {
+ for (ForgeDirection tDirection : ForgeDirection.VALID_DIRECTIONS) {
+ if (((IFluidHandler)aTileEntity).drain(tDirection, 1000, false) != null) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ ((IFluidHandler)aTileEntity).drain(tDirection, 1000, true);
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.fluid", "Clears 1000 Liters of Fluid from Tanks");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java new file mode 100644 index 0000000000..57571cd408 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java @@ -0,0 +1,83 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe.Util;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+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_Utility;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class Behaviour_Plunger_Item
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Plunger_Item(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;
+ }
+ TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((aTileEntity instanceof IGregTechTileEntity))
+ {
+ IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity)aTileEntity).getMetaTileEntity();
+ if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) {
+ for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe)tMetaTileEntity, new HashMap(), 0L, false, true)).keySet())
+
+ {
+ int i = 0;
+ for (int j = ((IMetaTileEntityItemPipe)tTileEntity).getSizeInventory(); i < j; i++) {
+ if (((IMetaTileEntityItemPipe)tTileEntity).isValidSlot(i)) {
+ if ((((IMetaTileEntityItemPipe)tTileEntity).getStackInSlot(i) != null) && (
+ (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))))
+ {
+ ItemStack tStack = ((IMetaTileEntityItemPipe)tTileEntity).decrStackSize(i, 64);
+ if (tStack != null)
+ {
+ 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);
+ tEntity.motionX = 0.0D;tEntity.motionY = 0.0D;tEntity.motionZ = 0.0D;
+ aWorld.spawnEntityInWorld(tEntity);
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.item", "Clears Items from Pipes");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java new file mode 100644 index 0000000000..b50a5e79d7 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java @@ -0,0 +1,46 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import java.util.List;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class Behaviour_PrintedPages
+ extends Behaviour_None
+{
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ if (GT_Utility.isStringValid(getTitle(aStack))) {
+ aList.add(getTitle(aStack));
+ }
+ if (GT_Utility.isStringValid(getAuthor(aStack))) {
+ aList.add("by " + getAuthor(aStack));
+ }
+ return aList;
+ }
+
+ public static String getTitle(ItemStack aStack)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return "";
+ }
+ return tNBT.getString("title");
+ }
+
+ public static String getAuthor(ItemStack aStack)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return "";
+ }
+ return tNBT.getString("author");
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java new file mode 100644 index 0000000000..c90c5bf42f --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java @@ -0,0 +1,149 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ItemData;
+import gregtech.api.objects.MaterialStack;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.blocks.GT_Block_Ores;
+import gregtech.common.blocks.GT_TileEntity_Ores;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+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;
+import net.minecraftforge.fluids.IFluidBlock;
+
+public class Behaviour_Prospecting
+ extends Behaviour_None
+{
+ private final int mVanillaCosts;
+ private final int mEUCosts;
+
+ public Behaviour_Prospecting(int aVanillaCosts, int aEUCosts)
+ {
+ this.mVanillaCosts = aVanillaCosts;
+ this.mEUCosts = aEUCosts;
+ }
+
+ 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);
+
+
+ ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta));
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ return true;
+ }
+ 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)))
+ {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer))
+ {
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ 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;
+
+ int i = 0;
+ for (int j = 6 + tQuality; i < j; i++)
+ {
+ tX -= ForgeDirection.getOrientation(aSide).offsetX;
+ tY -= ForgeDirection.getOrientation(aSide).offsetY;
+ tZ -= ForgeDirection.getOrientation(aSide).offsetZ;
+
+ Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock.");
+ break;
+ }
+ if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock)))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock.");
+ break;
+ }
+ if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ)))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock.");
+ break;
+ }
+ if (tBlock != aBlock)
+ {
+ if (i >= 4) {
+ break;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); break;
+ }
+ }
+ Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide);
+ i = 0;
+ for (int j = 9 + 2 * tQuality; i < j; i++)
+ {
+ tX = aX - 4 - tQuality + tRandom.nextInt(j);
+ tY = aY - 4 - tQuality + tRandom.nextInt(j);
+ tZ = aZ - 4 - tQuality + tRandom.nextInt(j);
+ Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ if ((tBlock instanceof GT_Block_Ores))
+ {
+ TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
+ if ((tTileEntity instanceof GT_TileEntity_Ores))
+ {
+ Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores)tTileEntity).mMetaData % 1000)];
+ if ((tMaterial != null) && (tMaterial != Materials._NULL))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore.");
+ return true;
+ }
+ }
+ }
+ else
+ {
+ tMetaID = aWorld.getBlockMetadata(tX, tY, tZ);
+ tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")))
+ {
+ GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ return true;
+ }
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "No Ores found.");
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java new file mode 100644 index 0000000000..233217dfe0 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java @@ -0,0 +1,50 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_Scanner
+ extends Behaviour_None
+{
+ public static final IItemBehaviour<GT_MetaBase_Item> INSTANCE = new Behaviour_Scanner();
+
+ 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 (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D)))
+ {
+ ArrayList<String> tList = new ArrayList();
+ if (aItem.use(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), aPlayer)) {
+ for (int i = 0; i < tList.size(); i++) {
+ GT_Utility.sendChatToPlayer(aPlayer, (String)tList.get(i));
+ }
+ }
+ return true;
+ }
+ GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(108)), 1, 1.0F, aX, aY, aZ);
+ return aPlayer instanceof EntityPlayerMP;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scanning", "Can scan Blocks in World");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java new file mode 100644 index 0000000000..31fc309880 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java @@ -0,0 +1,63 @@ +package gregtech.common.items.behaviors;
+
+import forestry.api.lepidopterology.EnumFlutterType;
+import forestry.api.lepidopterology.IAlleleButterflySpecies;
+import forestry.api.lepidopterology.IButterfly;
+import forestry.api.lepidopterology.IButterflyGenome;
+import forestry.api.lepidopterology.IButterflyRoot;
+import forestry.api.lepidopterology.IEntityButterfly;
+import forestry.api.lepidopterology.ILepidopteristTracker;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_LanguageManager;
+import java.util.List;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_Scoop
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Scoop(int aCosts)
+ {
+ this.mCosts = aCosts;
+ }
+
+ public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity)
+ {
+ if ((aEntity instanceof IEntityButterfly))
+ {
+ if (aPlayer.worldObj.isRemote) {
+ return true;
+ }
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ Object tButterfly = ((IEntityButterfly)aEntity).getButterfly();
+ ((IButterfly)tButterfly).getGenome().getPrimary().getRoot().getBreedingTracker(aEntity.worldObj, aPlayer.getGameProfile()).registerCatch((IButterfly)tButterfly);
+ 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())));
+ aEntity.setDead();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scoop", "Catches Butterflies on Leftclick");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java new file mode 100644 index 0000000000..a29d8197bf --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java @@ -0,0 +1,62 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import java.util.Map;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_Screwdriver
+ extends Behaviour_None
+{
+ private final int mVanillaCosts;
+ private final int mEUCosts;
+
+ public Behaviour_Screwdriver(int aVanillaCosts, int aEUCosts)
+ {
+ this.mVanillaCosts = aVanillaCosts;
+ this.mEUCosts = aEUCosts;
+ }
+
+ 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);
+ if ((aBlock == Blocks.unpowered_repeater) || (aBlock == Blocks.powered_repeater))
+ {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer))
+ {
+ 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.unpowered_comparator) || (aBlock == Blocks.powered_comparator))
+ {
+ if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer))
+ {
+ 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;
+ }
+ return false;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java new file mode 100644 index 0000000000..d23e8d9035 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java @@ -0,0 +1,59 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_LanguageManager;
+import ic2.api.crops.ICropTile;
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class Behaviour_Sense
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_Sense(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;
+ }
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof ICropTile))
+ {
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int k = -1; k < 2; k++) {
+ if ((aStack.stackSize > 0) && (((tTileEntity = aWorld.getTileEntity(aX + i, aY + j, aZ + k)) instanceof ICropTile)) && (((ICropTile)tTileEntity).harvest(true)) && (!aPlayer.capabilities.isCreativeMode)) {
+ ((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts);
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sense", "Rightclick to harvest Crop Sticks");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java new file mode 100644 index 0000000000..c20ca76200 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java @@ -0,0 +1,58 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class Behaviour_SensorKit
+ extends Behaviour_None
+{
+ 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 ((aPlayer instanceof EntityPlayerMP))
+ {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IInventory)) && (!((IInventory)tTileEntity).isUseableByPlayer(aPlayer))) {
+ return false;
+ }
+ if (((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation()))
+ {
+ GT_Utility.setStack(aStack, ItemList.NC_SensorCard.get(aStack.stackSize, new Object[0]));
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ tNBT.setInteger("x", aX);
+ tNBT.setInteger("y", aY);
+ tNBT.setInteger("z", aZ);
+ aStack.setTagCompound(tNBT);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sensorkit.tooltip", "Used to display Information using the Mod Nuclear Control");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java new file mode 100644 index 0000000000..a9015ce49a --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java @@ -0,0 +1,131 @@ +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_Utility;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.block.Block;
+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.world.World;
+
+public class Behaviour_SoftHammer
+ extends Behaviour_None
+{
+ private final int mCosts;
+
+ public Behaviour_SoftHammer(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);
+ if (aBlock == Blocks.lit_redstone_lamp)
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, Blocks.redstone_lamp, 0, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aBlock == Blocks.redstone_lamp)
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aBlock == Blocks.golden_rail)
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 8) % 16, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aBlock == Blocks.activator_rail)
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.isRemote = true;
+ aWorld.setBlock(aX, aY, aZ, aBlock, (aMeta + 8) % 16, 0);
+ aWorld.isRemote = false;
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ 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);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper))
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 1) % 6, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 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.trapped_chest))
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta - 1) % 4 + 2, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aBlock == Blocks.hopper)
+ {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))
+ {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 1) % 6 == 1 ? (aMeta + 1) % 6 : 2, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.softhammer", "Activates and Deactivates Machines");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java new file mode 100644 index 0000000000..0198324f28 --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java @@ -0,0 +1,147 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.interfaces.internal.IGT_Mod;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.world.World;
+
+public class Behaviour_Sonictron
+ extends Behaviour_None
+{
+ public static final IItemBehaviour<GT_MetaBase_Item> INSTANCE = new Behaviour_Sonictron();
+
+ 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) && (aWorld.getBlock(aX, aY, aZ) == GregTech_API.sBlockMachines) && (aWorld.getBlockMetadata(aX, aY, aZ) == 6)) {}
+ setCurrentIndex(aStack, -1);
+ return false;
+ }
+
+ public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer)
+ {
+ setCurrentIndex(aStack, 0);
+ return aStack;
+ }
+
+ public void onUpdate(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand)
+ {
+ int tTickTimer = getTickTimer(aStack);
+ int tCurrentIndex = getCurrentIndex(aStack);
+ if ((tTickTimer++ % 2 == 0) && (tCurrentIndex > -1))
+ {
+ ItemStack[] tInventory = getNBTInventory(aStack);
+ GT_Values.GT.doSonictronSound(tInventory[tCurrentIndex], aPlayer.worldObj, aPlayer.posX, aPlayer.posY, aPlayer.posZ);
+ tCurrentIndex++;
+ if (tCurrentIndex > 63) {
+ tCurrentIndex = -1;
+ }
+ }
+ setTickTimer(aStack, tTickTimer);
+ setCurrentIndex(aStack, tCurrentIndex);
+ }
+
+ public static int getCurrentIndex(ItemStack aStack)
+ {
+ NBTTagCompound tNBTTagCompound = aStack.getTagCompound();
+ if (tNBTTagCompound == null) {
+ tNBTTagCompound = new NBTTagCompound();
+ }
+ return tNBTTagCompound.getInteger("mCurrentIndex");
+ }
+
+ public static int getTickTimer(ItemStack aStack)
+ {
+ NBTTagCompound tNBTTagCompound = aStack.getTagCompound();
+ if (tNBTTagCompound == null) {
+ tNBTTagCompound = new NBTTagCompound();
+ }
+ return tNBTTagCompound.getInteger("mTickTimer");
+ }
+
+ public static NBTTagCompound setCurrentIndex(ItemStack aStack, int aIndex)
+ {
+ NBTTagCompound tNBTTagCompound = aStack.getTagCompound();
+ if (tNBTTagCompound == null) {
+ tNBTTagCompound = new NBTTagCompound();
+ }
+ tNBTTagCompound.setInteger("mCurrentIndex", aIndex);
+ return tNBTTagCompound;
+ }
+
+ public static NBTTagCompound setTickTimer(ItemStack aStack, int aTime)
+ {
+ NBTTagCompound tNBTTagCompound = aStack.getTagCompound();
+ if (tNBTTagCompound == null) {
+ tNBTTagCompound = new NBTTagCompound();
+ }
+ tNBTTagCompound.setInteger("mTickTimer", aTime);
+ return tNBTTagCompound;
+ }
+
+ public static ItemStack[] getNBTInventory(ItemStack aStack)
+ {
+ ItemStack[] tInventory = new ItemStack[64];
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ return tInventory;
+ }
+ NBTTagList tNBT_ItemList = tNBT.getTagList("Inventory", 10);
+ for (int i = 0; i < tNBT_ItemList.tagCount(); i++)
+ {
+ NBTTagCompound tag = tNBT_ItemList.getCompoundTagAt(i);
+ byte slot = tag.getByte("Slot");
+ if ((slot >= 0) && (slot < tInventory.length)) {
+ tInventory[slot] = GT_Utility.loadItem(tag);
+ }
+ }
+ return tInventory;
+ }
+
+ public static NBTTagCompound setNBTInventory(ItemStack aStack, ItemStack[] aInventory)
+ {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ NBTTagList tNBT_ItemList = new NBTTagList();
+ for (int i = 0; i < aInventory.length; i++)
+ {
+ ItemStack stack = aInventory[i];
+ if (stack != null)
+ {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setByte("Slot", (byte)i);
+ stack.writeToNBT(tag);
+ tNBT_ItemList.appendTag(tag);
+ }
+ }
+ tNBT.setTag("Inventory", tNBT_ItemList);
+ aStack.setTagCompound(tNBT);
+ return tNBT;
+ }
+
+ public static void copyInventory(ItemStack[] aInventory, ItemStack[] aNewContent, int aIndexlength)
+ {
+ for (int i = 0; i < aIndexlength; i++) {
+ if (aNewContent[i] == null) {
+ aInventory[i] = null;
+ } else {
+ aInventory[i] = GT_Utility.copy(new Object[] { aNewContent[i] });
+ }
+ }
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java new file mode 100644 index 0000000000..e43e4ce3bf --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java @@ -0,0 +1,143 @@ +package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.ItemList;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockColored;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerCapabilities;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class Behaviour_Spray_Color
+ extends Behaviour_None
+{
+ private final ItemStack mEmpty;
+ private final ItemStack mUsed;
+ private final ItemStack mFull;
+ private final long mUses;
+ private final byte mColor;
+
+ public Behaviour_Spray_Color(ItemStack aEmpty, ItemStack aUsed, ItemStack aFull, long aUses, int aColor)
+ {
+ this.mEmpty = aEmpty;
+ this.mUsed = aUsed;
+ this.mFull = aFull;
+ this.mUses = aUses;
+ this.mColor = ((byte)aColor);
+ this.mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.paintspray." + this.mColor + ".tooltip", "Can Color things in " + Dyes.get(this.mColor).mName);
+ }
+
+ 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) || (aStack.stackSize != 1)) {
+ return false;
+ }
+ boolean rOutput = false;
+ if (!aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) {
+ return false;
+ }
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ long tUses = tNBT.getLong("GT.RemainingPaint");
+ if (GT_Utility.areStacksEqual(aStack, this.mFull, true))
+ {
+ aStack.func_150996_a(this.mUsed.getItem());
+ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mUsed));
+ tUses = this.mUses;
+ }
+ if ((GT_Utility.areStacksEqual(aStack, this.mUsed, true)) &&
+ (colorize(aWorld, aX, aY, aZ, aSide)))
+ {
+ GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(102)), 1.0F, 1.0F, aX, aY, aZ);
+ if (!aPlayer.capabilities.isCreativeMode) {
+ tUses -= 1L;
+ }
+ rOutput = true;
+ }
+ tNBT.removeTag("GT.RemainingPaint");
+ if (tUses > 0L) {
+ tNBT.setLong("GT.RemainingPaint", tUses);
+ }
+ if (tNBT.hasNoTags()) {
+ aStack.setTagCompound(null);
+ } else {
+ aStack.setTagCompound(tNBT);
+ }
+ if (tUses <= 0L) {
+ if (this.mEmpty == null)
+ {
+ aStack.stackSize -= 1;
+ }
+ else
+ {
+ aStack.func_150996_a(this.mEmpty.getItem());
+ Items.feather.setDamage(aStack, Items.feather.getDamage(this.mEmpty));
+ }
+ }
+ return rOutput;
+ }
+
+ private final Collection<Block> 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() });
+ private final String mTooltip;
+
+ private boolean colorize(World aWorld, int aX, int aY, int aZ, int aSide)
+ {
+ Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if ((aBlock != Blocks.air) && ((this.mAllowedVanillaBlocks.contains(aBlock)) || ((aBlock instanceof BlockColored))))
+ {
+ if (aBlock == Blocks.hardened_clay)
+ {
+ aWorld.setBlock(aX, aY, aZ, Blocks.stained_hardened_clay, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true;
+ }
+ if (aBlock == Blocks.glass_pane)
+ {
+ aWorld.setBlock(aX, aY, aZ, Blocks.stained_glass_pane, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true;
+ }
+ if (aBlock == Blocks.glass)
+ {
+ aWorld.setBlock(aX, aY, aZ, Blocks.stained_glass, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);return true;
+ }
+ if (aWorld.getBlockMetadata(aX, aY, aZ) == ((this.mColor ^ 0xFFFFFFFF) & 0xF)) {
+ return false;
+ }
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (this.mColor ^ 0xFFFFFFFF) & 0xF, 3);
+ return true;
+ }
+ return aBlock.recolourBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aSide), (this.mColor ^ 0xFFFFFFFF) & 0xF);
+ }
+
+ private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.paintspray.uses", "Remaining Uses:");
+ private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", "Not usable when stacked!");
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ aList.add(this.mTooltip);
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ long tRemainingPaint = tNBT == null ? 0L : GT_Utility.areStacksEqual(aStack, this.mFull, true) ? this.mUses : tNBT.getLong("GT.RemainingPaint");
+ aList.add(this.mTooltipUses + " " + tRemainingPaint);
+ aList.add(this.mTooltipUnstackable);
+ return aList;
+ }
+}
+
+
+/* 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java new file mode 100644 index 0000000000..2d84495038 --- /dev/null +++ b/src/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<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) + { + aList.add(this.mTooltip); + return aList; + } +} diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java new file mode 100644 index 0000000000..bb605280cf --- /dev/null +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java @@ -0,0 +1,44 @@ +package gregtech.common.items.behaviors;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Utility.ItemNBT;
+import java.util.List;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.GuiScreenBook;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Behaviour_WrittenBook
+ extends Behaviour_None
+{
+ @SideOnly(Side.CLIENT)
+ 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)
+ {
+ if ((GT_Utility.isStringValid(GT_Utility.ItemNBT.getBookTitle(aStack))) && ((aPlayer instanceof EntityPlayerSP))) {
+ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(aPlayer, aStack, false));
+ }
+ return true;
+ }
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
+ {
+ String tTitle = GT_Utility.ItemNBT.getBookTitle(aStack);
+ if (GT_Utility.isStringValid(tTitle))
+ {
+ aList.add(tTitle);
+ aList.add("by " + GT_Utility.ItemNBT.getBookAuthor(aStack));
+ }
+ return aList;
+ }
+}
+
+
+/* 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 |