mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-26 02:19:23 +00:00
prevent multi-layer snow replacement
This commit is contained in:
@@ -10,7 +10,9 @@ import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
|
||||
import net.momirealms.craftengine.core.world.BlockInWorld;
|
||||
import net.momirealms.craftengine.core.world.World;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Snow;
|
||||
|
||||
public class BukkitBlockInWorld implements BlockInWorld {
|
||||
private final Block block;
|
||||
@@ -25,6 +27,10 @@ public class BukkitBlockInWorld implements BlockInWorld {
|
||||
if (customState != null && !customState.isEmpty()) {
|
||||
return customState.behavior().canBeReplaced(context, customState);
|
||||
}
|
||||
if (this.block.getType() == Material.SNOW) {
|
||||
Snow snow = (Snow) block.getBlockData();
|
||||
return snow.getLayers() == 1;
|
||||
}
|
||||
return this.block.isReplaceable();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user