diff options
| author | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-18 23:04:39 -0400 |
|---|---|---|
| committer | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-18 23:04:39 -0400 |
| commit | 85c804fa112fd1f19c91e45d150a787cfbf0f7a8 (patch) | |
| tree | cb302d8e0f46e06be0b1d391317578b165aec245 /main/java/gregtech/common/items/behaviors | |
| parent | ce25063b910bb3bdd2b0c234b185fc4077caebdb (diff) | |
| download | GT5-Unofficial-85c804fa112fd1f19c91e45d150a787cfbf0f7a8.tar.gz GT5-Unofficial-85c804fa112fd1f19c91e45d150a787cfbf0f7a8.tar.bz2 GT5-Unofficial-85c804fa112fd1f19c91e45d150a787cfbf0f7a8.zip | |
Move source directory
Diffstat (limited to 'main/java/gregtech/common/items/behaviors')
23 files changed, 0 insertions, 1951 deletions
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java deleted file mode 100644 index d0be735248..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java +++ /dev/null @@ -1,129 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java b/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java deleted file mode 100644 index 98c099e4ed..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java +++ /dev/null @@ -1,66 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java b/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java deleted file mode 100644 index 827239a64e..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java +++ /dev/null @@ -1,63 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java deleted file mode 100644 index b09b23cc2f..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java +++ /dev/null @@ -1,115 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java deleted file mode 100644 index 8d0809f279..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java +++ /dev/null @@ -1,37 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java deleted file mode 100644 index fc995e3a13..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java +++ /dev/null @@ -1,68 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java b/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java deleted file mode 100644 index ef287d1204..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java +++ /dev/null @@ -1,137 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/main/java/gregtech/common/items/behaviors/Behaviour_None.java deleted file mode 100644 index 43f84393fc..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_None.java +++ /dev/null @@ -1,82 +0,0 @@ -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;
- }
-}
diff --git a/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java b/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java deleted file mode 100644 index 9d3d8e4d4b..0000000000 --- a/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java +++ /dev/null @@ -1,53 +0,0 @@ -package gregtech.common.items.behaviors;
-
-import greg |
