From 46c48c6dd6aec408836d866d444e0b4c6b37a334 Mon Sep 17 00:00:00 2001 From: Cedric Date: Sat, 4 Nov 2023 13:55:01 +0100 Subject: [PATCH] ref: changed to Player --- .../signals/handler/SignalStateHandler.java | 9 ++++----- .../com/troblecodings/signals/items/Placementtool.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java b/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java index 33cd9b0e9..898cc09ab 100644 --- a/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java +++ b/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java @@ -32,7 +32,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.client.CPacketCustomPayload; -import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; @@ -81,7 +80,7 @@ public static void onServerStop(final FMLServerStoppingEvent event) { } public static void createStates(final SignalStateInfo info, - final Map states) { + final Map states, final EntityPlayer creator) { if (info.world.isRemote) return; synchronized (CURRENTLY_LOADED_STATES) { @@ -89,7 +88,7 @@ public static void createStates(final SignalStateInfo info, } new Thread(() -> { final List> list = new ArrayList<>(); - list.add(new LoadHolder<>(new ChunkPos(info.pos))); + list.add(new LoadHolder<>(creator)); synchronized (SIGNAL_COUNTER) { SIGNAL_COUNTER.put(info, list); } @@ -371,7 +370,7 @@ public static void onChunkWatch(final ChunkWatchEvent.Watch event) { final SignalTileEntity signalTile = (SignalTileEntity) tile; final SignalStateInfo info = new SignalStateInfo(world, pos, signalTile.getSignal()); - states.add(new StateLoadHolder(info, new LoadHolder<>(new ChunkPos(pos)))); + states.add(new StateLoadHolder(info, new LoadHolder<>(player))); synchronized (CURRENTLY_LOADED_STATES) { if (CURRENTLY_LOADED_STATES.containsKey(info)) { sendToPlayer(info, CURRENTLY_LOADED_STATES.get(info), player); @@ -394,7 +393,7 @@ public static void onChunkUnWatch(final ChunkWatchEvent.UnWatch event) { final SignalTileEntity signalTile = (SignalTileEntity) tile; states.add( new StateLoadHolder(new SignalStateInfo(world, pos, signalTile.getSignal()), - new LoadHolder<>(new ChunkPos(pos)))); + new LoadHolder<>(event.getPlayer()))); } }); unloadSignals(states); diff --git a/src/main/java/com/troblecodings/signals/items/Placementtool.java b/src/main/java/com/troblecodings/signals/items/Placementtool.java index c49e83d6e..1f4416ae3 100644 --- a/src/main/java/com/troblecodings/signals/items/Placementtool.java +++ b/src/main/java/com/troblecodings/signals/items/Placementtool.java @@ -114,7 +114,7 @@ public EnumActionResult onItemUse(final EntityPlayer player, final World worldIn signalProperties.put(Signal.CUSTOMNAME, "false"); nametoSet = signal.getSignalTypeName(); } - SignalStateHandler.createStates(info, signalProperties); + SignalStateHandler.createStates(info, signalProperties, player); NameHandler.createName(nameInfo, nametoSet); worldIn.setBlockState(placePos, signal.getStateForPlacement(worldIn, placePos, facing, hitX,