From 2ac85af0eca2352d5fc9d8d21c1b8ce03823bfed Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 27 May 2020 12:14:06 +0200 Subject: Unified Large Chem reactor OC related #294 Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../GT_MetaTileEntity_MultiBlockBase.java | 82 +++++++++++----------- 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 3efbe0d57b..c6828c707e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -1,10 +1,5 @@ package gregtech.api.metatileentity.implementations; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; - -import java.util.ArrayList; - import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -29,6 +24,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; +import java.util.ArrayList; + +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; + public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public static boolean disableMaintenance; @@ -538,13 +538,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { aFirstVoltageFound = aVoltage; } else { - /** - * Calcualtes overclocked ness using long integers - * @param aEUt - recipe EUt - * @param aDuration - recipe Duration - * @param mAmperage - should be 1 ? - */ - //Long time calculation if (aFirstVoltageFound != aVoltage) { aFoundMixedDynamos = true; } @@ -559,13 +552,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } long leftToInject; - //Long EUt calculation long aVoltage; - //Isnt too low EUt check? int aAmpsToInject; int aRemainder; int ampsOnCurrentHatch; - //xEUt *= 4;//this is effect of everclocking for (GT_MetaTileEntity_Hatch_Dynamo aDynamo : mDynamoHatches) { if (isValidMetaTileEntity(aDynamo)) { leftToInject = aEU - injected; @@ -594,51 +584,63 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } /** - * Calcualtes overclocked ness using long integers - * @param aEUt - recipe EUt - * @param aDuration - recipe Duration - * @param mAmperage - should be 1 ? + * Calcualtes the overclockedness using long integers + * @param aEUt - recipe EUt + * @param aDuration - recipe Duration + * @param mAmperage - should be 1 ? + * @param maxInputVoltage - Multiblock Max input voltage + * @param perfectOC - If the Multiblock OCs perfectly, i.e. the large Chemical Reactor */ - protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) { - byte mTier=(byte)Math.max(0,GT_Utility.getTier(maxInputVoltage)); - if(mTier==0){ + protected void calculateOverclockedNessMultiInternal(int aEUt, int aDuration, int mAmperage, long maxInputVoltage, boolean perfectOC) { + byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage)); + if(mTier == 0){ //Long time calculation long xMaxProgresstime = ((long)aDuration)<<1; - if(xMaxProgresstime>Integer.MAX_VALUE-1){ + if(xMaxProgresstime > Integer.MAX_VALUE - 1){ //make impossible if too long - mEUt=Integer.MAX_VALUE-1; - mMaxProgresstime=Integer.MAX_VALUE-1; + mEUt = Integer.MAX_VALUE - 1; + mMaxProgresstime = Integer.MAX_VALUE - 1; }else{ - mEUt=aEUt>>2; - mMaxProgresstime=(int)xMaxProgresstime; + mEUt = aEUt >> 2; + mMaxProgresstime= (int) xMaxProgresstime; } }else{ //Long EUt calculation - long xEUt=aEUt; + long xEUt = aEUt; //Isnt too low EUt check? - long tempEUt = xEUt>=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 less power + mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking + xEUt = mMaxProgresstime==0 ? xEUt >> ocTimeShift : xEUt << 2;//U know, if the time is less than 1 tick make the machine use 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) + 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) + if(mMaxProgresstime == 0) mMaxProgresstime = 1;//set time to 1 tick } } } + protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) { + calculateOverclockedNessMultiInternal(aEUt,aDuration,mAmperage,maxInputVoltage,false); + } + + protected void calculatePerfectOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) { + calculateOverclockedNessMultiInternal(aEUt,aDuration,mAmperage,maxInputVoltage,true); + } + public boolean drainEnergyInput(long aEU) { if (aEU <= 0) return true; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) -- cgit From 3e925efcda289784b291cb4da2d5dc537897d722 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Fri, 17 Jul 2020 03:37:33 +0300 Subject: Transformer not change visually when mode changes to step up https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/5420 --- src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 5 +++-- .../implementations/GT_MetaTileEntity_Transformer.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 63c88cfd0a..61e8382777 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -545,7 +545,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], - oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), + oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0) ), 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)), @@ -556,7 +556,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } if (mTickTimer > 10) { - byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); + byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)| (mWorks ? 64 : 0)); if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); tData = mMetaTileEntity.getUpdateData(); @@ -681,6 +681,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mActive = ((aValue & 8) != 0); mRedstone = ((aValue & 16) != 0); //mLockUpgrade = ((aValue&32) != 0); + mWorks = ((aValue & 64) != 0); break; case 1: if (hasValidMetaTileEntity()) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index f33b8aa3d9..711670db08 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java @@ -60,7 +60,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + 1]; + return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1]; } @Override -- cgit From 09a56b53995f98535d337aa40c2c75a92a70144c Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Sun, 2 Aug 2020 19:21:20 +0200 Subject: Fix full size pipes restrictor textures. --- .../metatileentity/implementations/GT_MetaPipeEntity_Fluid.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') 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 0767bd0081..23afaa84f7 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 @@ -104,7 +104,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { {1, 0, 2, 3}, {1, 0, 2, 3} }; - if (aSide >= 0 && aSide < 6) for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; + if (aSide >= 0 && aSide < 6) { + for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; + //Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate + if (tThickNess >= 0.99F && (aSide == 5 || aSide == 2)) + if (tMask > 3 && tMask < 12) + tMask = (byte) (tMask ^ 12); + } return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)}; } -- cgit From 3a07aac9a56e9f340954e9092aecf85ba648c405 Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Sun, 23 Aug 2020 15:33:20 +0200 Subject: Attempt at improving chest buffers, also slowing down lower tier ones. --- .../implementations/GT_MetaTileEntity_Buffer.java | 23 +++--- .../java/gregtech/api/util/GT_LanguageManager.java | 2 +- src/main/java/gregtech/api/util/GT_Utility.java | 7 +- .../common/gui/GT_Container_ChestBuffer.java | 2 +- .../common/gui/GT_Container_SuperBuffer.java | 2 +- .../automation/GT_MetaTileEntity_ChestBuffer.java | 86 ++++++++++++---------- .../automation/GT_MetaTileEntity_SuperBuffer.java | 3 +- .../automation/GT_MetaTileEntity_TypeFilter.java | 6 +- 8 files changed, 68 insertions(+), 63 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 73ab28822a..a57f2440a7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -12,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; import static gregtech.api.enums.GT_Values.V; public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock { - public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = true; + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false; public int mSuccess = 0, mTargetStackSize = 0; public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { @@ -257,18 +257,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM } protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if( bStockingMode ) { - int tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1); - if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { - mSuccess = 50; - aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true); - } - } else { - int tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize); - if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { - mSuccess = 50; - aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true); - } + int tCost; + if( bStockingMode ) + tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, (byte) 1, (byte) 64, (byte) 1); + else + tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize); + + if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { + mSuccess = 50; + aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true); } } diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java index b44b6ffa40..c87e0f7417 100644 --- a/src/main/java/gregtech/api/util/GT_LanguageManager.java +++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java @@ -323,7 +323,7 @@ public class GT_LanguageManager { addStringLocalization("Interaction_DESCRIPTION_Index_214", "Connected"); addStringLocalization("Interaction_DESCRIPTION_Index_215", "Disconnected"); addStringLocalization("Interaction_DESCRIPTION_Index_216", "Deprecated Recipe"); - addStringLocalization("Interaction_DESCRIPTION_Index_217", "Stocking mode. Keeps this many items in destination input slots."); + addStringLocalization("Interaction_DESCRIPTION_Index_217", "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."); addStringLocalization("Interaction_DESCRIPTION_Index_218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."); addStringLocalization("Interaction_DESCRIPTION_Index_500", "Fitting: Loose - More Flow"); addStringLocalization("Interaction_DESCRIPTION_Index_501", "Fitting: Tight - More Efficiency"); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 6df77f16bf..a65ed00aed 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -547,7 +547,7 @@ public class GT_Utility { for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; } - if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) { + if (aTileEntity2 instanceof IInventory) { int[] tPutSlots = null; if (aTileEntity2 instanceof ISidedInventory) tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo); @@ -561,13 +561,12 @@ public class GT_Utility { byte tMovedItemCount = 0; ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlots[i]); if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) { + if (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) { for (int j = 0; j < tPutSlots.length; j++) { if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, tGrabStack, aMaxTargetStackSize)) { tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); - if (tMovedItemCount >= aMaxMoveAtOnce) { + if (tMovedItemCount >= aMaxMoveAtOnce ||(tMovedItemCount > 0 && aMaxTargetStackSize < 64)) return tMovedItemCount; - } } } } diff --git a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java index 016d0889f7..d465134d5e 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java +++ b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java @@ -67,7 +67,7 @@ public class GT_Container_ChestBuffer if (aSlotIndex == 30) { ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode); if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) { - GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots.")); + GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); } else { GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); } diff --git a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java index 5a59cb5aa9..530e64aa68 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java +++ b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java @@ -62,7 +62,7 @@ public class GT_Container_SuperBuffer if (aSlotIndex == 3) { ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode); if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) { - GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots.")); + GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.")); } else { GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.")); } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index d11b1f2f81..6605d4fc35 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -19,11 +19,15 @@ import java.util.Comparator; public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { + private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1,1,1}; + + public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 28, new String[]{ "Buffers up to 27 Item Stacks", "Use Screwdriver to regulate output stack size", - "Consumes 3EU per moved Item"}); + "Consumes 3EU per moved Item", + getTickRateDesc(aTier)}); } public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { @@ -55,6 +59,8 @@ public class GT_MetaTileEntity_ChestBuffer } protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (aTimer % tickRate[mTier] > 0) return; + if(aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); } @@ -64,9 +70,9 @@ public class GT_MetaTileEntity_ChestBuffer super.moveItems(aBaseMetaTileEntity, aTimer); } // mSuccesss is set to 50 on a successful move - if(mSuccess == 50) { - fillStacksIntoFirstSlots(); - } + //if(mSuccess == 50) { + // fillStacksIntoFirstSlots(); + //} if(mSuccess < 0) { mSuccess = 0; } @@ -85,47 +91,32 @@ public class GT_MetaTileEntity_ChestBuffer return 1; Item item1 = o1.getItem(); Item item2 = o2.getItem(); - - // If item1 is a block and item2 isn't, sort item1 before item2 - if (((item1 instanceof ItemBlock)) && (!(item2 instanceof ItemBlock))) { + + if(item1 instanceof ItemBlock) { + if (!(item2 instanceof ItemBlock)) + return -1; // If item1 is a block and item2 isn't, sort item1 before item2 + } else if (item2 instanceof ItemBlock) + return 1; // If item2 is a block and item1 isn't, sort item1 after item2 + + int id1 = Item.getIdFromItem( item1 ); + int id2 = Item.getIdFromItem( item2 ); + if ( id1 < id2 ) { return -1; } - - // If item2 is a block and item1 isn't, sort item1 after item2 - if (((item2 instanceof ItemBlock)) && (!(item1 instanceof ItemBlock))) { + if ( id1 > id2 ) { return 1; } - // If the items are blocks, use the string comparison - if ((item1 instanceof ItemBlock)) { // only need to check one since we did the check above - String displayName1 = o1.getDisplayName(); - String displayName2 = o2.getDisplayName(); - int result = displayName1.compareToIgnoreCase(displayName2); - //GT_FML_LOGGER.info("sorter: " + displayName1 + " " + displayName2 + " " + result); - return result; - } else - { - // Not a block. Use the ID and damage to compare them. - int id1 = Item.getIdFromItem( item1 ); - int id2 = Item.getIdFromItem( item2 ); - if ( id1 < id2 ) { - return -1; - } - if ( id1 > id2 ) { - return 1; - } - // id1 must equal id2, get their damage and compare - id1 = o1.getItemDamage(); - id2 = o2.getItemDamage(); - - if ( id1 < id2 ) { - return -1; - } - if ( id1 > id2 ) { - return 1; - } - return 0; + id1 = o1.getItemDamage(); + id2 = o2.getItemDamage(); + + if ( id1 < id2 ) { + return -1; + } + if ( id1 > id2 ) { + return 1; } + return 0; } }); } @@ -155,4 +146,21 @@ public class GT_MetaTileEntity_ChestBuffer public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); } + + protected static String getTickRateDesc(int tier){ + int tickRate = getTickRate(tier); + String s = ""; + if (tickRate < 20) + s = "1/" + 20/tickRate + " "; + else if (tickRate > 20) { + s = (tickRate / 20) + "th "; + } + return "Moves items every " + s + "second"; + } + + protected static int getTickRate(int tier) { + if (tier > 9) + return 1; + return tickRate[tier]; + } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java index 10fcb47d12..da35f17518 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java @@ -15,7 +15,8 @@ public class GT_MetaTileEntity_SuperBuffer super(aID, aName, aNameRegional, aTier, 257, new String[]{ "Buffers up to 256 Item Stacks", "Use Screwdriver to regulate output stack size", - "Consumes 1EU per moved Item"}); + "Consumes 1EU per moved Item", + getTickRateDesc(aTier)}); } public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index 9b9f782601..6292a769a2 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -83,17 +83,17 @@ public class GT_MetaTileEntity_TypeFilter } } } - this.mRotationIndex = 0; + this.mRotationIndex = -1; } } public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); - if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) { + if ((getBaseMetaTileEntity().isServerSide()) && ((aTick % 8L == 0L) || mRotationIndex == -1)) { if (this.mPrefix.mPrefixedItems.isEmpty()) { this.mInventory[9] = null; } else { - this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[]{this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())}); + this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())); if (this.mInventory[9].getItemDamage() == 32767) { this.mInventory[9].setItemDamage(0); } -- cgit From b403f91a2f38ca5f8ea94732cab4e776e46c4e7a Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Sun, 23 Aug 2020 15:47:03 +0200 Subject: Revert stocking mode change. --- .../api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index a57f2440a7..645836a801 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -259,7 +259,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { int tCost; if( bStockingMode ) - tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, (byte) 1, (byte) 64, (byte) 1); + tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1); else tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize); -- cgit From 3cff40ad257cc5ea5bef66920bbcef08996c0ac9 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Wed, 2 Sep 2020 14:10:41 +0300 Subject: GT p2p tunnel was added to AE itself --- build.gradle | 2 +- build.properties | 2 +- src/main/java/gregtech/GT_Mod.java | 3 +-- .../implementations/GT_MetaPipeEntity_Cable.java | 3 --- .../loaders/oreprocessing/ProcessingWire.java | 18 +++++++++++---- .../loaders/postload/GT_AE2EnergyTunnelLoader.java | 27 ---------------------- 6 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/gregtech/loaders/postload/GT_AE2EnergyTunnelLoader.java (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/build.gradle b/build.gradle index 2f28009a4c..3ab328be4b 100644 --- a/build.gradle +++ b/build.gradle @@ -112,7 +112,7 @@ dependencies { provided name: "Galacticraft-API", version: config.gc.version, ext: 'jar' provided name: "GalacticraftCore-Dev", version: config.gc.version, ext: 'jar' provided name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar' - provided name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' +// provided name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' provided name: 'Railcraft', version: config.railcraft.version, ext: 'jar' provided name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar' diff --git a/build.properties b/build.properties index eb5559e8fc..212a1b999c 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -gt.version=5.09.33.52 +gt.version=5.09.33.53 ae2.version=rv3-beta-22 applecore.version=1.7.10-1.2.1+107.59407 diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index e4fedf1fa1..27932b98c2 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -767,8 +767,7 @@ public class GT_Mod implements IGT_Mod { new GT_CropLoader().run(); new GT_Worldgenloader().run(); new GT_CoverLoader().run(); - new GT_AE2EnergyTunnelLoader().run(); - + LoadArmorComponents.init(); GT_RecipeRegistrator.registerUsagesForMaterials(null, false, new ItemStack(Blocks.planks, 1), new ItemStack(Blocks.cobblestone, 1), new ItemStack(Blocks.stone, 1), new ItemStack(Items.leather, 1)); 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 3373b142c4..02d6752bdd 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 @@ -24,7 +24,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_SolarPanel; -import gregtech.loaders.postload.PartP2PGTPower; import ic2.api.energy.EnergyNet; import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.energy.tile.IEnergySink; @@ -423,8 +422,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile // AE2-p2p Compat if (GT_Mod.gregtechproxy.mAE2Integration) { - if (tTileEntity instanceof IEnergySource && tTileEntity instanceof IPartHost && ((IPartHost)tTileEntity).getPart(tDir) instanceof PartP2PGTPower && ((IEnergySource) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)) - return true; if (tTileEntity instanceof appeng.tile.powersink.IC2 && ((appeng.tile.powersink.IC2)tTileEntity).acceptsEnergyFrom((TileEntity)baseMetaTile, tDir)) return true; } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java index 7e54fdb279..63f4abcf65 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java @@ -18,7 +18,7 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr private Materials[] dielectrics = {Materials.PolyvinylChloride, Materials.Polydimethylsiloxane}; private Materials[] rubbers = {Materials.Rubber, Materials.StyreneButadieneRubber, Materials.Silicone}; private Materials[] syntheticRubbers = {Materials.StyreneButadieneRubber, Materials.Silicone}; - + static private TunnelType tt = TunnelType.ME; public ProcessingWire() { OrePrefixes.wireGt01.add(this); OrePrefixes.wireGt02.add(this); @@ -29,6 +29,16 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr } public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { + if (GT_Mod.gregtechproxy.mAE2Integration) { + if (tt == TunnelType.ME) { + try { + tt = TunnelType.valueOf("GT_POWER"); + } catch (IllegalArgumentException ignored) { + tt = TunnelType.IC2_POWER; + } + } + } + int cableWidth; OrePrefixes correspondingCable; switch (aPrefix) { @@ -83,7 +93,7 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), new Object[]{OrePrefixes.wireGt12.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial)}); if (GT_Mod.gregtechproxy.mAE2Integration) { - Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, TunnelType.IC2_POWER); + Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, tt); } break; default: @@ -173,8 +183,8 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr } GT_Values.RA.addUnboxingRecipe(GT_OreDictUnificator.get(correspondingCable, aMaterial, 1L), GT_Utility.copyAmount(1L, new Object[]{aStack}), null, 100, 8); if (GT_Mod.gregtechproxy.mAE2Integration) { - Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, TunnelType.IC2_POWER); - Api.INSTANCE.registries().p2pTunnel().addNewAttunement(GT_OreDictUnificator.get(correspondingCable, aMaterial, 1L), TunnelType.IC2_POWER); + Api.INSTANCE.registries().p2pTunnel().addNewAttunement(aStack, tt); + Api.INSTANCE.registries().p2pTunnel().addNewAttunement(GT_OreDictUnificator.get(correspondingCable, aMaterial, 1L), tt); } } } diff --git a/src/main/java/gregtech/loaders/postload/GT_AE2EnergyTunnelLoader.java b/src/main/java/gregtech/loaders/postload/GT_AE2EnergyTunnelLoader.java deleted file mode 100644 index a558696045..0000000000 --- a/src/main/java/gregtech/loaders/postload/GT_AE2EnergyTunnelLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -package gregtech.loaders.postload; - -import appeng.items.parts.PartType; -import gregtech.GT_Mod; -import gregtech.api.util.GT_Log; - -import java.lang.reflect.Field; - -public class GT_AE2EnergyTunnelLoader implements Runnable { - @Override - public void run() { - if (GT_Mod.gregtechproxy.mAE2Integration) { - try { - load(); - } catch (Throwable e) { - GT_Log.out.println("Failed to load P2P tunnel for GT electricity"); - e.printStackTrace(GT_Log.out); - } - } - } - - public void load() throws Throwable { - Field f = PartType.class.getDeclaredField("myPart"); - f.setAccessible(true); - f.set(PartType.P2PTunnelEU, PartP2PGTPower.class); - } -} -- cgit From efbaa3fcb94da0aea4a4d51519b58df4641e68d9 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Fri, 18 Sep 2020 22:31:23 +0200 Subject: fix energy consumption on OC past tick limit fix the energy consumption of the large chemical reactor where it would reduce the energy consumption if the it OCd past the tick limit --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c6828c707e..c41d2ca316 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,8 +617,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking + int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking - xEUt = mMaxProgresstime==0 ? xEUt >> ocTimeShift : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power + if (mMaxProgresstime <1) + { + xEUt *= oldTime * (perfectOC ? 1:2); + break; + } + else + { + xEUt <<= ocTimeShift; + } } if(xEUt > Integer.MAX_VALUE - 1) { mEUt = Integer.MAX_VALUE - 1; -- cgit From ce56bfde0fd9d9e032fbbd5b431923dbf0d679a4 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sat, 19 Sep 2020 19:40:57 +0200 Subject: Revert "fix energy consumption on OC past tick limit" This reverts commit efbaa3fcb94da0aea4a4d51519b58df4641e68d9. --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c41d2ca316..c6828c707e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,17 +617,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking - int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking - if (mMaxProgresstime <1) - { - xEUt *= oldTime * (perfectOC ? 1:2); - break; - } - else - { - xEUt <<= ocTimeShift; - } + xEUt = mMaxProgresstime==0 ? xEUt >> ocTimeShift : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power } if(xEUt > Integer.MAX_VALUE - 1) { mEUt = Integer.MAX_VALUE - 1; -- cgit From 40a6b42cd5e2ad4f6a97fffebf991d56c3ac50fc Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Sat, 19 Sep 2020 19:55:01 +0200 Subject: fix to much power on non perfect OC --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c41d2ca316..6d2110baee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -621,6 +621,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking if (mMaxProgresstime <1) { + if(oldTime == 1) + break; xEUt *= oldTime * (perfectOC ? 1:2); break; } -- cgit From 305d6832b7e2a501b45eb41bf2cdb8e4edb65cfb Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Sat, 19 Sep 2020 20:30:48 +0200 Subject: put back oldTime --- .../metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index a64073d67e..6d2110baee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,6 +617,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking + int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking if (mMaxProgresstime <1) { -- cgit From 749e36968f3a2b392f497e59934ad521f4c78742 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 4 Oct 2020 23:36:56 +0200 Subject: Invalid Muffler Hatch Facing Added the ability to change the invalid facing orientation on the Muffler Hatch Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../GT_MetaTileEntity_Hatch_Muffler.java | 97 +++++++++++++--------- 1 file changed, 56 insertions(+), 41 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 9cadeaddc2..b3998b62e7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -12,6 +12,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.Arrays; + import static gregtech.api.objects.XSTR.XSTR_INSTANCE; public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @@ -53,10 +55,23 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } + private int[] mFacings; + + /*private void init()*/ { + setInValidFacings(ForgeDirection.DOWN); + } + + public void setInValidFacings(ForgeDirection... aFacings) { + mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); + } + @Override public boolean isFacingValid(byte aFacing) { - return aFacing != 0; - } + for (int x : mFacings) + if (x == aFacing) + return false; + return true; + } @Override public boolean isAccessAllowed(EntityPlayer aPlayer) { @@ -80,9 +95,9 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } return false; } - - public int calculatePollutionReduction(int aPollution){ - return (int) (aPollution *(Math.pow(0.85F, mTier - 1))); + + public int calculatePollutionReduction(int aPollution) { + return (int) (aPollution * (Math.pow(0.85F, mTier - 1))); } @Override @@ -98,51 +113,51 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) - pollutionParticles(this.getBaseMetaTileEntity().getWorld(),"largesmoke"); - } - - public void pollutionParticles(World aWorld,String name){ - boolean chk1,chk2,chk3; - float ran1=XSTR_INSTANCE.nextFloat(),ran2=0,ran3=0; - chk1=ran1*100= GT_Mod.gregtechproxy.mPollutionSmogLimit){ - ran2=XSTR_INSTANCE.nextFloat(); - ran3=XSTR_INSTANCE.nextFloat(); - chk2=ran2*100= GT_Mod.gregtechproxy.mPollutionSmogLimit) { + ran2 = XSTR_INSTANCE.nextFloat(); + ran3 = XSTR_INSTANCE.nextFloat(); + chk2 = ran2 * 100 < calculatePollutionReduction(100); + chk3 = ran3 * 100 < calculatePollutionReduction(100); + if (!(chk1 || chk2 || chk3)) return; + } else { + if (!chk1) return; + chk2 = chk3 = false; } - IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity(); - ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing()); - float xPos=aDir.offsetX*0.76F+aMuffler.getXCoord()+0.25F; - float yPos=aDir.offsetY*0.76F+aMuffler.getYCoord()+0.25F; - float zPos=aDir.offsetZ*0.76F+aMuffler.getZCoord()+0.25F; + IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); + ForgeDirection aDir = ForgeDirection.getOrientation(aMuffler.getFrontFacing()); + float xPos = aDir.offsetX * 0.76F + aMuffler.getXCoord() + 0.25F; + float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; + float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - float ySpd=aDir.offsetY*0.1F+0.2F+0.1F*XSTR_INSTANCE.nextFloat(); + float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * XSTR_INSTANCE.nextFloat(); float xSpd; float zSpd; - if(aDir.offsetY==-1){ - float temp=XSTR_INSTANCE.nextFloat()*2*(float)Math.PI; - xSpd=(float)Math.sin(temp)*0.1F; - zSpd=(float)Math.cos(temp)*0.1F; - }else{ - xSpd=aDir.offsetX*(0.1F+0.2F*XSTR_INSTANCE.nextFloat()); - zSpd=aDir.offsetZ*(0.1F+0.2F*XSTR_INSTANCE.nextFloat()); + if (aDir.offsetY == -1) { + float temp = XSTR_INSTANCE.nextFloat() * 2 * (float) Math.PI; + xSpd = (float) Math.sin(temp) * 0.1F; + zSpd = (float) Math.cos(temp) * 0.1F; + } else { + xSpd = aDir.offsetX * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); + zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - if(chk1) - aWorld.spawnParticle(name, xPos + ran1*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk1) + aWorld.spawnParticle(name, xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - if(chk2) - aWorld.spawnParticle(name, xPos + ran2*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk2) + aWorld.spawnParticle(name, xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - if(chk3) - aWorld.spawnParticle(name, xPos + ran3*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk3) + aWorld.spawnParticle(name, xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); } } -- cgit From 7c495e8f38795ced3d8156cea253cea63a0bc46a Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 19 Oct 2020 03:53:55 +0200 Subject: allow to pull items from input bus --- .../implementations/GT_MetaTileEntity_Hatch_InputBus.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index 8c36c2af65..0111d932ae 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -160,7 +160,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; + return true; } @Override -- cgit From 2914c59e4261c91994ca329105c986d959e5d47b Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 19 Oct 2020 04:05:15 +0200 Subject: allow only from input side --- .../implementations/GT_MetaTileEntity_Hatch_InputBus.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index 0111d932ae..dfac210915 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -160,7 +160,7 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return true; + return aSide == getBaseMetaTileEntity().getFrontFacing(); } @Override -- cgit From 2763104566be435df158ca11a96f51503857e11f Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Mon, 19 Oct 2020 12:56:06 +0200 Subject: Unf****d build.gradle Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- build.gradle | 98 +++++++++++----------- .../implementations/GT_MetaPipeEntity_Fluid.java | 38 ++++++--- 2 files changed, 73 insertions(+), 63 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/build.gradle b/build.gradle index 2f28009a4c..4ed676b8c4 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'idea' +apply plugin: 'java' apply plugin: 'signing' file "build.properties" withReader { @@ -29,30 +30,21 @@ version = "${config.gt.version}" group= "gregtech" archivesBaseName = "gregtech" - sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +compileJava.options.encoding("UTF-8") minecraft { version = "${config.minecraft.version}-${config.forge.version}" - runDir = "eclipse" - + runDir = "run" } -idea { module { inheritOutputDirs = true } } - -configurations { - provided - embedded - compile.extendsFrom provided, embedded -} +idea.module.inheritOutputDirs = true repositories { maven { - name 'Forge' - url 'http://files.minecraftforge.net/maven' + name = 'Forge' + url = 'http://files.minecraftforge.net/maven' } maven { name = "chickenbones" @@ -63,58 +55,58 @@ repositories { url = "http://maven.ic2.player.to/" } maven { // EnderIO & EnderCore - name 'tterrag Repo' - url "http://maven.tterrag.com" + name = 'tterrag Repo' + url = "http://maven.tterrag.com" } maven { // TConstruct - name 'DVS1 Maven FS' - url 'http://dvs1.progwml6.com/files/maven' + name = 'DVS1 Maven FS' + url = 'http://dvs1.progwml6.com/files/maven' } maven { // AppleCore - url "http://www.ryanliptak.com/maven/" + url = "http://www.ryanliptak.com/maven/" } maven { // GalacticGreg, YAMCore,.. - name 'UsrvDE' - url "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/" + name = 'UsrvDE' + url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/" } ivy { - name 'gtnh_download_source_stupid_underscore_typo' - artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]" + name = 'gtnh_download_source_stupid_underscore_typo' + artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") } ivy { - name 'gtnh_download_source' - artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]" + name = 'gtnh_download_source' + artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") } } dependencies { - compile "eu.usrv:YAMCore:${config.minecraft.version}-${config.yamcore.version}:deobf" - compile "tconstruct:TConstruct:${config.minecraft.version}-${config.tconstruct.version}:deobf" - compile "mantle:Mantle:${config.minecraft.version}-${config.mantle.version}:deobf" - provided ("appeng:appliedenergistics2:${config.ae2.version}:dev") { + compileOnly "eu.usrv:YAMCore:${config.minecraft.version}-${config.yamcore.version}:deobf" + compileOnly "tconstruct:TConstruct:${config.minecraft.version}-${config.tconstruct.version}:deobf" + //compile "mantle:Mantle:${config.minecraft.version}-${config.mantle.version}:deobf" + compileOnly ("appeng:appliedenergistics2:${config.ae2.version}:dev") { exclude module: '*' } - provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.codechickenlib.version}:dev" - provided "codechicken:CodeChickenCore:${config.minecraft.version}-${config.codechickencore.version}:dev" - provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" - provided "codechicken:Translocator:${config.minecraft.version}-${config.translocators.version}:dev" - provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" - provided "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev" - provided "applecore:AppleCore:${config.applecore.version}:api" - provided "com.enderio.core:EnderCore:${config.enderiocore.version}:dev" - provided ("com.enderio:EnderIO:${config.enderio.version}:dev") { + compileOnly "codechicken:CodeChickenLib:${config.minecraft.version}-${config.codechickenlib.version}:dev" + compileOnly "codechicken:CodeChickenCore:${config.minecraft.version}-${config.codechickencore.version}:dev" + compileOnly "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" + compileOnly "codechicken:Translocator:${config.minecraft.version}-${config.translocators.version}:dev" + compile "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" + compileOnly "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev" + compileOnly "applecore:AppleCore:${config.applecore.version}:api" + compileOnly "com.enderio.core:EnderCore:${config.enderiocore.version}:dev" + compileOnly ("com.enderio:EnderIO:${config.enderio.version}:dev") { transitive = false } - compile files("libs/Galacticraft-API-1.7-${config.gc.version}.jar") - compile files("libs/GalacticraftCore-Dev-${config.gc.version}.jar") - provided name: "Galacticraft-API", version: config.gc.version, ext: 'jar' - provided name: "GalacticraftCore-Dev", version: config.gc.version, ext: 'jar' - provided name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar' - provided name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' - provided name: 'Railcraft', version: config.railcraft.version, ext: 'jar' - provided name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar' + compileOnly files("libs/Galacticraft-API-1.7-${config.gc.version}.jar") + compileOnly files("libs/GalacticraftCore-Dev-${config.gc.version}.jar") + compileOnly name: "Galacticraft-API", version: config.gc.version, ext: 'jar' + compileOnly name: "GalacticraftCore-Dev", version: config.gc.version, ext: 'jar' + compileOnly name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar' + //compileOnly name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' + compileOnly name: 'Railcraft', version: config.railcraft.version, ext: 'jar' + compileOnly name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar' //provided name: 'ImmersiveEngineering', version: config.immeng.version, ext: 'jar' //provided name: 'magneticraft', version: config.magneticraft.version, ext: 'jar' @@ -149,14 +141,18 @@ task sourceJar(type: Jar) { task devJar(type: Jar) { from sourceSets.main.output classifier = 'dev' - manifest { - //attributes 'FMLCorePlugin': 'WhateverLoaderClass' - //attributes 'FMLCorePluginContainsFMLMod': 'true' - } +} + +task apiJar(type: Jar) { + from sourceSets.main.allSource + include("gregtech/api/**") + classifier = 'api' } artifacts { - archives devJar + archives(devJar) + archives(sourceJar) + archives(apiJar) } task signJar(dependsOn: 'reobf'){ 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 23afaa84f7..1d1b1a9ea0 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 @@ -1,8 +1,12 @@ package gregtech.api.metatileentity.implementations; +import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; @@ -389,36 +393,46 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public boolean canConnect(byte aSide, TileEntity tTileEntity) { - if (tTileEntity == null) return false; + if (tTileEntity == null) + return false; final byte tSide = (byte)ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); - if (baseMetaTile == null) return false; + if (baseMetaTile == null) + return false; final GT_CoverBehavior coverBehavior = baseMetaTile.getCoverBehaviorAtSide(aSide); final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; - if (coverBehavior instanceof GT_Cover_Drain) return true; - - // Tinker Construct Faucets return a null tank info, so check the class - if (GregTech_API.mTConstruct && tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic) return true; + if (coverBehavior instanceof GT_Cover_Drain || isTConstructFaucet(tTileEntity)) + return true; final IFluidHandler fTileEntity = (tTileEntity instanceof IFluidHandler) ? (IFluidHandler) tTileEntity : null; if (fTileEntity != null) { FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { - if (tInfo.length > 0) return true; - - // Translocators return a TankInfo, but it's of 0 length - so check the class if we see this pattern - if (GregTech_API.mTranslocator && tTileEntity instanceof codechicken.translocator.TileLiquidTranslocator) return true; - if (gTileEntity != null && gTileEntity.getCoverBehaviorAtSide(tSide) instanceof GT_Cover_FluidRegulator) return true; + return tInfo.length > 0 + || isTranslocator(tTileEntity) + || gTileEntity != null && gTileEntity.getCoverBehaviorAtSide(tSide) instanceof GT_Cover_FluidRegulator; } } return false; } + @Optional.Method(modid = "TConstruct") + private boolean isTConstructFaucet(TileEntity tTileEntity){ + // Tinker Construct Faucets return a null tank info, so check the class + return GregTech_API.mTConstruct && tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic; + } + + @Optional.Method(modid = "Translocator") + private boolean isTranslocator(TileEntity tTileEntity){ + // Translocators return a TankInfo, but it's of 0 length - so check the class if we see this pattern + return GregTech_API.mTranslocator && tTileEntity instanceof codechicken.translocator.TileLiquidTranslocator; + } + @Override public boolean getGT6StyleConnection() { // Yes if GT6 pipes are enabled -- cgit From 1661004faa9a3e1839b544b6cf4ac1479ea60a67 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Mon, 19 Oct 2020 14:02:28 +0200 Subject: Lift checks out of Stripped Methodes to prevent NoSuchMethodErrors Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../metatileentity/implementations/GT_MetaPipeEntity_Fluid.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') 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 1d1b1a9ea0..8a28301fdf 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 @@ -404,7 +404,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final GT_CoverBehavior coverBehavior = baseMetaTile.getCoverBehaviorAtSide(aSide); final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; - if (coverBehavior instanceof GT_Cover_Drain || isTConstructFaucet(tTileEntity)) + if (coverBehavior instanceof GT_Cover_Drain || (GregTech_API.mTConstruct && isTConstructFaucet(tTileEntity))) return true; final IFluidHandler fTileEntity = (tTileEntity instanceof IFluidHandler) ? (IFluidHandler) tTileEntity : null; @@ -413,7 +413,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { return tInfo.length > 0 - || isTranslocator(tTileEntity) + || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) || gTileEntity != null && gTileEntity.getCoverBehaviorAtSide(tSide) instanceof GT_Cover_FluidRegulator; } @@ -424,13 +424,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Optional.Method(modid = "TConstruct") private boolean isTConstructFaucet(TileEntity tTileEntity){ // Tinker Construct Faucets return a null tank info, so check the class - return GregTech_API.mTConstruct && tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic; + return tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic; } @Optional.Method(modid = "Translocator") private boolean isTranslocator(TileEntity tTileEntity){ // Translocators return a TankInfo, but it's of 0 length - so check the class if we see this pattern - return GregTech_API.mTranslocator && tTileEntity instanceof codechicken.translocator.TileLiquidTranslocator; + return tTileEntity instanceof codechicken.translocator.TileLiquidTranslocator; } @Override -- cgit From 4b802f15c5af0f69a3275fd5951e65145083acf6 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Sun, 25 Oct 2020 21:27:07 +0100 Subject: fix acidental perfect OC on all multies (#332) --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 6d2110baee..202e542c88 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -628,7 +628,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } else { - xEUt <<= ocTimeShift; + xEUt <<= 2; } } if(xEUt > Integer.MAX_VALUE - 1) { -- cgit From 9db3e6c47eb404abffe662573d7b1d7fa5302db6 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 10 Nov 2020 17:40:35 +0100 Subject: Cleanroom Callback Rework --- .../metatileentity/IMachineCallback.java | 7 +++ .../GT_MetaTileEntity_BasicMachine.java | 49 +++++++++++++++----- .../multi/GT_MetaTileEntity_Cleanroom.java | 53 +++++++++++++--------- 3 files changed, 77 insertions(+), 32 deletions(-) create mode 100644 src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java new file mode 100644 index 0000000000..9306ef28f3 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMachineCallback.java @@ -0,0 +1,7 @@ +package gregtech.api.interfaces.metatileentity; + +public interface IMachineCallback { + Machinetype getCallbackBase(); + void setCallbackBase(Machinetype callback); + Class getType(); +} \ No newline at end of file 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 1c5b90f7db..97daa6fc71 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 @@ -7,6 +7,7 @@ import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMachineCallback; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; @@ -15,6 +16,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -37,7 +39,8 @@ import static gregtech.api.enums.GT_Values.debugCleanroom; * This is the main construct for my Basic Machines such as the Automatic Extractor * Extend this class to make a simple Machine */ -public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank { +public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_BasicTank implements IMachineCallback { + /** * return values for checkRecipe() */ @@ -51,8 +54,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; public FluidStack mOutputFluid; - public String mGUIName = "", mNEIName = ""; - public GT_MetaTileEntity_MultiBlockBase mCleanroom; + public String mGUIName, mNEIName; + + + @Deprecated + public GT_MetaTileEntity_Cleanroom mCleanroom; /** * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered */ @@ -125,6 +131,21 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B return true; } + @Override + public GT_MetaTileEntity_Cleanroom getCallbackBase() { + return this.mCleanroom; + } + + @Override + public void setCallbackBase(GT_MetaTileEntity_Cleanroom callback) { + this.mCleanroom = callback; + } + + @Override + public Class getType() { + return GT_MetaTileEntity_Cleanroom.class; + } + @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[14][17][]; @@ -449,7 +470,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); else if (mOutputFluid.isFluidEqual(getDrainableStack())) getDrainableStack().amount += mOutputFluid.amount; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null; + Arrays.fill(mOutputItems, null); mOutputFluid = null; mEUt = 0; mProgresstime = 0; @@ -518,7 +539,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B startProcess(); } else { mMaxProgresstime = 0; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null; + Arrays.fill(mOutputItems, null); mOutputFluid = null; } } @@ -584,7 +605,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B //Long EUt calculation long xEUt=aEUt; //Isnt too low EUt check? - long tempEUt = xEUt mCleanroom.mEfficiency) + if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > getCallbackBase().mEfficiency) { if (debugCleanroom) { GT_Log.out.println( "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + - mCleanroom.mEfficiency + getCallbackBase().mEfficiency ); } mOutputItems[i] = null; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 6ceebc3877..21a407f6e2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -5,10 +5,10 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMachineCallback; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; @@ -16,9 +16,9 @@ import gregtech.api.util.GT_Recipe; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import static gregtech.api.enums.GT_Values.debugCleanroom; -import static gregtech.api.enums.GT_Values.V; public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase { private int mHeight = -1; @@ -207,24 +207,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) { return false; } - for (int dX = -x + 1; dX <= x - 1; dX++) { - for (int dZ = -z + 1; dZ <= z - 1; dZ++) { - for (int dY = -1; dY >= y + 1; dY--) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); - if (tTileEntity != null) { - IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Machine detected, adding pointer back to cleanroom" - ); - } - ((GT_MetaTileEntity_BasicMachine) aMetaTileEntity).mCleanroom = this; - } - } - } - } - } + + setCallbacks(x, y, z, aBaseMetaTileEntity); if (doorState) { this.mEfficiency = Math.max(0, this.mEfficiency - 200); @@ -240,7 +224,34 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas return mPlascreteCount>=20 && mGlassCount < (int) Math.floor(ratio); } - + + private void setCallbacks(int x, int y, int z, IGregTechTileEntity aBaseMetaTileEntity){ + for (int dX = -x + 1; dX <= x - 1; dX++) + for (int dZ = -z + 1; dZ <= z - 1; dZ++) + for (int dY = -1; dY >= y + 1; dY--) { + TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityOffset(dX, dY, dZ); + + if (tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity iMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + + if (iMetaTileEntity instanceof IMachineCallback) + checkAndSetCallback((IMachineCallback) iMetaTileEntity); + + } else if (tTileEntity instanceof IMachineCallback) + checkAndSetCallback((IMachineCallback) tTileEntity); + } + } + + @SuppressWarnings("unchecked") + private void checkAndSetCallback(IMachineCallback iMachineCallback) { + if (debugCleanroom) + GT_Log.out.println( + "Cleanroom: IMachineCallback detected, checking for cleanroom: " + (iMachineCallback.getType() == this.getClass()) + ); + if (iMachineCallback.getType() == this.getClass()) + ((IMachineCallback) iMachineCallback).setCallbackBase(this); + } + @Override public boolean allowGeneralRedstoneOutput(){ return true; -- cgit From 997abcd915717c11dd7bd1423e41512cb1446e53 Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Mon, 16 Nov 2020 00:40:58 +0100 Subject: use moveMultipleItemStacks to variuos functions --- .../implementations/GT_MetaPipeEntity_Item.java | 2 +- .../GT_MetaTileEntity_BasicMachine.java | 16 ++++++++--- .../implementations/GT_MetaTileEntity_Buffer.java | 4 +-- .../GT_MetaTileEntity_Hatch_OutputBus.java | 11 +++++--- .../gregtech/common/covers/GT_Cover_Conveyor.java | 32 +++++++++++++++------- 5 files changed, 44 insertions(+), 21 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') 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 650e9a031e..c73e95e95b 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 @@ -270,7 +270,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { - return GT_Utility.moveOneItemStack(aSender, tInventory, (byte) 6, GT_Utility.getOppositeSide(aSide), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1) > 0; + return GT_Utility.moveMultipleItemStacks(aSender, tInventory, (byte) 6, GT_Utility.getOppositeSide(aSide), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,1) > 0; } } } 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 97daa6fc71..2c632c596b 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 @@ -32,6 +32,7 @@ import java.util.Arrays; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.debugCleanroom; +import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -510,10 +511,17 @@ 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()); - for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { - tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); - if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true); - } + long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); + int tMaxStacks = (int)(tStoredEnergy/64l); + if (tMaxStacks > mOutputItems.length) + tMaxStacks = mOutputItems.length; + + int tCost = moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks); + aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCost, true); +// for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { +// tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); +// if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true); +// } } if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 645836a801..7284cd3c01 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -259,9 +259,9 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { int tCost; if( bStockingMode ) - tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1); + tCost = GT_Utility.moveMultipleItemStacks(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1,1); else - tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize); + tCost = GT_Utility.moveMultipleItemStacks(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize,1); if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) { mSuccess = 50; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java index 6c56ac6a74..1dafbcce5a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java @@ -12,6 +12,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import static gregtech.api.util.GT_Utility.*; + public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), new String[]{"Item Output for Multiblocks", @@ -112,10 +114,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick&0x7)==0) { IInventory tTileEntity =aBaseMetaTileEntity.getIInventoryAtSide(aBaseMetaTileEntity.getFrontFacing()); if(tTileEntity!=null){ - for (ItemStack aMInventory : mInventory) - GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, - aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), - null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + moveMultipleItemStacks(aBaseMetaTileEntity,tTileEntity,aBaseMetaTileEntity.getFrontFacing(),aBaseMetaTileEntity.getBackFacing(),null,false,(byte)64,(byte)1,(byte)64,(byte)1,mInventory.length); + +// GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity, +// aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), +// null, false, (byte) 64, (byte) 1, (byte)( 64 * aBaseMetaTileEntity.getSizeInventory()), (byte) 1); } } } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java index 303f358a34..aee46b7aab 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java @@ -14,6 +14,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fluids.Fluid; +import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; + public class GT_Cover_Conveyor extends GT_CoverBehavior { public final int mTickRate; private final int mMaxStacks; @@ -42,19 +44,29 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { boolean costsEnergy = ((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= 128L); byte moved; - for(int i=0 ; i < this.mMaxStacks ; i++) { - // Costs energy but we don't have enough, bail - if ((costsEnergy && !aTileEntity.isUniversalEnergyStored(256L))) - break; - moved = GT_Utility.moveOneItemStack(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + if (costsEnergy) { + long tStoredEnergy = aTileEntity.getUniversalEnergyStored(); + int tMaxStacks = (int)(tStoredEnergy/(4*64*this.mMaxStacks)); + if (tMaxStacks > this.mMaxStacks) + tMaxStacks = this.mMaxStacks; + int tCost = moveMultipleItemStacks(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks); + aTileEntity.decreaseStoredEnergyUnits(4 * tCost, true); + } else { + moveMultipleItemStacks(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,this.mMaxStacks); + } - if(moved == 0) - break; - if (costsEnergy) - aTileEntity.decreaseStoredEnergyUnits(4 * moved, true); - } +// for(int i=0 ; i < this.mMaxStacks ; i++) { +// // Costs energy but we don't have enough, bail +// if ((costsEnergy && !aTileEntity.isUniversalEnergyStored(256L))) +// break; +// +// moved = GT_Utility.moveOneItemStack(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); +// +// if(moved == 0) +// break; +// } return aCoverVariable; } -- cgit From d66962ed18b3f8d15889ce0b5545427311b24f94 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:45:04 +0100 Subject: add the option to disable input filter (#365) --- .../implementations/GT_MetaTileEntity_Hatch_InputBus.java | 9 ++++++++- src/main/resources/assets/gregtech/lang/en_US.lang | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index dfac210915..f2f76dca4f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -13,10 +13,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; + public boolean disableFilter = false; public GT_MetaTileEntity_Hatch_InputBus(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), new String[]{ @@ -136,12 +138,14 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setBoolean("disableSort", disableSort); + aNBT.setBoolean("disableFilter", disableFilter); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); disableSort = aNBT.getBoolean("disableSort"); + disableFilter = aNBT.getBoolean("disableFilter"); } @Override @@ -151,6 +155,9 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { if (aPlayer.isSneaking()) { disableSort = !disableSort; GT_Utility.sendChatToPlayer(aPlayer, trans("200", "Sort mode: " + (disableSort ? "Disabled" : "Enabled"))); + } else { + disableFilter = !disableFilter; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter."+disableFilter)); } } @@ -165,6 +172,6 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); + return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack)); } } diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index c3c5a574af..158d108278 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -66,7 +66,8 @@ GT5U.machines.minermulti=Multiblock Miner GT5U.machines.voidoveflow.enabled=Overflow voiding enabled GT5U.machines.voidoveflow.disabled=Overflow voiding disabled - +GT5U.hatch.disableFilter.true=Input Filter Off +GT5U.hatch.disableFilter.false=Input Filter On GT5U.multiblock.pollution=Pollution reduced to GT5U.multiblock.energy=Stored Energy -- cgit From b3789aebb681711a91ec51cdd390a47dc36282dd Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 4 Dec 2020 16:40:24 +0100 Subject: fix(rendering): UV Mapping on tiles - Fix all faces use the same UV mapping and orientation to be same as standard vanilla full blocks Vanilla blocks's face rendering. - Fix the orientation of bottom-face's arrow overlay with fixed UV of the `GT_MetaTileEntity_Buffer` type machines (filters, buffers, regulators) - Fix UV mapping of item pipes restrictor overlay - Fix UV mapping of fluid pipes blocked input overlay orientation on all sides - Fix UV mappiong of thick covers - Remove the now useless and broken custom UVMapped vertices at the bottom face. ![](https://i.imgur.com/MImsbQY.png) --- .../implementations/GT_MetaPipeEntity_Fluid.java | 2 +- .../implementations/GT_MetaTileEntity_Buffer.java | 133 ++++++++++++--------- .../gregtech/api/objects/GT_RenderedTexture.java | 77 +++++------- .../java/gregtech/api/objects/GT_SidedTexture.java | 98 +++++---------- .../gregtech/common/render/GT_Renderer_Block.java | 58 ++++----- 5 files changed, 160 insertions(+), 208 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') 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 8a28301fdf..2afc996df2 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 @@ -111,7 +111,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; //Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate - if (tThickNess >= 0.99F && (aSide == 5 || aSide == 2)) + if (aSide == 5 || aSide == 2 || aSide == 0) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 7284cd3c01..8758ea1a02 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -8,10 +8,18 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.GT_Values.V; public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock { + private static final int OUTPUT_INDEX = 0; + private static final int ARROW_RIGHT_INDEX = 1; + private static final int ARROW_DOWN_INDEX = 2; + private static final int ARROW_LEFT_INDEX = 3; + private static final int ARROW_UP_INDEX = 4; + private static final int FRONT_INDEX = 5; + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false; public int mSuccess = 0, mTargetStackSize = 0; @@ -33,74 +41,85 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[6][17][]; - ITexture tIcon = getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT), tUp = new GT_RenderedTexture(Textures.BlockIcons.ARROW_UP), tDown = new GT_RenderedTexture(Textures.BlockIcons.ARROW_DOWN), tLeft = new GT_RenderedTexture(Textures.BlockIcons.ARROW_LEFT), tRight = new GT_RenderedTexture(Textures.BlockIcons.ARROW_RIGHT); - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tOut}; - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tRight, tIcon}; - rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tDown, tIcon}; - rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tLeft, tIcon}; - rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tUp, tIcon}; - rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; + ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; + ITexture tIcon = getOverlayIcon(); + ITexture tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT); + ITexture tUp = new GT_RenderedTexture(Textures.BlockIcons.ARROW_UP); + ITexture tDown = new GT_RenderedTexture(Textures.BlockIcons.ARROW_DOWN); + ITexture tLeft = new GT_RenderedTexture(Textures.BlockIcons.ARROW_LEFT); + ITexture tRight = new GT_RenderedTexture(Textures.BlockIcons.ARROW_RIGHT); + for (int i = 0; i < rTextures[0].length; i++) { + rTextures[OUTPUT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tOut}; + rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tRight, tIcon}; + rTextures[ARROW_DOWN_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tDown, tIcon}; + rTextures[ARROW_LEFT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tLeft, tIcon}; + rTextures[ARROW_UP_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tUp, tIcon}; + rTextures[FRONT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tIcon}; } return rTextures; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return mTextures[5][aColorIndex + 1]; - if (GT_Utility.getOppositeSide(aSide) == aFacing) return mTextures[0][aColorIndex + 1]; - switch (aFacing) { - case 0: - return mTextures[4][aColorIndex + 1]; - case 1: - return mTextures[2][aColorIndex + 1]; - case 2: - switch (aSide) { - case 0: - return mTextures[2][aColorIndex + 1]; - case 1: - return mTextures[2][aColorIndex + 1]; - case 4: - return mTextures[1][aColorIndex + 1]; - case 5: - return mTextures[3][aColorIndex + 1]; + int colorIndex = aColorIndex + 1; + ForgeDirection side = ForgeDirection.VALID_DIRECTIONS[aSide]; + ForgeDirection facing = ForgeDirection.VALID_DIRECTIONS[aFacing]; + if (side == facing) return mTextures[FRONT_INDEX][colorIndex]; + if (ForgeDirection.OPPOSITES[aSide] == aFacing) return mTextures[OUTPUT_INDEX][colorIndex]; + switch (facing) { + case DOWN: + return mTextures[ARROW_UP_INDEX][colorIndex]; // ARROW_UP + case UP: + return mTextures[ARROW_DOWN_INDEX][colorIndex]; // ARROW_DOWN + case NORTH: + switch (side) { + case DOWN: + case UP: + return mTextures[ARROW_DOWN_INDEX][colorIndex]; // ARROW_DOWN + case WEST: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + case EAST: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + default: } - case 3: - switch (aSide) { - case 0: - return mTextures[4][aColorIndex + 1]; - case 1: - return mTextures[4][aColorIndex + 1]; - case 4: - return mTextures[3][aColorIndex + 1]; - case 5: - return mTextures[1][aColorIndex + 1]; + break; + case SOUTH: + switch (side) { + case DOWN: + case UP: + return mTextures[ARROW_UP_INDEX][colorIndex]; // ARROW_UP + case WEST: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + case EAST: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + default: } - case 4: - switch (aSide) { - case 0: - return mTextures[3][aColorIndex + 1]; - case 1: - return mTextures[1][aColorIndex + 1]; - case 2: - return mTextures[3][aColorIndex + 1]; - case 3: - return mTextures[1][aColorIndex + 1]; + break; + case WEST: + switch (side) { + case DOWN: + case UP: + case SOUTH: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + case NORTH: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + default: } - case 5: - switch (aSide) { - case 0: - return mTextures[1][aColorIndex + 1]; - case 1: - return mTextures[3][aColorIndex + 1]; - case 2: - return mTextures[1][aColorIndex + 1]; - case 3: - return mTextures[3][aColorIndex + 1]; + break; + case EAST: + switch (side) { + case DOWN: + case UP: + case SOUTH: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + case NORTH: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + default: } + break; + default: } - return mTextures[5][aColorIndex + 1]; + return mTextures[FRONT_INDEX][colorIndex]; } @Override diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 70b71cf125..074cabf341 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -37,94 +37,77 @@ public class GT_RenderedTexture implements ITexture, IColorModulationContainer { @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tesselator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; } + @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tesselator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + tesselator.setColorRGBA(255, 255, 255, 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer.getIcon(); - - float d_16 = 16.0F; - float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - float d11 = aX + (float)aRenderer.renderMinX; - float d12 = aX + (float)aRenderer.renderMaxX; - float d13 = aY + (float)aRenderer.renderMinY; - float d14 = aZ + (float)aRenderer.renderMinZ; - float d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); - - if ((aIcon = mIconContainer.getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + aRenderer.flipTexture = true; + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + tesselator.setColorRGBA(128, 128, 128, 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; + aRenderer.flipTexture = false; } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tesselator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tesselator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 2b4f144393..ab88225781 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -7,7 +7,6 @@ import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; public class GT_SidedTexture implements ITexture, IColorModulationContainer { private final IIconContainer[] mIconContainer; @@ -45,115 +44,76 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer { @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getIcon()); if (mIconContainer[5].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getIcon()); if (mIconContainer[4].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getOverlayIcon()); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); if (mIconContainer[1].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + tessellator.setColorRGBA(255, 255, 255, 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer[0].getIcon(); - - float d_16 = 16.0F; - float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - float d11 = aX + (float)aRenderer.renderMinX; - float d12 = aX + (float)aRenderer.renderMaxX; - float d13 = aY + (float)aRenderer.renderMinY; - float d14 = aZ + (float)aRenderer.renderMinZ; - float d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); - - if ((aIcon = mIconContainer[0].getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - d11 = aX + (float)aRenderer.renderMinX; - d12 = aX + (float)aRenderer.renderMaxX; - d13 = aY + (float)aRenderer.renderMinY; - d14 = aZ + (float)aRenderer.renderMinZ; - d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + aRenderer.flipTexture = true; + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); + if (mIconContainer[0].getOverlayIcon() != null) { + tessellator.setColorRGBA(128, 128, 128, 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } + aRenderer.field_152631_f = false; + aRenderer.flipTexture = false; } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getIcon()); if (mIconContainer[3].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getOverlayIcon()); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getIcon()); if (mIconContainer[2].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index 795e93f582..5ee32f8dc6 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -154,7 +154,7 @@ public class GT_Renderer_Block } boolean[] tIsCovered = new boolean[6]; for (byte i = 0; i < 6; i = (byte) (i + 1)) { - tIsCovered[i] = (aTileEntity.getCoverIDAtSide(i) != 0 ? true : false); + tIsCovered[i] = (aTileEntity.getCoverIDAtSide(i) != 0); } if ((tIsCovered[0]) && (tIsCovered[1]) && (tIsCovered[2]) && (tIsCovered[3]) && (tIsCovered[4]) && (tIsCovered[5])) { return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); @@ -420,20 +420,17 @@ public class GT_Renderer_Block } public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); - } + if (aWorld == null) return; + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) return; + Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); + if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { @@ -444,13 +441,12 @@ public class GT_Renderer_Block Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); } if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { @@ -460,15 +456,13 @@ public class GT_Renderer_Block } Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); } - aRenderer.flipTexture = (!aFullBlock); if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { @@ -479,13 +473,12 @@ public class GT_Renderer_Block Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); } if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { @@ -496,13 +489,12 @@ public class GT_Renderer_Block Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); } if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { @@ -512,15 +504,13 @@ public class GT_Renderer_Block } Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); } - aRenderer.flipTexture = (!aFullBlock); if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ); + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); } } } - aRenderer.flipTexture = false; } public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { @@ -579,7 +569,7 @@ public class GT_Renderer_Block if (aTileEntity == null) { return false; } - if (((aTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer))) { + if (aTileEntity instanceof IGregTechTileEntity && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer))) { return true; } if ((aTileEntity instanceof IPipeRenderedTileEntity)) { -- cgit