Client-side cache is now cleared when leaving or joining worlds

This commit is contained in:
Luis C.M committed 2023-06-05 18:50:41 -05:00
1 parent 54b46129a9
commit 6470c8317b
9 files changed
+56 -43

No files matched your search

@@ -3,9 +3,11 @@ package noppes.npcs.client;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.world.World;
import noppes.npcs.CustomNpcs;
@@ -30,6 +32,10 @@ public class ClientTickHandler{
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onClientTick(TickEvent.ClientTickEvent event){
Minecraft mc = Minecraft.getMinecraft();
if ((this.prevWorld == null || mc.theWorld == null) && this.prevWorld != mc.theWorld) {
ClientCacheHandler.clearCache();
this.prevWorld = mc.theWorld;
}
if(event.phase == Phase.END) {
if (mc.thePlayer != null && mc.theWorld != null && !mc.isGamePaused() && ClientEventHandler.hasOverlays(mc.thePlayer)) {
renderCNPCPlayer.itemRenderer.updateEquippedItem();