From b7ce9db75baaf5a60b659fb565d4f9505f77e509 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Sat, 15 Feb 2020 20:39:11 +0100 Subject: removed unused imports changed subversion to 33 --- src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main/java/gregtech/api/interfaces/tileentity') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 8c9bac5c01..73436e3b2a 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,7 +3,6 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; -- cgit From 5c8be4893ee303377629ae7404e5608eb4bd7c37 Mon Sep 17 00:00:00 2001 From: "karpov.evgeniy" Date: Tue, 25 Feb 2020 11:58:19 +0500 Subject: Provide owner's UUID to forge event bus for fake players. Second PR cuz line endings fixed. --- .../interfaces/tileentity/IGregTechTileEntity.java | 11 +++++++ .../api/metatileentity/BaseMetaPipeEntity.java | 11 +++++++ .../api/metatileentity/BaseMetaTileEntity.java | 35 +++++++++++++++++----- src/main/java/gregtech/api/util/GT_Utility.java | 5 ++-- .../gregtech/common/blocks/GT_Item_Machines.java | 1 + 5 files changed, 54 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech/api/interfaces/tileentity') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index 953e3e5dc4..8bd8c5b678 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -12,6 +12,7 @@ import net.minecraftforge.fluids.IFluidHandler; import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * A simple compound Interface for all my TileEntities. @@ -92,6 +93,16 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil */ public String getOwnerName(); + /** + * Gets the UniqueID of the Machines Owner. + */ + public UUID getOwnerUuid(); + + /** + * Sets the UniqueID of the Machines Owner. + */ + public void setOwnerUuid(UUID uuid); + /** * Sets initial Values from NBT * diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 6d9ce47ef2..257cc79adb 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -6,6 +6,7 @@ import static gregtech.api.enums.GT_Values.NW; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -1175,6 +1176,16 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE return "Player"; } + @Override + public UUID getOwnerUuid() { + return GT_Utility.defaultUuid; + } + + @Override + public void setOwnerUuid(UUID uuid) { + + } + @Override public byte getComparatorValue(byte aSide) { return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1da2dffca9..58a97f644a 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -39,6 +39,7 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.NW; @@ -69,6 +70,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public long mLastSoundTick = 0; private long mLastCheckTick = 0; private String mOwnerName = ""; + private UUID mOwnerUuid = GT_Utility.defaultUuid; private NBTTagCompound mRecipeStuff = new NBTTagCompound(); private static final Field ENTITY_ITEM_HEALTH_FIELD; @@ -116,6 +118,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE aNBT.setByte("mStrongRedstone", mStrongRedstone); aNBT.setShort("mFacing", mFacing); aNBT.setString("mOwnerName", mOwnerName); + aNBT.setString("mOwnerUuid", mOwnerUuid == null ? "" : mOwnerUuid.toString()); aNBT.setBoolean("mLockUpgrade", mLockUpgrade); aNBT.setBoolean("mMuffler", mMuffler); aNBT.setBoolean("mSteamConverter", mSteamConverter); @@ -181,6 +184,11 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mStrongRedstone = aNBT.getByte("mStrongRedstone"); mFacing = oFacing = (byte) aNBT.getShort("mFacing"); mOwnerName = aNBT.getString("mOwnerName"); + try { + mOwnerUuid = UUID.fromString(aNBT.getString("mOwnerUuid")); + } catch (IllegalArgumentException e){ + mOwnerUuid = null; + } mLockUpgrade = aNBT.getBoolean("mLockUpgrade"); mMuffler = aNBT.getBoolean("mMuffler"); mSteamConverter = aNBT.getBoolean("mSteamConverter"); @@ -541,7 +549,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor), + oColor = mColor), xCoord, zCoord); mSendClientData = false; } @@ -1191,8 +1199,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) { if (!canAccessData()) return false; if (aCheckPrecicely || privateAccess() || (mOwnerName.length() == 0)) - if ((mOwnerName.length() == 0) && isServerSide()) setOwnerName(aPlayer.getDisplayName()); - else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) + if ((mOwnerName.length() == 0) && isServerSide()) { + setOwnerName(aPlayer.getDisplayName()); + setOwnerUuid(aPlayer.getUniqueID()); + } else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) return false; return true; } @@ -1244,7 +1254,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mMetaTileEntity.doExplosion(aAmount); } } - + public void dropItems(ItemStack tItem){ if(tItem==null)return; EntityItem tItemEntity = new EntityItem(this.worldObj, this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); @@ -1261,7 +1271,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999); } catch (Exception ignored) {} this.worldObj.spawnEntityInWorld(tItemEntity); - tItem.stackSize = 0; + tItem.stackSize = 0; } @Override @@ -1365,7 +1375,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE doEnetUpdate(); return true; } - + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { @@ -1421,6 +1431,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (isUpgradable() && !mLockUpgrade) { mLockUpgrade = true; setOwnerName(aPlayer.getDisplayName()); + setOwnerUuid(aPlayer.getUniqueID()); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } @@ -1527,7 +1538,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public byte getOutputRedstoneSignal(byte aSide) { return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : getGeneralRS(aSide); } - + public byte getGeneralRS(byte aSide){ if(mMetaTileEntity==null)return 0; return mMetaTileEntity.allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0; @@ -1726,6 +1737,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return mOwnerName = aName; } + @Override + public UUID getOwnerUuid() { + return mOwnerUuid; + } + + @Override + public void setOwnerUuid(UUID uuid) { + mOwnerUuid = uuid; + } + @Override public byte getComparatorValue(byte aSide) { return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index fa7bd78c4d..9e0589c2cb 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -95,6 +95,7 @@ public class GT_Utility { public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; public static Map sPlayedSoundMap = new /*Concurrent*/HashMap(); private static int sBookCount = 0; + public static UUID defaultUuid = null; // maybe default non-null? UUID.fromString("00000000-0000-0000-0000-000000000000"); static { GregTech_API.sItemStackMappings.add(sFilledContainerToData); @@ -1974,7 +1975,7 @@ public class GT_Utility { public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.getWorld() instanceof WorldServer) { - return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(null, aBaseMetaTileEntity.getOwnerName())); + return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(aBaseMetaTileEntity.getOwnerUuid(), aBaseMetaTileEntity.getOwnerName())); } return null; } @@ -2189,7 +2190,7 @@ public class GT_Utility { + "Oils: " + (tOils != null ? tOils.length : 0) + "\n\n" + "Ores within " + tRadius + " blocks\n\n" + "Location is center of orevein\n\n" - + "Check NEI to confirm orevein type"; + + "Check NEI to confirm orevein type"; tNBTList.appendTag(new NBTTagString(tPageText)); if (tOres != null) diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 1fa33e2a1d..773268d424 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -156,6 +156,7 @@ public class GT_Item_Machines tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage); if (aPlayer != null) { tTileEntity.setOwnerName(aPlayer.getDisplayName()); + tTileEntity.setOwnerUuid(aPlayer.getUniqueID()); } tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound()); final byte aSide = GT_Utility.getOppositeSide(side); -- cgit From 1922f34f1f8782f160e4808f4f6bb75a50703871 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 17 Mar 2020 19:12:19 +0100 Subject: Refactored Interfaces Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../gregtech/api/interfaces/IBlockOnWalkOver.java | 2 +- .../api/interfaces/IColorModulationContainer.java | 2 +- .../java/gregtech/api/interfaces/ICondition.java | 16 +- .../gregtech/api/interfaces/IDamagableItem.java | 2 +- .../gregtech/api/interfaces/IDebugableBlock.java | 2 +- .../java/gregtech/api/interfaces/IDescribable.java | 2 +- .../java/gregtech/api/interfaces/IFoodStat.java | 12 +- .../gregtech/api/interfaces/IIconContainer.java | 6 +- .../gregtech/api/interfaces/IItemBehaviour.java | 24 +- .../gregtech/api/interfaces/IItemContainer.java | 32 +- .../api/interfaces/IOreRecipeRegistrator.java | 2 +- .../gregtech/api/interfaces/IProjectileItem.java | 6 +- .../api/interfaces/IRedstoneCircuitBlock.java | 24 +- .../gregtech/api/interfaces/ISubTagContainer.java | 6 +- .../java/gregtech/api/interfaces/ITexture.java | 14 +- .../java/gregtech/api/interfaces/IToolStats.java | 71 ++--- .../interfaces/internal/IGT_CraftingRecipe.java | 2 +- .../gregtech/api/interfaces/internal/IGT_Mod.java | 12 +- .../api/interfaces/internal/IGT_RecipeAdder.java | 344 +++++++++++---------- .../api/interfaces/internal/IThaumcraftCompat.java | 56 +++- .../interfaces/metatileentity/IConnectable.java | 21 +- .../interfaces/metatileentity/IMetaTileEntity.java | 6 +- .../metatileentity/IMetaTileEntityCable.java | 4 +- .../metatileentity/IMetaTileEntityItemPipe.java | 15 +- .../tileentity/IBasicEnergyContainer.java | 34 +- .../interfaces/tileentity/IColoredTileEntity.java | 4 +- .../api/interfaces/tileentity/ICoverable.java | 26 +- .../api/interfaces/tileentity/IDigitalChest.java | 8 +- .../interfaces/tileentity/IEnergyConductor.java | 12 +- .../interfaces/tileentity/IEnergyConnected.java | 58 ++-- .../tileentity/IExperimentalEnergyTileEntity.java | 8 +- .../api/interfaces/tileentity/IFibreConnected.java | 10 +- .../tileentity/IGearEnergyTileEntity.java | 4 +- .../tileentity/IGregTechDeviceInformation.java | 4 +- .../interfaces/tileentity/IGregTechTileEntity.java | 48 +-- .../api/interfaces/tileentity/IHasInventory.java | 8 +- .../tileentity/IHasWorldObjectAndCoords.java | 122 ++++---- .../tileentity/IMachineBlockUpdateable.java | 2 +- .../interfaces/tileentity/IMachineProgress.java | 24 +- .../tileentity/IPipeRenderedTileEntity.java | 6 +- .../interfaces/tileentity/IRedstoneReceiver.java | 8 +- .../interfaces/tileentity/IRedstoneTileEntity.java | 2 +- .../interfaces/tileentity/ITexturedTileEntity.java | 2 +- 43 files changed, 555 insertions(+), 518 deletions(-) (limited to 'src/main/java/gregtech/api/interfaces/tileentity') diff --git a/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java index a2e7858fbd..8957f3bbbc 100644 --- a/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java +++ b/src/main/java/gregtech/api/interfaces/IBlockOnWalkOver.java @@ -4,5 +4,5 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; public interface IBlockOnWalkOver { - public void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ); + void onWalkOver(EntityLivingBase aEntity, World aWorld, int aX, int aY, int aZ); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java index ad3aa3c908..d3c312e610 100644 --- a/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java +++ b/src/main/java/gregtech/api/interfaces/IColorModulationContainer.java @@ -1,5 +1,5 @@ package gregtech.api.interfaces; public interface IColorModulationContainer { - public short[] getRGBA(); + short[] getRGBA(); } diff --git a/src/main/java/gregtech/api/interfaces/ICondition.java b/src/main/java/gregtech/api/interfaces/ICondition.java index 9e31da7338..3fb47251c7 100644 --- a/src/main/java/gregtech/api/interfaces/ICondition.java +++ b/src/main/java/gregtech/api/interfaces/ICondition.java @@ -1,11 +1,11 @@ package gregtech.api.interfaces; public interface ICondition { - public boolean isTrue(O aObject); + boolean isTrue(O aObject); // Utility Classes for adding relations between Conditions. - public static class Not implements ICondition { + class Not implements ICondition { private final ICondition mCondition; public Not(ICondition aCondition) { @@ -18,7 +18,7 @@ public interface ICondition { } } - public static class Or implements ICondition { + class Or implements ICondition { private final ICondition[] mConditions; public Or(ICondition... aConditions) { @@ -32,7 +32,7 @@ public interface ICondition { } } - public static class Nor implements ICondition { + class Nor implements ICondition { private final ICondition[] mConditions; public Nor(ICondition... aConditions) { @@ -46,7 +46,7 @@ public interface ICondition { } } - public static class And implements ICondition { + class And implements ICondition { private final ICondition[] mConditions; public And(ICondition... aConditions) { @@ -60,7 +60,7 @@ public interface ICondition { } } - public static class Nand implements ICondition { + class Nand implements ICondition { private final ICondition[] mConditions; public Nand(ICondition... aConditions) { @@ -74,7 +74,7 @@ public interface ICondition { } } - public static class Xor implements ICondition { + class Xor implements ICondition { private final ICondition mCondition1, mCondition2; public Xor(ICondition aCondition1, ICondition aCondition2) { @@ -88,7 +88,7 @@ public interface ICondition { } } - public static class Equal implements ICondition { + class Equal implements ICondition { private final ICondition mCondition1, mCondition2; public Equal(ICondition aCondition1, ICondition aCondition2) { diff --git a/src/main/java/gregtech/api/interfaces/IDamagableItem.java b/src/main/java/gregtech/api/interfaces/IDamagableItem.java index b7ebd6690d..37bb9a2794 100644 --- a/src/main/java/gregtech/api/interfaces/IDamagableItem.java +++ b/src/main/java/gregtech/api/interfaces/IDamagableItem.java @@ -3,5 +3,5 @@ package gregtech.api.interfaces; import net.minecraft.item.ItemStack; public interface IDamagableItem { - public boolean doDamageToItem(ItemStack aStack, int aVanillaDamage); + boolean doDamageToItem(ItemStack aStack, int aVanillaDamage); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java index bdb550ff53..dd72b4d71e 100644 --- a/src/main/java/gregtech/api/interfaces/IDebugableBlock.java +++ b/src/main/java/gregtech/api/interfaces/IDebugableBlock.java @@ -23,5 +23,5 @@ public interface IDebugableBlock { * 3 = Debug ONLY * @return a String-Array containing the DebugInfo, every Index is a separate line (0 = first Line) */ - public ArrayList getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel); + ArrayList getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IDescribable.java b/src/main/java/gregtech/api/interfaces/IDescribable.java index d4bcf58de8..3e72f587db 100644 --- a/src/main/java/gregtech/api/interfaces/IDescribable.java +++ b/src/main/java/gregtech/api/interfaces/IDescribable.java @@ -7,5 +7,5 @@ public interface IDescribable { /** * The Tooltip Text */ - public String[] getDescription(); + String[] getDescription(); } diff --git a/src/main/java/gregtech/api/interfaces/IFoodStat.java b/src/main/java/gregtech/api/interfaces/IFoodStat.java index b6773e9d65..eec89795fd 100644 --- a/src/main/java/gregtech/api/interfaces/IFoodStat.java +++ b/src/main/java/gregtech/api/interfaces/IFoodStat.java @@ -9,27 +9,27 @@ public interface IFoodStat { /** * Warning the "aPlayer" Parameter may be null! */ - public int getFoodLevel(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + int getFoodLevel(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - public float getSaturation(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + float getSaturation(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - public boolean alwaysEdible(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + boolean alwaysEdible(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - public boolean isRotten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + boolean isRotten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); /** * Warning the "aPlayer" Parameter may be null! */ - public EnumAction getFoodAction(GT_MetaBase_Item aItem, ItemStack aStack); + EnumAction getFoodAction(GT_MetaBase_Item aItem, ItemStack aStack); - public void onEaten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); + void onEaten(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IIconContainer.java b/src/main/java/gregtech/api/interfaces/IIconContainer.java index c8b995e9a7..0b185b387a 100644 --- a/src/main/java/gregtech/api/interfaces/IIconContainer.java +++ b/src/main/java/gregtech/api/interfaces/IIconContainer.java @@ -7,15 +7,15 @@ public interface IIconContainer { /** * @return A regular Icon. */ - public IIcon getIcon(); + IIcon getIcon(); /** * @return Icon of the Overlay (or null if there is no Icon) */ - public IIcon getOverlayIcon(); + IIcon getOverlayIcon(); /** * @return the Default Texture File for this Icon. */ - public ResourceLocation getTextureFile(); + ResourceLocation getTextureFile(); } diff --git a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java index 1d75f41e17..32d0c0948a 100644 --- a/src/main/java/gregtech/api/interfaces/IItemBehaviour.java +++ b/src/main/java/gregtech/api/interfaces/IItemBehaviour.java @@ -14,27 +14,27 @@ import net.minecraft.world.World; import java.util.List; public interface IItemBehaviour { - public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); + boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); + ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); - public List getAdditionalToolTips(E aItem, List aList, ItemStack aStack); + List getAdditionalToolTips(E aItem, List aList, ItemStack aStack); - public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); + void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); - public boolean isItemStackUsable(E aItem, ItemStack aStack); + boolean isItemStackUsable(E aItem, ItemStack aStack); - public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); + boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); + ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack); + boolean hasProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IItemContainer.java b/src/main/java/gregtech/api/interfaces/IItemContainer.java index 3c1bd87543..7ce2ad7403 100644 --- a/src/main/java/gregtech/api/interfaces/IItemContainer.java +++ b/src/main/java/gregtech/api/interfaces/IItemContainer.java @@ -5,35 +5,35 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public interface IItemContainer { - public Item getItem(); + Item getItem(); - public Block getBlock(); + Block getBlock(); - public boolean isStackEqual(Object aStack); + boolean isStackEqual(Object aStack); - public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); + boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT); - public ItemStack get(long aAmount, Object... aReplacements); + ItemStack get(long aAmount, Object... aReplacements); - public ItemStack getWildcard(long aAmount, Object... aReplacements); + ItemStack getWildcard(long aAmount, Object... aReplacements); - public ItemStack getUndamaged(long aAmount, Object... aReplacements); + ItemStack getUndamaged(long aAmount, Object... aReplacements); - public ItemStack getAlmostBroken(long aAmount, Object... aReplacements); + ItemStack getAlmostBroken(long aAmount, Object... aReplacements); - public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); + ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements); - public IItemContainer set(Item aItem); + IItemContainer set(Item aItem); - public IItemContainer set(ItemStack aStack); + IItemContainer set(ItemStack aStack); - public IItemContainer registerOre(Object... aOreNames); + IItemContainer registerOre(Object... aOreNames); - public IItemContainer registerWildcardAsOre(Object... aOreNames); + IItemContainer registerWildcardAsOre(Object... aOreNames); - public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); + ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements); - public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); + ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements); - public boolean hasBeenSet(); + boolean hasBeenSet(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java index 1f0ec91bba..d10c34ef51 100644 --- a/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java +++ b/src/main/java/gregtech/api/interfaces/IOreRecipeRegistrator.java @@ -12,5 +12,5 @@ public interface IOreRecipeRegistrator { * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! * @param aStack always != null */ - public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); + void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IProjectileItem.java b/src/main/java/gregtech/api/interfaces/IProjectileItem.java index 22211a6f0c..6e58d54823 100644 --- a/src/main/java/gregtech/api/interfaces/IProjectileItem.java +++ b/src/main/java/gregtech/api/interfaces/IProjectileItem.java @@ -10,15 +10,15 @@ public interface IProjectileItem { /** * @return if this Item has an Arrow Entity */ - public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack); + boolean hasProjectile(SubTag aProjectileType, ItemStack aStack); /** * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow */ - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); /** * @return an Arrow Entity to be spawned. If null then this is not an Arrow. Note: Other Projectiles still extend EntityArrow */ - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java index 8838992c62..73a81cc74b 100644 --- a/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java +++ b/src/main/java/gregtech/api/interfaces/IRedstoneCircuitBlock.java @@ -12,55 +12,55 @@ public interface IRedstoneCircuitBlock { /** * The Output Direction the Circuit Block is Facing */ - public byte getOutputFacing(); + byte getOutputFacing(); /** * sets Output Redstone State at Side */ - public boolean setRedstone(byte aStrength, byte aSide); + boolean setRedstone(byte aStrength, byte aSide); /** * returns Output Redstone State at Side * Note that setRedstone checks if there is a Difference between the old and the new Setting before consuming any Energy */ - public byte getOutputRedstone(byte aSide); + byte getOutputRedstone(byte aSide); /** * returns Input Redstone Signal at Side */ - public byte getInputRedstone(byte aSide); + byte getInputRedstone(byte aSide); /** * If this Side is Covered up and therefor not doing any Redstone */ - public GT_CoverBehavior getCover(byte aSide); + GT_CoverBehavior getCover(byte aSide); - public int getCoverID(byte aSide); + int getCoverID(byte aSide); - public int getCoverVariable(byte aSide); + int getCoverVariable(byte aSide); /** * returns whatever Block-ID is adjacent to the Redstone Circuit Block */ - public Block getBlockAtSide(byte aSide); + Block getBlockAtSide(byte aSide); /** * returns whatever Meta-Value is adjacent to the Redstone Circuit Block */ - public byte getMetaIDAtSide(byte aSide); + byte getMetaIDAtSide(byte aSide); /** * returns whatever TileEntity is adjacent to the Redstone Circuit Block */ - public TileEntity getTileEntityAtSide(byte aSide); + TileEntity getTileEntityAtSide(byte aSide); /** * returns whatever TileEntity is used by the Redstone Circuit Block */ - public ICoverable getOwnTileEntity(); + ICoverable getOwnTileEntity(); /** * returns worldObj.rand.nextInt(aRange) */ - public int getRandom(int aRange); + int getRandom(int aRange); } diff --git a/src/main/java/gregtech/api/interfaces/ISubTagContainer.java b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java index c7ccc45e96..92e4af0469 100644 --- a/src/main/java/gregtech/api/interfaces/ISubTagContainer.java +++ b/src/main/java/gregtech/api/interfaces/ISubTagContainer.java @@ -6,15 +6,15 @@ public interface ISubTagContainer { /** * @return if the Tag is inside the List. */ - public boolean contains(SubTag aTag); + boolean contains(SubTag aTag); /** * @return The ISubTagContainer you called this Function on, for convenience. */ - public ISubTagContainer add(SubTag... aTags); + ISubTagContainer add(SubTag... aTags); /** * @return if the Tag was there before it has been removed. */ - public boolean remove(SubTag aTag); + boolean remove(SubTag aTag); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java index 43efeac7c4..9d08713281 100644 --- a/src/main/java/gregtech/api/interfaces/ITexture.java +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -4,17 +4,17 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; public interface ITexture { - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public boolean isValidTexture(); + boolean isValidTexture(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/IToolStats.java b/src/main/java/gregtech/api/interfaces/IToolStats.java index 70aaeb206b..d282c02b11 100644 --- a/src/main/java/gregtech/api/interfaces/IToolStats.java +++ b/src/main/java/gregtech/api/interfaces/IToolStats.java @@ -22,107 +22,108 @@ public interface IToolStats { /** * Called when aPlayer crafts this Tool */ - public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); + void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); /** * Called when this gets added to a Tool Item */ - public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); + void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); /** * @return Damage the Tool receives when breaking a Block. 100 is one Damage Point (or 100 EU). */ - public int getToolDamagePerBlockBreak(); + int getToolDamagePerBlockBreak(); /** * @return Damage the Tool receives when converting the drops of a Block. 100 is one Damage Point (or 100 EU). */ - public int getToolDamagePerDropConversion(); + int getToolDamagePerDropConversion(); /** * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times more than normal. */ - public int getToolDamagePerContainerCraft(); + int getToolDamagePerContainerCraft(); /** * @return Damage the Tool receives when being used as Weapon, 200 is the normal Value, 100 for actual Weapons. */ - public int getToolDamagePerEntityAttack(); + int getToolDamagePerEntityAttack(); /** * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools of this Type. Decreasing is also possible. */ - public int getBaseQuality(); + int getBaseQuality(); /** * @return The Damage Bonus for this Type of Tool against Mobs. 1.0F is normal punch. */ - public float getBaseDamage(); + float getBaseDamage(); /** * @return This gets the Hurt Resistance time for Entities getting hit. (always does 1 as minimum) */ - public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); + int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Speed. */ - public float getSpeedMultiplier(); + float getSpeedMultiplier(); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Durability. */ - public float getMaxDurabilityMultiplier(); + float getMaxDurabilityMultiplier(); - public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); + DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); - public String getMiningSound(); + String getMiningSound(); - public String getCraftingSound(); + String getCraftingSound(); - public String getEntityHitSound(); + String getEntityHitSound(); - public String getBreakingSound(); + String getBreakingSound(); - public Enchantment[] getEnchantments(ItemStack aStack); + Enchantment[] getEnchantments(ItemStack aStack); - public int[] getEnchantmentLevels(ItemStack aStack); + int[] getEnchantmentLevels(ItemStack aStack); /** * @return If this Tool can be used for blocking Damage like a Sword. */ - public boolean canBlock(); + boolean canBlock(); /** * @return If this Tool can be used as an RC Crowbar. */ - public boolean isCrowbar(); + boolean isCrowbar(); /** * @return If this Tool can be used as an FR Grafter. */ - public boolean isGrafter(); + boolean isGrafter(); + + boolean isChainsaw(); - public boolean isChainsaw(); /** * @return If this Tool can be used as an BC Wrench. */ - public boolean isWrench(); - + boolean isWrench(); + /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ - public boolean isWeapon(); + boolean isWeapon(); /** * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your Bow/Gun or something */ - public boolean isRangedWeapon(); + boolean isRangedWeapon(); /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ - public boolean isMiningTool(); + boolean isMiningTool(); /** * aBlock.getHarvestTool(aMetaData) can return the following Values for example. @@ -130,33 +131,33 @@ public interface IToolStats { * * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this check. */ - public boolean isMinableBlock(Block aBlock, byte aMetaData); + boolean isMinableBlock(Block aBlock, byte aMetaData); /** * This lets you modify the Drop List, when this type of Tool has been used. * * @return the Amount of modified Items. */ - public int convertBlockDrops(List aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); + int convertBlockDrops(List aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); /** * @return Returns a broken Version of the Item. */ - public ItemStack getBrokenItem(ItemStack aStack); + ItemStack getBrokenItem(ItemStack aStack); /** * @return the Damage actually done to the Mob. */ - public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); /** * @return the Damage actually done to the Mob. */ - public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); + IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack); + short[] getRGBa(boolean aIsToolHead, ItemStack aStack); - public float getMiningSpeed(Block aBlock, byte aMetaData, float aDefault, EntityPlayer aPlayer, World worldObj, int aX, int aY, int aZ); + float getMiningSpeed(Block aBlock, byte aMetaData, float aDefault, EntityPlayer aPlayer, World worldObj, int aX, int aY, int aZ); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java index 4c1aa49c05..0bb4155214 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_CraftingRecipe.java @@ -3,5 +3,5 @@ package gregtech.api.interfaces.internal; import net.minecraft.item.crafting.IRecipe; public interface IGT_CraftingRecipe extends IRecipe { - public boolean isRemovable(); + boolean isRemovable(); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java index 945c988480..ff7b255f0e 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_Mod.java @@ -13,22 +13,22 @@ public interface IGT_Mod { /** * This means that Server specific Basefiles are definitely existing! Not if the World is actually server side or not! */ - public boolean isServerSide(); + boolean isServerSide(); /** * This means that Client specific Basefiles are definitely existing! Not if the World is actually client side or not! */ - public boolean isClientSide(); + boolean isClientSide(); /** * This means that Bukkit specific Basefiles are definitely existing! Not if the World is actually bukkit server or not! */ - public boolean isBukkitSide(); + boolean isBukkitSide(); /** * works only ClientSide otherwise returns null */ - public EntityPlayer getThePlayer(); + EntityPlayer getThePlayer(); //---------- Internal Usage Only ---------- @@ -37,10 +37,10 @@ public interface IGT_Mod { * * @return the Index of the added Armor */ - public int addArmor(String aArmorPrefix); + int addArmor(String aArmorPrefix); /** * Plays the Sonictron Sound for the ItemStack on the Client Side */ - public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ); + void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 40a30ebf8a..a6bc3e2b46 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -10,20 +10,20 @@ public interface IGT_RecipeAdder { * Does not work anymore! */ @Deprecated - public boolean addFusionReactorRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + boolean addFusionReactorRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); /** * Adds a FusionreactorRecipe * * @param aInput1 = first Input (not null, and respects StackSize) * @param aInput2 = second Input (not null, and respects StackSize) - * @param aOutput1 = Output of the Fusion (can be null, and respects StackSize) + * @param aOutput1 = Output of the Fusion (can be null, and respects StackSize) * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) * @param aFusionEnergyPerTick = The EU generated per Tick (can even be negative!) * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) * @return true if the Recipe got added, otherwise false. */ - public boolean addFusionReactorRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); + boolean addFusionReactorRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aFusionDurationInTicks, int aFusionEnergyPerTick, int aEnergyNeededForStartingFusion); /** * Adds a Centrifuge Recipe @@ -36,9 +36,9 @@ public interface IGT_RecipeAdder { * @param aOutput4 can be null * @param aDuration must be > 0 */ - public boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration); + boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration); - public boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); + boolean addCentrifugeRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); /** * Adds a Centrifuge Recipe @@ -50,17 +50,17 @@ public interface IGT_RecipeAdder { * @param aOutput4 can be null * @param aDuration must be > 0 */ - public boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + + boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt, boolean aCleanroom); - public boolean addCentrifugeRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt, boolean aCleanroom); /** - * * @param aInput1 must be != null * @param aOutput1 must be != null * @param aDuration must be > 0 * @return */ - public boolean addCompressorRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + boolean addCompressorRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds a Electrolyzer Recipe @@ -74,7 +74,7 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addElectrolyzerRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); + boolean addElectrolyzerRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int aDuration, int aEUt); /** * Adds a Electrolyzer Recipe @@ -88,29 +88,29 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); + boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt); /** * Adds a Chemical Recipe * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 */ - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int aDuration); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int aDuration); - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int aDuration, int aEUt); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Chemical Recipe * * @param aInput1 must be != null * @param aInput2 must be != null - * @param aOutput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 */ - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration); /** * Adds a Chemical Recipe @@ -122,7 +122,7 @@ public interface IGT_RecipeAdder { * @param aOutput2 must be != null * @param aDuration must be > 0 */ - public boolean addChemicalRecipeForBasicMachineOnly(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); + boolean addChemicalRecipeForBasicMachineOnly(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); /** @@ -134,16 +134,17 @@ public interface IGT_RecipeAdder { * @param aOutput2 must be != null * @param aDuration must be > 0 */ - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration); /** * Adds Recipes for creating a radically polymerized polymer from a base Material (for example Ethylene -> Polyethylene) - * @param aBasicMaterial The basic Material + * + * @param aBasicMaterial The basic Material * @param aBasicMaterialCell The corresponding Cell basic Material - * @param aPolymer The polymer + * @param aPolymer The polymer */ - public void addDefaultPolymerizationRecipes(Fluid aBasicMaterial, ItemStack aBasicMaterialCell, Fluid aPolymer); - + void addDefaultPolymerizationRecipes(Fluid aBasicMaterial, ItemStack aBasicMaterialCell, Fluid aPolymer); + /** * Adds a Chemical Recipe * @@ -153,9 +154,10 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUtick must be > 0 */ - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUtick); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUtick); + + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick, boolean aCleanroom); - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick, boolean aCleanroom); /** * Adds a Chemical Recipe * @@ -166,22 +168,23 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUtick must be > 0 */ - public boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); + boolean addChemicalRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, ItemStack aOutput2, int aDuration, int aEUtick); /** - + * Adds a Chemical Recipe that only exists in the Large Chemical Reactor - + * - + * @param aInputs item inputs - + * @param aFluidInputs fluid inputs - + * @param aFluidOutputs fluid outputs - + * @param aOutputs item outputs - + * @param aDuration must be > 0 - + * @param aEUtick must be > 0 - + * aInputs and aFluidInputs must contain at least one valid input. - + * aOutputs and aFluidOutputs must contain at least one valid output. - + */ + * + * Adds a Chemical Recipe that only exists in the Large Chemical Reactor + * + * + * + * @param aInputs item inputs + * + * @param aFluidInputs fluid inputs + * + * @param aFluidOutputs fluid outputs + * + * @param aOutputs item outputs + * + * @param aDuration must be > 0 + * + * @param aEUtick must be > 0 + * + * aInputs and aFluidInputs must contain at least one valid input. + * + * aOutputs and aFluidOutputs must contain at least one valid output. + * + + */ - public boolean addMultiblockChemicalRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUtick); + boolean addMultiblockChemicalRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUtick); /** @@ -196,7 +199,7 @@ public interface IGT_RecipeAdder { * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe */ @Deprecated - public boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); /** * Adds a Blast Furnace Recipe @@ -209,20 +212,20 @@ public interface IGT_RecipeAdder { * @param aEUt should be > 0 * @param aLevel should be > 0 is the minimum Heat Level needed for this Recipe */ - public boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + boolean addBlastRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); /** * Adds a Blast Furnace Recipe * - * @param aInput1 must be != null if aInput2 == null - * @param aInput2 must be != null if aInput1 == null + * @param aInput1 must be != null if aInput2 == null + * @param aInput2 must be != null if aInput1 == null * @param aCoalAmount must be > 0 - * @param aOutput1 must be != null if aOutput2 == null - * @param aOutput2 must be != null if aOutput1 == null - * @param aDuration must be > 0 + * @param aOutput1 must be != null if aOutput2 == null + * @param aOutput2 must be != null if aOutput1 == null + * @param aDuration must be > 0 */ - public boolean addPrimitiveBlastRecipe(ItemStack aInput1, ItemStack aInput2, int aCoalAmount, ItemStack aOutput1, ItemStack aOutput2, int aDuration); + boolean addPrimitiveBlastRecipe(ItemStack aInput1, ItemStack aInput2, int aCoalAmount, ItemStack aOutput1, ItemStack aOutput2, int aDuration); /** @@ -233,7 +236,7 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0, 100 ticks is standard. * @param aEUt should be > 0, 1 EU/t is standard. */ - public boolean addCannerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCannerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds an Alloy Smelter Recipe @@ -245,9 +248,9 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); + boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden); /** @@ -258,28 +261,29 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addCNCRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + boolean addCNCRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds an Assembler Recipe * * @param aInput1 must be != null * @param aOutput1 must be != null - * @param aInput2 must be != null + * @param aInput2 must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); /** - + * Adds an Assembler Recipe - + * - + * @param aInputs must be != null - + * @param aOutput1 must be != null - + * @param aDuration must be > 0 - + * @param aEUt should be > 0 - + */ - public boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + * + * Adds an Assembler Recipe + * + * + * + * @param aInputs must be != null + * + * @param aOutput1 must be != null + * + * @param aDuration must be > 0 + * + * @param aEUt should be > 0 + * + + */ + boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds an Assembler Recipe @@ -289,48 +293,49 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addAssemblerRecipe(ItemStack aInput1, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblerRecipe(ItemStack aInput1, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addAssemblerRecipe(ItemStack[] aInputs, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblerRecipe(ItemStack[] aInputs, Object aOreDict, int aAmount, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt); - public boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); + boolean addAssemblerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); - public boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); + boolean addAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput1, int aDuration, int aEUt, boolean aCleanroom); /** * Adds an Circuit Assembler Recipe * - * @param aInputs must be 1-6 ItemStacks + * @param aInputs must be 1-6 ItemStacks * @param aFluidInput 0-1 fluids - * @param aOutput must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 + * @param aOutput must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 */ - public boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt); - public boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt, boolean aCleanroom); + boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt, boolean aCleanroom); /** * Adds an Assemblyline Recipe * - * @param aInputs must be != null, 4-16 inputs + * @param aInputs must be != null, 4-16 inputs * @param aFluidInputs 0-4 fluids - * @param aOutput1 must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 */ - public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds a Assemblyline Recipe - * @param aInputs elements should be: ItemStack for single item; - * ItemStack[] for multiple equivalent items; - * {OreDict, amount} for oredict. + * + * @param aInputs elements should be: ItemStack for single item; + * ItemStack[] for multiple equivalent items; + * {OreDict, amount} for oredict. */ - public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds a Forge Hammer Recipe @@ -340,70 +345,69 @@ public interface IGT_RecipeAdder { * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds a Wiremill Recipe * - * @param aInput must be != null - * @param aOutput must be != null + * @param aInput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addWiremillRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addWiremillRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Polariser Recipe * - * @param aInput must be != null - * @param aOutput must be != null + * @param aInput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addPolarizerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addPolarizerRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Plate Bending Machine Recipe * - * @param aInput must be != null - * @param aOutput must be != null + * @param aInput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addBenderRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addBenderRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Extruder Machine Recipe * - * @param aInput must be != null + * @param aInput must be != null * @param aShape must be != null, Set the stackSize to 0 if you don't want to let it consume this Item. - * @param aOutput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); + boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Slicer Machine Recipe * - * @param aInput must be != null + * @param aInput must be != null * @param aShape must be != null, Set the stackSize to 0 if you don't want to let it consume this Item. - * @param aOutput must be != null + * @param aOutput must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 */ - public boolean addSlicerRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); + boolean addSlicerRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt); /** - * - * @param aInput must be != null - * @param aFluidInput must be != null - * @param aOutput1 must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 + * @param aInput must be != null + * @param aFluidInput must be != null + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 * @return */ - public boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int aDuration, int aEUt); + boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int aDuration, int aEUt); /** * Adds an Implosion Compressor Recipe @@ -413,7 +417,7 @@ public interface IGT_RecipeAdder { * @param aOutput1 must be != null * @param aOutput2 can be null */ - public boolean addImplosionRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2); + boolean addImplosionRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2); /** * Adds a Grinder Recipe @@ -425,71 +429,71 @@ public interface IGT_RecipeAdder { * @param aOutput3 can be null * @param aOutput4 can be null */ - public boolean addGrinderRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4); + boolean addGrinderRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4); /** * Adds a Distillation Tower Recipe * - * @param aInput must be != null + * @param aInput must be != null * @param aOutputs must be != null 1-5 Fluids * @param aOutput2 can be null */ - public boolean addDistillationTowerRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + boolean addDistillationTowerRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); - public boolean addSimpleArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addSimpleArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); - public boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); - public boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidPutput, int[] aChances, int aDuration, int aEUt); + boolean addPlasmaArcFurnaceRecipe(ItemStack aInput, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidPutput, int[] aChances, int aDuration, int aEUt); /** * Adds a Distillation Tower Recipe */ - public boolean addDistillationRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt); + boolean addDistillationRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aDuration, int aEUt); /** * Adds a Lathe Machine Recipe */ - public boolean addLatheRecipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addLatheRecipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds a Cutter Recipe */ - public boolean addCutterRecipe(ItemStack aInput, FluidStack aLubricant, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCutterRecipe(ItemStack aInput, FluidStack aLubricant, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds Cutter Recipes with default Lubricants */ - public boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); - public boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); + boolean addCutterRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); - public boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); + boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt); - public boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); + boolean addCutterRecipe(ItemStack aInput, ItemStack aCircuit, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, boolean aCleanroom); + + boolean addCutterRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, int aDuration, int aEUt, int aSpecial); - public boolean addCutterRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, int aDuration, int aEUt, int aSpecial); /** * Adds a Boxing Recipe */ - public boolean addBoxingRecipe(ItemStack aContainedItem, ItemStack aEmptyBox, ItemStack aFullBox, int aDuration, int aEUt); + boolean addBoxingRecipe(ItemStack aContainedItem, ItemStack aEmptyBox, ItemStack aFullBox, int aDuration, int aEUt); /** - * - * @param aInput must be != null + * @param aInput must be != null * @param aOutput1 must be != null * @param aDuration must be > 0 * @param aEUt should be > 0 * @return */ - public boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int aDuration, int aEUt); + boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int aDuration, int aEUt); /** * Adds an Unboxing Recipe */ - public boolean addUnboxingRecipe(ItemStack aFullBox, ItemStack aContainedItem, ItemStack aEmptyBox, int aDuration, int aEUt); + boolean addUnboxingRecipe(ItemStack aFullBox, ItemStack aContainedItem, ItemStack aEmptyBox, int aDuration, int aEUt); /** * Adds a Vacuum Freezer Recipe @@ -498,9 +502,9 @@ public interface IGT_RecipeAdder { * @param aOutput1 must be != null * @param aDuration must be > 0 */ - public boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration); + boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration); - public boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); /** * Adds a Fuel for My Generators @@ -510,162 +514,164 @@ public interface IGT_RecipeAdder { * @param aEU EU per MilliBucket. If no Liquid Form of this Container is available, then it will give you EU*1000 per Item. * @param aType 0 = Diesel; 1 = Gas Turbine; 2 = Thermal; 3 = Dense Fluid; 4 = Plasma; 5 = Magic; And if something is unclear or missing, then look at the GT_Recipe-Class */ - public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); + boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); /** * Adds an Amplifier Recipe for the Amplifabricator */ - public boolean addAmplifier(ItemStack aAmplifierItem, int aDuration, int aAmplifierAmountOutputted); + boolean addAmplifier(ItemStack aAmplifierItem, int aDuration, int aAmplifierAmountOutputted); /** * Adds a Recipe for the Brewing Machine (intentionally limited to Fluid IDs) */ - public boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, boolean aHidden); + boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, boolean aHidden); - public boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addBrewingRecipe(ItemStack aIngredient, Fluid aInput, Fluid aOutput, int aDuration, int aEUt, boolean aHidden); - public boolean addBrewingRecipeCustom(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addBrewingRecipeCustom(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); /** * Adds a Recipe for the Fermenter */ - public boolean addFermentingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, boolean aHidden); + boolean addFermentingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, boolean aHidden); - public boolean addFermentingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUT, boolean aHidden); + boolean addFermentingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUT, boolean aHidden); /** * Adds a Recipe for the Fluid Heater */ - public boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + boolean addFluidHeaterRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for the Distillery */ - public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); - public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); - public boolean addDistilleryRecipe(int circuitConfig, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe(int circuitConfig, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); - public boolean addDistilleryRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); + boolean addDistilleryRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt, boolean aHidden); /** * Adds a Recipe for the Fluid Solidifier */ - public boolean addFluidSolidifierRecipe(ItemStack aMold, FluidStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addFluidSolidifierRecipe(ItemStack aMold, FluidStack aInput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for Fluid Smelting */ - public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); /** * Adds a Recipe for Fluid Smelting */ - public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt, boolean hidden); + boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt, boolean hidden); /** * Adds a Recipe for Fluid Extraction */ - public boolean addFluidExtractionRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); + boolean addFluidExtractionRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt); /** * Adds a Recipe for the Fluid Canner */ - public boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput); + boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput); + + boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); - public boolean addFluidCannerRecipe(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration,int aEUt); /** * Adds a Recipe for the Chemical Bath */ - public boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + boolean addChemicalBathRecipe(ItemStack aInput, FluidStack aBathingFluid, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the Electromagnetic Separator */ - public boolean addElectromagneticSeparatorRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + boolean addElectromagneticSeparatorRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the Extractor */ - public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for the Printer */ - public boolean addPrinterRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aSpecialSlot, ItemStack aOutput, int aDuration, int aEUt); + boolean addPrinterRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aSpecialSlot, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for the Autoclave */ - public boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt); + boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt); /** * Adds a Recipe for the Autoclave */ - public boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); + boolean addAutoclaveRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); - public boolean addAutoclaveSpaceRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); + boolean addAutoclaveSpaceRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom); /** * Adds a Recipe for the Mixer */ - public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); - public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); - public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8, ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8, ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); /** * Adds a Recipe for the Laser Engraver */ - public boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt); + boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt); + /** * Adds a Recipe for the Laser Engraver */ - public boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt, boolean aCleanroom); + boolean addLaserEngraverRecipe(ItemStack aItemToEngrave, ItemStack aLens, ItemStack aEngravedItem, int aDuration, int aEUt, boolean aCleanroom); /** * Adds a Recipe for the Forming Press */ - public boolean addFormingPressRecipe(ItemStack aItemToImprint, ItemStack aForm, ItemStack aImprintedItem, int aDuration, int aEUt); + boolean addFormingPressRecipe(ItemStack aItemToImprint, ItemStack aForm, ItemStack aImprintedItem, int aDuration, int aEUt); /** * Adds a Recipe for the Sifter. (up to 9 Outputs) */ - public boolean addSifterRecipe(ItemStack aItemToSift, ItemStack[] aSiftedItems, int[] aChances, int aDuration, int aEUt); + boolean addSifterRecipe(ItemStack aItemToSift, ItemStack[] aSiftedItems, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) */ - public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the Arc Furnace. (up to 4 Outputs) */ - public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); + boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); /** * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) */ - public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); + boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt); /** * Adds a Recipe for the GT Pulveriser. (up to 4 Outputs) */ - public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); + boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden); /** * Adds a Distillation Tower Recipe * Every Fluid also gets separate distillation recipes * - * @param aInput must be != null + * @param aInput must be != null * @param aOutputs must be != null 1-5 Fluids * @param aOutput2 can be null */ - public boolean addUniversalDistillationRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); + boolean addUniversalDistillationRecipe(FluidStack aInput, FluidStack[] aOutputs, ItemStack aOutput2, int aDuration, int aEUt); /** * Adds Pyrolyse Recipe @@ -677,7 +683,7 @@ public interface IGT_RecipeAdder { * @param aDuration * @param aEUt */ - public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt); + boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt); /** * Adds Oil Cracking Recipe @@ -689,20 +695,20 @@ public interface IGT_RecipeAdder { */ @Deprecated - public boolean addCrackingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); + boolean addCrackingRecipe(FluidStack aInput, FluidStack aOutput, int aDuration, int aEUt); /** * Adds Oil Cracking Recipe * * @param circuitConfig The circuit configuration to control cracking severity - * @param aInput The fluid to be cracked - * @param aInput2 The fluid to catalyze the cracking (typically Hydrogen or Steam) - * @param aOutput The cracked fluid + * @param aInput The fluid to be cracked + * @param aInput2 The fluid to catalyze the cracking (typically Hydrogen or Steam) + * @param aOutput The cracked fluid * @param aDuration * @param aEUt */ - public boolean addCrackingRecipe(int circuitConfig, FluidStack aInput, FluidStack aInput2, FluidStack aOutput, int aDuration, int aEUt); + boolean addCrackingRecipe(int circuitConfig, FluidStack aInput, FluidStack aInput2, FluidStack aOutput, int aDuration, int aEUt); /** * Adds a Sound to the Sonictron9001 @@ -712,5 +718,5 @@ public interface IGT_RecipeAdder { * @param aSoundName = The Name of the Sound in the resources/newsound-folder like Vanillasounds * @return true if the Sound got added, otherwise false. */ - public boolean addSonictronSound(ItemStack aItemStack, String aSoundName); + boolean addSonictronSound(ItemStack aItemStack, String aSoundName); } diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java index 2c1f930835..c4f416c823 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -8,23 +8,49 @@ import net.minecraft.item.ItemStack; import java.util.List; public interface IThaumcraftCompat { - public static final int RESEARCH_TYPE_NORMAL = 0, RESEARCH_TYPE_SECONDARY = 1, RESEARCH_TYPE_FREE = 2, RESEARCH_TYPE_HIDDEN = 4, RESEARCH_TYPE_VIRTUAL = 8, RESEARCH_TYPE_ROUND = 16, RESEARCH_TYPE_SPECIAL = 32, RESEARCH_TYPE_AUTOUNLOCK = 64; + int + RESEARCH_TYPE_NORMAL = 0, + RESEARCH_TYPE_SECONDARY = 1, + RESEARCH_TYPE_FREE = 2, + RESEARCH_TYPE_HIDDEN = 4, + RESEARCH_TYPE_VIRTUAL = 8, + RESEARCH_TYPE_ROUND = 16, + RESEARCH_TYPE_SPECIAL = 32, + RESEARCH_TYPE_AUTOUNLOCK = 64; /** * The Research Keys of GT */ - public static final String - IRON_TO_STEEL = "GT_IRON_TO_STEEL", FILL_WATER_BUCKET = "GT_FILL_WATER_BUCKET", WOOD_TO_CHARCOAL = "GT_WOOD_TO_CHARCOAL", TRANSZINC = "GT_TRANSZINC", TRANSNICKEL = "GT_TRANSNICKEL", TRANSCOBALT = "GT_TRANSCOBALT", TRANSBISMUTH = "GT_TRANSBISMUTH", TRANSANTIMONY = "GT_TRANSANTIMONY", TRANSCUPRONICKEL = "GT_TRANSCUPRONICKEL", TRANSBATTERYALLOY = "GT_TRANSBATTERYALLOY", TRANSSOLDERINGALLOY = "GT_TRANSSOLDERINGALLOY", TRANSBRASS = "GT_TRANSBRASS", TRANSBRONZE = "GT_TRANSBRONZE", TRANSINVAR = "GT_TRANSINVAR", TRANSELECTRUM = "GT_TRANSELECTRUM", TRANSALUMINIUM = "GT_TRANSALUMINIUM", CRYSTALLISATION = "GT_CRYSTALLISATION", ADVANCEDENTROPICPROCESSING = "GT_ADVANCEDENTROPICPROCESSING", ADVANCEDMETALLURGY = "GT_ADVANCEDMETALLURGY"; - - public boolean registerPortholeBlacklistedBlock(Block aBlock); - - public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, boolean aAdditive); - - public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, String aOreDict); - - public Object addCrucibleRecipe(String aResearch, Object aInput, ItemStack aOutput, List aAspects); - - public Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, int aInstability, List aAspects); - - public Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List aAspects, ItemStack[] aResearchTriggers, Object[] aPages); + String + IRON_TO_STEEL = "GT_IRON_TO_STEEL", + FILL_WATER_BUCKET = "GT_FILL_WATER_BUCKET", + WOOD_TO_CHARCOAL = "GT_WOOD_TO_CHARCOAL", + TRANSZINC = "GT_TRANSZINC", + TRANSNICKEL = "GT_TRANSNICKEL", + TRANSCOBALT = "GT_TRANSCOBALT", + TRANSBISMUTH = "GT_TRANSBISMUTH", + TRANSANTIMONY = "GT_TRANSANTIMONY", + TRANSCUPRONICKEL = "GT_TRANSCUPRONICKEL", + TRANSBATTERYALLOY = "GT_TRANSBATTERYALLOY", + TRANSSOLDERINGALLOY = "GT_TRANSSOLDERINGALLOY", + TRANSBRASS = "GT_TRANSBRASS", + TRANSBRONZE = "GT_TRANSBRONZE", + TRANSINVAR = "GT_TRANSINVAR", + TRANSELECTRUM = "GT_TRANSELECTRUM", + TRANSALUMINIUM = "GT_TRANSALUMINIUM", + CRYSTALLISATION = "GT_CRYSTALLISATION", + ADVANCEDENTROPICPROCESSING = "GT_ADVANCEDENTROPICPROCESSING", + ADVANCEDMETALLURGY = "GT_ADVANCEDMETALLURGY"; + + boolean registerPortholeBlacklistedBlock(Block aBlock); + + boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, boolean aAdditive); + + boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, String aOreDict); + + Object addCrucibleRecipe(String aResearch, Object aInput, ItemStack aOutput, List aAspects); + + Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, int aInstability, List aAspects); + + Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List aAspects, ItemStack[] aResearchTriggers, Object[] aPages); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java index 96c03bbd6d..16fe07812f 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java @@ -4,15 +4,16 @@ package gregtech.api.interfaces.metatileentity; * For pipes, wires, and other MetaTiles which need to be decided whether they should connect to the block at each side. */ public interface IConnectable { - /** - * Try to connect to the Block at the specified side - * returns the connection state. Non-positive values for failed, others for succeeded. - */ - public int connect(byte aSide); - /** - * Try to disconnect to the Block at the specified side - */ - public void disconnect(byte aSide); + /** + * Try to connect to the Block at the specified side + * returns the connection state. Non-positive values for failed, others for succeeded. + */ + int connect(byte aSide); - public boolean isConnectedAtSide(int aSide); + /** + * Try to disconnect to the Block at the specified side + */ + void disconnect(byte aSide); + + boolean isConnectedAtSide(int aSide); } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index e973301395..a518b3baaf 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -389,7 +389,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand void onColorChangeClient(byte aColor); int getLightOpacity(); - + boolean allowGeneralRedstoneOutput(); void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider); @@ -402,9 +402,9 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * The onCreated Function of the Item Class redirects here */ void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer); - + boolean hasAlternativeModeText(); - + String getAlternativeModeText(); boolean shouldJoinIc2Enet(); diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java index ead9c8bf8f..a7c1209d24 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityCable.java @@ -7,9 +7,9 @@ import java.util.HashSet; public interface IMetaTileEntityCable extends IMetaTileEntity { @Deprecated - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList aAlreadyPassedTileEntityList); + long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList aAlreadyPassedTileEntityList); - default public long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet aAlreadyPassedSet) { + default long transferElectricity(byte aSide, long aVoltage, long aAmperage, HashSet aAlreadyPassedSet) { return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(aAlreadyPassedSet)); } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index 7187ccb04b..b61fe99904 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -10,12 +10,12 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { /** * @return if this Pipe can still be used. */ - public boolean pipeCapacityCheck(); + boolean pipeCapacityCheck(); /** * @return if this Pipe can still be used. */ - public boolean incrementTransferCounter(int aIncrement); + boolean incrementTransferCounter(int aIncrement); /** * Sends an ItemStack from aSender to the adjacent Blocks. @@ -23,7 +23,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { * @param aSender the BaseMetaTileEntity sending the Stack. * @return if it was able to send something */ - public boolean sendItemStack(Object aSender); + boolean sendItemStack(Object aSender); /** * Executes the Sending Code for inserting Stacks into the TileEntities. @@ -32,19 +32,19 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { * @param aSide the Side of the PIPE facing the TileEntity. * @return if this Side was allowed to Output into the Block. */ - public boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); + boolean insertItemStackIntoTileEntity(Object aSender, byte aSide); /** * Can be used to make flow control Pipes, like Redpowers Restriction Tubes. * Every normal Pipe returns a Value of 32768, so you can easily insert lower Numbers to set Routing priorities. * Negative Numbers to "suck" Items into a certain direction are also possible. */ - public int getStepSize(); + int getStepSize(); /** * Utility for the Item Network */ - public static class Util { + class Util { /** * @return a List of connected Item Pipes */ @@ -55,7 +55,8 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { IGregTechTileEntity aBaseMetaTileEntity = aMetaTileEntity.getBaseMetaTileEntity(); aMap.put(aMetaTileEntity, aStep); for (byte i = 0, j = 0; i < 6; i++) { - if (aMetaTileEntity instanceof IConnectable && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) continue; + if (aMetaTileEntity instanceof IConnectable && !((IConnectable) aMetaTileEntity).isConnectedAtSide(i)) + continue; j = GT_Utility.getOppositeSide(i); if (aSuckItems) { if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsItemsIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), -2, aBaseMetaTileEntity)) { diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java index 423b3d4379..b795c793bc 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java @@ -9,83 +9,83 @@ public interface IBasicEnergyContainer extends IEnergyConnected { * It is used for checking the contained Energy before consuming it. * If this returns false, it will also give a Message inside the Scanner, that this Machine doesn't have enough Energy. */ - public boolean isUniversalEnergyStored(long aEnergyAmount); + boolean isUniversalEnergyStored(long aEnergyAmount); /** * Gets the stored electric, kinetic or steam Energy (with EU as reference Value) * Always returns the largest one. */ - public long getUniversalEnergyStored(); + long getUniversalEnergyStored(); /** * Gets the largest electric, kinetic or steam Energy Capacity (with EU as reference Value) */ - public long getUniversalEnergyCapacity(); + long getUniversalEnergyCapacity(); /** * Gets the amount of Energy Packets per tick. */ - public long getOutputAmperage(); + long getOutputAmperage(); /** * Gets the Output in EU/p. */ - public long getOutputVoltage(); + long getOutputVoltage(); /** * Gets the amount of Energy Packets per tick. */ - public long getInputAmperage(); + long getInputAmperage(); /** * Gets the maximum Input in EU/p. */ - public long getInputVoltage(); + long getInputVoltage(); /** * Decreases the Amount of stored universal Energy. If ignoring too less Energy, then it just sets the Energy to 0 and returns false. */ - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy); + boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy); /** * Increases the Amount of stored electric Energy. If ignoring too much Energy, then the Energy Limit is just being ignored. */ - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy); + boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy); /** * Drain Energy Call for Electricity. */ - public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage); + boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage); /** * returns the amount of Electricity, accepted by this Block the last 5 ticks as Average. */ - public long getAverageElectricInput(); + long getAverageElectricInput(); /** * returns the amount of Electricity, outputted by this Block the last 5 ticks as Average. */ - public long getAverageElectricOutput(); + long getAverageElectricOutput(); /** * returns the amount of electricity contained in this Block, in EU units! */ - public long getStoredEU(); + long getStoredEU(); /** * returns the amount of electricity containable in this Block, in EU units! */ - public long getEUCapacity(); + long getEUCapacity(); /** * returns the amount of Steam contained in this Block, in EU units! */ - public long getStoredSteam(); + long getStoredSteam(); /** * returns the amount of Steam containable in this Block, in EU units! */ - public long getSteamCapacity(); + long getSteamCapacity(); /** * Increases stored Energy. Energy Base Value is in EU, even though it's Steam! @@ -96,5 +96,5 @@ public interface IBasicEnergyContainer extends IEnergyConnected { *

* And yes, you can't directly decrease the Steam of a Machine. That is done by decreaseStoredEnergyUnits */ - public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy); + boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java index 6b69911ad2..ddbb550dfc 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IColoredTileEntity.java @@ -4,12 +4,12 @@ public interface IColoredTileEntity { /** * @return 0 - 15 are Colors, while -1 means uncolored */ - public byte getColorization(); + byte getColorization(); /** * Sets the Color Modulation of the Block * * @param aColor the Color you want to set it to. -1 for reset. */ - public byte setColorization(byte aColor); + byte setColorization(byte aColor); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java index 99ec88c149..912dc554c0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -4,41 +4,41 @@ import gregtech.api.util.GT_CoverBehavior; import net.minecraft.item.ItemStack; public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEnergyContainer { - public boolean canPlaceCoverIDAtSide(byte aSide, int aID); + boolean canPlaceCoverIDAtSide(byte aSide, int aID); - public boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover); + boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover); - public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced); + boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced); - public void setCoverDataAtSide(byte aSide, int aData); + void setCoverDataAtSide(byte aSide, int aData); - public void setCoverIDAtSide(byte aSide, int aID); + void setCoverIDAtSide(byte aSide, int aID); - public void setCoverItemAtSide(byte aSide, ItemStack aCover); + void setCoverItemAtSide(byte aSide, ItemStack aCover); - public int getCoverDataAtSide(byte aSide); + int getCoverDataAtSide(byte aSide); - public int getCoverIDAtSide(byte aSide); + int getCoverIDAtSide(byte aSide); - public ItemStack getCoverItemAtSide(byte aSide); + ItemStack getCoverItemAtSide(byte aSide); - public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide); + GT_CoverBehavior getCoverBehaviorAtSide(byte aSide); /** * For use by the regular MetaTileEntities. Returns the Cover Manipulated input Redstone. * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. */ - public byte getInternalInputRedstoneSignal(byte aSide); + byte getInternalInputRedstoneSignal(byte aSide); /** * For use by the regular MetaTileEntities. This makes it not conflict with Cover based Redstone Signals. * Don't use this if you are a Cover Behavior. Only for MetaTileEntities. */ - public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength); + void setInternalOutputRedstoneSignal(byte aSide, byte aStrength); /** * Causes a general Cover Texture update. * Sends 6 Integers to Client + causes @issueTextureUpdate() */ - public void issueCoverUpdate(byte aSide); + void issueCoverUpdate(byte aSide); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java index 8f55b75fcf..d7c39c900c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IDigitalChest.java @@ -11,21 +11,21 @@ public interface IDigitalChest extends IHasWorldObjectAndCoords { * I need things like this Function for MetaTileEntities, you MUST check this!!! * Do not assume that it's a Digital Chest or similar Device, when it just implements this Interface. */ - public boolean isDigitalChest(); + boolean isDigitalChest(); /** * Gives an Array of Stacks with Size (of all the Data-stored Items) of the correspondent Item kinds (regular QChests have only one) * Does NOT include the 64 "ready" Items inside the Slots, and neither the 128 Items in the overflow Buffer. */ - public ItemStack[] getStoredItemData(); + ItemStack[] getStoredItemData(); /** * A generic Interface for just setting the amount of contained Items */ - public void setItemCount(int aCount); + void setItemCount(int aCount); /** * Gets the maximum Item count for this QChest alike Storage. This applies to the Data-Storage, not for the up to 192 buffered Items! */ - public int getMaxItemCount(); + int getMaxItemCount(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java index 2384678529..32fd276600 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConductor.java @@ -11,30 +11,30 @@ public interface IEnergyConductor extends IEnergyConnected { /** * @return if this is actually a Cable. (you must check this) */ - public boolean isConductor(); + boolean isConductor(); /** * @return the maximum Voltage of the Cable. */ - public long getMaxVoltage(); + long getMaxVoltage(); /** * @return the maximum Amperage of the Cable, per Wire. */ - public long getMaxAmperage(); + long getMaxAmperage(); /** * @return the Loss of the Cable, per Meter. */ - public long getLossPerMeter(); + long getLossPerMeter(); /** * @return the Material the Cable consists of. (may return Materials._NULL) */ - public Materials getCableMaterial(); + Materials getCableMaterial(); /** * @return the Material the Cable Insulation consists of. (may return Materials._NULL) */ - public Materials getInsulationMaterial(); + Materials getInsulationMaterial(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 73436e3b2a..47bec844ee 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -29,28 +29,30 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) * @return amount of used Amperes. 0 if not accepted anything. */ - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage); + long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage); /** * Sided Energy Input */ - public boolean inputEnergyFrom(byte aSide); - default public boolean inputEnergyFrom(byte aSide, boolean waitForActive) { + boolean inputEnergyFrom(byte aSide); + + default boolean inputEnergyFrom(byte aSide, boolean waitForActive) { return inputEnergyFrom(aSide); } /** * Sided Energy Output */ - public boolean outputsEnergyTo(byte aSide); - default public boolean outputsEnergyTo(byte aSide, boolean waitForActive) { + boolean outputsEnergyTo(byte aSide); + + default boolean outputsEnergyTo(byte aSide, boolean waitForActive) { return outputsEnergyTo(aSide); } /** * Utility for the Network */ - public static class Util { + class Util { /** * Emits Energy to the E-net. Also compatible with adjacent IC2 TileEntities. * @@ -84,33 +86,33 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd if (rfOut > 32L * GregTech_API.mEUtoRF / 100L) { int aExplosionPower = rfOut; float tStrength = - aExplosionPower < V[0] ? 1.0F : - aExplosionPower < V[1] ? 2.0F : - aExplosionPower < V[2] ? 3.0F : - aExplosionPower < V[3] ? 4.0F : - aExplosionPower < V[4] ? 5.0F : - aExplosionPower < V[4] * 2 ? 6.0F : - aExplosionPower < V[5] ? 7.0F : - aExplosionPower < V[6] ? 8.0F : - aExplosionPower < V[7] ? 9.0F : - aExplosionPower < V[8] ? 10.0F : - aExplosionPower < V[8] * 2 ? 11.0F : - aExplosionPower < V[9] ? 12.0F : - aExplosionPower < V[10] ? 13.0F : - aExplosionPower < V[11] ? 14.0F : - aExplosionPower < V[12] ? 15.0F : - aExplosionPower < V[12] * 2 ? 16.0F : - aExplosionPower < V[13] ? 17.0F : - aExplosionPower < V[14] ? 18.0F : - aExplosionPower < V[15] ? 19.0F : 20.0F; + aExplosionPower < V[0] ? 1.0F : + aExplosionPower < V[1] ? 2.0F : + aExplosionPower < V[2] ? 3.0F : + aExplosionPower < V[3] ? 4.0F : + aExplosionPower < V[4] ? 5.0F : + aExplosionPower < V[4] * 2 ? 6.0F : + aExplosionPower < V[5] ? 7.0F : + aExplosionPower < V[6] ? 8.0F : + aExplosionPower < V[7] ? 9.0F : + aExplosionPower < V[8] ? 10.0F : + aExplosionPower < V[8] * 2 ? 11.0F : + aExplosionPower < V[9] ? 12.0F : + aExplosionPower < V[10] ? 13.0F : + aExplosionPower < V[11] ? 14.0F : + aExplosionPower < V[12] ? 15.0F : + aExplosionPower < V[12] * 2 ? 16.0F : + aExplosionPower < V[13] ? 17.0F : + aExplosionPower < V[14] ? 18.0F : + aExplosionPower < V[15] ? 19.0F : 20.0F; int tX = tTileEntity.xCoord, tY = tTileEntity.yCoord, tZ = tTileEntity.zCoord; World tWorld = tTileEntity.getWorldObj(); GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) - if(GT_Mod.gregtechproxy.mPollution) - GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX,tZ), 100000); - tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + if (GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); + tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java index 7e86701f6b..3a32a557fb 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IExperimentalEnergyTileEntity.java @@ -25,22 +25,22 @@ public interface IExperimentalEnergyTileEntity extends IColoredTileEntity, IHasW * @param aSide 0 - 5 = Vanilla Directions of YOUR Block the Energy gets inserted to. 6 = No specific Side (don't do Side checks for this Side) * @return amount of used Amperes. 0 if not accepted anything. */ - public long injectEnergy(SubTag aEnergyType, byte aSide, long aPrimary, long aSecondary); + long injectEnergy(SubTag aEnergyType, byte aSide, long aPrimary, long aSecondary); /** * Sided Energy Input */ - public boolean inputEnergyFrom(SubTag aEnergyType, byte aSide); + boolean inputEnergyFrom(SubTag aEnergyType, byte aSide); /** * Sided Energy Output */ - public boolean outputsEnergyTo(SubTag aEnergyType, byte aSide); + boolean outputsEnergyTo(SubTag aEnergyType, byte aSide); /** * Utility for the Network */ - public static class Util { + class Util { public static int RF_PER_EU = 4; private static boolean RF_ENERGY = false, IC_ENERGY = false, CHECK_ALL = true; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java index edcf5bdb89..bde86524c5 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IFibreConnected.java @@ -7,25 +7,25 @@ public interface IFibreConnected extends IColoredTileEntity, IHasWorldObjectAndC /** * If this Blocks accepts Fibre from this Side */ - public void inputFibreFrom(byte aSide); + void inputFibreFrom(byte aSide); /** * If this Blocks emits Fibre to this Side */ - public void outputsFibreTo(byte aSide); + void outputsFibreTo(byte aSide); /** * Sets the Signal this Blocks outputs to this Fibre Color */ - public void setFibreOutput(byte aSide, byte aColor, byte aRedstoneStrength); + void setFibreOutput(byte aSide, byte aColor, byte aRedstoneStrength); /** * Gets the Signal this Blocks outputs to this Fibre Color */ - public byte getFibreOutput(byte aSide, byte aColor); + byte getFibreOutput(byte aSide, byte aColor); /** * Gets the Signal this Blocks receives from this Fibre Color */ - public byte getFibreInput(byte aSide, byte aColor); + byte getFibreInput(byte aSide, byte aColor); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java index 796f0a11b3..54fe151cb1 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGearEnergyTileEntity.java @@ -5,7 +5,7 @@ public interface IGearEnergyTileEntity { * If Rotation Energy can be accepted on this Side. * This means that the Gear/Axle will connect to this Side, and can cause the Gear/Axle to stop if the Energy isn't accepted. */ - public boolean acceptsRotationalEnergy(byte aSide); + boolean acceptsRotationalEnergy(byte aSide); /** * Inject Energy Call for Rotational Energy. @@ -13,5 +13,5 @@ public interface IGearEnergyTileEntity { * * @param aSpeed Positive = Clockwise, Negative = Counterclockwise */ - public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy); + boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java index e4bb4f1371..39c779e69c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechDeviceInformation.java @@ -9,7 +9,7 @@ public interface IGregTechDeviceInformation { * I need things like this Function for MetaTileEntities, you MUST check this!!! * Do not assume that it's a Information returning Device, when it just implements this Interface. */ - public boolean isGivingInformation(); + boolean isGivingInformation(); /** * Up to 8 Strings can be returned. @@ -17,5 +17,5 @@ public interface IGregTechDeviceInformation { * * @return an Array of Information Strings. Don't return null! */ - public String[] getInfoData(); + String[] getInfoData(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index 8bd8c5b678..af9ead9543 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -25,27 +25,27 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil /** * gets the Error displayed on the GUI */ - public int getErrorDisplayID(); + int getErrorDisplayID(); /** * sets the Error displayed on the GUI */ - public void setErrorDisplayID(int aErrorID); + void setErrorDisplayID(int aErrorID); /** * @return the MetaID of the Block or the MetaTileEntity ID. */ - public int getMetaTileID(); + int getMetaTileID(); /** * Internal Usage only! */ - public int setMetaTileID(short aID); + int setMetaTileID(short aID); /** * @return the MetaTileEntity which is belonging to this, or null if it doesnt has one. */ - public IMetaTileEntity getMetaTileEntity(); + IMetaTileEntity getMetaTileEntity(); /** * Sets the MetaTileEntity. @@ -54,54 +54,54 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil * * @param aMetaTileEntity */ - public void setMetaTileEntity(IMetaTileEntity aMetaTileEntity); + void setMetaTileEntity(IMetaTileEntity aMetaTileEntity); /** * Causes a general Texture update. *

* Only used Client Side to mark Blocks dirty. */ - public void issueTextureUpdate(); + void issueTextureUpdate(); /** * Causes the Machine to send its initial Data, like Covers and its ID. */ - public void issueClientUpdate(); + void issueClientUpdate(); /** * causes Explosion. Strength in Overload-EU */ - public void doExplosion(long aExplosionEU); + void doExplosion(long aExplosionEU); /** * Sets the Block on Fire in all 6 Directions */ - public void setOnFire(); + void setOnFire(); /** * Sets the Block to Fire */ - public void setToFire(); + void setToFire(); /** * Sets the Owner of the Machine. Returns the set Name. */ - public String setOwnerName(String aName); + String setOwnerName(String aName); /** * gets the Name of the Machines Owner or "Player" if not set. */ - public String getOwnerName(); + String getOwnerName(); /** * Gets the UniqueID of the Machines Owner. */ - public UUID getOwnerUuid(); + UUID getOwnerUuid(); /** * Sets the UniqueID of the Machines Owner. */ - public void setOwnerUuid(UUID uuid); + void setOwnerUuid(UUID uuid); /** * Sets initial Values from NBT @@ -109,30 +109,30 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil * @param aNBT is the NBTTag of readFromNBT * @param aID is the MetaTileEntityID */ - public void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID); + void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID); /** * Called when leftclicking the TileEntity */ - public void onLeftclick(EntityPlayer aPlayer); + void onLeftclick(EntityPlayer aPlayer); /** * Called when rightclicking the TileEntity */ - public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float par1, float par2, float par3); + boolean onRightclick(EntityPlayer aPlayer, byte aSide, float par1, float par2, float par3); - public float getBlastResistance(byte aSide); + float getBlastResistance(byte aSide); - public ArrayList getDrops(); + ArrayList getDrops(); /** * 255 = 100% */ - public int getLightOpacity(); + int getLightOpacity(); - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider); + void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider); - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); + AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); + void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java index 3bd8b0429c..42df520ff4 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasInventory.java @@ -8,12 +8,12 @@ public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords /** * if the Inventory of this TileEntity got modified this tick */ - public boolean hasInventoryBeenModified(); + boolean hasInventoryBeenModified(); /** * if this is just a Holoslot */ - public boolean isValidSlot(int aIndex); + boolean isValidSlot(int aIndex); /** * Tries to add a Stack to the Slot. @@ -21,7 +21,7 @@ public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords * * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added */ - public boolean addStackToSlot(int aIndex, ItemStack aStack); + boolean addStackToSlot(int aIndex, ItemStack aStack); /** * Tries to add X Items of a Stack to the Slot. @@ -29,5 +29,5 @@ public interface IHasInventory extends ISidedInventory, IHasWorldObjectAndCoords * * @return true if aStack == null, then false if aIndex is out of bounds, then false if aStack cannot be added, and then true if aStack has been added */ - public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount); + boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java index c86ac0f33f..9b7489cf00 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IHasWorldObjectAndCoords.java @@ -17,153 +17,153 @@ import net.minecraftforge.fluids.IFluidHandler; * Note: It doesn't have to be a TileEntity in certain cases! And only certain cases, such as the Recipe checking of the findRecipe Function. */ public interface IHasWorldObjectAndCoords { - public World getWorld(); + World getWorld(); - public int getXCoord(); + int getXCoord(); - public short getYCoord(); + short getYCoord(); - public int getZCoord(); + int getZCoord(); - public boolean isServerSide(); + boolean isServerSide(); - public boolean isClientSide(); + boolean isClientSide(); - public int getRandomNumber(int aRange); + int getRandomNumber(int aRange); - public TileEntity getTileEntity(int aX, int aY, int aZ); + TileEntity getTileEntity(int aX, int aY, int aZ); - public TileEntity getTileEntityOffset(int aX, int aY, int aZ); + TileEntity getTileEntityOffset(int aX, int aY, int aZ); - public TileEntity getTileEntityAtSide(byte aSide); + TileEntity getTileEntityAtSide(byte aSide); - public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance); + TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance); - public IInventory getIInventory(int aX, int aY, int aZ); + IInventory getIInventory(int aX, int aY, int aZ); - public IInventory getIInventoryOffset(int aX, int aY, int aZ); + IInventory getIInventoryOffset(int aX, int aY, int aZ); - public IInventory getIInventoryAtSide(byte aSide); + IInventory getIInventoryAtSide(byte aSide); - public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance); + IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance); - public IFluidHandler getITankContainer(int aX, int aY, int aZ); + IFluidHandler getITankContainer(int aX, int aY, int aZ); - public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ); + IFluidHandler getITankContainerOffset(int aX, int aY, int aZ); - public IFluidHandler getITankContainerAtSide(byte aSide); + IFluidHandler getITankContainerAtSide(byte aSide); - public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance); + IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance); - public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ); + IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ); - public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ); + IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ); - public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide); + IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide); - public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance); + IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance); - public Block getBlock(int aX, int aY, int aZ); + Block getBlock(int aX, int aY, int aZ); - public Block getBlockOffset(int aX, int aY, int aZ); + Block getBlockOffset(int aX, int aY, int aZ); - public Block getBlockAtSide(byte aSide); + Block getBlockAtSide(byte aSide); - public Block getBlockAtSideAndDistance(byte aSide, int aDistance); + Block getBlockAtSideAndDistance(byte aSide, int aDistance); - public byte getMetaID(int aX, int aY, int aZ); + byte getMetaID(int aX, int aY, int aZ); - public byte getMetaIDOffset(int aX, int aY, int aZ); + byte getMetaIDOffset(int aX, int aY, int aZ); - public byte getMetaIDAtSide(byte aSide); + byte getMetaIDAtSide(byte aSide); - public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance); + byte getMetaIDAtSideAndDistance(byte aSide, int aDistance); - public byte getLightLevel(int aX, int aY, int aZ); + byte getLightLevel(int aX, int aY, int aZ); - public byte getLightLevelOffset(int aX, int aY, int aZ); + byte getLightLevelOffset(int aX, int aY, int aZ); - public byte getLightLevelAtSide(byte aSide); + byte getLightLevelAtSide(byte aSide); - public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance); + byte getLightLevelAtSideAndDistance(byte aSide, int aDistance); - public boolean getOpacity(int aX, int aY, int aZ); + boolean getOpacity(int aX, int aY, int aZ); - public boolean getOpacityOffset(int aX, int aY, int aZ); + boolean getOpacityOffset(int aX, int aY, int aZ); - public boolean getOpacityAtSide(byte aSide); + boolean getOpacityAtSide(byte aSide); - public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance); + boolean getOpacityAtSideAndDistance(byte aSide, int aDistance); - public boolean getSky(int aX, int aY, int aZ); + boolean getSky(int aX, int aY, int aZ); - public boolean getSkyOffset(int aX, int aY, int aZ); + boolean getSkyOffset(int aX, int aY, int aZ); - public boolean getSkyAtSide(byte aSide); + boolean getSkyAtSide(byte aSide); - public boolean getSkyAtSideAndDistance(byte aSide, int aDistance); + boolean getSkyAtSideAndDistance(byte aSide, int aDistance); - public boolean getAir(int aX, int aY, int aZ); + boolean getAir(int aX, int aY, int aZ); - public boolean getAirOffset(int aX, int aY, int aZ); + boolean getAirOffset(int aX, int aY, int aZ); - public boolean getAirAtSide(byte aSide); + boolean getAirAtSide(byte aSide); - public boolean getAirAtSideAndDistance(byte aSide, int aDistance); + boolean getAirAtSideAndDistance(byte aSide, int aDistance); - public BiomeGenBase getBiome(); + BiomeGenBase getBiome(); - public BiomeGenBase getBiome(int aX, int aZ); + BiomeGenBase getBiome(int aX, int aZ); - public int getOffsetX(byte aSide, int aMultiplier); + int getOffsetX(byte aSide, int aMultiplier); - public short getOffsetY(byte aSide, int aMultiplier); + short getOffsetY(byte aSide, int aMultiplier); - public int getOffsetZ(byte aSide, int aMultiplier); + int getOffsetZ(byte aSide, int aMultiplier); /** * Checks if the TileEntity is Invalid or Unloaded. Stupid Minecraft cannot do that btw. */ - public boolean isDead(); + boolean isDead(); /** * Sends a Block Event to the Client TileEntity, the byte Parameters are only for validation as Minecraft doesn't properly write Packet Data. */ - public void sendBlockEvent(byte aID, byte aValue); + void sendBlockEvent(byte aID, byte aValue); /** * @return the Time this TileEntity has been loaded. */ - public long getTimer(); + long getTimer(); /** * Sets the Light Level of this Block on a Scale of 0 - 15 * It could be that it doesn't work. This is just for convenience. */ - public void setLightValue(byte aLightValue); + void setLightValue(byte aLightValue); /** * Function of the regular TileEntity */ - public void writeToNBT(NBTTagCompound aNBT); + void writeToNBT(NBTTagCompound aNBT); /** * Function of the regular TileEntity */ - public void readFromNBT(NBTTagCompound aNBT); + void readFromNBT(NBTTagCompound aNBT); /** * Function of the regular TileEntity */ - public boolean isInvalidTileEntity(); + boolean isInvalidTileEntity(); /** * Opens the GUI with this ID of this MetaTileEntity */ - public boolean openGUI(EntityPlayer aPlayer, int aID); + boolean openGUI(EntityPlayer aPlayer, int aID); /** * Opens the GUI with the ID = 0 of this TileEntity */ - public boolean openGUI(EntityPlayer aPlayer); + boolean openGUI(EntityPlayer aPlayer); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java index bb34419357..c7f6fe5f23 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java @@ -12,5 +12,5 @@ public interface IMachineBlockUpdateable { * I suggest to wait 1-5 seconds before actually checking the Machine Parts. * RP-Frames could for example cause Problems when you instacheck the Machine Parts. */ - public void onMachineBlockUpdate(); + void onMachineBlockUpdate(); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java index 00bb7b9a7d..588158d16c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java @@ -7,63 +7,63 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords { /** * returns the Progress this Machine has made. Warning, this can also be negative! */ - public int getProgress(); + int getProgress(); /** * returns the Progress the Machine needs to complete its task. */ - public int getMaxProgress(); + int getMaxProgress(); /** * increases the Progress of the Machine */ - public boolean increaseProgress(int aProgressAmountInTicks); + boolean increaseProgress(int aProgressAmountInTicks); /** * returns if the Machine currently does something. */ - public boolean hasThingsToDo(); + boolean hasThingsToDo(); /** * returns if the Machine just got enableWorking called after being disabled. * Used for Translocators, which need to check if they need to transfer immediately. */ - public boolean hasWorkJustBeenEnabled(); + boolean hasWorkJustBeenEnabled(); /** * allows Machine to work */ - public void enableWorking(); + void enableWorking(); /** * disallows Machine to work */ - public void disableWorking(); + void disableWorking(); /** * if the Machine is allowed to Work */ - public boolean isAllowedToWork(); + boolean isAllowedToWork(); /** * used to control Machines via Redstone Signal Strength by special Covers * In case of 0 the Machine is very likely doing nothing, or is just not being controlled at all. */ - public byte getWorkDataValue(); + byte getWorkDataValue(); /** * used to control Machines via Redstone Signal Strength by special Covers * only Values between 0 and 15! */ - public void setWorkDataValue(byte aValue); + void setWorkDataValue(byte aValue); /** * gives you the Active Status of the Machine */ - public boolean isActive(); + boolean isActive(); /** * sets the visible Active Status of the Machine */ - public void setActive(boolean aActive); + void setActive(boolean aActive); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java index 6618e4b4fd..909f4077f0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java @@ -3,9 +3,9 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.interfaces.ITexture; public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity { - public float getThickNess(); + float getThickNess(); - public byte getConnections(); + byte getConnections(); - public ITexture[] getTextureUncovered(byte aSide); + ITexture[] getTextureUncovered(byte aSide); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java index f5b0f76bad..8c644be2e6 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneReceiver.java @@ -10,20 +10,20 @@ public interface IRedstoneReceiver extends IHasWorldObjectAndCoords { * Do not use this if ICoverable is implemented. ICoverable has @getInternalInputRedstoneSignal for Machine internal Input Redstone * This returns the true incoming Redstone Signal. Only Cover Behaviors should check it, not MetaTileEntities. */ - public byte getInputRedstoneSignal(byte aSide); + byte getInputRedstoneSignal(byte aSide); /** * gets the strongest Redstone Level the TileEntity receives */ - public byte getStrongestRedstone(); + byte getStrongestRedstone(); /** * gets if the TileEntity receives Redstone */ - public boolean getRedstone(); + boolean getRedstone(); /** * gets if the TileEntity receives Redstone at this Side */ - public boolean getRedstone(byte aSide); + boolean getRedstone(byte aSide); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java index f1cf01d291..6100572a7d 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRedstoneTileEntity.java @@ -13,5 +13,5 @@ public interface IRedstoneTileEntity extends IRedstoneEmitter, IRedstoneReceiver * Causes a general Block update. * Sends nothing to Client, just causes a Block Update. */ - public void issueBlockUpdate(); + void issueBlockUpdate(); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java index 048ddbdd06..b16ae65548 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ITexturedTileEntity.java @@ -7,5 +7,5 @@ public interface ITexturedTileEntity { /** * @return the Textures rendered by the GT Rendering */ - public ITexture[] getTexture(Block aBlock, byte aSide); + ITexture[] getTexture(Block aBlock, byte aSide); } \ No newline at end of file -- cgit From 9bef8b3a8a8270db9c289c05c998e71273ca20fc Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 15 Apr 2020 19:01:06 +0200 Subject: Refactor to fixed thread pool executor Use actually something made for this task... --- src/main/java/gregtech/GT_Mod.java | 5 +- .../interfaces/metatileentity/IMetaTileEntity.java | 26 ++- .../interfaces/tileentity/IGregTechTileEntity.java | 21 ++ .../tileentity/IMachineBlockUpdateable.java | 7 + .../api/metatileentity/BaseMetaPipeEntity.java | 11 ++ .../api/metatileentity/BaseMetaTileEntity.java | 11 ++ .../api/metatileentity/MetaPipeEntity.java | 4 + .../api/metatileentity/MetaTileEntity.java | 1 - .../implementations/GT_MetaPipeEntity_Frame.java | 5 + .../threads/GT_Runnable_MachineBlockUpdate.java | 217 ++++++++------------- 10 files changed, 161 insertions(+), 147 deletions(-) (limited to 'src/main/java/gregtech/api/interfaces/tileentity') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 9272ed20e2..22b677337e 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -1189,7 +1189,7 @@ public class GT_Mod implements IGT_Mod { aEvent.registerServerCommand(new GT_Command()); //Sets a new Machine Block Update Thread everytime a world is loaded - GT_Runnable_MachineBlockUpdate.initThread(); + GT_Runnable_MachineBlockUpdate.initExecutorService(); } public boolean isServerSide() { @@ -1232,7 +1232,6 @@ public class GT_Mod implements IGT_Mod { @Mod.EventHandler public void onServerStopping(FMLServerStoppingEvent aEvent) { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { try { tRunnable.run(); @@ -1316,7 +1315,7 @@ public class GT_Mod implements IGT_Mod { } } //Interrupt IDLE Threads to close down cleanly - GT_Runnable_MachineBlockUpdate.getINSTANCETHREAD().interrupt(); + GT_Runnable_MachineBlockUpdate.shutdownExecutorService(); } private void addSolidFakeLargeBoilerFuels() { diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index a518b3baaf..f0ca426616 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; import net.minecraft.block.Block; @@ -31,7 +32,7 @@ import java.util.List; *

* Don't implement this yourself and expect it to work. Extend @MetaTileEntity itself. */ -public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity { +public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity, IMachineBlockUpdateable { /** * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. *

@@ -233,11 +234,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand */ boolean isAccessAllowed(EntityPlayer aPlayer); - /** - * When a Machine Update occurs - */ - void onMachineBlockUpdate(); - /** * a Player rightclicks the Machine * Sneaky rightclicks are not getting passed to this! @@ -408,4 +404,22 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand String getAlternativeModeText(); boolean shouldJoinIc2Enet(); + + /** + * The Machine Update, which is called when the Machine needs an Update of its Parts. + * I suggest to wait 1-5 seconds before actually checking the Machine Parts. + * RP-Frames could for example cause Problems when you instacheck the Machine Parts. + * + * just do stuff since we are already in meta tile... + */ + @Override + void onMachineBlockUpdate(); + + /** + * just return in should recurse since we are already in meta tile... + */ + @Override + default boolean isMachineBlockUpdateRecursive(){ + return true; + } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index af9ead9543..8e135fbc85 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -135,4 +135,25 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); + + /** + * Checks validity of meta tile and delegates to it + */ + @Override + default void onMachineBlockUpdate(){ + if(!isDead() && getMetaTileEntity()!=null && + getMetaTileEntity().getBaseMetaTileEntity()==this){ + getMetaTileEntity().onMachineBlockUpdate(); + } + } + + /** + * Checks validity of meta tile and delegates to it + */ + @Override + default boolean isMachineBlockUpdateRecursive() { + return !isDead() && getMetaTileEntity()!=null && + getMetaTileEntity().getBaseMetaTileEntity()==this && + getMetaTileEntity().isMachineBlockUpdateRecursive(); + } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java index c7f6fe5f23..31590f3d57 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java @@ -13,4 +13,11 @@ public interface IMachineBlockUpdateable { * RP-Frames could for example cause Problems when you instacheck the Machine Parts. */ void onMachineBlockUpdate(); + + /** + * Should recurse? + */ + default boolean isMachineBlockUpdateRecursive(){ + return true; + } } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 881d4a814e..ae8fc7324d 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -584,11 +584,22 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE return stack; } + /** + * Checks validity of meta tile and delegates to it + */ @Override public void onMachineBlockUpdate() { if (canAccessData()) mMetaTileEntity.onMachineBlockUpdate(); } + /** + * Checks validity of meta tile and delegates to it + */ + @Override + public boolean isMachineBlockUpdateRecursive() { + return canAccessData() && mMetaTileEntity.isMachineBlockUpdateRecursive(); + } + @Override public int getProgress() { return canAccessData() ? mMetaTileEntity.getProgresstime() : 0; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 58a97f644a..1ae88ade41 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -913,11 +913,22 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return stack; } + /** + * Checks validity of meta tile and delegates to it + */ @Override public void onMachineBlockUpdate() { if (canAccessData()) mMetaTileEntity.onMachineBlockUpdate(); } + /** + * Checks validity of meta tile and delegates to it + */ + @Override + public boolean isMachineBlockUpdateRecursive() { + return canAccessData() && mMetaTileEntity.isMachineBlockUpdateRecursive(); + } + @Override public int getProgress() { return canAccessData() ? mMetaTileEntity.getProgresstime() : 0; diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 6614cca210..9fa16b9890 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -840,4 +840,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public boolean shouldJoinIc2Enet() { return false; } + @Override + public boolean isMachineBlockUpdateRecursive() { + return false; + } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 1753d2677c..d08a8d9da5 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -85,7 +85,6 @@ public abstract class MetaTileEntity implements IMetaTileEntity { getBaseMetaTileEntity().setMetaTileID((short) aID); GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); mInventory = new ItemStack[aInvSlotCount]; - } /** diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index 9db9ad910e..7074d63422 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -97,4 +97,9 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public void disconnect(byte aSide) {/* Do nothing*/} + + @Override + public boolean isMachineBlockUpdateRecursive() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index c811f3a614..fedf13673d 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -1,152 +1,90 @@ package gregtech.api.threads; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import java.util.HashSet; -import java.util.Queue; import java.util.Set; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; public class GT_Runnable_MachineBlockUpdate implements Runnable { - - private static int mX; - private static int mY; - private static int mZ; - private static World mWorld; - private static final Set mVisited = new HashSet<>(80); + //used by runner thread + private final int x, y, z; + private final World world; + private final Set visited = new HashSet<>(80); //Threading - private static boolean allowedToRun; //makes if this thread is idle - private static final Queue toUpdate = new ConcurrentLinkedQueue<>(); //blocks added while this thread ran - private static Thread INSTANCETHREAD; //Instance of this thread + private static final ThreadFactory THREAD_FACTORY= r -> { + Thread thread=new Thread(r); + thread.setName("GT_MachineBlockUpdate"); + return thread; + }; + private static ExecutorService EXECUTOR_SERVICE; //This class should never be initiated outside of this class! - private GT_Runnable_MachineBlockUpdate() { - } - - public static synchronized void setmX(int mX) { - GT_Runnable_MachineBlockUpdate.mX = mX; - } - - public static synchronized void setmY(int mY) { - GT_Runnable_MachineBlockUpdate.mY = mY; - } - - public static synchronized void setmZ(int mZ) { - GT_Runnable_MachineBlockUpdate.mZ = mZ; - } - - public static synchronized void setmWorld(World mWorld) { - GT_Runnable_MachineBlockUpdate.mWorld = mWorld; + private GT_Runnable_MachineBlockUpdate(World aWorld, int aX, int aY, int aZ) { + this.world = aWorld; + this.x = aX; + this.y = aY; + this.z = aZ; } /** - * Clears the mVisited HashSet + * If the thread is idle, sets new values and remove the idle flag, otherwise, queue the cooridinates. */ - public static synchronized void resetVisited() { - synchronized (GT_Runnable_MachineBlockUpdate.mVisited) { - GT_Runnable_MachineBlockUpdate.mVisited.clear(); - } + public static void setMachineUpdateValues(World aWorld, int aX, int aY, int aZ) { + EXECUTOR_SERVICE.submit(new GT_Runnable_MachineBlockUpdate(aWorld,aX,aY,aZ)); } - /** - * Never call this Method without checking if the thead is NOT allowed to run! - */ - private static void setMachineUpdateValuesUnsafe(World aWorld, int aX, int aY, int aZ){ - setmZ(aZ); - setmY(aY); - setmX(aX); - setmWorld(aWorld); - resetVisited(); - setAllowedToRun(true); - synchronized (toUpdate) { - if (getINSTANCETHREAD().getState() == Thread.State.WAITING) - toUpdate.notify(); - } + public static void initExecutorService() { + EXECUTOR_SERVICE = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),THREAD_FACTORY); + //Executors.newSingleThreadExecutor(THREAD_FACTORY); + //Executors.newCachedThreadPool(THREAD_FACTORY); + //Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),THREAD_FACTORY); } - /** - * If the thread is idleing, sets new values and remove the idle flag, otherwise, queue the cooridinates. - */ - public static synchronized void setMachineUpdateValues(World aWorld, int aX, int aY, int aZ) { - if (GT_Runnable_MachineBlockUpdate.isAllowedToRun()) { - toUpdate.add(new Coordinates(aX, aY, aZ, aWorld)); - } else { - GT_Runnable_MachineBlockUpdate.setMachineUpdateValuesUnsafe(aWorld, aX, aY, aZ); - } - } - - public static class Coordinates { - - protected final int mX; - protected final int mY; - protected final int mZ; - protected final World mWorld; - - public Coordinates(int mX, int mY, int mZ, World mWorld) { - this.mX = mX; - this.mY = mY; - this.mZ = mZ; - this.mWorld = mWorld; - } - - /** - * Updated the Main Update Thread while its Idle - */ - public void update() { - GT_Runnable_MachineBlockUpdate.setMachineUpdateValues(this.mWorld,this.mX,this.mY,this.mZ); + public static void shutdownExecutorService() { + try { + EXECUTOR_SERVICE.awaitTermination(60, TimeUnit.SECONDS); + } catch (InterruptedException e) { + GT_Mod.GT_FML_LOGGER.error("Well this interruption got interrupted...", e); } - } - - public static synchronized boolean isAllowedToRun() { - return allowedToRun; - } - - public static synchronized void setAllowedToRun(boolean unlocked) { - GT_Runnable_MachineBlockUpdate.allowedToRun = unlocked; - } - - public static synchronized void initThread() { - GT_Runnable_MachineBlockUpdate.INSTANCETHREAD = new Thread(new GT_Runnable_MachineBlockUpdate(), "GT Machine Block Updates"); - GT_Runnable_MachineBlockUpdate.INSTANCETHREAD.start(); - } - - public static synchronized Thread getINSTANCETHREAD() { - return INSTANCETHREAD; + //terminates executor permanently + EXECUTOR_SERVICE.shutdownNow(); } private boolean shouldRecurse(TileEntity aTileEntity, int aX, int aY, int aZ) { - if (aTileEntity instanceof IGregTechTileEntity) { - // Stop recursion on GregTech cables, item pipes, and fluid pipes - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aTileEntity).getMetaTileEntity(); - if ((tMetaTileEntity instanceof GT_MetaPipeEntity_Cable) || - (tMetaTileEntity instanceof GT_MetaPipeEntity_Fluid) || - (tMetaTileEntity instanceof GT_MetaPipeEntity_Item)) - return false; + //no check on IGregTechTileEntity as it should call the underlying meta tile isMachineBlockUpdateRecursive + //if (aTileEntity instanceof IGregTechTileEntity) { + // return ((IGregTechTileEntity) aTileEntity).isMachineBlockUpdateRecursive(); + //} + return (aTileEntity instanceof IMachineBlockUpdateable && + ((IMachineBlockUpdateable) aTileEntity).isMachineBlockUpdateRecursive()) || + GregTech_API.isMachineBlock(world.getBlock(aX, aY, aZ), world.getBlockMetadata(aX, aY, aZ)); + } + + private void causeUpdate(TileEntity tileEntity){ + //no check for IGregTechTileEntity as it should call the underlying meta tile onMachineBlockUpdate + if (tileEntity instanceof IMachineBlockUpdateable) { + ((IMachineBlockUpdateable) tileEntity).onMachineBlockUpdate(); } - - return (aTileEntity instanceof IMachineBlockUpdateable) || - GregTech_API.isMachineBlock(mWorld.getBlock(aX, aY, aZ), mWorld.getBlockMetadata(aX, aY, aZ)); } private void stepToUpdateMachine(int aX, int aY, int aZ) { - if (!mVisited.add(new ChunkPosition(aX, aY, aZ))) + if (!visited.add(new ChunkPosition(aX, aY, aZ))) return; + TileEntity tTileEntity = world.getTileEntity(aX, aY, aZ); - TileEntity tTileEntity = mWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IMachineBlockUpdateable) - ((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate(); + causeUpdate(tTileEntity); - if (mVisited.size() < 5 || shouldRecurse(tTileEntity, aX, aY, aZ)) { + if (visited.size() < 5 || shouldRecurse(tTileEntity, aX, aY, aZ)) { stepToUpdateMachine(aX + 1, aY, aZ); stepToUpdateMachine(aX - 1, aY, aZ); stepToUpdateMachine(aX, aY + 1, aZ); @@ -154,33 +92,38 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { stepToUpdateMachine(aX, aY, aZ + 1); stepToUpdateMachine(aX, aY, aZ - 1); } - } @Override public void run() { - for(;;) { //infinite loop - if (isAllowedToRun()) {//Are we ready to work? - try { - stepToUpdateMachine(mX, mY, mZ); - } catch (Throwable e) {/**/} - setAllowedToRun(false); //Work is finished, wait for new Coords. - } else { - //Checkes if the Update Queue has members - //DO NOT USE OPTIONALS HERE! - synchronized (toUpdate) { - Coordinates coordinates = toUpdate.poll(); - if (coordinates != null) { - coordinates.update(); - } else { - try { - toUpdate.wait(); - } catch (InterruptedException ignored) { - return; - } - } - } - } + try { + stepToUpdateMachine(x, y, z); + } catch (Exception e) { + GT_Mod.GT_FML_LOGGER.error("Well this update was broken... " + new Coordinates(x,y,z,world), e); + } + } + + public static class Coordinates { + public final int mX; + public final int mY; + public final int mZ; + public final World mWorld; + + public Coordinates(int mX, int mY, int mZ, World mWorld) { + this.mX = mX; + this.mY = mY; + this.mZ = mZ; + this.mWorld = mWorld; + } + + @Override + public String toString() { + return "Coordinates{" + + "mX=" + mX + + ", mY=" + mY + + ", mZ=" + mZ + + ", mWorld=" + mWorld.getProviderName()+ " @dimId " + mWorld.provider.dimensionId + + '}'; } } } \ No newline at end of file -- cgit From b1f29c6c04170c322cc2f7631147a4c8f86160cd Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Sun, 3 May 2020 23:55:23 +0200 Subject: Added cover guis for pump/filter --- src/main/java/gregtech/api/gui/GT_GUICover.java | 185 +++++++++++++++++++++ .../api/gui/widgets/GT_GuiFakeItemButton.java | 63 +++++++ .../java/gregtech/api/gui/widgets/GT_GuiIcon.java | 77 +++++++++ .../gregtech/api/gui/widgets/GT_GuiIconButton.java | 111 +++++++++++++ .../gregtech/api/gui/widgets/GT_GuiTooltip.java | 37 +++++ .../api/gui/widgets/GT_GuiTooltipManager.java | 71 ++++++++ .../java/gregtech/api/interfaces/IGuiScreen.java | 35 ++++ .../api/interfaces/tileentity/ICoverable.java | 5 + .../api/metatileentity/BaseMetaPipeEntity.java | 24 ++- .../api/metatileentity/BaseMetaTileEntity.java | 24 ++- .../api/net/GT_Packet_TileEntityCover.java | 99 +++++++++++ .../api/net/GT_Packet_TileEntityCoverGUI.java | 125 ++++++++++++++ .../java/gregtech/api/util/GT_CoverBehavior.java | 18 ++ src/main/java/gregtech/common/GT_Client.java | 2 +- src/main/java/gregtech/common/GT_Network.java | 2 +- src/main/java/gregtech/common/GT_Proxy.java | 20 ++- .../common/covers/GT_Cover_Fluidfilter.java | 173 ++++++++++++++++--- .../java/gregtech/common/covers/GT_Cover_Pump.java | 170 ++++++++++++++++--- .../assets/gregtech/textures/gui/GuiButtons.png | Bin 0 -> 9499 bytes .../assets/gregtech/textures/gui/GuiCover.png | Bin 0 -> 6998 bytes 20 files changed, 1187 insertions(+), 54 deletions(-) create mode 100644 src/main/java/gregtech/api/gui/GT_GUICover.java create mode 100644 src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java create mode 100644 src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java create mode 100644 src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java create mode 100644 src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java create mode 100644 src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java create mode 100644 src/main/java/gregtech/api/interfaces/IGuiScreen.java create mode 100644 src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java create mode 100644 src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java create mode 100644 src/main/resources/assets/gregtech/textures/gui/GuiButtons.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/GuiCover.png (limited to 'src/main/java/gregtech/api/interfaces/tileentity') diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java new file mode 100644 index 0000000000..760d888c02 --- /dev/null +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -0,0 +1,185 @@ +package gregtech.api.gui; + +import gregtech.api.enums.Dyes; +import gregtech.api.gui.widgets.GT_GuiTooltip; +import gregtech.api.gui.widgets.GT_GuiTooltipManager; +import gregtech.api.gui.widgets.GT_GuiTooltipManager.GT_IToolTipRenderer; +import gregtech.api.interfaces.IGuiScreen; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRenderer, IGuiScreen { + + protected GT_GuiTooltipManager ttManager = new GT_GuiTooltipManager(); + + protected int gui_width = 176; + protected int gui_height = 107; + protected int guiTop, guiLeft; + protected boolean drawButtons = true; + private GuiButton selectedButton; + + protected List elements = new ArrayList<>(); + + public GT_GUICover() { + } + + public GT_GUICover(int width, int height) { + this.gui_width = width; + this.gui_height = height; + } + + @Override + public void initGui() { + guiLeft = (this.width - this.gui_width) / 2; + guiTop = (this.height - this.gui_height) / 2; + + for (IGuiElement element : elements) { + element.onInit(); + + if (element instanceof GuiButton) + buttonList.add(element); + } + + onInitGui(guiLeft, guiTop, gui_width, gui_height); + } + + protected abstract void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height); + + @Override + public void drawScreen(int mouseX, int mouseY, float parTicks) { + drawDefaultBackground(); + + drawBackground(mouseX, mouseY, parTicks); + + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + if (drawButtons) { + RenderHelper.enableGUIStandardItemLighting(); + for (IGuiElement e : elements) + e.draw(mouseX, mouseY, parTicks); + } + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft, guiTop, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + GL11.glDisable(GL11.GL_LIGHTING); + drawForegroundLayer(mouseX, mouseY, parTicks); + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + + public void drawForegroundLayer(int mouseX, int mouseY, float parTicks) { + drawExtras(mouseX, mouseY, parTicks); + ttManager.onTick(this, mouseX, mouseY); + } + + public void drawBackground(int mouseX, int mouseY, float parTicks) { + short[] color = Dyes.MACHINE_METAL.getRGBA(); + GL11.glColor3ub((byte) color[0], (byte) color[1], (byte) color[2]); + this.mc.renderEngine.bindTexture(new ResourceLocation("gregtech:textures/gui/GuiCover.png")); + drawTexturedModalRect(guiLeft, guiTop, 0,0, gui_width, gui_height); + } + + public void drawExtras(int mouseX, int mouseY, float parTicks) {} + + @Override + public boolean doesGuiPauseGame() + { + return false; + } + + public void keyTyped(char p_73869_1_, int p_73869_2_) { + if (p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) { + this.mc.displayGuiScreen((GuiScreen) null); + this.mc.setIngameFocus(); + return; + } + super.keyTyped(p_73869_1_, p_73869_2_); + } + + @Override + public void addElement(IGuiElement element) { + if (elements.contains(element)) + return; + elements.add(element); + } + @Override + public boolean removeElement(IGuiElement element) { + return elements.remove(element); + } + + public void actionPerformed(GuiButton button) { + selectedButton = button; + } + + public void clearSelectedButton() { + selectedButton = null; + } + public GuiButton getSelectedButton(){return selectedButton;} + + public void buttonClicked(GuiButton button) { + + } + + public RenderItem getItemRenderer() { + return itemRender; + } + + /** + * GT_IToolTipRenderer + */ + @Override + public void drawHoveringText(List par1List, int par2, int par3, FontRenderer render) { + super.drawHoveringText(par1List, par2, par3, render); + } + @Override + public FontRenderer getFontRenderer() { + return super.fontRendererObj; + } + @Override + public void addToolTip(GT_GuiTooltip toolTip) { + ttManager.addToolTip(toolTip); + } + @Override + public boolean removeToolTip(GT_GuiTooltip toolTip) { + return ttManager.removeToolTip(toolTip); + } + + /** + * Junk + */ + @Override + public int getGuiTop() { + return guiTop; + } + @Override + public int getGuiLeft() { + return guiLeft; + } + @Override + public int getXSize() { + return gui_width; + } + @Override + public int getYSize() { + return gui_height; + } +} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java new file mode 100644 index 0000000000..25af30965a --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiFakeItemButton.java @@ -0,0 +1,63 @@ +package gregtech.api.gui.widgets; + +import gregtech.api.interfaces.IGuiScreen; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class GT_GuiFakeItemButton implements IGuiScreen.IGuiElement { + + private final GT_GuiIcon bgIcon; + private ItemStack item; + private IGuiScreen gui; + private int x0, y0, xPosition, yPosition; + private int width, height; + + public GT_GuiFakeItemButton(IGuiScreen gui, int x, int y, GT_GuiIcon bgIcon) { + this.gui = gui; + this.x0 = x; + this.y0 = y; + this.bgIcon = bgIcon; + item = null; + width = 18; + height = 18; + gui.addElement(this); + } + + public void setItem(ItemStack i) { + item = i; + } + + public ItemStack getItem(){ + return item; + } + + @Override + public void onInit() { + xPosition = x0 + gui.getGuiLeft(); + yPosition = y0 + gui.getGuiTop(); + } + + @Override + public void draw(int mouseX, int mouseY, float parTicks) { + GL11.glColor4f(1, 1, 1, 1); + GL11.glPushAttrib(GL11.GL_ENABLE_BIT); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + if (bgIcon != null){ + GT_GuiIcon.render(bgIcon, xPosition-1, yPosition-1, 18, 18,0,true); + } + + if (item != null) + gui.getItemRenderer().renderItemAndEffectIntoGUI(gui.getFontRenderer(), Minecraft.getMinecraft().getTextureManager(), item, xPosition, yPosition); + + GL11.glPopAttrib(); + } + + public Rectangle getBounds() { + return new Rectangle(x0, y0, width, height); + } +} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java new file mode 100644 index 0000000000..1c31462e62 --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java @@ -0,0 +1,77 @@ +package gregtech.api.gui.widgets; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; + +public enum GT_GuiIcon { + BUTTON_NORMAL (0, 0, 0), + BUTTON_DOWN (0, 32, 0), + BUTTON_HIGHLIGHT (0, 32*2, 0), + BUTTON_HIGHLIGHT_DOWN (0, 32*3, 0), + BUTTON_DISABLED (0, 32*4, 0), + + DISABLE (0, 0, 32), + REDSTONE_OFF (0, 32, 32), + REDSTONE_ON (0, 32*2, 32), + CHECKMARK (0, 32*3, 32), + CROSS (0, 32*4, 32), + WHITELIST (0, 32*5, 32), + BLACKLIST (0, 32*6, 32), + + EXPORT (0, 0, 32*2), + IMPORT (0, 32, 32*2), + ALLOW_INPUT (0, 32*2, 32*2), + BLOCK_INPUT (0, 32*3, 32*2), + + SLOT_DARKGRAY (1, 176,0,18,18), + SLOT_GRAY (1, 176,18,18,18); + + private static final int T_SIZE = 256; + private static final ResourceLocation[] TEXTURES = { + new ResourceLocation("gregtech", "textures/gui/GuiButtons.png"), + new ResourceLocation("gregtech", "textures/gui/GuiCover.png") + }; + + public final int x, y, width, height; + public final GT_GuiIcon overlay; + private final int texID; + + GT_GuiIcon(int texID, int x, int y, int width, int height, GT_GuiIcon overlay) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.overlay = overlay; + this.texID = texID; + } + + GT_GuiIcon(int texID, int x, int y) { + this(texID, x, y,32,32,null); + } + GT_GuiIcon(int texID, int x, int y, int width, int height) { + this(texID, x, y, width, height,null); + } + + public static void render(GT_GuiIcon icon, double x, double y, double width, double height, double zLevel, boolean doDraw) { + Tessellator tess = Tessellator.instance; + if (doDraw) { + Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURES[icon.texID]); + tess.startDrawingQuads(); + } + double minU = (double) icon.x / T_SIZE; + double maxU = (double) (icon.x + icon.width) / T_SIZE; + double minV = (double) icon.y / T_SIZE; + double maxV = (double) (icon.y + icon.height) / T_SIZE; + tess.addVertexWithUV(x, y + height, zLevel, minU, maxV); + tess.addVertexWithUV(x + width, y + height, zLevel, maxU, maxV); + tess.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV); + tess.addVertexWithUV(x, y + 0, zLevel, minU, minV); + + if (icon.overlay != null) + render(icon.overlay, x, y, width, height, zLevel, false); + + if (doDraw) + tess.draw(); + } +} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java new file mode 100644 index 0000000000..bd1e921592 --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIconButton.java @@ -0,0 +1,111 @@ +package gregtech.api.gui.widgets; + +import gregtech.api.interfaces.IGuiScreen; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import org.lwjgl.opengl.GL11; +import java.awt.Rectangle; + +public class GT_GuiIconButton extends GuiButton implements IGuiScreen.IGuiElement { + public static final int DEFAULT_WIDTH = 16; + public static final int DEFAULT_HEIGHT = 16; + + protected GT_GuiIcon icon; + private int x0, y0; + private IGuiScreen gui; + private String[] tooltipText; + + private GT_GuiTooltip tooltip; + + + public GT_GuiIconButton(IGuiScreen gui, int id, int x, int y, GT_GuiIcon icon) { + super(id, x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT, ""); + this.gui = gui; + this.icon = icon; + this.x0 = x; + this.y0 = y; + gui.addElement(this); + } + + public void onInit() { + if (tooltip != null) + gui.addToolTip(tooltip); + xPosition = x0 + gui.getGuiLeft(); + yPosition = y0 + gui.getGuiTop(); + } + + @Override + public void draw(int mouseX, int mouseY, float parTicks) { + drawButton(Minecraft.getMinecraft(), mouseX, mouseY); + } + + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + if (this.tooltip != null) + this.tooltip.enabled = true; + + if (this.visible) { + //moused over + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + width && mouseY < this.yPosition + height; + + mouseDragged(mc, mouseX, mouseY); + + GL11.glPushAttrib(GL11.GL_ENABLE_BIT); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + int x = xPosition; + int y = yPosition; + if(!this.field_146123_n) { + GL11.glColor4f(160F/255F, 170F/255F, 1, 1); + } + else + GL11.glColor4f(1, 1, 1, 1); + + GT_GuiIcon.render(getButtonTexture(this.field_146123_n), x, y, width, height, 0, true); + + GL11.glColor4f(1, 1, 1, 1); + if (icon != null) { + GT_GuiIcon.render(icon, x, y, width, height , 0, true); + } + + GL11.glPopAttrib(); + } + } + + @Override + public void mouseReleased(int mouseX, int mouseY) { + this.gui.clearSelectedButton(); + if(mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) + this.gui.buttonClicked(this); + } + + public GT_GuiIcon getButtonTexture(boolean mouseOver) { + if (!enabled) + return GT_GuiIcon.BUTTON_DISABLED; + if (this.equals(this.gui.getSelectedButton())) + return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT_DOWN : GT_GuiIcon.BUTTON_DOWN; + else + return mouseOver ? GT_GuiIcon.BUTTON_HIGHLIGHT : GT_GuiIcon.BUTTON_NORMAL; + } + + public GT_GuiIcon getIcon() { + return icon; + } + + public GT_GuiTooltip getTooltip() { + return tooltip; + } + + public GT_GuiIconButton setTooltipText(String... text) { + if (tooltip == null) + tooltip = new GT_GuiTooltip(getBounds(), text); + else + tooltip.setToolTipText(text); + this.tooltipText = text; + return this; + } + + public Rectangle getBounds() { + return new Rectangle(x0, y0, width, height); + } +} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java new file mode 100644 index 0000000000..d24437f018 --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltip.java @@ -0,0 +1,37 @@ +package gregtech.api.gui.widgets; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class GT_GuiTooltip { + + protected Rectangle bounds; + private List text; + public boolean enabled = true; + + public GT_GuiTooltip(Rectangle bounds, String... text) { + this.bounds = bounds; + setToolTipText(text); + } + + protected void updateText() { + } + + public void setToolTipText(String... text) { + if (text != null) { + this.text = new ArrayList<>(text.length); + for (int i = 0; i < text.length; i++) { + if (i == 0) + this.text.add("\u00a7f" + text[i]); + else + this.text.add("\u00a77" + text[i]); + } + } else + this.text = new ArrayList<>(); + } + + public List getToolTipText() { + return text; + } +} diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java new file mode 100644 index 0000000000..d0e6964abc --- /dev/null +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiTooltipManager.java @@ -0,0 +1,71 @@ +package gregtech.api.gui.widgets; + +import net.minecraft.client.gui.FontRenderer; + +import java.util.ArrayList; +import java.util.List; + +public class GT_GuiTooltipManager { + public interface GT_IToolTipRenderer { + int getGuiLeft(); + int getGuiTop(); + int getXSize(); + FontRenderer getFontRenderer(); + void drawHoveringText(List par1List, int par2, int par3, FontRenderer font); + } + + private static final long DELAY = 5; + private int mouseStopped; + private int lastMouseX = -1; + private int lastMouseY = -1; + private final List tips = new ArrayList<>(); + + public void addToolTip(GT_GuiTooltip tip) { + if (!tips.contains(tip)) tips.add(tip); + } + + public boolean removeToolTip(GT_GuiTooltip tip) { + return tips.remove(tip); + } + + public final void onTick(GT_IToolTipRenderer render, int mouseX, int mouseY) { + if ((Math.abs(mouseX-lastMouseX) < 2 ) && (Math.abs(mouseY-lastMouseY) < 2 )) + mouseStopped = Math.min(mouseStopped+1, 50); + else + mouseStopped = 0; + + lastMouseX = mouseX; + lastMouseY = mouseY; + + if (mouseStopped > DELAY) + mouseX -= render.getGuiLeft(); + mouseY -= render.getGuiTop(); + for (GT_GuiTooltip tip : tips) { + if(tip.enabled && tip.bounds.contains(mouseX, mouseY)){ + tip.updateText(); + drawTooltip(tip, mouseX, mouseY, render); + break; + } + } + } + + private void drawTooltip(GT_GuiTooltip tip, int mouseX, int mouseY, GT_IToolTipRenderer render) { + List text = tip.getToolTipText(); + if (text == null) + return; + + if (mouseX > render.getGuiLeft() + render.getXSize()/2) { + int maxWidth = 0; + for (String s : text) { + int w = render.getFontRenderer().getStringWidth(s); + if (w > maxWidth) { + maxWidth = w; + } + } + mouseX -= (maxWidth + 18); + } + + render.drawHoveringText(text, mouseX, mouseY, render.getFontRenderer()); + } + +} diff --git a/src/main/java/gregtech/api/interfaces/IGuiScreen.java b/src/main/java/gregtech/api/interfaces/IGuiScreen.java new file mode 100644 index 0000000000..d0089afbb8 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IGuiScreen.java @@ -0,0 +1,35 @@ +package gregtech.api.interfaces; + +import gregtech.api.gui.widgets.GT_GuiTooltip; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.entity.RenderItem; + + +public interface IGuiScreen { + + interface IGuiElement { + void onInit(); + void draw(int mouseX, int mouseY, float parTicks); + } + + void addToolTip(GT_GuiTooltip toolTip); + + boolean removeToolTip(GT_GuiTooltip toolTip); + + GuiButton getSelectedButton(); + void clearSelectedButton(); + void buttonClicked(GuiButton button); + + int getGuiLeft(); + int getGuiTop(); + + int getXSize(); + int getYSize(); + + void addElement(IGuiElement element); + boolean removeElement(IGuiElement element); + + RenderItem getItemRenderer(); + FontRenderer getFontRenderer(); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java index 912dc554c0..76d121b8da 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/ICoverable.java @@ -41,4 +41,9 @@ public interface ICoverable extends IRedstoneTileEntity, IHasInventory, IBasicEn * Sends 6 Integers to Client + causes @issueTextureUpdate() */ void issueCoverUpdate(byte aSide); + + /** + * Receiving a packet with cover data. + */ + void receiveCoverData(byte coverSide, int coverID, int coverData); } \ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index ae8fc7324d..439da50f24 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -461,6 +461,12 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE issueClientUpdate(); } + @Override + public void receiveCoverData(byte coverSide, int coverID, int coverData) { + if ((coverSide >= 0 && coverSide < 6) && (mCoverSides[coverSide] == coverID)) + setCoverDataAtSide(coverSide, coverData); + } + @Override public byte getStrongestRedstone() { return (byte) Math.max(getInternalInputRedstoneSignal((byte) 0), Math.max(getInternalInputRedstoneSignal((byte) 1), Math.max(getInternalInputRedstoneSignal((byte) 2), Math.max(getInternalInputRedstoneSignal((byte) 3), Math.max(getInternalInputRedstoneSignal((byte) 4), getInternalInputRedstoneSignal((byte) 5)))))); @@ -798,6 +804,15 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE return hasValidMetaTileEntity() && !isDead; } + public boolean shouldDisplayWrenchGrid(ItemStack heldItem, byte side) { + return (getCoverIDAtSide(side) == 0) && ( + GT_Utility.isStackInList(heldItem, GregTech_API.sCovers.keySet()) || + GT_Utility.isStackInList(heldItem, GregTech_API.sCrowbarList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sWireCutterList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sScrewdriverList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sSolderingToolList)); + } + @Override public void doExplosion(long aAmount) { if (canAccessData()) { @@ -826,7 +841,14 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE @Override public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if (isClientSide()) { - if (getCoverBehaviorAtSide(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) return true; + byte tSide = aSide; + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + + if (shouldDisplayWrenchGrid(tCurrentItem, aSide)) { + tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + } + + if (getCoverBehaviorAtSide(tSide).onCoverRightclickClient(tSide, this, aPlayer, aX, aY, aZ)) return true; } if (isServerSide()) { ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1ae88ade41..52c010afbd 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -781,6 +781,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE issueClientUpdate(); } + @Override + public void receiveCoverData(byte coverSide, int coverID, int coverData) { + if ((coverSide >= 0 && coverSide < 6) && (mCoverSides[coverSide] == coverID)) + setCoverDataAtSide(coverSide, coverData); + } + @Override public byte getStrongestRedstone() { return (byte) Math.max(getInternalInputRedstoneSignal((byte) 0), Math.max(getInternalInputRedstoneSignal((byte) 1), Math.max(getInternalInputRedstoneSignal((byte) 2), Math.max(getInternalInputRedstoneSignal((byte) 3), Math.max(getInternalInputRedstoneSignal((byte) 4), getInternalInputRedstoneSignal((byte) 5)))))); @@ -1312,6 +1318,15 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return (mMuffler ? 1 : 0) + (mLockUpgrade ? 1 : 0) + (mSteamConverter ? 1 : 0) + mOtherUpgrades; } + public boolean shouldDisplayWrenchGrid(ItemStack heldItem, byte side) { + return (getCoverIDAtSide(side) == 0) && ( + GT_Utility.isStackInList(heldItem, GregTech_API.sCovers.keySet()) || + GT_Utility.isStackInList(heldItem, GregTech_API.sCrowbarList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sWireCutterList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sScrewdriverList) || + GT_Utility.isStackInList(heldItem, GregTech_API.sSolderingToolList)); + } + @Override public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if (isClientSide()) { @@ -1397,10 +1412,11 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return true; } - if (getCoverIDAtSide(aSide) == 0) { + byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + if (getCoverIDAtSide(tSide) == 0) { if (GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) { - if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(aSide, new GT_ItemStack(tCurrentItem), this) && mMetaTileEntity.allowCoverOnSide(aSide, new GT_ItemStack(tCurrentItem))) { - setCoverItemAtSide(aSide, tCurrentItem); + if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(tSide, new GT_ItemStack(tCurrentItem), this) && mMetaTileEntity.allowCoverOnSide(aSide, new GT_ItemStack(tCurrentItem))) { + setCoverItemAtSide(tSide, tCurrentItem); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } @@ -1410,7 +1426,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord); - dropCover(aSide, aSide, false); + dropCover(tSide, aSide, false); } return true; } diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java new file mode 100644 index 0000000000..bc688f47ed --- /dev/null +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCover.java @@ -0,0 +1,99 @@ +package gregtech.api.net; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; + +/** + * Client -> Server: Update cover data + */ + +public class GT_Packet_TileEntityCover extends GT_Packet { + protected int mX; + protected short mY; + protected int mZ; + + protected byte side; + protected int coverID, coverData, dimID; + + public GT_Packet_TileEntityCover() { + super(true); + } + + public GT_Packet_TileEntityCover(int mX, short mY, int mZ, byte coverSide, int coverID, int coverData, int dimID) { + super(false); + this.mX = mX; + this.mY = mY; + this.mZ = mZ; + + this.side = coverSide; + this.coverID = coverID; + this.coverData = coverData; + + this.dimID = dimID; + } + public GT_Packet_TileEntityCover(byte coverSide, int coverID, int coverData, ICoverable tile) { + super(false); + this.mX = tile.getXCoord(); + this.mY = tile.getYCoord(); + this.mZ = tile.getZCoord(); + + this.side = coverSide; + this.coverID = coverID; + this.coverData = coverData; + + this.dimID = tile.getWorld().provider.dimensionId; + } + + @Override + public byte getPacketID() { + return 6; + } + + @Override + public byte[] encode() { + ByteArrayDataOutput tOut = ByteStreams.newDataOutput(4+2+4+1+4+4+4); + tOut.writeInt(mX); + tOut.writeShort(mY); + tOut.writeInt(mZ); + + tOut.writeByte(side); + tOut.writeInt(coverID); + tOut.writeInt(coverData); + + tOut.writeInt(dimID); + + return tOut.toByteArray(); + } + + @Override + public GT_Packet decode(ByteArrayDataInput aData) { + return new GT_Packet_TileEntityCover( + aData.readInt(), + aData.readShort(), + aData.readInt(), + + aData.readByte(), + aData.readInt(), + aData.readInt(), + + aData.readInt()); + } + + @Override + public void process(IBlockAccess aWorld) { + World world = DimensionManager.getWorld(dimID); + if (world != null) { + TileEntity tile = world.getTileEntity(mX, mY, mZ); + if (tile instanceof IGregTechTileEntity && !((IGregTechTileEntity) tile).isDead()) { + ((IGregTechTileEntity) tile).receiveCoverData(side, coverID, coverData); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java new file mode 100644 index 0000000000..58ebf95ac6 --- /dev/null +++ b/src/main/java/gregtech/api/net/GT_Packet_TileEntityCoverGUI.java @@ -0,0 +1,125 @@ +package gregtech.api.net; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.GT_Proxy; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +/** + * Server -> Client: Show GUI + */ + +public class GT_Packet_TileEntityCoverGUI extends GT_Packet { + protected int mX; + protected short mY; + protected int mZ; + + protected byte side; + protected int coverID, coverData, dimID, playerID; + + public GT_Packet_TileEntityCoverGUI() { + super(true); + } + + public GT_Packet_TileEntityCoverGUI(int mX, short mY, int mZ, byte coverSide, int coverID, int coverData, int dimID, int playerID) { + super(false); + this.mX = mX; + this.mY = mY; + this.mZ = mZ; + + this.side = coverSide; + this.coverID = coverID; + this.coverData = coverData; + + this.dimID = dimID; + this.playerID = playerID; + } + + + public GT_Packet_TileEntityCoverGUI(byte side, int coverID, int coverData, ICoverable tile, EntityPlayerMP aPlayer) { + super(false); + + this.mX = tile.getXCoord(); + this.mY = tile.getYCoord(); + this.mZ = tile.getZCoord(); + + this.side = side; + this.coverID = coverID; + this.coverData = coverData; + + this.dimID = tile.getWorld().provider.dimensionId; + this.playerID = aPlayer.getEntityId(); + } + + public GT_Packet_TileEntityCoverGUI(byte coverSide, int coverID, int coverData, IGregTechTileEntity tile) { + super(false); + this.mX = tile.getXCoord(); + this.mY = tile.getYCoord(); + this.mZ = tile.getZCoord(); + + this.side = coverSide; + this.coverID = coverID; + this.coverData = coverData; + + this.dimID = tile.getWorld().provider.dimensionId; + } + + @Override + public byte getPacketID() { + return 7; + } + + @Override + public byte[] encode() { + ByteArrayDataOutput tOut = ByteStreams.newDataOutput(4+2+4+1+4+4+4+4); + tOut.writeInt(mX); + tOut.writeShort(mY); + tOut.writeInt(mZ); + + tOut.writeByte(side); + tOut.writeInt(coverID); + tOut.writeInt(coverData); + + tOut.writeInt(dimID); + tOut.writeInt(playerID); + + return tOut.toByteArray(); + } + + @Override + public GT_Packet decode(ByteArrayDataInput aData) { + return new GT_Packet_TileEntityCoverGUI( + aData.readInt(), + aData.readShort(), + aData.readInt(), + + aData.readByte(), + aData.readInt(), + aData.readInt(), + + aData.readInt(), + aData.readInt()); + } + + @Override + public void process(IBlockAccess aWorld) { + if (aWorld instanceof World) { + EntityClientPlayerMP a = Minecraft.getMinecraft().thePlayer; + TileEntity tile = aWorld.getTileEntity(mX, mY, mZ); + if (tile instanceof IGregTechTileEntity && !((IGregTechTileEntity) tile).isDead()) { + + ((IGregTechTileEntity) tile).setCoverDataAtSide(side, coverData); //Set it client side to read later. + a.openGui(GT_Values.GT, GT_Proxy.GUI_ID_COVER_SIDE_BASE + side, a.worldObj, mX, mY, mZ); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java index a540601dd1..38c01b9d92 100644 --- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java +++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java @@ -1,8 +1,11 @@ package gregtech.api.util; +import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.net.GT_Packet_TileEntityCoverGUI; import gregtech.api.objects.GT_ItemStack; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -43,9 +46,24 @@ public abstract class GT_CoverBehavior { * return the new Value of the Cover Variable */ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!hasCoverGUI()) + return aCoverVariable; + + if(aPlayer instanceof EntityPlayerMP) { + GT_Values.NW.sendToPlayer(new GT_Packet_TileEntityCoverGUI(aSide, aCoverID, aCoverVariable, aTileEntity, (EntityPlayerMP) aPlayer), (EntityPlayerMP) aPlayer); + } + return aCoverVariable; } + public boolean hasCoverGUI() { + return false; + } + + public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { + return null; + } + /** * Checks if the Cover can be placed on this. */ diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 978afd9e06..9b7bdbfed6 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -446,7 +446,7 @@ public class GT_Client extends GT_Proxy TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); try { Class.forName("codechicken.lib.vec.Rotation"); - if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList))|| GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList))) { + if ((aTileEntity instanceof BaseMetaPipeEntity) && ((BaseMetaPipeEntity) aTileEntity).shouldDisplayWrenchGrid(aEvent.currentItem, (byte) aEvent.target.sideHit)) { drawGrid(aEvent); return; } diff --git a/src/main/java/gregtech/common/GT_Network.java b/src/main/java/gregtech/common/GT_Network.java index 1b315c3085..5fd315b7ce 100644 --- a/src/main/java/gregtech/common/GT_Network.java +++ b/src/main/java/gregtech/common/GT_Network.java @@ -35,7 +35,7 @@ public class GT_Network public GT_Network() { this.mChannel = NetworkRegistry.INSTANCE.newChannel("GregTech", new ChannelHandler[]{this, new HandlerShared()}); - this.mSubChannels = new GT_Packet[]{new GT_Packet_TileEntity(), new GT_Packet_Sound(), new GT_Packet_Block_Event(), new GT_Packet_Ores(), new GT_Packet_Pollution(), new MessageSetFlaskCapacity()}; + this.mSubChannels = new GT_Packet[]{new GT_Packet_TileEntity(), new GT_Packet_Sound(), new GT_Packet_Block_Event(), new GT_Packet_Ores(), new GT_Packet_Pollution(), new MessageSetFlaskCapacity(), new GT_Packet_TileEntityCover(), new GT_Packet_TileEntityCoverGUI()}; } protected void encode(ChannelHandlerContext aContext, GT_Packet aPacket, List aOutput) diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index d21491adea..26b971a093 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -219,6 +219,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public boolean gt6Cable = true; public boolean ic2EnergySourceCompat = true; public boolean costlyCableConnection = false; + public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15 public GT_Proxy() { GameRegistry.registerFuelHandler(this); @@ -1529,6 +1530,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof IGregTechTileEntity)) { + if (GUI_ID_COVER_SIDE_BASE <= aID && aID < GUI_ID_COVER_SIDE_BASE+6) { + return null; + } IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (tMetaTileEntity != null) { return tMetaTileEntity.getServerGUI(aID, aPlayer.inventory, (IGregTechTileEntity) tTileEntity); @@ -1553,6 +1557,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } + @Override public Object getClientGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { if(aID>=1000){ int ID = aID-1000; @@ -1585,9 +1590,20 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof IGregTechTileEntity)) { - IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + IGregTechTileEntity tile = (IGregTechTileEntity) tTileEntity; + + if (GUI_ID_COVER_SIDE_BASE <= aID && aID < GUI_ID_COVER_SIDE_BASE+6) { + byte side = (byte) (aID - GT_Proxy.GUI_ID_COVER_SIDE_BASE); + GT_CoverBehavior cover = tile.getCoverBehaviorAtSide(side); + + if (cover.hasCoverGUI()) { + return cover.getClientGUI(side, tile.getCoverIDAtSide(side), tile.getCoverDataAtSide(side), tile); + } + return null; + } + IMetaTileEntity tMetaTileEntity = tile.getMetaTileEntity(); if (tMetaTileEntity != null) { - return tMetaTileEntity.getClientGUI(aID, aPlayer.inventory, (IGregTechTileEntity) tTileEntity); + return tMetaTileEntity.getClientGUI(aID, aPlayer.inventory, tile); } } return null; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java index a398f7d17f..51db541650 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java @@ -1,24 +1,32 @@ package gregtech.common.covers; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.GT_GUICover; +import gregtech.api.gui.widgets.GT_GuiFakeItemButton; +import gregtech.api.gui.widgets.GT_GuiIcon; +import gregtech.api.gui.widgets.GT_GuiIconButton; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.net.GT_Packet_TileEntityCover; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; +import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.*; + import static gregtech.api.enums.GT_Values.E; public class GT_Cover_Fluidfilter extends GT_CoverBehavior { // Uses the lower 3 bits of the cover variable, so we have 8 options to work with (0-7) - private final int FILTER_INPUT_DENY_OUTPUT = 0; - private final int INVERT_INPUT_DENY_OUTPUT = 1; - private final int FILTER_INPUT_ANY_OUTPUT = 2; - private final int INVERT_INPUT_ANY_OUTPUT = 3; - private final int DENY_INPUT_FILTER_OUTPUT = 4; - private final int DENY_INPUT_INVERT_OUTPUT = 5; - private final int ANY_INPUT_FILTER_OUTPUT = 6; - private final int ANY_INPUT_INVERT_OUTPUT = 7; + private final int FILTER_INPUT_DENY_OUTPUT = 0; // 000 + private final int INVERT_INPUT_DENY_OUTPUT = 1; // 001 + private final int FILTER_INPUT_ANY_OUTPUT = 2; // 010 + private final int INVERT_INPUT_ANY_OUTPUT = 3; // 011 + private final int DENY_INPUT_FILTER_OUTPUT = 4; // 100 + private final int DENY_INPUT_INVERT_OUTPUT = 5; // 101 + private final int ANY_INPUT_FILTER_OUTPUT = 6; // 110 + private final int ANY_INPUT_INVERT_OUTPUT = 7; // 111 public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { int aFilterMode = aCoverVariable & 7; @@ -50,21 +58,6 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehavior { } - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - int aFilterMode = aCoverVariable & 7; - aCoverVariable ^= aFilterMode; - aFilterMode = (aFilterMode + (aPlayer.isSneaking()? -1 : 1)) % 8; - if (aFilterMode < 0) { - aFilterMode = 7; - } - - GT_Utility.sendChatToPlayer(aPlayer, getFilterMode(aFilterMode)); - - aCoverVariable|=aFilterMode; - - return aCoverVariable; - } - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { //GT_FML_LOGGER.info("rightclick"); if ( @@ -142,4 +135,138 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehavior { public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 0; } + /** + * GUI Stuff + */ + + @Override + public boolean hasCoverGUI() { + return true; + } + + @Override + public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { + return new GT_FluidFilterGUICover(aSide, aCoverID, coverData, aTileEntity); + } + + private class GT_FluidFilterGUICover extends GT_GUICover { + private final byte side; + private final int coverID; + private int coverVariable; + private final ICoverable tile; + private GT_GuiFakeItemButton fakeItemButton; + protected String header, filterString; + + private final static int startX = 10; + private final static int startY = 25; + private final static int spaceX = 18; + private final static int spaceY = 18; + + public GT_FluidFilterGUICover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) + { + this.side = aSide; + this.coverID = aCoverID; + this.coverVariable = aCoverVariable; + this.tile = aTileEntity; + + ItemStack item = GT_Utility.intToStack(aCoverID); + this.header = (item != null) ? item.getDisplayName() : ""; + + GT_GuiIconButton b; + b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.EXPORT).setTooltipText(trans("043","Filter Input")); + b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.IMPORT).setTooltipText(trans("044","Filter Output")); + b = new GT_GuiIconButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.BLOCK_INPUT).setTooltipText(trans("219", "Block Output")); + b = new GT_GuiIconButton(this, 3, startX + spaceX*1, startY+spaceY*2, GT_GuiIcon.ALLOW_INPUT).setTooltipText(trans("220", "Allow Output")); + b = new GT_GuiIconButton(this, 4, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.WHITELIST).setTooltipText(trans("045","Whitelist Fluid")); + b = new GT_GuiIconButton(this, 5, startX + spaceX*1, startY+spaceY*1, GT_GuiIcon.BLACKLIST).setTooltipText(trans("046","Blacklist Fluid")); + + new GT_GuiFakeItemButton(this, 5, 5, null).setItem(item); + fakeItemButton = new GT_GuiFakeItemButton(this, startX, startY+spaceY*3+2, GT_GuiIcon.SLOT_DARKGRAY); + } + + private int getNewCoverVariable(int id) { + switch (id) { + case 0: + return (coverVariable & ~0x7) | (coverVariable & 0x3); + case 1: + return (coverVariable & ~0x7) | (coverVariable | 0x4); + case 2: + return (coverVariable & ~0x7) | (coverVariable & 0x5); + case 3: + return (coverVariable & ~0x7) | (coverVariable | 0x2); + case 4: + return (coverVariable & ~0x7) | (coverVariable & 0x6); + case 5: + return (coverVariable & ~0x7) | (coverVariable | 0x1); + } + return coverVariable; + } + + private boolean getClickable(int id) { + switch (id) { + case 0: case 1: + return (coverVariable>>2 & 0x1) != (id & 0x1); + case 2: case 3: + return (coverVariable>>1 & 0x1) != (id & 0x1); + case 4: case 5: + return (coverVariable & 0x1) != (id & 0x1); + } + return false; + } + + + @Override + public void drawExtras(int mouseX, int mouseY, float parTicks) { + this.fontRendererObj.drawString(header, 25, 9, 0xFF222222); + this.fontRendererObj.drawString(trans("016","Filter Direction" ), startX + spaceX*2, 3+startY+spaceY*0, 0xFF555555); + this.fontRendererObj.drawString(trans("223", "Filter Type"), startX + spaceX*2, 3+startY+spaceY*1, 0xFF555555); + this.fontRendererObj.drawString(trans("017","Block Flow"), startX + spaceX*2, 3+startY+spaceY*2, 0xFF555555); + this.fontRendererObj.drawSplitString(filterString, startX + spaceX+3, 4+startY+spaceY*3, gui_width-40 , 0xFF222222); + } + + @Override + protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { + updateButtons(); + } + + public void buttonClicked(GuiButton btn){ + if (getClickable(btn.id)){ + coverVariable = getNewCoverVariable(btn.id); + GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile)); + } + updateButtons(); + } + + private void updateButtons(){ + GT_GuiIconButton b; + for (Object o : buttonList) { + if (o instanceof GT_GuiIconButton) { + b = (GT_GuiIconButton) o; + b.enabled = getClickable(b.id); + if (getClickable(1)) { //filtering input + if (b.id == 2) + b.setTooltipText(trans("219", "Block Output")); + else if (b.id == 3) + b.setTooltipText(trans("220", "Allow Output")); + } else { + if (b.id == 2) + b.setTooltipText(trans("221", "Block Input")); + else if (b.id == 3) + b.setTooltipText(trans("222", "Allow Input")); + } + } + } + Fluid f = FluidRegistry.getFluid(coverVariable >>> 3); + if (f != null) { + ItemStack item = GT_Utility.getFluidDisplayStack(f); + if (item != null) { + fakeItemButton.setItem(item); + filterString = item.getDisplayName(); + return; + } + } + fakeItemButton.setItem(null); + filterString = trans("224", "Filter Empty"); + } + } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java index 466f6566c0..aeca33783b 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java @@ -1,19 +1,39 @@ package gregtech.common.covers; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.GT_GUICover; +import gregtech.api.gui.widgets.GT_GuiFakeItemButton; +import gregtech.api.gui.widgets.GT_GuiIconButton; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IMachineProgress; +import gregtech.api.net.GT_Packet_TileEntityCover; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.EntityPlayer; +import gregtech.api.gui.widgets.GT_GuiIcon; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public class GT_Cover_Pump - extends GT_CoverBehavior { + extends GT_CoverBehavior{ public final int mTransferRate; + // {"006", "Export"}, + // {"007", "Import"}, + // {"008", "Export (conditional)"}, + // {"009", "Import (conditional)"}, + // {"010", "Export (invert cond)"}, + // {"011", "Import (invert cond)"}, + // {"012", "Export allow Input"}, + // {"013", "Import allow Output"}, + // {"014", "Export allow Input (conditional)"}, + // {"015", "Import allow Output (conditional)"}, + // {"016", "Export allow Input (invert cond)"}, + // {"017", "Import allow Output (invert cond)"}, + public GT_Cover_Pump(int aTransferRate) { this.mTransferRate = aTransferRate; } @@ -67,26 +87,6 @@ public class GT_Cover_Pump return aCoverVariable; } - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 12; - if(aCoverVariable <0){aCoverVariable = 11;} - switch(aCoverVariable) { - case 0: GT_Utility.sendChatToPlayer(aPlayer, trans("006", "Export")); break; - case 1: GT_Utility.sendChatToPlayer(aPlayer, trans("007", "Import")); break; - case 2: GT_Utility.sendChatToPlayer(aPlayer, trans("008", "Export (conditional)")); break; - case 3: GT_Utility.sendChatToPlayer(aPlayer, trans("009", "Import (conditional)")); break; - case 4: GT_Utility.sendChatToPlayer(aPlayer, trans("010", "Export (invert cond)")); break; - case 5: GT_Utility.sendChatToPlayer(aPlayer, trans("011", "Import (invert cond)")); break; - case 6: GT_Utility.sendChatToPlayer(aPlayer, trans("012", "Export allow Input")); break; - case 7: GT_Utility.sendChatToPlayer(aPlayer, trans("013", "Import allow Output")); break; - case 8: GT_Utility.sendChatToPlayer(aPlayer, trans("014", "Export allow Input (conditional)")); break; - case 9: GT_Utility.sendChatToPlayer(aPlayer, trans("015", "Import allow Output (conditional)")); break; - case 10: GT_Utility.sendChatToPlayer(aPlayer, trans("016", "Export allow Input (invert cond)")); break; - case 11: GT_Utility.sendChatToPlayer(aPlayer, trans("017", "Import allow Output (invert cond)")); break; - } - return aCoverVariable; - } - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } @@ -136,4 +136,130 @@ public class GT_Cover_Pump public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return 1; } + + /** + * GUI Stuff + */ + + @Override + public boolean hasCoverGUI() { + return true; + } + + @Override + public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { + return new GT_PumpGUICover(aSide, aCoverID, coverData, aTileEntity); + } + + private class GT_PumpGUICover extends GT_GUICover { + private final byte side; + private final int coverID; + private int coverVariable; + private final ICoverable tile; + protected String header; + + private final static int startX = 10; + private final static int startY = 25; + private final static int spaceX = 18; + private final static int spaceY = 18; + + public GT_PumpGUICover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + this.side = aSide; + this.coverID = aCoverID; + this.coverVariable = aCoverVariable; + this.tile = aTileEntity; + + ItemStack item = GT_Utility.intToStack(aCoverID); + this.header = (item != null) ? item.getDisplayName() : ""; + new GT_GuiFakeItemButton(this, 5, 5, null).setItem(item); + + GT_GuiIconButton b; + b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.EXPORT).setTooltipText(trans("006","Export")); + b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.IMPORT).setTooltipText(trans("007","Import")); + b = new GT_GuiIconButton(this, 2, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK).setTooltipText(trans("008","Ignore")); + b = new GT_GuiIconButton(this, 3, startX + spaceX*1, startY+spaceY*1, GT_GuiIcon.REDSTONE_ON).setTooltipText(trans("009","Conditional")); + b = new GT_GuiIconButton(this, 4, startX + spaceX*2, startY+spaceY*1, GT_GuiIcon.REDSTONE_OFF).setTooltipText(trans("010","Invert Condition")); + b = new GT_GuiIconButton(this, 5, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.ALLOW_INPUT).setTooltipText(trans("011","Allow Input")); + b = new GT_GuiIconButton(this, 6, startX + spaceX*1, startY+spaceY*2, GT_GuiIcon.BLOCK_INPUT).setTooltipText(trans("012","Block Input")); + } + + @Override + public void drawExtras(int mouseX, int mouseY, float parTicks) { + this.fontRendererObj.drawString(header, 25, 9, 0xFF222222); + this.fontRendererObj.drawString(trans("013","Import/Export" ), startX + spaceX*3, 3+startY+spaceY*0, 0xFF555555); + this.fontRendererObj.drawString(trans("014","Conditional"), startX + spaceX*3, 3+startY+spaceY*1, 0xFF555555); + this.fontRendererObj.drawString(trans("015", "Enable Input"), startX + spaceX*3, 3+startY+spaceY*2, 0xFF555555); + } + + @Override + protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { + updateButtons(); + } + + public void buttonClicked(GuiButton btn){ + if (getClickable(btn.id)){ + coverVariable = getNewCoverVariable(btn.id); + GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile)); + } + updateButtons(); + } + + private void updateButtons(){ + GuiButton b; + for (Object o : buttonList) { + b = (GuiButton) o; + b.enabled = getClickable(b.id); + } + } + + private int getNewCoverVariable(int id) { + switch (id) { + case 0: + return coverVariable & ~0x1; + case 1: + return coverVariable | 0x1; + case 2: + if (coverVariable > 5) + return 0x6 | (coverVariable & ~0xE); + return (coverVariable & ~0xE); + case 3: + if (coverVariable > 5) + return 0x8 | (coverVariable & ~0xE); + return 0x2 | (coverVariable & ~0xE); + case 4: + if (coverVariable > 5) + return 0xA | (coverVariable & ~0xE); + return (0x4 | (coverVariable & ~0xE)); + case 5: + if (coverVariable <= 5) + return coverVariable + 6; + break; + case 6: + if (coverVariable > 5) + return coverVariable - 6; + } + return coverVariable; + } + + private boolean getClickable(int id) { + if (coverVariable < 0 | 11 < coverVariable) + return false; + + switch (id) { + case 0: case 1: + return (0x1 & coverVariable) != id; + case 2: + return (coverVariable % 6) >= 2; + case 3: + return (coverVariable % 6) < 2 | 4 <= (coverVariable % 6); + case 4: + return (coverVariable % 6) < 4; + case 5: + return coverVariable < 6; + case 6: + return coverVariable >= 6; + } + return false; + } + } } diff --git a/src/main/resources/assets/gregtech/textures/gui/GuiButtons.png b/src/main/resources/assets/gregtech/textures/gui/GuiButtons.png new file mode 100644 index 0000000000..f9b1d69325 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/GuiButtons.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/GuiCover.png b/src/main/resources/assets/gregtech/textures/gui/GuiCover.png new file mode 100644 index 0000000000..95353c79ca Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/GuiCover.png differ -- cgit