diff options
author | Jakub Szewczyk <git@kubasz.xyz> | 2022-03-31 17:31:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 18:31:42 +0200 |
commit | 2ed0d164315810c0c03e92d30e52225a8228ac99 (patch) | |
tree | 32546c67961d47ed9b7767c18b625952fff576be /src/main | |
parent | bec757c9d1f329fb30ed262b3eea9e9b69289181 (diff) | |
download | GT5-Unofficial-2ed0d164315810c0c03e92d30e52225a8228ac99.tar.gz GT5-Unofficial-2ed0d164315810c0c03e92d30e52225a8228ac99.tar.bz2 GT5-Unofficial-2ed0d164315810c0c03e92d30e52225a8228ac99.zip |
Make gregtech machines mark the chunk they're in as dirty on updates (#1001)
* Make gregtech machines mark the chunk they're in as dirty on updates
* Avoid any potential NPE in markDirty
* Mark dirty on GT tool use (screwdriver/wrench/etc)
* Fix multiblocks not marking hatches/buses as dirty too
Diffstat (limited to 'src/main')
7 files changed, 76 insertions, 27 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 2f7504a4ce..f10066edf8 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -203,9 +203,9 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I } } if (isServerSide() && mTickTimer > 10) { - if (!doCoverThings()) + if (!doCoverThings()) return; - + byte oldConnections = mConnections; // Mask-out connection direction bits to keep only Foam related connections mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~IConnectable.CONNECTED_ALL)); @@ -278,7 +278,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I 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 = mConnections, + xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor @@ -471,6 +471,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I @Override public void setInventorySlotContents(int aIndex, ItemStack aStack) { + markDirty(); mInventoryChanged = true; if (canAccessData()) mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); @@ -810,6 +811,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); if (tCurrentItem != null) { if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + mMetaTileEntity.markDirty(); tCurrentItem.func_150996_a(Items.bucket); setColorization((byte) -1); return true; @@ -817,6 +819,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { if (mMetaTileEntity.onWrenchRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { + mMetaTileEntity.markDirty(); GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } @@ -827,12 +830,14 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { setCoverDataAtSide(tSide, getCoverBehaviorAtSideNew(tSide).onCoverScrewdriverClick(tSide, getCoverIDAtSide(tSide), getComplexCoverDataAtSide(tSide), this, aPlayer, 0.5F, 0.5F, 0.5F)); mMetaTileEntity.onScrewdriverRightClick(tSide, aPlayer, aX, aY, aZ); + mMetaTileEntity.markDirty(); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } } else { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { setCoverDataAtSide(aSide, getCoverBehaviorAtSideNew(aSide).onCoverScrewdriverClick(aSide, getCoverIDAtSide(aSide), getComplexCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + mMetaTileEntity.markDirty(); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } } @@ -850,6 +855,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { if (mWorks) disableWorking(); else enableWorking(); + mMetaTileEntity.markDirty(); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("090","Machine Processing: ") + (isAllowedToWork() ? GT_Utility.trans("088","Enabled") : GT_Utility.trans("087","Disabled"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord); } @@ -858,6 +864,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { + mMetaTileEntity.markDirty(); //logic handled internally GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } @@ -867,9 +874,11 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { + mMetaTileEntity.markDirty(); //logic handled internally GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord); } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { + mMetaTileEntity.markDirty(); mStrongRedstone ^= (1 << tSide); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("091","Redstone Output at Side ") + tSide + GT_Utility.trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? GT_Utility.trans("093","Strong") : GT_Utility.trans("094","Weak"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); @@ -888,6 +897,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I mMetaTileEntity.allowCoverOnSide(coverSide, new GT_ItemStack(tCurrentItem))) { setCoverItemAtSide(coverSide, tCurrentItem); + mMetaTileEntity.markDirty(); if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } @@ -898,6 +908,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord); dropCover(coverSide, aSide, false); + mMetaTileEntity.markDirty(); } return true; } @@ -916,7 +927,13 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I return false; try { - if (!aPlayer.isSneaking() && hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); + if (!aPlayer.isSneaking() && hasValidMetaTileEntity()) { + boolean handled = mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); + if(handled) { + mMetaTileEntity.markDirty(); + } + return handled; + } } catch (Throwable e) { GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); e.printStackTrace(GT_Log.err); @@ -1156,7 +1173,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I if (!canAccessData() || getCoverIDAtSide(aSide) != 0) return false; return mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy); } - + private boolean canMoveFluidOnSide(ForgeDirection aSide, Fluid aFluid, boolean isFill) { if (aSide == ForgeDirection.UNKNOWN) return true; @@ -1215,7 +1232,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { if (canAccessData() - && (aSide == ForgeDirection.UNKNOWN + && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSideNew((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getComplexCoverDataAtSide((byte) aSide.ordinal()), null, this)) @@ -1242,6 +1259,7 @@ public class BaseMetaPipeEntity extends CoverableGregTechTileEntity implements I } aStack = GT_OreDictUnificator.get(aStack); if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { + markDirty(); tStack.stackSize += aStack.stackSize; return true; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 222fe6a8fb..78d73d6a51 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -89,7 +89,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I private final boolean[] mActiveEUOutputs = new boolean[]{false, false, false, false, false, false}; private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; - private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false; + private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false; private boolean mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true; private boolean mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false; private byte mColor = 0, oColor = 0, oStrongRedstone = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage=0; @@ -322,9 +322,9 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I mAverageEUInput[mAverageEUInputIndex] = 0; mAverageEUOutput[mAverageEUOutputIndex] = 0; } - + mMetaTileEntity.onPreTick(this, mTickTimer); - + if (!hasValidMetaTileEntity()) { mRunningThroughTick = false; return; @@ -777,7 +777,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I doEnetUpdate(); cableUpdateDelay = 10; - + if (mMetaTileEntity.shouldTriggerBlockUpdate()) { // If we're triggering a block update this will call onMachineBlockUpdate() GregTech_API.causeMachineUpdate(worldObj, xCoord, yCoord, zCoord); @@ -803,8 +803,10 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I @Override public void setInventorySlotContents(int aIndex, ItemStack aStack) { mInventoryChanged = true; - if (canAccessData()) + if (canAccessData()) { + markDirty(); mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + } } @Override @@ -1145,7 +1147,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I } return false; } - + @Override protected boolean hasValidMetaTileEntity() { return mMetaTileEntity != null && mMetaTileEntity.getBaseMetaTileEntity() == this; @@ -1676,7 +1678,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I return rEU / (mAverageEUOutput.length - 1); } - + @Override protected void updateOutputRedstoneSignal(byte aSide) { if (mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { @@ -1685,7 +1687,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I setOutputRedstoneSignal(aSide, (byte) 15); } } - + @Override public String getOwnerName() { if (GT_Utility.isStringInvalid(mOwnerName)) return "Player"; @@ -1983,6 +1985,7 @@ public class BaseMetaTileEntity extends CoverableGregTechTileEntity implements I aStack = GT_OreDictUnificator.get(aStack); if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { tStack.stackSize += aStack.stackSize; + markDirty(); return true; } return false; diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 7b05b582ae..a23956f6e3 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidHandler; @@ -465,9 +466,15 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje public final void setToFire() { worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.fire); } - - @Override - public void markDirty() {/* Do not do the super Function */} + + @Override + public void markDirty() { + // Avoid sending neighbor updates, just mark the chunk as dirty to make sure it gets saved + Chunk chunk = worldObj.getChunkFromBlockCoords(xCoord, zCoord); + if(chunk != null) { + chunk.setChunkModified(); + } + } @Deprecated public String trans(String aKey, String aEnglish){ diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 0e27e66f6d..a065dcd50f 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -418,7 +418,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity { * This is used to set the internal Energy to the given Parameter. I use this for the IDSU. */ public void setEUVar(long aEnergy) { - ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredEnergy = aEnergy; + if (aEnergy != ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredEnergy) { + markDirty(); + ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredEnergy = aEnergy; + } } /** @@ -432,7 +435,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity { * This is used to set the internal Steam Energy to the given Parameter. */ public void setSteamVar(long aSteam) { - ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam = aSteam; + if(((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam != aSteam){ + markDirty(); + ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam = aSteam; + } } /** @@ -679,6 +685,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity { @Override public void setInventorySlotContents(int aIndex, ItemStack aStack) { + markDirty(); if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack; } @@ -704,10 +711,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity { ItemStack tStack = getStackInSlot(aIndex), rStack = GT_Utility.copyOrNull(tStack); if (tStack != null) { if (tStack.stackSize <= aAmount) { - if (setStackToZeroInsteadOfNull(aIndex)) tStack.stackSize = 0; + if (setStackToZeroInsteadOfNull(aIndex)) { + tStack.stackSize = 0; + markDirty(); + } else setInventorySlotContents(aIndex, null); } else { rStack = tStack.splitStack(aAmount); + markDirty(); if (tStack.stackSize == 0 && !setStackToZeroInsteadOfNull(aIndex)) setInventorySlotContents(aIndex, null); } @@ -753,6 +764,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity { } public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { + markDirty(); return fill(aFluid, doFill); } @@ -761,6 +773,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity { if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) { int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); if (tSteam > 0) { + markDirty(); if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); return tSteam * 2; } @@ -814,7 +827,9 @@ public abstract class MetaTileEntity implements IMetaTileEntity { @Override public void markDirty() { - // + if (mBaseMetaTileEntity != null) { + mBaseMetaTileEntity.markDirty(); + } } @Override 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 ef492950a1..4c890a5673 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 @@ -125,7 +125,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B mNEIName = aNEIName; mPower = buildPower(); } - + public GT_MetaTileEntity_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); @@ -146,7 +146,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B protected boolean isValidMainFacing(byte aSide) { return aSide > 1; } - + public boolean setMainFacing(byte aSide){ if (!isValidMainFacing(aSide)) return false; mMainFacing = aSide; @@ -408,6 +408,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B @Override public FluidStack setDrainableStack(FluidStack aFluid) { + markDirty(); mFluidOut = aFluid; return mFluidOut; } @@ -428,9 +429,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B if(aBaseMetaTileEntity.getAirAtSide(i)){ aBaseMetaTileEntity.openGUI(aPlayer); return true; - } + } } - GT_Utility.sendChatToPlayer(aPlayer,"No free Side!"); + GT_Utility.sendChatToPlayer(aPlayer,"No free Side!"); return true; } @@ -509,6 +510,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B boolean tSucceeded = false; if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) { + markDirty(); aBaseMetaTileEntity.setActive(true); if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { if (++mProgresstime >= mMaxProgresstime) { @@ -966,7 +968,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B { if (debugCleanroom) { GT_Log.out.println( - "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + + "BasicMachine: Voiding output due to efficiency failure. mEfficiency = " + getCallbackBase().mEfficiency ); } 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 60832dd4d9..8ee2f48b2d 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 @@ -133,6 +133,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { * @return true if stack is fully accepted. false is stack is partially accepted or nothing is accepted */ public boolean storeAll(ItemStack aStack) { + markDirty(); for (int i = 0, mInventoryLength = mInventory.length; i < mInventoryLength && aStack.stackSize > 0; i++) { ItemStack tSlot = mInventory[i]; if (GT_Utility.isStackInvalid(tSlot)) { 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 dcbee86a2d..a2d6f3a05b 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 @@ -354,6 +354,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { if (onRunningTick(mInventory[1])) { + markDirty(); if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { stopMachine(); } @@ -390,7 +391,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(mInventory[1]); + if(checkRecipe(mInventory[1])) { + markDirty(); + } } if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); } |