Skip to content

Commit

Permalink
ref: changed to Player
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Nov 4, 2023
1 parent 8887a61 commit 46c48c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -81,15 +80,15 @@ public static void onServerStop(final FMLServerStoppingEvent event) {
}

public static void createStates(final SignalStateInfo info,
final Map<SEProperty, String> states) {
final Map<SEProperty, String> states, final EntityPlayer creator) {
if (info.world.isRemote)
return;
synchronized (CURRENTLY_LOADED_STATES) {
CURRENTLY_LOADED_STATES.put(info, ImmutableMap.copyOf(states));
}
new Thread(() -> {
final List<LoadHolder<?>> list = new ArrayList<>();
list.add(new LoadHolder<>(new ChunkPos(info.pos)));
list.add(new LoadHolder<>(creator));
synchronized (SIGNAL_COUNTER) {
SIGNAL_COUNTER.put(info, list);
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 46c48c6

Please sign in to comment.