mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-20 07:02:32 +01:00
Remove unsafe prefix from Chunk#setBlock
This commit is contained in:
parent
7f8120a334
commit
35baf1e772
@ -11,6 +11,7 @@ import net.minestom.server.event.player.PlayerChunkLoadEvent;
|
||||
import net.minestom.server.event.player.PlayerChunkUnloadEvent;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockGetter;
|
||||
import net.minestom.server.instance.block.BlockSetter;
|
||||
import net.minestom.server.network.packet.server.play.ChunkDataPacket;
|
||||
import net.minestom.server.network.packet.server.play.UpdateLightPacket;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
@ -45,7 +46,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* You generally want to avoid storing references of this object as this could lead to a huge memory leak,
|
||||
* you should store the chunk coordinates instead.
|
||||
*/
|
||||
public abstract class Chunk implements BlockGetter, Viewable, Tickable, DataContainer {
|
||||
public abstract class Chunk implements BlockGetter, BlockSetter, Viewable, Tickable, DataContainer {
|
||||
|
||||
protected static final BiomeManager BIOME_MANAGER = MinecraftServer.getBiomeManager();
|
||||
|
||||
@ -103,7 +104,8 @@ public abstract class Chunk implements BlockGetter, Viewable, Tickable, DataCont
|
||||
* @param z the block Z
|
||||
* @param block the block to place
|
||||
*/
|
||||
public abstract void UNSAFE_setBlock(int x, int y, int z, @NotNull Block block);
|
||||
@Override
|
||||
public abstract void setBlock(int x, int y, int z, @NotNull Block block);
|
||||
|
||||
/**
|
||||
* Executes a chunk tick.
|
||||
|
@ -71,7 +71,7 @@ public class DynamicChunk extends Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UNSAFE_setBlock(int x, int y, int z, @NotNull Block block) {
|
||||
public void setBlock(int x, int y, int z, @NotNull Block block) {
|
||||
final short blockStateId = block.getStateId();
|
||||
final BlockHandler handler = block.getHandler();
|
||||
final NBTCompound nbt = null; // TODO
|
||||
@ -305,7 +305,7 @@ public class DynamicChunk extends Chunk {
|
||||
Block block = Block.fromStateId(blockStateId);
|
||||
// TODO read other data
|
||||
|
||||
UNSAFE_setBlock(x, y, z, block);
|
||||
setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
// Finished reading
|
||||
|
@ -154,7 +154,7 @@ public class InstanceContainer extends Instance {
|
||||
block = executeBlockPlacementRule(block, blockPosition);
|
||||
|
||||
// Set the block
|
||||
chunk.UNSAFE_setBlock(x, y, z, block);
|
||||
chunk.setBlock(x, y, z, block);
|
||||
|
||||
// Refresh neighbors since a new block has been placed
|
||||
executeNeighboursBlockPlacementRule(blockPosition);
|
||||
|
@ -215,7 +215,7 @@ public class ChunkBatch implements Batch<ChunkCallback> {
|
||||
Block prevBlock = chunk.getBlock(x, y, z);
|
||||
inverse.setBlock(x, y, z, prevBlock);
|
||||
}
|
||||
chunk.UNSAFE_setBlock(x, y, z, block);
|
||||
chunk.setBlock(x, y, z, block);
|
||||
return ChunkUtils.getSectionAt(y);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class ChunkGenerationBatch extends ChunkBatch {
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull Block block) {
|
||||
chunk.UNSAFE_setBlock(x, y, z, block);
|
||||
chunk.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
public void generate(@NotNull ChunkGenerator chunkGenerator, @Nullable ChunkCallback callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user