Skip to content

Commit

Permalink
todo: figure out how to handle skin changes (or maybe just dont)
Browse files Browse the repository at this point in the history
  • Loading branch information
bazke committed Oct 28, 2023
1 parent aed8a3e commit 6bb7ead
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.event.entity.EntityLeaveLevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

Expand Down Expand Up @@ -47,6 +48,13 @@ public static void onLoggingOut(final ClientPlayerNetworkEvent.LoggingOut event)
FACES.clear();
}

//TODO this gets called a bazillion times? just a local thing?
@SubscribeEvent
public static void onPlayerLeave(final EntityLeaveLevelEvent event) {
System.out.println("someone left");
FACES.remove(event.getEntity().getUUID());
}

public static ResourceLocation getFace(final UUID uuid) {
return FACES.getOrDefault(uuid, getPlayerSkinOrDefault(uuid));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.saveddata.SavedData;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.EntityLeaveLevelEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -117,6 +118,8 @@ public static void onServerTick(TickEvent.ServerTickEvent event) {

//TODO consider the case: 2 active hosts. one host is removed -> what happens? iterate all POIs and check if face is host?
//maybe something like below?
//TODO concurrentmodex? just a local thing? i dont know. i dont know anything anymore. <- thx copilot
//anyway this crashes with java.util.ConcurrentModificationException: null when the second client leaves. does it only happen with the onPlayerLeave event?
for (Poi poi : manager.getAllPois()) {
for (UUID face : poi.faces()) {

Expand Down

0 comments on commit 6bb7ead

Please sign in to comment.