diff options
-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); |