Add shulker boxes and (leveled) snow.
Leveled one block height could be done in a generic way via Bukkit, once needed.
This commit is contained in:
parent
58d17aa057
commit
0a77c07b21
|
@ -10,6 +10,7 @@ import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
|||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShulkerBox;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSlab;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStairs;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
|
@ -30,6 +31,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
0.075 + 0.3, 0.925 - 0.3, 1.5);
|
||||
private static final BukkitShapeModel MODEL_GATE = new BukkitGate(
|
||||
0.075 + 0.3, 0.925 - 0.3, 1.5);
|
||||
private static final BukkitShapeModel MODEL_SHULKER_BOX = new BukkitShulkerBox();
|
||||
|
||||
public MCAccessBukkitModern() {
|
||||
super();
|
||||
|
@ -53,7 +55,8 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
|
||||
// Directly keep blocks as is.
|
||||
for (final Material mat : new Material[] {
|
||||
BridgeMaterial.MOVING_PISTON
|
||||
BridgeMaterial.MOVING_PISTON,
|
||||
Material.SNOW
|
||||
}) {
|
||||
processedBlocks.add(mat);
|
||||
}
|
||||
|
@ -73,6 +76,12 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
shapeModels.put(mat, MODEL_SLAB);
|
||||
}
|
||||
|
||||
// Shulker boxes.
|
||||
for (final Material mat : MaterialUtil.SHULKER_BOXES) {
|
||||
processedBlocks.add(mat);
|
||||
shapeModels.put(mat, MODEL_SHULKER_BOX);
|
||||
}
|
||||
|
||||
// Sort to processed by flags.
|
||||
for (final Material mat : Material.values()) {
|
||||
final long flags = BlockProperties.getBlockFlags(mat);
|
||||
|
@ -92,7 +101,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
shapeModels.put(mat, MODEL_THICK_FENCE);
|
||||
}
|
||||
}
|
||||
// ... (heads, chests, static, shulker box ...)
|
||||
// ... (chests, snow, heads, static)
|
||||
}
|
||||
|
||||
super.setupBlockProperties(worldConfigProvider);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Container;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitShulkerBox implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
//final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (state instanceof Container) {
|
||||
if (!((Container) state).getInventory().getViewers().isEmpty()) {
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.5, 1.0};
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -79,6 +79,11 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
|||
// Wall torch
|
||||
BlockInit.setInstantAir("WALL_TORCH");
|
||||
|
||||
// Shulker boxes.
|
||||
for (Material mat : MaterialUtil.SHULKER_BOXES) {
|
||||
BlockFlags.addFlags(mat, BlockProperties.F_XZ100 | BlockFlags.SOLID_GROUND);
|
||||
}
|
||||
|
||||
// Stone types.
|
||||
for (Material mat : BridgeMaterial.getAllBlocks("andesite", "diorite", "granite",
|
||||
"polished_andesite", "polished_diorite", "polished_granite",
|
||||
|
|
Loading…
Reference in New Issue