Skip to content

Commit

Permalink
Fix cache buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Sep 25, 2024
1 parent 8c1bd07 commit a346e3b
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.imesense.dynamicspawncontrol.debug.CodeGenericUtils;
import org.imesense.dynamicspawncontrol.technical.configs.ConfigGameDebugger;
import org.imesense.dynamicspawncontrol.technical.customlibrary.Log;

import java.util.HashSet;

import static org.imesense.dynamicspawncontrol.technical.worldcache.Cache.*;

@Mod.EventBusSubscriber
public final class CacheEvents
{
Expand All @@ -43,7 +46,7 @@ public CacheEvents()
}

@SubscribeEvent(priority = EventPriority.NORMAL)
public synchronized void onWorldTick(TickEvent.WorldTickEvent event)
public synchronized void onWorldTick_0(TickEvent.WorldTickEvent event)
{
if (event.phase == TickEvent.Phase.END)
{
Expand All @@ -60,8 +63,20 @@ public synchronized void onWorldTick(TickEvent.WorldTickEvent event)
}
}

@SubscribeEvent
public synchronized void onPlayerLoggedIn_1(PlayerEvent.PlayerLoggedInEvent event)
{
Cache.copyActualToBuffer();
}

@SubscribeEvent
public synchronized void onPlayerLoggedOut_2(PlayerEvent.PlayerLoggedOutEvent event)
{
Cache.copyActualToBuffer();
}

@SubscribeEvent(priority = EventPriority.LOW)
public synchronized void onRenderOverlay(RenderGameOverlayEvent.Post event)
public synchronized void onRenderOverlay_3(RenderGameOverlayEvent.Post event)
{
if (!ConfigGameDebugger.DebugMonitorCache)
{
Expand All @@ -75,7 +90,7 @@ public synchronized void onRenderOverlay(RenderGameOverlayEvent.Post event)
}

@SubscribeEvent(priority = EventPriority.HIGH)
public synchronized void onEntityJoinWorld(EntityJoinWorldEvent event)
public synchronized void onEntityJoinWorld_4(EntityJoinWorldEvent event)
{
World world = event.getWorld();
Entity entity = event.getEntity();
Expand All @@ -95,7 +110,7 @@ public synchronized void onEntityJoinWorld(EntityJoinWorldEvent event)
{
if (entity instanceof EntityAnimal)
{
Cache.CACHED_ACTUAL_ANIMALS.add((EntityAnimal) entity);
CACHED_ACTUAL_ANIMALS.add((EntityAnimal) entity);
}
else if (entity instanceof EntityMob)
{
Expand Down Expand Up @@ -124,7 +139,7 @@ else if (entity instanceof EntityMob)
}

@SubscribeEvent(priority = EventPriority.HIGH)
public synchronized void updateEntitySpawnEvent(LivingSpawnEvent.CheckSpawn event)
public synchronized void updateEntitySpawnEvent_5(LivingSpawnEvent.CheckSpawn event)
{
Entity entity = event.getEntity();

Expand Down

0 comments on commit a346e3b

Please sign in to comment.