Brewing stand, cauldron, hopper, end portal frame.
This commit is contained in:
parent
a142df024b
commit
b422d077db
|
@ -20,7 +20,6 @@ import java.util.Set;
|
|||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
|
@ -56,16 +55,6 @@ public class MCAccessBukkit extends MCAccessBukkitBase implements BlockPropertie
|
|||
itchyBlocks.add(mat);
|
||||
}
|
||||
}
|
||||
// Blocks that are reported to be full and solid, but which are not.
|
||||
final long flags = BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT;
|
||||
for (final Material mat : new Material[]{
|
||||
BridgeMaterial.END_PORTAL_FRAME,
|
||||
}) {
|
||||
if (!processedBlocks.contains(mat)) {
|
||||
BlockProperties.setBlockFlags(mat, BlockProperties.getBlockFlags(mat) | flags);
|
||||
itchyBlocks.add(mat);
|
||||
}
|
||||
}
|
||||
if (!itchyBlocks.isEmpty()) {
|
||||
StaticLog.logDebug("The following blocks can not be modeled correctly: " + StringUtil.join(itchyBlocks, ", "));
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
|||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDirectionalCentered;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDoor;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitEndPortalFrame;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
|
||||
|
@ -48,6 +49,8 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
0.375, 1.5);
|
||||
private static final BukkitShapeModel MODEL_SHULKER_BOX = new BukkitShulkerBox();
|
||||
|
||||
// Blocks with different heights based on whatever.
|
||||
private static final BukkitShapeModel MODEL_END_PORTAL_FRAME = new BukkitEndPortalFrame();
|
||||
|
||||
// Blocks that have a different shape, based on how they have been placed.
|
||||
private static final BukkitShapeModel MODEL_SLAB = new BukkitSlab();
|
||||
|
@ -88,15 +91,18 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
0.5625);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT4_3 = new BukkitStatic(
|
||||
0.75);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_7 = new BukkitStatic(
|
||||
0.875);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_15 = new BukkitStatic(
|
||||
0.9375);
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* BREWING_STAND, CAULDRON, CONDUIT, HOPPER, END_PORTAL_FRAME,
|
||||
* LADDER,
|
||||
* CONDUIT,
|
||||
* CHORUS_FLOWER, CHORUS_PLANT, COCOA,
|
||||
* TURTLE_EGG, SEA_PICKLE,
|
||||
* VINE, LADDER,
|
||||
* VINE,
|
||||
* CAKE,
|
||||
*/
|
||||
// TODO: anvils, dead coral fans
|
||||
|
@ -129,11 +135,18 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
|
||||
// TODO: Also consider removing flags (passable_x4 etc).
|
||||
|
||||
// Adjust flags for individual blocks.
|
||||
BlockProperties.setBlockFlags(Material.CAULDRON,
|
||||
BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT
|
||||
| BlockProperties.F_MIN_HEIGHT4_1);
|
||||
|
||||
// Directly keep blocks as is.
|
||||
for (final Material mat : new Material[] {
|
||||
Material.CAULDRON,
|
||||
BridgeMaterial.COBWEB,
|
||||
Material.HOPPER,
|
||||
BridgeMaterial.MOVING_PISTON,
|
||||
Material.SNOW,
|
||||
BridgeMaterial.COBWEB
|
||||
Material.SNOW
|
||||
}) {
|
||||
processedBlocks.add(mat);
|
||||
}
|
||||
|
@ -141,6 +154,9 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
// Lily pad
|
||||
addModel(BridgeMaterial.LILY_PAD, MODEL_LILY_PAD);
|
||||
|
||||
// End portal frame.
|
||||
addModel(BridgeMaterial.END_PORTAL_FRAME, MODEL_END_PORTAL_FRAME);
|
||||
|
||||
// End rod.
|
||||
addModel(Material.END_ROD, MODEL_END_ROD);
|
||||
|
||||
|
@ -174,6 +190,13 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
|||
addModel(mat, MODEL_XZ100_HEIGHT4_3);
|
||||
}
|
||||
|
||||
// 7/8 height.
|
||||
for (Material mat : new Material[] {
|
||||
Material.BREWING_STAND // TODO: base is 1/8, center 0.875 - needs multi-cuboid.
|
||||
}) {
|
||||
addModel(mat, MODEL_XZ100_HEIGHT8_7);
|
||||
}
|
||||
|
||||
// 16/15 height, full xz bounds.
|
||||
for (Material mat : new Material[] {
|
||||
Material.GRASS_PATH, BridgeMaterial.FARMLAND
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
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.data.BlockData;
|
||||
import org.bukkit.block.data.type.EndPortalFrame;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitEndPortalFrame 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 (blockData instanceof EndPortalFrame) {
|
||||
return ((EndPortalFrame) blockData).hasEye()
|
||||
? new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0}
|
||||
: new double[] {0.0, 0.0, 0.0, 1.0, 0.8125, 1.0};
|
||||
}
|
||||
else {
|
||||
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) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof EndPortalFrame) {
|
||||
return ((EndPortalFrame) blockData).hasEye() ? 0x4 : 0;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -91,8 +91,8 @@ public class BlocksMC1_5 implements BlockPropertiesSetup {
|
|||
|
||||
// 154 Hopper
|
||||
BlockInit.setAs("HOPPER", Material.COAL_ORE);
|
||||
// TODO: Needs workaround. [workaround-flag + different purpose flag sets ?]
|
||||
BlockFlags.addFlags("HOPPER", BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockFlags.addFlags("HOPPER", BlockProperties.F_GROUND_HEIGHT
|
||||
| BlockProperties.F_MIN_HEIGHT16_11);
|
||||
|
||||
// 155 Block of Quartz
|
||||
BlockInit.setAs("QUARTZ_BLOCK", Material.SANDSTONE);
|
||||
|
|
|
@ -778,11 +778,34 @@ public class BlockProperties {
|
|||
*/
|
||||
public static final long F_MIN_HEIGHT16_15 = f_flag();
|
||||
|
||||
/**
|
||||
* Minimum height 13/16 (8125). <br>
|
||||
* Only applies with F_GROUND_HEIGHT set.
|
||||
*/
|
||||
public static final long F_MIN_HEIGHT16_13 = f_flag();
|
||||
|
||||
/**
|
||||
* Minimum height 11/16 (0.6875). <br>
|
||||
* Only applies with F_GROUND_HEIGHT set.
|
||||
*/
|
||||
public static final long F_MIN_HEIGHT16_11 = f_flag();
|
||||
|
||||
/**
|
||||
* Minimum height 5/16 (0.3125). <br>
|
||||
* Only applies with F_GROUND_HEIGHT set.
|
||||
*/
|
||||
public static final long F_MIN_HEIGHT16_5 = f_flag();
|
||||
|
||||
/**
|
||||
* Minimum height 1/4 (0.25). <br>
|
||||
* Only applies with F_GROUND_HEIGHT set.
|
||||
*/
|
||||
public static final long F_MIN_HEIGHT4_1 = f_flag();
|
||||
|
||||
/**
|
||||
* Minimum height 1/16 (0.0625). <br>
|
||||
* Only applies with F_GROUND_HEIGHT set.
|
||||
*/
|
||||
// TODO: Lily pad min height of MC versions?
|
||||
public static final long F_MIN_HEIGHT16_1 = f_flag();
|
||||
|
||||
/** CARPET. **/
|
||||
|
@ -1189,6 +1212,7 @@ public class BlockProperties {
|
|||
}) {
|
||||
setFlag(mat, F_GROUND_HEIGHT);
|
||||
}
|
||||
setFlag(BridgeMaterial.END_PORTAL_FRAME, F_MIN_HEIGHT16_13);
|
||||
// Issues standing on with F_PASSABLE_X4. Note getGroundMinHeight.
|
||||
for (Material mat : MaterialUtil.WOODEN_TRAP_DOORS) {
|
||||
setFlag(mat, F_GROUND_HEIGHT);
|
||||
|
@ -1357,6 +1381,8 @@ public class BlockProperties {
|
|||
setBlock(mat, brickType);
|
||||
}
|
||||
}
|
||||
setBlockFlags(Material.CAULDRON, BlockFlags.SOLID_GROUND
|
||||
| F_GROUND_HEIGHT | F_MIN_HEIGHT16_5); // LEGACY
|
||||
setBlock(BridgeMaterial.CRAFTING_TABLE, chestType);
|
||||
setBlock(Material.CHEST, chestType);
|
||||
for (Material mat : MaterialUtil.WOODEN_DOORS) {
|
||||
|
@ -3068,7 +3094,8 @@ public class BlockProperties {
|
|||
}
|
||||
}
|
||||
else if (id == Material.CAULDRON) {
|
||||
if (Math.min(fy, fy + dY * dT) >= 0.3125) {
|
||||
if (Math.min(fy, fy + dY * dT) >= getGroundMinHeight(
|
||||
access, bx, by, bz, node, flags)) {
|
||||
// Check for moving through walls or floor.
|
||||
// TODO: Maybe this is too exact...
|
||||
return isInsideCenter(fx, fz, dX, dZ, dT, 0.125);
|
||||
|
@ -3272,20 +3299,12 @@ public class BlockProperties {
|
|||
// else if (id == BridgeMaterial.CAKE.getId()) {
|
||||
// return 0.4375;
|
||||
// }
|
||||
else if (id == Material.CAULDRON) {
|
||||
// TODO: slightly over 0.
|
||||
return 0.3125;
|
||||
}
|
||||
else if (id == Material.CACTUS) {
|
||||
return 0.9375;
|
||||
}
|
||||
else if (id == BridgeMaterial.PISTON_HEAD) {
|
||||
return 0.625;
|
||||
}
|
||||
else if (id == BridgeMaterial.END_PORTAL_FRAME) {
|
||||
// Allow moving as if no eye was inserted.
|
||||
return 0.8125;
|
||||
}
|
||||
else if (bounds == null) {
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -3295,6 +3314,22 @@ public class BlockProperties {
|
|||
// 1/16
|
||||
return 0.0625;
|
||||
}
|
||||
if ((flags & F_MIN_HEIGHT4_1) != 0) {
|
||||
// 1/4
|
||||
return 0.25;
|
||||
}
|
||||
if ((flags & F_MIN_HEIGHT16_5) != 0) {
|
||||
// 5/16
|
||||
return 0.3125;
|
||||
}
|
||||
if ((flags & F_MIN_HEIGHT16_11) != 0) {
|
||||
// 11/16
|
||||
return 0.6875;
|
||||
}
|
||||
if ((flags & F_MIN_HEIGHT16_13) != 0) {
|
||||
// 13/16
|
||||
return 0.8125;
|
||||
}
|
||||
if ((flags & F_MIN_HEIGHT16_15) != 0) {
|
||||
// 15/16
|
||||
return 0.9375;
|
||||
|
|
Loading…
Reference in New Issue