Fixed Dormant Chunk Cache.
This commit is contained in:
parent
b2d240b6cc
commit
45c292344f
3 changed files with 32 additions and 1 deletions
|
@ -490,6 +490,7 @@ public class Registration
|
|||
ph.registerNewLayer( "appeng.api.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyHandler" );
|
||||
|
||||
FMLCommonHandler.instance().bus().register( TickHandler.instance );
|
||||
MinecraftForge.EVENT_BUS.register( TickHandler.instance );
|
||||
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
||||
|
||||
IGridCacheRegistry gcr = AEApi.instance().registries().gridCache();
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.LinkedList;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.core.AELog;
|
||||
|
@ -103,10 +104,23 @@ public class TickHandler
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkLoad(ChunkEvent.Load load)
|
||||
{
|
||||
for (Object te : load.getChunk().chunkTileEntityMap.values())
|
||||
{
|
||||
if ( te instanceof AEBaseTile )
|
||||
{
|
||||
((AEBaseTile) te).onChunkLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent ev)
|
||||
{
|
||||
if ( ev.type == Type.SERVER && ev.phase == Phase.END ) // for no there is no reason to care about this on the client...
|
||||
if ( ev.type == Type.SERVER && ev.phase == Phase.END ) // for no there is no reason to care about this on the
|
||||
// client...
|
||||
{
|
||||
HandlerRep repo = getRepo();
|
||||
while (!repo.tiles.isEmpty())
|
||||
|
|
|
@ -111,6 +111,22 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||
h.Tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
if ( !isInvalid() )
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* for dormant chunk cache.
|
||||
*/
|
||||
public void onChunkLoad()
|
||||
{
|
||||
if ( isInvalid() )
|
||||
validate();
|
||||
}
|
||||
|
||||
@Override
|
||||
// NOTE: WAS FINAL, changed for Immibis
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
|
|
Loading…
Add table
Reference in a new issue