diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-21 19:12:11 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-21 19:12:11 +1000 |
commit | ae6844407be97824e2db9355fdcf04608592a7a9 (patch) | |
tree | 44866054203c96608cbe8fa3e3c5bd5b6a94d3b7 /src/Java/gtPlusPlus/xmod/gregtech/common/items | |
parent | 06f58135c44414dafdf3c677d2cd69f91b8dd7db (diff) | |
download | GT5-Unofficial-ae6844407be97824e2db9355fdcf04608592a7a9.tar.gz GT5-Unofficial-ae6844407be97824e2db9355fdcf04608592a7a9.tar.bz2 GT5-Unofficial-ae6844407be97824e2db9355fdcf04608592a7a9.zip |
+ Gave Tokens icons.
$ Fixed some invalid recipe logging for recipes that contained nulls.
$ Fixed Custom ores not having a default texture.
% Moved Pump Logging, it was moved to WARNING from INFO.
- Removed most of old Pump tool code.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/items')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java | 88 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Pump.java | 157 |
2 files changed, 1 insertions, 244 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 47c1f35f93..d228fdc04a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -16,7 +16,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher; -import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Pump; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -25,13 +24,11 @@ import net.minecraftforge.fluids.FluidStack; public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { public static final short SKOOKUM_CHOOCHER = 7734; - public static final short HAND_PUMP = 7736; public static GT_MetaGenerated_Tool INSTANCE; public MetaGeneratedGregtechTools() { super("plusplus.metatool.01"); INSTANCE = this; - //Skookum Choocher GregTech_API.registerTool( this.addTool( @@ -45,89 +42,6 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), GregTech_API.sWrenchList); - - //Pump - this.addTool( - HAND_PUMP, - "Electric Pump", - "Holds Fluids from GT Machines.", - new TOOL_Gregtech_Pump(), - new Object[]{GregtechToolDictNames.craftingToolHandPump, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}); - this.setFluidContainerStats(HAND_PUMP, 16000L, 16L); - } - - - - public final ConcurrentHashMap<Short, Long[]> mFluidContainerStats = new ConcurrentHashMap<Short, Long[]>(); - - public final MetaGeneratedGregtechTools setFluidContainerStats(int aMetaValue, long aCapacity, long aStacksize) { - if (aMetaValue >= 0) { - if (aCapacity > 0L) { - this.mFluidContainerStats.put(Short.valueOf((short) aMetaValue), - new Long[]{Long.valueOf(aCapacity), Long.valueOf(Math.max(1L, aStacksize))}); - } - return this; - } else { - return this; - } - } - - @Override - public final Long[] getFluidContainerStats(ItemStack aStack) { - return (Long[]) this.mFluidContainerStats.get(Short.valueOf((short) aStack.getItemDamage())); - } - - - @SuppressWarnings("unchecked") - private ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> getItemBehaviours() { - try { - ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>> aItemBehaviors; - aItemBehaviors = (ConcurrentHashMap<Short, ArrayList<IItemBehaviour<GT_MetaBase_Item>>>) ReflectionUtils.getField(getClass(), "mItemBehaviors").get(this); - return aItemBehaviors != null ? aItemBehaviors : null; - } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { - return null; - } - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - Logger.INFO("Item Right Click"); - this.use(aStack, 0.0D, aPlayer); - this.isItemStackUsable(aStack); - ArrayList<IItemBehaviour<GT_MetaBase_Item>> tList = (ArrayList<IItemBehaviour<GT_MetaBase_Item>>) this.getItemBehaviours().get(Short.valueOf((short) this.getDamage(aStack))); - try { - IItemBehaviour<GT_MetaBase_Item> tBehavior; - if (tList != null) { - for (IItemBehaviour<GT_MetaBase_Item> g : tList) { - if (g != null) { - if (g instanceof TOOL_Gregtech_Pump) { - TOOL_Gregtech_Pump t = (TOOL_Gregtech_Pump) g; - if (t != null) { - Logger.INFO("Right clicked with Pump tool."); - aStack = g.onItemRightClick(this, aStack, aWorld, aPlayer); - FluidStack f = t.getBehaviour().getStoredFluid(); - if (f != null) { - Logger.INFO("Found Fluid '"+f.getLocalizedName()+"', trying to set fluid contents of tool."); - this.setFluidContent(aStack, f); - } - } - } - else { - aStack = g.onItemRightClick(this, aStack, aWorld, aPlayer); - } - } - } - } - } catch (Throwable arg6) { - if (GT_Values.D1) { - arg6.printStackTrace(GT_Log.err); - } - } - return aStack; - } - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Pump.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Pump.java deleted file mode 100644 index 1c48c7401f..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Pump.java +++ /dev/null @@ -1,157 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.items.behaviours; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.items.behaviors.Behaviour_None; -import gtPlusPlus.api.objects.Logger; - -public class Behaviour_Pump -extends Behaviour_None { - - private final int mCosts; - private FluidStack mStoredFluid; - private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick"); - - public Behaviour_Pump(final int aCosts) { - this.mCosts = aCosts; - } - - @Override - public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { - if (aWorld.isRemote) { - return false; - } - else { - final Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - //final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null) { - return false; - } - if ((tTileEntity instanceof IGregTechTileEntity)) { - Logger.INFO("Right Clicking on GT Tile - Behaviour Class."); - if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { - Logger.INFO("Returning False - Behaviour Class. Timer < 50"); - return false; - } - else if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) { - Logger.INFO("Returning True - Behaviour Class. NotUsable()"); - return true; - } - else { - Logger.INFO("Trying to find Stored Fluid - Behaviour Class."); - FluidStack aStored = getStoredFluidOfGTMachine((IGregTechTileEntity)tTileEntity); - if (aStored != null) { - this.mStoredFluid = aStored; - boolean b = setStoredFluidOfGTMachine((IGregTechTileEntity)tTileEntity); - Logger.INFO("Cleared Tank? "+b); - Logger.INFO("Returning True - Behaviour Class."); - return true; - } - else { - Logger.INFO("Found no valid Fluidstack - Behaviour Class."); - } - } - - } - } - Logger.INFO("Returning False - Behaviour Class."); - return false; - } - - public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { - aList.add(this.mTooltip); - aList.add("Stored Fluid: "+(mStoredFluid != null ? mStoredFluid.getLocalizedName()+" - "+mStoredFluid.amount+"L" : "None")); - return aList; - } - - @Override - public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - // TODO Auto-generated method stub - return super.onItemRightClick(aItem, aStack, aWorld, aPlayer); - } - - @Override - public void onUpdate(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, - boolean aIsInHand) { - // TODO Auto-generated method stub - super.onUpdate(aItem, aStack, aWorld, aPlayer, aTimer, aIsInHand); - } - - public FluidStack getStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) { - return null; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();; - if (aMetaTileEntity == null) { - return null; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) { - Logger.INFO("Tile Was Instanceof BasicTank."); - return getStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity); - } - else { - return null; - } - } - - public FluidStack getStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity) { - FluidStack f = aTileEntity.mFluid; - Logger.INFO("Returning Fluid stack from tile. Found: "+(f != null ? f.getLocalizedName()+" - "+f.amount+"L" : "Nothing")); - return f.copy(); - } - - public boolean setStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity) { - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]"); - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();; - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) { - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [2]"); - return setStoredFluidOfGTMachine((IGregTechTileEntity) aMetaTileEntity); - } - else { - return false; - } - } - - public boolean setStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity) { - try { - aTileEntity.mFluid = null; - boolean b = aTileEntity.mFluid == null; - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [3] "+b); - return aTileEntity.mFluid == null; - } - catch (Throwable t) { - Logger.INFO("Trying to clear Tile's tank. FAILED - Behaviour Class. [x]"); - return false; - } - } - - public synchronized final FluidStack getStoredFluid() { - return mStoredFluid; - } - - public synchronized final void setStoredFluid(FluidStack mStoredFluid) { - this.mStoredFluid = mStoredFluid; - } -} |