diff options
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
16 files changed, 142 insertions, 145 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index e0125ae50a..338724cf20 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -807,7 +807,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { if (mWorks) disableWorking(); else enableWorking(); - GT_Utility.sendChatToPlayer(aPlayer, trans("090","Machine Processing: ") + (isAllowedToWork() ? trans("088","Enabled") : trans("087","Disabled"))); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("090","Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088","Enabled") : GT_Utility.trans("087","Disabled"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord); } return true; @@ -828,7 +828,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= (1 << tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak"))); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); issueBlockUpdate(); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 562a566b2b..222fe6a8fb 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1354,7 +1354,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { mInputDisabled = !mInputDisabled; if (mInputDisabled) mOutputDisabled = !mOutputDisabled; - GT_Utility.sendChatToPlayer(aPlayer, trans("086","Auto-Input: ") + (mInputDisabled ? trans("087","Disabled") : trans("088","Enabled") + trans("089"," Auto-Output: ") + (mOutputDisabled ? trans("087","Disabled") : trans("088","Enabled")))); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("086","Auto-Input: ") + (mInputDisabled ? GT_Utility.trans("087","Disabled") : GT_Utility.trans("088","Enabled") + GT_Utility.trans("089"," Auto-Output: ") + (mOutputDisabled ? GT_Utility.trans("087","Disabled") : GT_Utility.trans("088","Enabled")))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, zCoord); } return true; @@ -1365,7 +1365,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I if (mWorks) disableWorking(); else enableWorking(); { - String tChat = trans("090", "Machine Processing: ") + (isAllowedToWork() ? trans("088", "Enabled") : trans("087", "Disabled")); + String tChat = GT_Utility.trans("090", "Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); if (getMetaTileEntity() != null && getMetaTileEntity().hasAlternativeModeText()) tChat = getMetaTileEntity().getAlternativeModeText(); GT_Utility.sendChatToPlayer(aPlayer, tChat); @@ -1382,7 +1382,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= (1 << tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak"))); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); issueBlockUpdate(); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index dcaa98f120..7b05b582ae 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -468,9 +468,10 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje @Override public void markDirty() {/* Do not do the super Function */} - + + @Deprecated public String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); + return GT_Utility.trans(aKey, aEnglish); } /* diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index a04a53f8ca..7d4fd38b8b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -757,8 +757,9 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return ""; } + @Deprecated public String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); + return GT_Utility.trans(aKey, aEnglish); } private boolean connectableColor(TileEntity tTileEntity) { diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 068c02297e..31b008095c 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -946,9 +946,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity { public boolean allowGeneralRedstoneOutput(){ return false; } - + + @Deprecated public String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); + return GT_Utility.trans(aKey, aEnglish); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 8666f609b6..788753f0cc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -218,10 +218,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if(isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); }else if(!GT_Mod.gregtechproxy.costlyCableConnection){ if (connect(aWrenchingSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } return true; } @@ -233,10 +233,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { disconnect(aWrenchingSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); } else if (!GT_Mod.gregtechproxy.costlyCableConnection || GT_ModHandler.consumeSolderingMaterial(aPlayer)) { if (connect(aWrenchingSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } return true; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 8cce529050..bf87c03d79 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -392,20 +392,20 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aPlayer.isSneaking()) { if (isInputDisabledAtSide(tSide)) { mDisableInput &= ~tMask; - GT_Utility.sendChatToPlayer(aPlayer, trans("212", "Input enabled")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("212", "Input enabled")); if (!isConnectedAtSide(tSide)) connect(tSide); } else { mDisableInput |= tMask; - GT_Utility.sendChatToPlayer(aPlayer, trans("213", "Input disabled")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("213", "Input disabled")); } } else { if (!isConnectedAtSide(tSide)) { if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } else { disconnect(tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); } } return true; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index e316a44c80..db4f5b7603 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -197,10 +197,10 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (isConnectedAtSide(tSide)) { disconnect(tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("215", "Disconnected")); } else { if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("214", "Connected")); } return true; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 6cdbe77526..ef492950a1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -11,8 +11,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_CoverBehaviorBase; +import gregtech.common.power.BasicMachineEUPower; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.power.Power; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -67,6 +69,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; public FluidStack mOutputFluid; public String mGUIName, mNEIName; + private final Power mPower; @Deprecated @@ -101,7 +104,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mAmperage = aAmperage; mGUIName = aGUIName; mNEIName = aNEIName; + mPower = buildPower(); } + public GT_MetaTileEntity_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays); mInputSlotCount = Math.max(0, aInputSlotCount); @@ -109,6 +114,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mAmperage = aAmperage; mGUIName = aGUIName; mNEIName = aNEIName; + mPower = buildPower(); } public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); @@ -117,6 +123,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mAmperage = aAmperage; mGUIName = aGUIName; mNEIName = aNEIName; + mPower = buildPower(); } public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { @@ -126,6 +133,14 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mAmperage = aAmperage; mGUIName = aGUIName; mNEIName = aNEIName; + mPower = buildPower(); + } + + /** + * To be called by the constructor to initialize this instance's Power + */ + protected Power buildPower() { + return new BasicMachineEUPower(mTier, mAmperage); } protected boolean isValidMainFacing(byte aSide) { @@ -546,7 +561,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) { TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); - int tMaxStacks = (int)(tStoredEnergy/64l); + int tMaxStacks = (int)(tStoredEnergy/64L); if (tMaxStacks > mOutputItems.length) tMaxStacks = mOutputItems.length; @@ -641,42 +656,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * @param aDuration - recipe Duration */ protected void calculateOverclockedNess(int aEUt, int aDuration) { - if(mTier==0){ - //Long time calculation - long xMaxProgresstime = ((long)aDuration)<<1; - if(xMaxProgresstime>Integer.MAX_VALUE-1){ - //make impossible if too long - mEUt=Integer.MAX_VALUE-1; - mMaxProgresstime=Integer.MAX_VALUE-1; - }else{ - mEUt=aEUt>>2; - mMaxProgresstime=(int)xMaxProgresstime; - } - }else{ - //Long EUt calculation - long xEUt=aEUt; - //Isnt too low EUt check? - long tempEUt = Math.max(xEUt, V[1]); - - mMaxProgresstime = aDuration; - - while (tempEUt <= V[mTier -1] * (long)mAmperage) { - tempEUt<<=2;//this actually controls overclocking - //xEUt *= 4;//this is effect of everclocking - mMaxProgresstime>>=1;//this is effect of overclocking - xEUt = mMaxProgresstime==0 ? xEUt>>1 : xEUt<<2;//U know, if the time is less than 1 tick make the machine use 2x less power - } - if(xEUt>Integer.MAX_VALUE-1){ - mEUt = Integer.MAX_VALUE-1; - mMaxProgresstime = Integer.MAX_VALUE-1; - }else{ - mEUt = (int)xEUt; - if(mEUt==0) - mEUt = 1; - if(mMaxProgresstime==0) - mMaxProgresstime = 1;//set time to 1 tick - } - } + mPower.computePowerUsageAndDuration(aEUt, aDuration); + mEUt = mPower.getEuPerTick(); + mMaxProgresstime = mPower.getDurationTicks(); } protected ItemStack getSpecialSlot() { @@ -843,7 +825,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter)); } else { mAllowInputFromOutputSide = !mAllowInputFromOutputSide; - GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? trans("095", "Input from Output Side allowed") : trans("096", "Input from Output Side forbidden")); + GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? GT_Utility.trans("095", "Input from Output Side allowed") : GT_Utility.trans("096", "Input from Output Side forbidden")); } } } @@ -1059,7 +1041,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - + currenttip.add(String.format("Progress: %d s / %d s", tag.getInteger("progressSingleBlock"), tag.getInteger("maxProgressSingleBlock"))); super.getWailaBody(itemStack, currenttip, accessor, config); } @@ -1071,4 +1053,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B tag.setInteger("progressSingleBlock", mProgresstime / 20); tag.setInteger("maxProgressSingleBlock", mMaxProgresstime / 20); } + + public Power getPower() { + return mPower; + } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 204156f3ab..02e94a7ea9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -7,6 +7,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; +import gregtech.common.power.Power; +import gregtech.api.util.GT_Recipe; +import gregtech.common.power.SteamPower; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.entity.EntityLivingBase; @@ -33,25 +36,28 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE; * Extend this class to make a simple Machine */ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileEntity_BasicMachine { - /* - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicMachine_Bronze(mTier, mDescription, mTextures); - } - */ private static final int NEEDS_STEAM_VENTING = 64; public boolean mNeedsSteamVenting = false; - public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aID, aName, aNameRegional, aBricked ? 1 : 0, 0, aDescription, aInputSlotCount, aOutputSlotCount, "", ""); + public GT_MetaTileEntity_BasicMachine_Bronze(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aID, aName, aNameRegional, aHighPressure ? 2 : 1, 0, aDescription, aInputSlotCount, aOutputSlotCount, "", ""); } - public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aName, aBricked ? 1 : 0, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); + public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); } - public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aName, aBricked ? 1 : 0, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); + public GT_MetaTileEntity_BasicMachine_Bronze(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aName, aHighPressure ? 2 : 1, 0, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, "", ""); + } + + protected boolean isBricked() { + return false; + } + + @Override + public Power buildPower() { + return new SteamPower(mTier, 1, 2); } @Override @@ -153,6 +159,17 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE } @Override + public int checkRecipe() { + GT_Recipe tRecipe = getRecipeList().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[mTier], null, getAllInputs()); + if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { + this.mOutputItems[0] = tRecipe.getOutput(0); + calculateOverclockedNess(tRecipe); + return 2; + } + return 0; + } + + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); // Super already zeroed out setErrorDisplayID, add additional error codes here. @@ -199,76 +216,76 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE } public float getSteamDamage() { - return 6.0F; + return 6.0F * mTier; } @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java index 20a3758324..a58cf6345d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java @@ -3,6 +3,8 @@ package gregtech.api.metatileentity.implementations; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.ITexture; import gregtech.api.render.TextureFactory; +import gregtech.common.power.Power; +import gregtech.common.power.SteamPower; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; @@ -20,90 +22,90 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; * Extend this class to make a simple Machine */ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEntity_BasicMachine_Bronze { - public GT_MetaTileEntity_BasicMachine_Steel(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aID, aName, aNameRegional, aDescription, aInputSlotCount, aOutputSlotCount, aBricked); + public GT_MetaTileEntity_BasicMachine_Steel(int aID, String aName, String aNameRegional, String aDescription, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aID, aName, aNameRegional, aDescription, aInputSlotCount, aOutputSlotCount, aHighPressure); } - public GT_MetaTileEntity_BasicMachine_Steel(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aBricked); + public GT_MetaTileEntity_BasicMachine_Steel(String aName, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } - public GT_MetaTileEntity_BasicMachine_Steel(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aBricked) { - super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aBricked); + public GT_MetaTileEntity_BasicMachine_Steel(String aName, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, boolean aHighPressure) { + super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aHighPressure); } @Override - public float getSteamDamage() { - return 12.0F; + public Power buildPower() { + return new SteamPower(mTier, 2, 1); } @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(isBricked() ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + ret |
