diff options
Diffstat (limited to 'src/main/java/gregtech/common/items/behaviors')
| -rw-r--r-- | src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java | 160 | ||||
| -rw-r--r-- | src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java | 3 |
2 files changed, 78 insertions, 85 deletions
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java index 57571cd408..7088884e7b 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java @@ -1,83 +1,77 @@ -package gregtech.common.items.behaviors;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe.Util;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Utility;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.PlayerCapabilities;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-
-public class Behaviour_Plunger_Item
- extends Behaviour_None
-{
- private final int mCosts;
-
- public Behaviour_Plunger_Item(int aCosts)
- {
- this.mCosts = aCosts;
- }
-
- public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ)
- {
- if (aWorld.isRemote) {
- return false;
- }
- TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((aTileEntity instanceof IGregTechTileEntity))
- {
- IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity)aTileEntity).getMetaTileEntity();
- if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) {
- for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe)tMetaTileEntity, new HashMap(), 0L, false, true)).keySet())
-
- {
- int i = 0;
- for (int j = ((IMetaTileEntityItemPipe)tTileEntity).getSizeInventory(); i < j; i++) {
- if (((IMetaTileEntityItemPipe)tTileEntity).isValidSlot(i)) {
- if ((((IMetaTileEntityItemPipe)tTileEntity).getStackInSlot(i) != null) && (
- (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts))))
- {
- ItemStack tStack = ((IMetaTileEntityItemPipe)tTileEntity).decrStackSize(i, 64);
- if (tStack != null)
- {
- EntityItem tEntity = new EntityItem(aWorld, ((IGregTechTileEntity)aTileEntity).getOffsetX((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetY((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetZ((byte)aSide, 1) + 0.5D, tStack);
- tEntity.motionX = 0.0D;tEntity.motionY = 0.0D;tEntity.motionZ = 0.0D;
- aWorld.spawnEntityInWorld(tEntity);
- GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.item", "Clears Items from Pipes");
-
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack)
- {
- aList.add(this.mTooltip);
- return aList;
- }
-}
-
-
-/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar
- * Qualified Name: gregtech.common.items.behaviors.Behaviour_Plunger_Item
- * JD-Core Version: 0.7.0.1
- */
\ No newline at end of file +package gregtech.common.items.behaviors; + +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe; +import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe.Util; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class Behaviour_Plunger_Item + extends Behaviour_None +{ + private final int mCosts; + + public Behaviour_Plunger_Item(int aCosts) + { + this.mCosts = aCosts; + } + + public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) + { + if (aWorld.isRemote) { + return false; + } + TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((aTileEntity instanceof IGregTechTileEntity)) + { + IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity)aTileEntity).getMetaTileEntity(); + if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) { + for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe)tMetaTileEntity, new HashMap(), 0L, false, true)).keySet()) + + { + int i = 0; + for (int j = ((IMetaTileEntityItemPipe)tTileEntity).getSizeInventory(); i < j; i++) { + if (((IMetaTileEntityItemPipe)tTileEntity).isValidSlot(i)) { + if ((((IMetaTileEntityItemPipe)tTileEntity).getStackInSlot(i) != null) && ( + (aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)aItem).doDamage(aStack, this.mCosts)))) + { + ItemStack tStack = ((IMetaTileEntityItemPipe)tTileEntity).decrStackSize(i, 64); + if (tStack != null) + { + EntityItem tEntity = new EntityItem(aWorld, ((IGregTechTileEntity)aTileEntity).getOffsetX((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetY((byte)aSide, 1) + 0.5D, ((IGregTechTileEntity)aTileEntity).getOffsetZ((byte)aSide, 1) + 0.5D, tStack); + tEntity.motionX = 0.0D;tEntity.motionY = 0.0D;tEntity.motionZ = 0.0D; + aWorld.spawnEntityInWorld(tEntity); + GT_Utility.sendSoundToPlayers(aWorld, (String)GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + } + } + } + } + } + return false; + } + + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.plunger.item", "Clears Items from Pipes"); + + public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) + { + aList.add(this.mTooltip); + return aList; + } +}
\ No newline at end of file diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java index e43e4ce3bf..dc1c14c4c4 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 @@ -61,8 +61,7 @@ public class Behaviour_Spray_Color 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)))
+ 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) {
|
