mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-12 18:31:41 +01:00
Remove unused methods
This commit is contained in:
parent
408e80799e
commit
1ae057428b
@ -16,10 +16,8 @@ import net.minestom.server.network.packet.server.play.ChunkDataPacket;
|
|||||||
import net.minestom.server.network.packet.server.play.UpdateLightPacket;
|
import net.minestom.server.network.packet.server.play.UpdateLightPacket;
|
||||||
import net.minestom.server.network.player.PlayerConnection;
|
import net.minestom.server.network.player.PlayerConnection;
|
||||||
import net.minestom.server.utils.ArrayUtils;
|
import net.minestom.server.utils.ArrayUtils;
|
||||||
import net.minestom.server.utils.PacketUtils;
|
|
||||||
import net.minestom.server.utils.Position;
|
import net.minestom.server.utils.Position;
|
||||||
import net.minestom.server.utils.chunk.ChunkSupplier;
|
import net.minestom.server.utils.chunk.ChunkSupplier;
|
||||||
import net.minestom.server.utils.player.PlayerUtils;
|
|
||||||
import net.minestom.server.world.biomes.Biome;
|
import net.minestom.server.world.biomes.Biome;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -403,7 +401,6 @@ public abstract class Chunk implements BlockGetter, BlockSetter, Viewable, Ticka
|
|||||||
// Only send loaded chunk
|
// Only send loaded chunk
|
||||||
if (!isLoaded())
|
if (!isLoaded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
final PlayerConnection playerConnection = player.getPlayerConnection();
|
||||||
playerConnection.sendPacket(getLightPacket());
|
playerConnection.sendPacket(getLightPacket());
|
||||||
playerConnection.sendPacket(createChunkPacket());
|
playerConnection.sendPacket(createChunkPacket());
|
||||||
@ -417,48 +414,6 @@ public abstract class Chunk implements BlockGetter, BlockSetter, Viewable, Ticka
|
|||||||
sendPacketToViewers(createChunkPacket());
|
sendPacketToViewers(createChunkPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a full {@link ChunkDataPacket} to {@code player}.
|
|
||||||
*
|
|
||||||
* @param player the player to update the chunk to
|
|
||||||
*/
|
|
||||||
public synchronized void sendChunkUpdate(@NotNull Player player) {
|
|
||||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
|
||||||
playerConnection.sendPacket(createChunkPacket());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a full {@link ChunkDataPacket} to all chunk viewers.
|
|
||||||
*/
|
|
||||||
public synchronized void sendChunkUpdate() {
|
|
||||||
PacketUtils.sendGroupedPacket(getViewers(), createChunkPacket());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a chunk section update packet to {@code player}.
|
|
||||||
*
|
|
||||||
* @param section the section to update
|
|
||||||
* @param player the player to send the packet to
|
|
||||||
* @throws IllegalArgumentException if {@code section} is not a valid section
|
|
||||||
*/
|
|
||||||
public synchronized void sendChunkSectionUpdate(int section, @NotNull Player player) {
|
|
||||||
if (!PlayerUtils.isNettyClient(player))
|
|
||||||
return;
|
|
||||||
player.getPlayerConnection().sendPacket(createChunkSectionUpdatePacket(section));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the {@link ChunkDataPacket} to update a single chunk section.
|
|
||||||
*
|
|
||||||
* @param section the chunk section to update
|
|
||||||
* @return the {@link ChunkDataPacket} to update a single chunk section
|
|
||||||
*/
|
|
||||||
protected @NotNull ChunkDataPacket createChunkSectionUpdatePacket(int section) {
|
|
||||||
ChunkDataPacket chunkDataPacket = createChunkPacket();
|
|
||||||
chunkDataPacket.sections.entrySet().removeIf(entry -> entry.getKey() != section);
|
|
||||||
return chunkDataPacket;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the chunk as "unloaded".
|
* Sets the chunk as "unloaded".
|
||||||
*/
|
*/
|
||||||
|
@ -205,7 +205,7 @@ public class InstanceContainer extends Instance {
|
|||||||
|
|
||||||
// The player probably have a wrong version of this chunk section, send it
|
// The player probably have a wrong version of this chunk section, send it
|
||||||
if (block.isAir()) {
|
if (block.isAir()) {
|
||||||
chunk.sendChunkSectionUpdate(ChunkUtils.getSectionAt(y), player);
|
chunk.sendChunk(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class BlockPlacementListener {
|
|||||||
|
|
||||||
// Refresh chunk section if needed
|
// Refresh chunk section if needed
|
||||||
if (refreshChunk) {
|
if (refreshChunk) {
|
||||||
chunk.sendChunkSectionUpdate(ChunkUtils.getSectionAt(blockPosition.getY()), player);
|
chunk.sendChunk(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user