fixed chunks not updating properly, fixes #404
This commit is contained in:
1 parent
d85b0737ff
commit
1a023c91be
1 file changed
+13
-12
@@ -68,6 +68,7 @@ import net.minecraft.item.MiningToolItem;
|
|||||||
import net.minecraft.item.ShearsItem;
|
import net.minecraft.item.ShearsItem;
|
||||||
import net.minecraft.item.SwordItem;
|
import net.minecraft.item.SwordItem;
|
||||||
import net.minecraft.item.TridentItem;
|
import net.minecraft.item.TridentItem;
|
||||||
|
import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket;
|
import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.PlaySoundIdS2CPacket;
|
import net.minecraft.network.packet.s2c.play.PlaySoundIdS2CPacket;
|
||||||
import net.minecraft.command.argument.ItemStackArgument;
|
import net.minecraft.command.argument.ItemStackArgument;
|
||||||
@@ -279,21 +280,21 @@ public class CarpetExpression
|
|||||||
return bs;
|
return bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void forceChunkUpdate(BlockPos pos, ServerWorld world)
|
private static void forceChunkUpdate(BlockPos pos, ServerWorld world)
|
||||||
{
|
{
|
||||||
Chunk chunk = world.getChunk(pos);
|
WorldChunk worldChunk = world.getChunkManager().getWorldChunk(pos.getX()>>4, pos.getZ()>>4, false);
|
||||||
chunk.setShouldSave(true);
|
if (worldChunk != null)
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i = 0; i<16; i++)
|
|
||||||
{
|
{
|
||||||
BlockPos section = new BlockPos((pos.getX()>>4 <<4)+8, 16*i, (pos.getZ()>>4 <<4)+8);
|
int vd = world.getServer().getPlayerManager().getViewDistance() * 16;
|
||||||
world.getChunkManager().markForUpdate(section);
|
int vvd = vd * vd;
|
||||||
world.getChunkManager().markForUpdate(section.east());
|
List<ServerPlayerEntity> nearbyPlayers = world.getPlayers(p -> pos.getSquaredDistance(p.getX(), pos.getY(), p.getZ(), true) < vvd);
|
||||||
world.getChunkManager().markForUpdate(section.west());
|
if (!nearbyPlayers.isEmpty())
|
||||||
world.getChunkManager().markForUpdate(section.north());
|
{
|
||||||
}*/
|
ChunkDataS2CPacket packet = new ChunkDataS2CPacket(worldChunk, 65535);
|
||||||
|
ChunkPos chpos = new ChunkPos(pos);
|
||||||
|
nearbyPlayers.forEach(p -> p.networkHandler.sendPacket(packet));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tryBreakBlock_copy_from_ServerPlayerInteractionManager(ServerPlayerEntity player, BlockPos blockPos_1)
|
private boolean tryBreakBlock_copy_from_ServerPlayerInteractionManager(ServerPlayerEntity player, BlockPos blockPos_1)
|
||||||
|
|||||||
Reference in new issue
Block a user