mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Temporary fix for Forge 1.17 setRemoved() regression
This commit is contained in:
parent
b9310e93a9
commit
10f84bcd79
7 changed files with 66 additions and 16 deletions
|
@ -185,12 +185,17 @@ public class KineticTileEntity extends SmartTileEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
|
super.setRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
if (!level.isClientSide) {
|
if (!level.isClientSide) {
|
||||||
if (hasNetwork())
|
if (hasNetwork())
|
||||||
getOrCreateNetwork().remove(this);
|
getOrCreateNetwork().remove(this);
|
||||||
detachKinetics();
|
detachKinetics();
|
||||||
}
|
}
|
||||||
super.setRemoved();
|
super.setRemovedNotDueToChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -86,10 +86,15 @@ public class EngineTileEntity extends SmartTileEntity implements IInstanceRender
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
detachWheel();
|
|
||||||
super.setRemoved();
|
super.setRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
|
detachWheel();
|
||||||
|
super.setRemovedNotDueToChunkUnload();
|
||||||
|
}
|
||||||
|
|
||||||
protected void refreshWheelSpeed() {
|
protected void refreshWheelSpeed() {
|
||||||
if (poweredWheel == null)
|
if (poweredWheel == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -362,9 +362,14 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
|
super.setRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
if (!level.isClientSide)
|
if (!level.isClientSide)
|
||||||
disassemble();
|
disassemble();
|
||||||
super.setRemoved();
|
super.setRemovedNotDueToChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -59,9 +59,14 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
|
super.setRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
if (!level.isClientSide)
|
if (!level.isClientSide)
|
||||||
disassemble();
|
disassemble();
|
||||||
super.setRemoved();
|
super.setRemovedNotDueToChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -173,10 +173,15 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
|
super.setRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
this.remove = true;
|
this.remove = true;
|
||||||
if (!level.isClientSide)
|
if (!level.isClientSide)
|
||||||
disassemble();
|
disassemble();
|
||||||
super.setRemoved();
|
super.setRemovedNotDueToChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -197,12 +197,17 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
onEmptied();
|
|
||||||
itemCapability.invalidate();
|
itemCapability.invalidate();
|
||||||
fluidCapability.invalidate();
|
fluidCapability.invalidate();
|
||||||
super.setRemoved();
|
super.setRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
|
onEmptied();
|
||||||
|
super.setRemovedNotDueToChunkUnload();
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||||
|
|
|
@ -146,10 +146,30 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti
|
||||||
.reduce(ItemRequirement.NONE, (a, b) -> a.with(b.getRequiredItems()), (a, b) -> a.with(b));
|
.reduce(ItemRequirement.NONE, (a, b) -> a.with(b.getRequiredItems()), (a, b) -> a.with(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Remove this hack once this issue is resolved: https://github.com/MinecraftForge/MinecraftForge/issues/8302
|
||||||
|
Once the PR linked in the issue is accepted, we should use the new method for determining whether setRemoved was
|
||||||
|
called due to a chunk unload or not, and remove this volatile workaround
|
||||||
|
*/
|
||||||
|
private boolean unloaded;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkUnloaded() {
|
||||||
|
super.onChunkUnloaded();
|
||||||
|
unloaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setRemovedNotDueToChunkUnload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved() {
|
public void setRemoved() {
|
||||||
forEachBehaviour(TileEntityBehaviour::remove);
|
forEachBehaviour(TileEntityBehaviour::remove);
|
||||||
super.setRemoved();
|
super.setRemoved();
|
||||||
|
|
||||||
|
if (!unloaded) {
|
||||||
|
setRemovedNotDueToChunkUnload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLazyTickRate(int slowTickRate) {
|
public void setLazyTickRate(int slowTickRate) {
|
||||||
|
|
Loading…
Reference in a new issue