aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/items/behaviors
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-04-27 17:06:22 +0200
committerTechnus <daniel112092@gmail.com>2017-04-27 17:06:22 +0200
commit929073a7aea2ff925aa04403be746398b1fc57e7 (patch)
tree8f162d84344aeadbef04b3e313fdd8e5438130c0 /src/main/java/gregtech/common/items/behaviors
parent2ee3b7e712413604549af3097fda93cbb22a262e (diff)
parentf5e078aa1eb2da76585d620afa91903f0dbdd031 (diff)
downloadGT5-Unofficial-929073a7aea2ff925aa04403be746398b1fc57e7.tar.gz
GT5-Unofficial-929073a7aea2ff925aa04403be746398b1fc57e7.tar.bz2
GT5-Unofficial-929073a7aea2ff925aa04403be746398b1fc57e7.zip
Merge branch 'experimental' from GTNH into mergeGTNH (based on BLOODASP)
# Conflicts: # build.properties # src/main/java/gregtech/GT_Mod.java # src/main/java/gregtech/api/enums/ItemList.java # src/main/java/gregtech/api/enums/Materials.java # src/main/java/gregtech/api/enums/Textures.java # src/main/java/gregtech/api/enums/Tier.java # src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java # src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java # src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java # src/main/java/gregtech/api/util/GT_ModHandler.java # src/main/java/gregtech/api/util/GT_Recipe.java # src/main/java/gregtech/api/util/GT_RecipeRegistrator.java # src/main/java/gregtech/api/util/GT_Utility.java # src/main/java/gregtech/common/GT_Client.java # src/main/java/gregtech/common/GT_Pollution.java # src/main/java/gregtech/common/GT_Proxy.java # src/main/java/gregtech/common/GT_RecipeAdder.java # src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java # src/main/java/gregtech/common/GT_Worldgenerator.java # src/main/java/gregtech/common/blocks/GT_Block_Casings3.java # src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java # src/main/java/gregtech/common/blocks/GT_Block_Machines.java # src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java # src/main/java/gregtech/common/blocks/GT_Item_Machines.java # src/main/java/gregtech/common/blocks/GT_Item_Ores.java # src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java # src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java # src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java # src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java # src/main/java/gregtech/common/gui/GT_Container_Regulator.java # src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java # src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java # src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java # src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java # src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java # src/main/java/gregtech/common/items/armor/ArmorData.java # src/main/java/gregtech/common/items/armor/GuiElectricArmor1.java # src/main/java/gregtech/common/items/armor/ModularArmor_Item.java # src/main/java/gregtech/common/items/armor/Values.java # src/main/java/gregtech/common/items/armor/gui/GuiModularArmor.java # src/main/java/gregtech/common/items/armor/gui/InventoryArmor.java # src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Fluid.java # src/main/java/gregtech/common/items/behaviors/Behaviour_Sense.java # src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java # src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java # src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java # src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java # src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java # src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java # src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_FluidNaquadahReactor.java # src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SolidNaquadahReactor.java # src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java # src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java # src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java # src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java # src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java # src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java # src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java # src/main/java/gregtech/common/tools/GT_Tool_Scoop.java # src/main/java/gregtech/loaders/load/GT_FuelLoader.java # src/main/java/gregtech/loaders/misc/GT_Achievements.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingBlock.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingDustSmall.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingDustTiny.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingGemExquisite.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingGemFlawless.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingNugget.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeLarge.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeMedium.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeSmall.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate1.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate2.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate3.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate4.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate5.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingStickLong.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadBuzzSaw.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadChainsaw.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadDrill.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadFile.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadHammer.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingToolHeadWrench.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire01.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire02.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire04.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire08.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire12.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingWire16.java # src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java # src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java # src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java # src/main/java/gregtech/loaders/preload/GT_Loader_ItemData.java # src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java # src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java # src/main/java/gregtech/loaders/preload/GT_Loader_OreProcessing.java # src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java # src/main/resources/assets/gregtech/textures/items/gt.Double_Naquadahcell.png # src/main/resources/assets/gregtech/textures/items/gt.Double_NaquadahcellDep.png # src/main/resources/assets/gregtech/textures/items/gt.Naquadahcell.png # src/main/resources/assets/gregtech/textures/items/gt.NaquadahcellDep.png # src/main/resources/assets/gregtech/textures/items/gt.Quad_Naquadahcell.png # src/main/resources/assets/gregtech/textures/items/gt.Quad_NaquadahcellDep.png
Diffstat (limited to 'src/main/java/gregtech/common/items/behaviors')
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java224
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java118
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java110
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java206
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java68
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java120
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java240
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_None.java144
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java92
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java74
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java254
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java103
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java90
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java96
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java96
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java208
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java246
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java242
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java68
19 files changed, 1411 insertions, 1388 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
index acb6986ec6..1ebd3c0d16 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow.java
@@ -1,112 +1,112 @@
-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.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.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;
- }
-}
+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.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.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/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java
index 80a646bde4..000937b4de 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Arrow_Potion.java
@@ -1,59 +1,59 @@
-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 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;
- }
-}
+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 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/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java
index 8524f7ca17..1fe66cb723 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Crowbar.java
@@ -1,55 +1,55 @@
-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 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;
- }
-}
+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 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/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
index a339c5f35b..0943a9b9e2 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java
@@ -1,103 +1,103 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-
-import java.util.List;
-
-public class Behaviour_DataOrb
- extends Behaviour_None {
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- if (!(getDataTitle(aStack).length() == 0)) {
- aList.add(getDataTitle(aStack));
- aList.add(getDataName(aStack));
- }
- return aList;
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+import java.util.List;
+
+public class Behaviour_DataOrb
+ extends Behaviour_None {
+ 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;
+ }
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
+ if (!(getDataTitle(aStack).length() == 0)) {
+ aList.add(getDataTitle(aStack));
+ aList.add(getDataName(aStack));
+ }
+ return aList;
+ }
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java
index 38a9f6facd..809d7f806c 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java
@@ -1,34 +1,34 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-
-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;int j = tString.length();
- for (; i < j; i += 64) {
- aList.add(tString.substring(i, Math.min(i + 64, j)));
- }
- }
- return aList;
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+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;int j = tString.length();
+ for (; i < j; i += 64) {
+ aList.add(tString.substring(i, Math.min(i + 64, j)));
+ }
+ }
+ return aList;
+ }
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java
index 2f9d31c3f5..a03332057d 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java
@@ -1,60 +1,60 @@
-package gregtech.common.items.behaviors;
-
-import cpw.mods.fml.common.eventhandler.Event;
-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 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;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.entity.player.UseHoeEvent;
-
-import java.util.List;
-
-public class Behaviour_Hoe
- extends Behaviour_None {
- private final int mCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.hoe", "Can till Dirt");
-
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+package gregtech.common.items.behaviors;
+
+import cpw.mods.fml.common.eventhandler.Event;
+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 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;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.UseHoeEvent;
+
+import java.util.List;
+
+public class Behaviour_Hoe
+ extends Behaviour_None {
+ private final int mCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.hoe", "Can till Dirt");
+
+ 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;
+ }
+
+ 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_Lighter.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java
index a3d192ddd2..e0559ae324 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Lighter.java
@@ -1,120 +1,120 @@
-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 net.minecraft.entity.Entity;
-import net.minecraft.entity.monster.EntityCreeper;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import java.util.List;
-
-public class Behaviour_Lighter
- extends Behaviour_None {
- private final ItemStack mEmptyLighter;
- private final ItemStack mUsedLighter;
- private final ItemStack mFullLighter;
- private final long mFuelAmount;
- 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 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));
- }
- }
-
- 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;
- }
-}
+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 net.minecraft.entity.Entity;
+import net.minecraft.entity.monster.EntityCreeper;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.List;
+
+public class Behaviour_Lighter
+ extends Behaviour_None {
+ private final ItemStack mEmptyLighter;
+ private final ItemStack mUsedLighter;
+ private final ItemStack mFullLighter;
+ private final long mFuelAmount;
+ 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 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));
+ }
+ }
+
+ 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/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java
index 66ed8bb672..6e046217b0 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java
@@ -1,72 +1,72 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.enums.SubTag;
-import gregtech.api.interfaces.IItemBehaviour;
-import gregtech.api.items.GT_MetaBase_Item;
-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;
-
-import java.util.List;
-
-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;
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.SubTag;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.items.GT_MetaBase_Item;
+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;
+
+import java.util.List;
+
+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/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java
index f546a82379..ef364b4cdc 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Essentia.java
@@ -1,46 +1,46 @@
-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 net.minecraft.entity.player.EntityPlayer;
-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;
-
-import java.util.List;
-
-public class Behaviour_Plunger_Essentia
- extends Behaviour_None {
- private final int mCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.essentia", "Clears Essentia from Containers and Tubes");
-
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+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 net.minecraft.entity.player.EntityPlayer;
+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;
+
+import java.util.List;
+
+public class Behaviour_Plunger_Essentia
+ extends Behaviour_None {
+ private final int mCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.essentia", "Clears Essentia from Containers and Tubes");
+
+ 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;
+ }
+
+ 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_PrintedPages.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java
index e6f6fec484..287ebedd33 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_PrintedPages.java
@@ -1,37 +1,37 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.List;
-
-public class Behaviour_PrintedPages
- extends Behaviour_None {
- 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");
- }
-
- 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;
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.List;
+
+public class Behaviour_PrintedPages
+ extends Behaviour_None {
+ 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");
+ }
+
+ 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;
+ }
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java
index c950cc8fe1..4dcdf2696b 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java
@@ -1,127 +1,127 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.objects.ItemData;
-import gregtech.api.objects.XSTR;
-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_Abstract;
-import gregtech.common.blocks.GT_TileEntity_Ores;
-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;
-
-import java.util.List;
-import java.util.Random;
-
-public class Behaviour_Prospecting
- extends Behaviour_None {
- private final int mVanillaCosts;
- private final int mEUCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting");
-
- 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 XSTR(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_Abstract)) {
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ItemData;
+import gregtech.api.objects.XSTR;
+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_Abstract;
+import gregtech.common.blocks.GT_TileEntity_Ores;
+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;
+
+import java.util.List;
+import java.util.Random;
+
+public class Behaviour_Prospecting
+ extends Behaviour_None {
+ private final int mVanillaCosts;
+ private final int mEUCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting");
+
+ 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 XSTR(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_Abstract)) {
+ 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;
+ }
+
+ 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_Scanner.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java
index 187027a563..02dafe640e 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java
@@ -1,40 +1,63 @@
-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 net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Behaviour_Scanner
- extends Behaviour_None {
- public static final IItemBehaviour<GT_MetaBase_Item> INSTANCE = new Behaviour_Scanner();
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scanning", "Can scan Blocks in World");
-
- 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)) {
- int tList_sS=tList.size();
- for (int i = 0; i < tList_sS; 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+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 net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Behaviour_Scanner
+ extends Behaviour_None {
+ public static final IItemBehaviour<GT_MetaBase_Item> INSTANCE = new Behaviour_Scanner();
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scanning", "Can scan Blocks in World");
+
+ 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) {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ 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)) {
+ int tList_sS=tList.size();
+ tNBT.setInteger("dataLinesCount",tList_sS);
+ for (int i = 0; i < tList_sS; i++) {
+ tNBT.setString("dataLines"+Integer.toString(i),(String) tList.get(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);
+ //doGuiAtClient()
+ return aPlayer instanceof EntityPlayerMP;
+ }
+
+ public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
+ try {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ int lines = tNBT.getInteger("dataLinesCount");
+ if(lines<1) throw new Exception();
+ aList.add(EnumChatFormatting.BLUE+"Block scan data result:");
+ for (int i = 0; i < lines; i++) {
+ aList.add(EnumChatFormatting.RESET+tNBT.getString("dataLines" + Integer.toString(i)));
+ }
+ }catch(Exception e){
+ aList.add(this.mTooltip);
+ }
+ return aList;
+ }
+
+ //public static boolean doGuiAtClient() {
+ // if (!FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null || !GT.getThePlayer().worldObj.isRemote)
+ // return false;
+ // //GUI render start HERE
+ // return true;
+ //}
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java
index 926703cbc9..8d36168374 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scoop.java
@@ -1,45 +1,45 @@
-package gregtech.common.items.behaviors;
-
-import forestry.api.lepidopterology.EnumFlutterType;
-import forestry.api.lepidopterology.IButterfly;
-import forestry.api.lepidopterology.IEntityButterfly;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.GT_LanguageManager;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-
-public class Behaviour_Scoop
- extends Behaviour_None {
- private final int mCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scoop", "Catches Butterflies on Leftclick");
-
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+package gregtech.common.items.behaviors;
+
+import forestry.api.lepidopterology.EnumFlutterType;
+import forestry.api.lepidopterology.IButterfly;
+import forestry.api.lepidopterology.IEntityButterfly;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+public class Behaviour_Scoop
+ extends Behaviour_None {
+ private final int mCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.scoop", "Catches Butterflies on Leftclick");
+
+ 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;
+ }
+
+ 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_Screwdriver.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java
index 59bf68aa77..ea548f2106 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Screwdriver.java
@@ -1,48 +1,48 @@
-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 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;
- }
-}
+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 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;
+ }
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java
index 525d023a35..bcbe985cdb 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SensorKit.java
@@ -1,48 +1,48 @@
-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 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;
-
-import java.util.List;
-
-public class Behaviour_SensorKit
- extends Behaviour_None {
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sensorkit.tooltip", "Used to display Information using the Mod Nuclear Control");
-
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+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 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;
+
+import java.util.List;
+
+public class Behaviour_SensorKit
+ extends Behaviour_None {
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.sensorkit.tooltip", "Used to display Information using the Mod Nuclear Control");
+
+ 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;
+ }
+
+ 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_SoftHammer.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java
index 87b3f3c24c..058cf98b52 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_SoftHammer.java
@@ -1,104 +1,104 @@
-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 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;
-
-import java.util.List;
-
-public class Behaviour_SoftHammer
- extends Behaviour_None {
- private final int mCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.softhammer", "Activates and Deactivates Machines");
-
- 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;
- }
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
- aList.add(this.mTooltip);
- return aList;
- }
-}
+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 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;
+
+import java.util.List;
+
+public class Behaviour_SoftHammer
+ extends Behaviour_None {
+ private final int mCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.softhammer", "Activates and Deactivates Machines");
+
+ 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;
+ }
+
+ 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_Sonictron.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
index f256f036ca..aa4c954ba1 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Sonictron.java
@@ -1,123 +1,123 @@
-package gregtech.common.items.behaviors;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.interfaces.IItemBehaviour;
-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 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]});
- }
- }
- }
-
- 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) {
- 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);
- }
-}
+package gregtech.common.items.behaviors;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.IItemBehaviour;
+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 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]});
+ }
+ }
+ }
+
+ 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) {
+ 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);
+ }
+}
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
index 46487156a0..748a660c15 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java
@@ -1,121 +1,121 @@
-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 net.minecraft.block.Block;
-import net.minecraft.block.BlockColored;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-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;
- 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 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 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 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);
- }
-
- 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;
- }
-}
+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 net.minecraft.block.Block;
+import net.minecraft.block.BlockColored;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+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;
+ 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 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 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 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);
+ }
+
+ 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;
+ }
+}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java
index 89e47d51df..3d1ee73d43 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_WrittenBook.java
@@ -1,34 +1,34 @@
-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 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;
-
-import java.util.List;
-
-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;
- }
-}
+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 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;
+
+import java.util.List;
+
+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;
+ }
+}