diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-04-23 16:06:04 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 03:36:04 -0230 |
commit | 8b7c200770f12503df891a1443c5496f9d5f7452 (patch) | |
tree | 3f874aa954682d53703bf64dc7c2d6f0d3c40fca /src | |
parent | 3d4645c54cb8cc9b4be960e9921c5c7d0ac2477e (diff) | |
download | NotEnoughUpdates-8b7c200770f12503df891a1443c5496f9d5f7452.tar.gz NotEnoughUpdates-8b7c200770f12503df891a1443c5496f9d5f7452.tar.bz2 NotEnoughUpdates-8b7c200770f12503df891a1443c5496f9d5f7452.zip |
Fix capes going crazy when the plater leaves render distance (#1108)
Fixed capes going crazy when the player unloads
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java | 16 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 984a7931..a544ba1d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -26,11 +26,14 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.shader.Framebuffer; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.potion.Potion; import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -385,4 +388,17 @@ public class CapeManager { public CapeData[] getCapes() { return capes; } + + @SubscribeEvent + public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { + if (!(event.entity instanceof EntityOtherPlayerMP)) return; + EntityOtherPlayerMP player = (EntityOtherPlayerMP) event.entity; + Pair<NEUCape, String> neuCapeStringPair = capeMap.get(player.getGameProfile().getId().toString()); + if (neuCapeStringPair == null) return; + if (neuCapeStringPair.getLeft() == null) { + return; + } + neuCapeStringPair.getLeft().resetNodes(); + + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index d32abf64..12cbbdfd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -580,6 +580,10 @@ public class NEUCape { return x * m + b; } + public void resetNodes() { + nodes = null; + } + private void updateCape(EntityPlayer player) { Vector3f capeTranslation = updateFixedCapeNodes(player); |