Remove Block IDs

This commit is contained in:
md_5 2017-12-06 16:37:51 +11:00
parent 7e43deaa28
commit 3a111dc4a5
33 changed files with 527 additions and 744 deletions

View File

@ -15,6 +15,7 @@
package fr.neatmonster.nocheatplus.compat.bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -43,9 +44,9 @@ public class BlockCacheBukkit extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int fetchTypeId(final int x, final int y, final int z) {
public Material fetchTypeId(final int x, final int y, final int z) {
// TODO: consider setting type id and data at once.
return world.getBlockTypeIdAt(x, y, z);
return world.getBlockAt(x, y, z).getType();
}
@SuppressWarnings("deprecation")

View File

@ -103,9 +103,7 @@ public class MCAccessBukkitBase implements MCAccess {
}
@Override
public AlmostBoolean isBlockSolid(final int id) {
@SuppressWarnings("deprecation")
final Material mat = Material.getMaterial(id);
public AlmostBoolean isBlockSolid(final Material mat) {
if (mat == null) {
return AlmostBoolean.MAYBE;
}
@ -228,9 +226,7 @@ public class MCAccessBukkitBase implements MCAccess {
}
@Override
public AlmostBoolean isBlockLiquid(final int id) {
@SuppressWarnings("deprecation")
final Material mat = Material.getMaterial(id);
public AlmostBoolean isBlockLiquid(final Material mat) {
if (mat == null) return AlmostBoolean.MAYBE;
switch (mat) {
case STATIONARY_LAVA:

View File

@ -29,6 +29,7 @@ import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import org.bukkit.Material;
public class MCAccessCBReflect extends MCAccessBukkitBase {
@ -152,7 +153,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
}
@Override
public AlmostBoolean isBlockSolid(final int id) {
public AlmostBoolean isBlockSolid(final Material id) {
try {
return helper.isBlockSolid(id);
}
@ -162,7 +163,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
}
@Override
public AlmostBoolean isBlockLiquid(final int id) {
public AlmostBoolean isBlockLiquid(final Material id) {
try {
return helper.isBlockLiquid(id);
}

View File

@ -14,6 +14,8 @@
*/
package fr.neatmonster.nocheatplus.compat.cbreflect.reflect;
import org.bukkit.Material;
/**
* Reflection based block bounds fetching.
* @author asofold
@ -27,7 +29,7 @@ public interface IReflectBlock {
* @param id
* @return
*/
public Object nms_getById(int id);
public Object nms_getById(Material id);
/**
* Get the material for a Block instance.

View File

@ -20,6 +20,7 @@ import java.lang.reflect.Method;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import org.bukkit.Material;
/**
* Reflection for block shape getting (latest).
@ -137,7 +138,7 @@ public class ReflectBlock implements IReflectBlock {
}
@Override
public Object nms_getById(final int id) {
public Object nms_getById(final Material id) {
if (this.nmsGetById == null) {
fail();
}

View File

@ -21,6 +21,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.bukkit.Material;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
import fr.neatmonster.nocheatplus.config.ConfPaths;
@ -211,7 +213,7 @@ public class ReflectBlockSix implements IReflectBlock {
}
@Override
public Object nms_getById(final int id) {
public Object nms_getById(final Material id) {
if (this.nmsGetById == null) {
fail();
}

View File

@ -18,6 +18,7 @@ import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -282,7 +283,7 @@ public class ReflectHelper {
* @param id
* @return Block instance (could be null).
*/
public Object nmsBlock_getById(int id) {
public Object nmsBlock_getById(Material id) {
if (reflectBlock == null) {
fail();
}
@ -310,7 +311,7 @@ public class ReflectHelper {
return (Boolean) ReflectionUtil.invokeMethodNoArgs(this.reflectMaterial.nmsIsLiquid, material);
}
public AlmostBoolean isBlockSolid(int id) {
public AlmostBoolean isBlockSolid(Material id) {
Object obj = nmsBlock_getById(id);
if (obj == null) {
return AlmostBoolean.MAYBE;
@ -322,7 +323,7 @@ public class ReflectHelper {
return AlmostBoolean.match(nmsMaterial_isSolid(obj));
}
public AlmostBoolean isBlockLiquid(int id) {
public AlmostBoolean isBlockLiquid(Material id) {
Object obj = nmsBlock_getById(id);
if (obj == null) {
return AlmostBoolean.MAYBE;
@ -339,7 +340,7 @@ public class ReflectHelper {
* a method in world types.)
*
* @param nmsWorld
* @param typeId
* @param id
* @param x
* @param y
* @param z
@ -347,7 +348,7 @@ public class ReflectHelper {
* cases like air/unspecified.
*/
public double[] nmsWorld_fetchBlockShape(final Object nmsWorld,
final int id, final int x, final int y, final int z) {
final Material id, final int x, final int y, final int z) {
if (reflectBlock == null) {
fail();
}

View File

@ -19,7 +19,6 @@ package fr.neatmonster.nocheatplus.actions;
*/
public enum ParameterName {
// TODO: Cleanup for some kind of policies: useful names, alternative names, prefer generic names.
BLOCK_ID("blockid"),
BLOCK_TYPE("blocktype"),
CHECK("check"),
DISTANCE("distance"),

View File

@ -106,7 +106,6 @@ public class FastBreak extends Check {
final ViolationData vd = new ViolationData(this, player, data.fastBreakVL, vlAdded, cc.fastBreakActions);
if (vd.needsParameters()) {
vd.setParameter(ParameterName.BLOCK_TYPE, blockType.toString());
vd.setParameter(ParameterName.BLOCK_ID, Integer.toString(BlockProperties.getId(blockType)));
}
cancel = executeActions(vd).willCancel();
}

View File

@ -380,7 +380,7 @@ public class BlockInteractListener extends CheckListener {
else {
builder.append(") block: ");
builder.append(block.getWorld().getName() + "/" + LocUtil.simpleFormat(block));
builder.append(" type: " + BlockProperties.getId(block.getType()));
builder.append(" type: " + block.getType());
builder.append(" data: " + BlockProperties.getData(block));
builder.append(" face: " + face);
}

View File

@ -75,7 +75,6 @@ public class Against extends Check {
data.againstVL += 1.0;
final ViolationData vd = new ViolationData(this, player, data.againstVL, 1, cc.againstActions);
vd.setParameter(ParameterName.BLOCK_TYPE, placedMat.toString());
vd.setParameter(ParameterName.BLOCK_ID, Integer.toString(BlockProperties.getId(placedMat)));
return executeActions(vd).willCancel();
}
else {

View File

@ -1125,8 +1125,8 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
(
// 1: Ordinary.
to.getY() - to.getBlockY() <= Math.max(cc.yOnGround, cc.noFallyOnGround)
// 1: With carpet. TODO: Magic block id. Use isCarpet(id) instead.
|| to.getTypeId() == 171 && to.getY() - to.getBlockY() <= 0.9
// 1: With carpet.
|| BlockProperties.isCarpet(to.getTypeId()) && to.getY() - to.getBlockY() <= 0.9
)
&& MovingUtil.getRealisticFallDistance(player, from.getY(), to.getY(), data) > 1.0
// 0: Within wobble-distance.
@ -2699,10 +2699,10 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
if (from.getBlockFlags() != 0) {
builder.append("\nfrom flags: " + StringUtil.join(BlockProperties.getFlagNames(from.getBlockFlags()), "+"));
}
if (from.getTypeId() != 0) {
if (from.getTypeId() != Material.AIR) {
DebugUtil.addBlockInfo(builder, from, "\nfrom");
}
if (from.getTypeIdBelow() != 0) {
if (from.getTypeIdBelow() != Material.AIR) {
DebugUtil.addBlockBelowInfo(builder, from, "\nfrom");
}
if (!from.isOnGround() && from.isOnGround(0.5)) {
@ -2712,10 +2712,10 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
if (to.getBlockFlags() != 0) {
builder.append("\nto flags: " + StringUtil.join(BlockProperties.getFlagNames(to.getBlockFlags()), "+"));
}
if (to.getTypeId() != 0) {
if (to.getTypeId() != Material.AIR) {
DebugUtil.addBlockInfo(builder, to, "\nto");
}
if (to.getTypeIdBelow() != 0) {
if (to.getTypeIdBelow() != Material.AIR) {
DebugUtil.addBlockBelowInfo(builder, to, "\nto");
}
if (!to.isOnGround() && to.isOnGround(0.5)) {

View File

@ -209,8 +209,6 @@ public class Passable extends Check {
vd.setParameter(ParameterName.LOCATION_FROM, String.format(Locale.US, "%.2f, %.2f, %.2f", from.getX(), from.getY(), from.getZ()));
vd.setParameter(ParameterName.LOCATION_TO, String.format(Locale.US, "%.2f, %.2f, %.2f", to.getX(), to.getY(), to.getZ()));
vd.setParameter(ParameterName.DISTANCE, String.format(Locale.US, "%.2f", TrigUtil.distance(from, to)));
// TODO: Consider adding from.getTypeId() too, if blocks differ and non-air.
vd.setParameter(ParameterName.BLOCK_ID, "" + to.getTypeId());
if (!tags.isEmpty()) {
vd.setParameter(ParameterName.TAGS, tags);
}

View File

@ -89,14 +89,14 @@ public interface MCAccess extends IGetBlockCache, IEntityAccessDimensions {
* @param id
* @return MAYBE if undecided, YES or NO if decided.
*/
public AlmostBoolean isBlockSolid(int id);
public AlmostBoolean isBlockSolid(Material id);
/**
* NMS Block static..
* @param id
* @return MAYBE if undecided, YES or NO if decided.
*/
public AlmostBoolean isBlockLiquid(int id);
public AlmostBoolean isBlockLiquid(Material id);
/**
* Does only check y bounds, returns false if dead. This is called by

View File

@ -32,60 +32,27 @@ public class BlockInit {
* Check for Material existence, throw RuntimeException if not.
* @param id
*/
public static void assertMaterialExists(int id) {
public static void assertMaterialExists(String id) {
if (BlockProperties.getMaterial(id) == null) {
throw new RuntimeException("Material " + id + " does not exist.");
}
}
/**
* Check for material existence and naming (exact match).
* @param id
* @param name
*/
public static void assertMaterialName(int id, String name) {
Material mat = BlockProperties.getMaterial(id);
if ( mat == null) {
throw new RuntimeException("Material " + id + " does not exist.");
}
if (mat.name().equals(name)) {
throw new RuntimeException("Name for Material " + id + " ('" + mat.name() + "') does not match '" + name + "'.");
}
}
/**
* Check for material existence and naming (parts must all be contained with ignored case).
* @param id
* @param parts
*/
public static void assertMaterialNameMatch(int id, String... parts) {
Material mat = BlockProperties.getMaterial(id);
if ( mat == null) {
throw new RuntimeException("Material " + id + " does not exist.");
}
String name = mat.name().toLowerCase();
for (String part : parts) {
if (name.indexOf(part.toLowerCase()) < 0) {
throw new RuntimeException("Name for Material " + id + " ('" + mat.name() + "') should contain '" + part + "'.");
}
}
}
/**
* Set block breaking properties same as the block of the given material.
* @param newId
* @param mat
*/
public static void setPropsAs(int newId, Material mat) {
public static void setPropsAs(String newId, Material mat) {
BlockProperties.setBlockProps(newId, BlockProperties.getBlockProps(mat));
}
/**
* Set block breaking properties same as the block of the given id.
* @param newId
* @param mat
* @param otherId
*/
public static void setPropsAs(int newId, int otherId) {
public static void setPropsAs(String newId, String otherId) {
BlockProperties.setBlockProps(newId, BlockProperties.getBlockProps(otherId));
}
@ -94,7 +61,7 @@ public class BlockInit {
* @param newId
* @param mat
*/
public static void setAs(int newId, Material mat) {
public static void setAs(String newId, Material mat) {
BlockFlags.setFlagsAs(newId, mat);
setPropsAs(newId, mat);
}
@ -102,9 +69,9 @@ public class BlockInit {
/**
* Set block breaking and shape properties same as the block of the given id.
* @param newId
* @param mat
* @param otherId
*/
public static void setAs(int newId, int otherId) {
public static void setAs(String newId, String otherId) {
BlockFlags.setFlagsAs(newId, otherId);
setPropsAs(newId, otherId);
}
@ -113,7 +80,7 @@ public class BlockInit {
* Set like air, plus instantly breakable.
* @param newId
*/
public static void setInstantAir(int newId) {
public static void setInstantAir(String newId) {
BlockFlags.setFlagsAs(newId, Material.AIR);
BlockProperties.setBlockProps(newId, BlockProperties.instantType);
}

View File

@ -30,23 +30,23 @@ import fr.neatmonster.nocheatplus.logging.StaticLog;
public class BlocksMC1_10 implements BlockPropertiesSetup {
public BlocksMC1_10() {
BlockInit.assertMaterialNameMatch(213, "MAGMA");
BlockInit.assertMaterialNameMatch(216, "BONE_BLOCK");
BlockInit.assertMaterialNameMatch(217, "STRUCTURE_VOID");
BlockInit.assertMaterialExists("MAGMA");
BlockInit.assertMaterialExists("BONE_BLOCK");
BlockInit.assertMaterialExists("STRUCTURE_VOID");
}
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
// 213 MAGMA
BlockInit.setAs(213, Material.STONE_PLATE);
BlockInit.setAs("MAGMA", Material.STONE_PLATE);
// 214 NETHER_WART_BLOCK
BlockInit.setAs(214, Material.SKULL);
BlockInit.setAs("NETHER_WART_BLOCK", Material.SKULL);
// 215 RED_NETHER_BRICK
BlockInit.setAs(215, Material.NETHER_BRICK);
BlockInit.setAs("RED_NETHER_BRICK", Material.NETHER_BRICK);
// 216 BONE_BLOCK
BlockInit.setAs(216, Material.COBBLESTONE);
BlockInit.setAs("BONE_BLOCK", Material.COBBLESTONE);
// 217 STRUCTURE_VOID
BlockInit.setAs(217, 255); // Like STRUCTURE_BLOCK.
BlockInit.setAs("STRUCTURE_VOID", "STRUCTURE_BLOCK"); // Like STRUCTURE_BLOCK.
StaticLog.logInfo("Added block-info for Minecraft 1.10 blocks.");
}

View File

@ -24,13 +24,29 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
@SuppressWarnings("deprecation")
public class BlocksMC1_11 implements BlockPropertiesSetup {
private static final int first_shulker_box = 219;
private static final int last_shulker_box = 234;
private static final String[] shulker_boxes = new String[]{
"WHITE_SHULKER_BOX",
"ORANGE_SHULKER_BOX",
"MAGENTA_SHULKER_BOX",
"LIGHT_BLUE_SHULKER_BOX",
"YELLOW_SHULKER_BOX",
"LIME_SHULKER_BOX",
"PINK_SHULKER_BOX",
"GRAY_SHULKER_BOX",
"SILVER_SHULKER_BOX",
"CYAN_SHULKER_BOX",
"PURPLE_SHULKER_BOX",
"BLUE_SHULKER_BOX",
"BROWN_SHULKER_BOX",
"GREEN_SHULKER_BOX",
"RED_SHULKER_BOX",
"BLACK_SHULKER_BOX"
};
public BlocksMC1_11() {
BlockInit.assertMaterialNameMatch(218, "OBSERVER");
for (int i = first_shulker_box; i <= last_shulker_box; i++) {
BlockInit.assertMaterialNameMatch(i, "SHULKER_BOX");
BlockInit.assertMaterialExists("OBSERVER");
for (String box : shulker_boxes) {
BlockInit.assertMaterialExists(box);
}
}
@ -39,15 +55,15 @@ public class BlocksMC1_11 implements BlockPropertiesSetup {
long solidFlags = BlockProperties.F_SOLID | BlockProperties.F_GROUND;
// 218 OBSERVER
// Wiki (16-11-25): 17.5, 2.65, 1.32, 0.9, 0.7, 0.45
BlockProperties.setBlockProps(218, new BlockProps(BlockProperties.woodPickaxe, 6,
BlockProperties.setBlockProps("OBSERVER", new BlockProps(BlockProperties.woodPickaxe, 6,
BlockProperties.secToMs(15.0, 2.2, 1.1, 0.7, 0.55, 0.45)));
BlockProperties.setBlockFlags(218, solidFlags);
BlockProperties.setBlockFlags("OBSERVER", solidFlags);
// ALL SORTS OF SHULKER BOXES
for (int i = first_shulker_box; i <= last_shulker_box; i++) {
for (String box : shulker_boxes) {
// Wiki (16-11-25): 9, 4.5, 2.25, 1.5, 1.15, 0.75
BlockProperties.setBlockProps(i, new BlockProps(BlockProperties.woodPickaxe, 6,
BlockProperties.setBlockProps(box, new BlockProps(BlockProperties.woodPickaxe, 6,
BlockProperties.secToMs(10.0, 1.45, 0.7, 0.5, 0.35, 0.2)));
BlockProperties.setBlockFlags(i, solidFlags);
BlockProperties.setBlockFlags(box, solidFlags);
}
StaticLog.logInfo("Added block-info for Minecraft 1.11 blocks.");
}

View File

@ -13,13 +13,29 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
@SuppressWarnings("deprecation")
public class BlocksMC1_12 implements BlockPropertiesSetup {
private static final int firstTerracotta = 235;
private static final int lastTerracotta = 250;
private static final String[] terracotta = new String[]{
"WHITE_GLAZED_TERRACOTTA",
"ORANGE_GLAZED_TERRACOTTA",
"MAGENTA_GLAZED_TERRACOTTA",
"LIGHT_BLUE_GLAZED_TERRACOTTA",
"YELLOW_GLAZED_TERRACOTTA",
"LIME_GLAZED_TERRACOTTA",
"PINK_GLAZED_TERRACOTTA",
"GRAY_GLAZED_TERRACOTTA",
"SILVER_GLAZED_TERRACOTTA",
"CYAN_GLAZED_TERRACOTTA",
"PURPLE_GLAZED_TERRACOTTA",
"BLUE_GLAZED_TERRACOTTA",
"BROWN_GLAZED_TERRACOTTA",
"GREEN_GLAZED_TERRACOTTA",
"RED_GLAZED_TERRACOTTA",
"BLACK_GLAZED_TERRACOTTA"
};
public BlocksMC1_12() {
BlockInit.assertMaterialNameMatch(251, "CONCRETE");
for (int i = firstTerracotta; i <= lastTerracotta; i++) {
BlockInit.assertMaterialNameMatch(i, "GLAZED_TERRACOTTA");
BlockInit.assertMaterialExists("CONCRETE");
for (String glazed : terracotta) {
BlockInit.assertMaterialExists(glazed);
}
}
@ -47,16 +63,16 @@ public class BlocksMC1_12 implements BlockPropertiesSetup {
BlockProps props = new BlockProps(BlockProperties.woodPickaxe, 1.4f,
BlockProperties.secToMs(7.0, 1.05, 0.55, 0.35, 0.3, 0.2));
for (int i = firstTerracotta; i <= lastTerracotta; i++) {
for (String glazed : terracotta) {
// Set flags as with "hardened clay".
BlockFlags.setFlagsAs(i, 172);
BlockFlags.setFlagsAs(glazed, "HARD_CLAY");
// Breaking times.
BlockProperties.setBlockProps(i, props);
BlockProperties.setBlockProps(glazed, props);
}
// Concrete
BlockFlags.setFlagsAs(251, Material.COBBLESTONE);
BlockProperties.setBlockProps(251,
BlockFlags.setFlagsAs("CONCRETE", Material.COBBLESTONE);
BlockProperties.setBlockProps("CONCRETE",
new BlockProps(BlockProperties.woodPickaxe, 1.8f,
// TODO: 2.7 with bare hands seems unlikely.
BlockProperties.secToMs(2.7, 1.35, 0.7, 0.45, 0.35, 0.25)
@ -64,7 +80,7 @@ public class BlocksMC1_12 implements BlockPropertiesSetup {
);
// Concrete powder
BlockInit.setAs(252, Material.DIRT);
BlockInit.setAs("CONCRETE_POWDER", Material.DIRT);
StaticLog.logInfo("Added block-info for Minecraft 1.12 blocks.");
}

View File

@ -32,7 +32,7 @@ public class BlocksMC1_5 implements BlockPropertiesSetup {
public BlocksMC1_5(){
// Test if materials exist.
BlockInit.assertMaterialNameMatch(152, "redstone", "block");
BlockInit.assertMaterialExists("REDSTONE_BLOCK");
}
@Override
@ -43,51 +43,51 @@ public class BlocksMC1_5 implements BlockPropertiesSetup {
////////////////////
// 146 Trapped Chest
BlockInit.setAs(146, Material.CHEST);
BlockInit.setAs("TRAPPED_CHEST", Material.CHEST);
// 147 Weighted Pressure Plate (Light)
// BlockFlags.addFlags(147, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(147, Material.STONE_PLATE);
BlockInit.setAs("GOLD_PLATE", Material.STONE_PLATE);
// 148 Weighted Pressure Plate (Heavy)
// BlockFlags.addFlags(148, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(148, Material.STONE_PLATE);
BlockInit.setAs("IRON_PLATE", Material.STONE_PLATE);
// 149 Redstone Comparator (inactive)
// BlockFlags.addFlags(149, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(149, Material.DIODE_BLOCK_OFF);
BlockInit.setAs("REDSTONE_COMPARATOR_OFF", Material.DIODE_BLOCK_OFF);
// 150 Redstone Comparator (active)
// BlockFlags.addFlags(150, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(150, Material.DIODE_BLOCK_ON);
BlockInit.setAs("REDSTONE_COMPARATOR_ON", Material.DIODE_BLOCK_ON);
// 151 Daylight Sensor
// BlockFlags.addFlags(151, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(151, Material.HUGE_MUSHROOM_1);
BlockInit.setAs("DAYLIGHT_DETECTOR", Material.HUGE_MUSHROOM_1);
// 152 Block of Redstone
BlockInit.setAs(152, Material.ENCHANTMENT_TABLE);
BlockInit.setAs("REDSTONE_BLOCK", Material.ENCHANTMENT_TABLE);
// 153 Nether Quartz Ore
BlockInit.setAs(153, Material.COAL_ORE);
BlockInit.setAs("QUARTZ_ORE", Material.COAL_ORE);
// 154 Hopper
BlockInit.setAs(154, Material.COAL_ORE);
BlockInit.setAs("HOPPER", Material.COAL_ORE);
// TODO: Needs workaround. [workaround-flag + different purpose flag sets ?]
BlockFlags.addFlags(154, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT);
BlockFlags.addFlags("HOPPER", BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT);
// 155 Block of Quartz
BlockInit.setAs(155, Material.SANDSTONE);
BlockInit.setAs("QUARTZ_BLOCK", Material.SANDSTONE);
// 156 Quartz Stairs
BlockInit.setAs(156, Material.SANDSTONE_STAIRS);
BlockInit.setAs("QUARTZ_STAIRS", Material.SANDSTONE_STAIRS);
// 157 Activator Rail
BlockInit.setAs(157, Material.DETECTOR_RAIL);
BlockInit.setAs("ACTIVATOR_RAIL", Material.DETECTOR_RAIL);
// 158 Dropper
// BlockFlags.setFlagsAs(158, Material.DISPENSER);
BlockInit.setAs(158, Material.DISPENSER);
BlockInit.setAs("DROPPER", Material.DISPENSER);
/////////////////////
@ -95,11 +95,11 @@ public class BlocksMC1_5 implements BlockPropertiesSetup {
////////////////////
// 78 Snow
BlockFlags.addFlags(78, BlockProperties.F_HEIGHT_8_INC);
BlockFlags.removeFlags(78, BlockProperties.F_HEIGHT_8SIM_INC);
BlockFlags.addFlags("SNOW", BlockProperties.F_HEIGHT_8_INC);
BlockFlags.removeFlags("SNOW", BlockProperties.F_HEIGHT_8SIM_INC);
// 95 Locked chest
BlockProperties.setBlockProps(95, BlockProperties.instantType);
// BlockProperties.setBlockProps("LOCKED_CHEST", BlockProperties.instantType);
StaticLog.logInfo("Added block-info for Minecraft 1.5 blocks.");
}

View File

@ -28,29 +28,29 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
public class BlocksMC1_6_1 implements BlockPropertiesSetup{
public BlocksMC1_6_1(){
BlockInit.assertMaterialNameMatch(173, "coal", "block");
BlockInit.assertMaterialExists("COAL_BLOCK");
}
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
// Block of Coal: like block of redstone.
BlockInit.setAs(173, 152);
BlockInit.setAs("COAL_BLOCK", "REDSTONE_BLOCK");
// Hardened Clay
BlockProperties.setBlockProps(172, new BlockProps(BlockProperties.woodPickaxe, 1.25f, BlockProperties.secToMs(6.25, 0.95, 0.5, 0.35, 0.25, 0.2)));
BlockFlags.setFlagsAs(172, Material.STONE); // TODO: Assumption (!).
BlockProperties.setBlockProps("HARD_CLAY", new BlockProps(BlockProperties.woodPickaxe, 1.25f, BlockProperties.secToMs(6.25, 0.95, 0.5, 0.35, 0.25, 0.2)));
BlockFlags.setFlagsAs("HARD_CLAY", Material.STONE); // TODO: Assumption (!).
// Stained Clay: Set as hardened clay.
BlockInit.setAs(159, 172);
BlockInit.setAs("STAINED_CLAY", "HARD_CLAY");
// Hay Bale
BlockInit.setPropsAs(170, Material.STONE_BUTTON);
BlockFlags.setFlagsAs(170, Material.STONE); // TODO: Assumption (!).
BlockInit.setPropsAs("HAY_BLOCK", Material.STONE_BUTTON);
BlockFlags.setFlagsAs("HAY_BLOCK", Material.STONE); // TODO: Assumption (!).
// Carpet
BlockProperties.setBlockProps(171, new BlockProps(BlockProperties.noTool, 0.1f, BlockProperties.secToMs(0.15)));
BlockProperties.setBlockFlags(171, BlockProperties.F_GROUND|BlockProperties.F_IGN_PASSABLE|BlockProperties.F_GROUND_HEIGHT);
BlockProperties.setBlockProps("CARPET", new BlockProps(BlockProperties.noTool, 0.1f, BlockProperties.secToMs(0.15)));
BlockProperties.setBlockFlags("CARPET", BlockProperties.F_GROUND|BlockProperties.F_IGN_PASSABLE|BlockProperties.F_GROUND_HEIGHT|BlockProperties.F_CARPET);
StaticLog.logInfo("Added block-info for Minecraft 1.6.1 blocks.");
}

View File

@ -28,8 +28,8 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
public class BlocksMC1_7_2 implements BlockPropertiesSetup{
public BlocksMC1_7_2() {
BlockInit.assertMaterialNameMatch(95, "stained", "glass");
BlockInit.assertMaterialNameMatch(174, "packed", "ice");
BlockInit.assertMaterialExists("STAINED_GLASS");
BlockInit.assertMaterialExists("PACKED_ICE");
}
@Override
@ -37,21 +37,21 @@ public class BlocksMC1_7_2 implements BlockPropertiesSetup{
// Block shapes.
// Stained glass
BlockInit.setAs(95, Material.GLASS);
BlockInit.setAs("STAINED_GLASS", Material.GLASS);
// Stained glass pane
BlockInit.setAs(160, 102);
BlockInit.setAs("STAINED_GLASS_PANE", "THIN_GLASS");
// Leaves 2
BlockInit.setAs(161, Material.LEAVES);
BlockInit.setAs("LEAVES_2", Material.LEAVES);
// Log 2
BlockInit.setAs(162, Material.LOG);
BlockInit.setAs("LOG_2", Material.LOG);
// Acacia wood stairs
BlockInit.setAs(163, Material.WOOD_STAIRS);
BlockInit.setAs("ACACIA_STAIRS", Material.WOOD_STAIRS);
// Oak wood stairs
BlockInit.setAs(164, Material.WOOD_STAIRS);
BlockInit.setAs("DARK_OAK_STAIRS", Material.WOOD_STAIRS);
// Packed ice
BlockInit.setAs(174, Material.ICE);
BlockInit.setAs("PACKED_ICE", Material.ICE);
// Large flowers
BlockInit.setAs(175, Material.YELLOW_FLOWER);
BlockInit.setAs("DOUBLE_PLANT", Material.YELLOW_FLOWER);
// Block breaking.
final long[] ironTimes = BlockProperties.secToMs(15, 7.5, 1.15, 0.75, 0.56, 1.25);
@ -59,7 +59,7 @@ public class BlocksMC1_7_2 implements BlockPropertiesSetup{
for (Material mat : new Material[]{
Material.LAPIS_ORE, Material.LAPIS_BLOCK, Material.IRON_ORE,
}) {
BlockProperties.setBlockProps(BlockProperties.getId(mat), ironType);
BlockProperties.setBlockProps(mat, ironType);
}
final long[] diamondTimes = BlockProperties.secToMs(15, 7.5, 3.75, 0.75, 0.56, 1.25);
final BlockProps diamondType = new BlockProps(BlockProperties.woodPickaxe, 3, diamondTimes);
@ -67,7 +67,7 @@ public class BlocksMC1_7_2 implements BlockPropertiesSetup{
Material.REDSTONE_ORE, Material.GLOWING_REDSTONE_ORE,
Material.EMERALD_ORE, Material.GOLD_ORE, Material.DIAMOND_ORE,
}) {
BlockProperties.setBlockProps(BlockProperties.getId(mat), diamondType);
BlockProperties.setBlockProps(mat, diamondType);
}
StaticLog.logInfo("Added block-info for Minecraft 1.7.2 blocks.");

View File

@ -28,11 +28,11 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
public class BlocksMC1_8 implements BlockPropertiesSetup {
public BlocksMC1_8() {
BlockInit.assertMaterialNameMatch(166, "barrier");
BlockInit.assertMaterialNameMatch(165, "slime");
BlockInit.assertMaterialNameMatch(187, "fence", "gate");
BlockInit.assertMaterialNameMatch(176, "banner");
BlockInit.assertMaterialNameMatch(169, "sea", "lantern");
BlockInit.assertMaterialExists("BARRIER");
BlockInit.assertMaterialExists("SLIME_BLOCK");
BlockInit.assertMaterialExists("ACACIA_FENCE_GATE");
BlockInit.assertMaterialExists("STANDING_BANNER");
BlockInit.assertMaterialExists("SEA_LANTERN");
}
@Override
@ -50,100 +50,100 @@ public class BlocksMC1_8 implements BlockPropertiesSetup {
Material.WALL_SIGN,
Material.SIGN_POST,
}) {
BlockProperties.setBlockProps(BlockProperties.getId(mat), props);
BlockProperties.setBlockProps(mat, props);
}
// Ladder.
props = new BlockProps(BlockProperties.woodAxe, 0.4f, BlockProperties.secToMs(0.6, 0.3, 0.15, 0.1, 0.075, 0.05));
BlockProperties.setBlockProps(BlockProperties.getId(Material.LADDER), props);
BlockProperties.setBlockProps(Material.LADDER, props);
// ---- New blocks ----
// 165(SLIME_BLOCK
BlockInit.setAs(165, Material.TNT); // Full block, instant break.
BlockInit.setAs("SLIME_BLOCK", Material.TNT); // Full block, instant break.
// Add the bouncing flag.
BlockProperties.setBlockFlags(165, BlockProperties.getBlockFlags(165) | BlockProperties.F_BOUNCE25);
BlockFlags.addFlags("SLIME_BLOCK", BlockProperties.F_BOUNCE25);
// 166(BARRIER
BlockInit.setAs(166, Material.BEDROCK); // Full block, unbreakable.
BlockInit.setAs("BARRIER", Material.BEDROCK); // Full block, unbreakable.
// 167(IRON_TRAP_DOOR
BlockFlags.setFlagsAs(167, Material.TRAP_DOOR);
BlockInit.setPropsAs(167, Material.IRON_DOOR_BLOCK);
BlockFlags.setFlagsAs("IRON_TRAPDOOR", Material.TRAP_DOOR);
BlockInit.setPropsAs("IRON_TRAPDOOR", Material.IRON_DOOR_BLOCK);
// 168(PRISMARINE
BlockInit.setAs(168, Material.STONE);
BlockInit.setAs("PRISMARINE", Material.STONE);
// 169(SEA_LANTERN
BlockInit.setAs(169, Material.REDSTONE_LAMP_OFF);
BlockInit.setAs("SEA_LANTERN", Material.REDSTONE_LAMP_OFF);
// 176(STANDING_BANNER
BlockProperties.setBlockFlags(176, 0L);
BlockProperties.setBlockFlags("STANDING_BANNER", 0L);
props = new BlockProps(BlockProperties.woodAxe, 0.4f, BlockProperties.secToMs(1.5, 0.75, 0.4, 0.25, 0.2, 0.15));
BlockProperties.setBlockProps(176, props);
BlockProperties.setBlockProps("STANDING_BANNER", props);
// 177(WALL_BANNER
BlockInit.setInstantAir(177);
BlockInit.setInstantAir("WALL_BANNER");
// 178(DAYLIGHT_DETECTOR_INVERTED
BlockInit.setAs(178, Material.DAYLIGHT_DETECTOR);
BlockInit.setAs("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR);
// 179(RED_SANDSTONE
BlockInit.setAs(179, Material.SANDSTONE);
BlockInit.setAs("RED_SANDSTONE", Material.SANDSTONE);
// 180(RED_SANDSTONE_STAIRS
BlockInit.setAs(180, Material.SANDSTONE_STAIRS);
BlockInit.setAs("RED_SANDSTONE_STAIRS", Material.SANDSTONE_STAIRS);
// 181(DOUBLE_STEP_2
BlockInit.setAs(181, Material.DOUBLE_STEP); // TODO: red sandstone / prismarine ?
BlockInit.setAs("DOUBLE_STONE_SLAB2", Material.DOUBLE_STEP); // TODO: red sandstone / prismarine ?
// 182(STEP_2
BlockInit.setAs(182, Material.STEP); // TODO: red sandstone / prismarine ?
BlockInit.setAs("STONE_SLAB2", Material.STEP); // TODO: red sandstone / prismarine ?
// 183(SPRUCE_FENCE_GATE
BlockInit.setAs(183, Material.FENCE_GATE);
BlockInit.setAs("SPRUCE_FENCE_GATE", Material.FENCE_GATE);
// 184(BIRCH_FENCE_GATE
BlockInit.setAs(184, Material.FENCE_GATE);
BlockInit.setAs("BIRCH_FENCE_GATE", Material.FENCE_GATE);
// 185(JUNGLE_FENCE_GATE
BlockInit.setAs(185, Material.FENCE_GATE);
BlockInit.setAs("JUNGLE_FENCE_GATE", Material.FENCE_GATE);
// 186(DARK_OAK_FENCE_GATE
BlockInit.setAs(186, Material.FENCE_GATE);
BlockInit.setAs("DARK_OAK_FENCE_GATE", Material.FENCE_GATE);
// 187(ACACIA_FENCE_GATE
BlockInit.setAs(187, Material.FENCE_GATE);
BlockInit.setAs("ACACIA_FENCE_GATE", Material.FENCE_GATE);
// 188(SPRUCE_FENCE
BlockInit.setAs(188, Material.FENCE);
BlockInit.setAs("SPRUCE_FENCE", Material.FENCE);
// 189(BIRCH_FENCE
BlockInit.setAs(189, Material.FENCE);
BlockInit.setAs("BIRCH_FENCE", Material.FENCE);
// 190(JUNGLE_FENCE
BlockInit.setAs(190, Material.FENCE);
BlockInit.setAs("JUNGLE_FENCE", Material.FENCE);
// 191(DARK_OAK_FENCE
BlockInit.setAs(191, Material.FENCE);
BlockInit.setAs("DARK_OAK_FENCE", Material.FENCE);
// 192(ACACIA_FENCE
BlockInit.setAs(192, Material.FENCE);
BlockInit.setAs("ACACIA_FENCE", Material.FENCE);
// 193(SPRUCE_DOOR
BlockInit.setAs(193, Material.WOODEN_DOOR);
BlockInit.setAs("SPRUCE_DOOR", Material.WOODEN_DOOR);
// 194(BIRCH_DOOR
BlockInit.setAs(194, Material.WOODEN_DOOR);
BlockInit.setAs("BIRCH_DOOR", Material.WOODEN_DOOR);
// 195(JUNGLE_DOOR
BlockInit.setAs(195, Material.WOODEN_DOOR);
BlockInit.setAs("JUNGLE_DOOR", Material.WOODEN_DOOR);
// 196(ACACIA_DOOR
BlockInit.setAs(196, Material.WOODEN_DOOR);
BlockInit.setAs("ACACIA_DOOR", Material.WOODEN_DOOR);
// 197(DARK_OAK_DOOR
BlockInit.setAs(197, Material.WOODEN_DOOR);
BlockInit.setAs("DARK_OAK_DOOR", Material.WOODEN_DOOR);
StaticLog.logInfo("Added block-info for Minecraft 1.8 blocks.");
}

View File

@ -28,9 +28,9 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
public class BlocksMC1_9 implements BlockPropertiesSetup {
public BlocksMC1_9() {
BlockInit.assertMaterialNameMatch(198, "end_rod");
BlockInit.assertMaterialNameMatch(208, "GRASS_PATH");
BlockInit.assertMaterialNameMatch(209, "END_GATEWAY");
BlockInit.assertMaterialExists("END_ROD");
BlockInit.assertMaterialExists("GRASS_PATH");
BlockInit.assertMaterialExists("END_GATEWAY");
}
@Override
@ -40,57 +40,57 @@ public class BlocksMC1_9 implements BlockPropertiesSetup {
final BlockProps instant = BlockProperties.instantType;
// 198(END_ROD)
BlockFlags.addFlags(198, ground);
BlockProperties.setBlockProps(198, instant);
BlockFlags.addFlags("END_ROD", ground);
BlockProperties.setBlockProps("END_ROD", instant);
// 199(CHORUS_PLANT)
BlockFlags.addFlags(199, ground);
BlockProperties.setBlockProps(199, instant);
BlockFlags.addFlags("CHORUS_PLANT", ground);
BlockProperties.setBlockProps("CHORUS_PLANT", instant);
// 200(CHORUS_FLOWER)
BlockFlags.addFlags(200, ground);
BlockProperties.setBlockProps(200, instant);
BlockFlags.addFlags("CHORUS_FLOWER", ground);
BlockProperties.setBlockProps("CHORUS_FLOWER", instant);
// 201(PURPUR_BLOCK / SOLID+GROUND)
BlockInit.setAs(201, Material.SMOOTH_BRICK);
BlockInit.setAs("PURPUR_BLOCK", Material.SMOOTH_BRICK);
// 202(PURPUR_PILLAR / SOLID+GROUND)
BlockInit.setAs(202, Material.SMOOTH_BRICK); // Rough.
BlockInit.setAs("PURPUR_PILLAR", Material.SMOOTH_BRICK); // Rough.
// 203(PURPUR_STAIRS / SOLID+GROUND)
BlockInit.setAs(203, Material.SMOOTH_STAIRS); // Rough.
BlockInit.setAs("PURPUR_STAIRS", Material.SMOOTH_STAIRS); // Rough.
// 204(PURPUR_DOUBLE_SLAB / SOLID+GROUND)
BlockInit.setAs(204, Material.DOUBLE_STEP);
BlockInit.setAs("PURPUR_DOUBLE_SLAB", Material.DOUBLE_STEP);
// 205(PURPUR_SLAB / SOLID+GROUND)
BlockInit.setAs(205, Material.STEP);
BlockInit.setAs("PURPUR_SLAB", Material.STEP);
// 206(END_BRICKS / SOLID+GROUND)
BlockInit.setAs(206, Material.SANDSTONE);
BlockInit.setAs("END_BRICKS", Material.SANDSTONE);
// 207(BEETROOT_BLOCK)
BlockFlags.addFlags(207, ground);
BlockProperties.setBlockProps(207, instant);
BlockFlags.addFlags("BEETROOT_BLOCK", ground);
BlockProperties.setBlockProps("BEETROOT_BLOCK", instant);
// 208(GRASS_PATH / SOLID+GROUND)
BlockInit.setAs(208, Material.GRASS);
BlockInit.setAs("GRASS_PATH", Material.GRASS);
// 209(END_GATEWAY)
// -> Leave flags as is (like air).
BlockProperties.setBlockProps(209, BlockProperties.indestructibleType);
BlockProperties.setBlockProps("END_GATEWAY", BlockProperties.indestructibleType);
// 210(COMMAND_REPEATING / SOLID+GROUND)
BlockInit.setAs(210, 137); // Like command block.
BlockInit.setAs("COMMAND_REPEATING", "COMMAND"); // Like command block.
// 211(COMMAND_CHAIN / SOLID+GROUND)
BlockInit.setAs(211, 137); // Like command block.
BlockInit.setAs("COMMAND_CHAIN", "COMMAND"); // Like command block.
// 212(FROSTED_ICE / SOLID+GROUND)
BlockInit.setAs(212, Material.ICE);
BlockInit.setAs("FROSTED_ICE", Material.ICE);
// 255(STRUCTURE_BLOCK / SOLID+GROUND)
BlockInit.setInstantAir(255);
BlockInit.setInstantAir("STRUCTURE_BLOCK");
// Special case activation.
// TODO: Is this the right place?

View File

@ -39,29 +39,6 @@ public class RawConfigFile extends YamlConfiguration {
return content.replace(' ', '_').replace('-', '_').replace('.', '_');
}
/**
* Attempt to get an int id from a string.<br>
* Will return out of range numbers, attempts to parse materials.
* @param content
* @return
*/
@SuppressWarnings("deprecation")
public static Integer parseTypeId(String content) {
content = content.trim().toUpperCase();
try {
return Integer.parseInt(content);
}
catch (NumberFormatException e){}
try {
Material mat = Material.matchMaterial(prepareMatchMaterial(content));
if (mat != null) {
return mat.getId();
}
}
catch (Exception e) {}
return null;
}
/**
* Attempt to get a Material from a string.<br>
* Will attempt to match the name but also type ids.
@ -71,11 +48,6 @@ public class RawConfigFile extends YamlConfiguration {
@SuppressWarnings("deprecation")
public static Material parseMaterial(String content) {
content = content.trim().toUpperCase();
try {
Integer id = Integer.parseInt(content);
return Material.getMaterial(id);
}
catch (NumberFormatException e){}
try {
return Material.matchMaterial(prepareMatchMaterial(content));
}
@ -154,56 +126,6 @@ public class RawConfigFile extends YamlConfiguration {
else return value;
}
/**
* Attempt to get a type id from the path somehow, return null if nothing found.<br>
* Will attempt to interpret strings, will return negative or out of range values.
* @deprecated Not used, will be replaced by getMaterial, if needed.
* @param path
* @return
*/
@Deprecated
public Integer getTypeId(final String path){
return getTypeId(path, null);
}
/**
* Attempt to get a type id from the path somehow, return preset if nothing found.<br>
* Will attempt to interpret strings, will return negative or out of range values.
* @deprecated Not used, will be replaced by getMaterial, if needed.
* @param path
* @param preset
* @return
*/
@Deprecated
public Integer getTypeId(final String path, final Integer preset){
String content = getString(path, null);
if (content != null){
Integer id = parseTypeId(content);
if (id != null) return id;
}
int id = getInt(path, Integer.MAX_VALUE);
return id == Integer.MAX_VALUE ? preset : id;
}
/**
* Outputs warnings to console.
* @param path
* @param target Collection to fill ids into.
*/
public void readMaterialIdsFromList(final String path, final Collection<Integer> target) {
final List<String> content = getStringList(path);
if (content == null || content.isEmpty()) return;
for (final String entry : content){
final Integer id = parseTypeId(entry);
if (id == null){
StaticLog.logWarning("Bad material entry (" + path +"): " + entry);
}
else{
target.add(id);
}
}
}
public AlmostBoolean getAlmostBoolean(final String path, final AlmostBoolean defaultValue) {
final AlmostBoolean choice = AlmostBoolean.match(getString(path, null));
return choice == null ? defaultValue : choice;

View File

@ -15,6 +15,7 @@
package fr.neatmonster.nocheatplus.logging.debug;
import org.bukkit.Location;
import org.bukkit.Material;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.logging.Streams;
@ -151,7 +152,7 @@ public class DebugUtil {
}
builder.append(" id=");
final IBlockCacheNode node = blockCache.getOrCreateBlockCacheNode(x, y, z, true);
final int id = node.getId();
final Material id = node.getId();
builder.append(id);
builder.append(" data=");
builder.append(node.getData());

View File

@ -19,6 +19,7 @@ import org.bukkit.Location;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.FakeBlockCache;
import org.bukkit.Material;
@ -109,7 +110,7 @@ public class InteractRayTracing extends RayTracing {
* @return
*/
private boolean doesCollide(final int blockX, final int blockY, final int blockZ) {
final int id = blockCache.getTypeId(blockX, blockY, blockZ);
final Material id = blockCache.getTypeId(blockX, blockY, blockZ);
final long flags = BlockProperties.getBlockFlags(id);
if ((flags & BlockProperties.F_SOLID) == 0) {
// Ignore non solid blocks anyway.

View File

@ -15,6 +15,7 @@
package fr.neatmonster.nocheatplus.utilities.location;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -72,12 +73,12 @@ public class PlayerLocation extends RichEntityLocation {
// TODO: check onGroundMinY !?
onIce = false;
} else {
final int id;
final Material id;
if (player.isSneaking() || player.isBlocking()) {
id = getTypeId(blockX, Location.locToBlock(minY - 0.1D), blockZ);
}
else {
id = getTypeIdBelow().intValue();
id = getTypeIdBelow();
}
onIce = BlockProperties.isIce(id);
}

View File

@ -444,7 +444,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
*
* @return the type id above
*/
public int getTypeIdAbove() {
public Material getTypeIdAbove() {
return blockCache.getTypeId(blockX, blockY + 1, blockZ);
}
@ -489,7 +489,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
*
* @return the type id
*/
public Integer getTypeId() {
public Material getTypeId() {
if (node == null) {
getOrCreateBlockCacheNode();
}
@ -501,7 +501,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
*
* @return the type id below
*/
public Integer getTypeIdBelow() {
public Material getTypeIdBelow() {
if (nodeBelow == null) {
getOrCreateBlockCacheNodeBelow();
}
@ -532,7 +532,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
* the z
* @return the type id
*/
public final int getTypeId(final int x, final int y, final int z) {
public final Material getTypeId(final int x, final int y, final int z) {
return blockCache.getTypeId(x, y, z);
}
@ -654,7 +654,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
public boolean isOnClimbable() {
if (onClimbable == null) {
// Early return with flags set and no climbable nearby.
final int typeId = getTypeId();
final Material typeId = getTypeId();
if (blockFlags != null && (blockFlags & BlockProperties.F_CLIMBABLE) == 0
// Special case trap doors: // Better than increasing maxYOnGround.
&& (blockFlags & BlockProperties.F_PASSABLE_X4) == 0
@ -713,7 +713,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
* the id
* @return true, if successful
*/
public boolean standsOnBlock(final int id) {
public boolean standsOnBlock(final Material id) {
if (!isOnGround()) {
return false;
}
@ -801,7 +801,7 @@ public class RichBoundsLocation implements IGetBukkitLocation, IGetBlockPosition
// TODO: Consider dropping this shortcut.
final int bY = Location.locToBlock(y - yOnGround);
final IBlockCacheNode useNode = bY == blockY ? getOrCreateBlockCacheNode() : (bY == blockY -1 ? getOrCreateBlockCacheNodeBelow() : blockCache.getOrCreateBlockCacheNode(blockX, bY, blockZ, false));
final int id = useNode.getId();
final Material id = useNode.getId();
final long flags = BlockProperties.getBlockFlags(id);
// TODO: Might remove check for variable ?
if ((flags & BlockProperties.F_GROUND) != 0 && (flags & BlockProperties.F_VARIABLE) == 0) {

View File

@ -15,6 +15,7 @@
package fr.neatmonster.nocheatplus.utilities.map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
@ -31,11 +32,6 @@ import fr.neatmonster.nocheatplus.utilities.ds.map.CoordMap;
*/
public abstract class BlockCache {
// TODO: New concepts (Might switch to material, inspect MC+CB code for reliability and performance of block-ids during runtime).
/** The Constant ID_AIR. */
private static final int ID_AIR = 0;
/**
* Read access to a BlockCacheNode.
* @author asofold
@ -61,7 +57,7 @@ public abstract class BlockCache {
* Always set.
* @return
*/
public int getId();
public Material getId();
/**
* Ensure to test with isDataSet().
@ -113,11 +109,11 @@ public abstract class BlockCache {
private static final short FETCHED_BOUNDS = 0x04;
private short fetched;
private final int id;
private Material id;
private int data = 0;
private double[] bounds = null;
public BlockCacheNode(int id) {
public BlockCacheNode(Material id) {
this.id = id;
fetched = FETCHED_ID;
}
@ -138,7 +134,7 @@ public abstract class BlockCache {
}
@Override
public int getId() {
public Material getId() {
return id;
}
@ -197,7 +193,7 @@ public abstract class BlockCache {
/** The max block y. */
protected int maxBlockY = 255;
private final BlockCacheNode airNode = new BlockCacheNode(ID_AIR);
private final BlockCacheNode airNode = new BlockCacheNode(Material.AIR);
// TODO: setBlockCacheConfig -> set static nodes (rather only by id).
/**
@ -238,7 +234,7 @@ public abstract class BlockCache {
* the z
* @return the int
*/
public abstract int fetchTypeId(int x, int y, int z);
public abstract Material fetchTypeId(int x, int y, int z);
/**
* Fetch the data from the underlying world.
@ -310,9 +306,9 @@ public abstract class BlockCache {
if (node != null) {
return node;
}
final int id = (y < 0 || y > maxBlockY) ? ID_AIR : fetchTypeId(x, y, z);
final Material id = (y < 0 || y > maxBlockY) ? Material.AIR : fetchTypeId(x, y, z);
// (Later: Static id-node map from config.)
if (id == ID_AIR) {
if (id == Material.AIR) {
return airNode;
}
else {
@ -333,7 +329,7 @@ public abstract class BlockCache {
* the z
* @return the type id
*/
public int getTypeId(double x, double y, double z) {
public Material getTypeId(double x, double y, double z) {
return getTypeId(Location.locToBlock(x), Location.locToBlock(y), Location.locToBlock(z));
}
@ -356,7 +352,7 @@ public abstract class BlockCache {
* the block
* @return the type id
*/
public int getTypeId(final Block block) {
public Material getTypeId(final Block block) {
return getTypeId(block.getX(), block.getY(), block.getZ());
}
@ -371,7 +367,7 @@ public abstract class BlockCache {
* the z
* @return the type id
*/
public int getTypeId(final int x, final int y, final int z) {
public Material getTypeId(final int x, final int y, final int z) {
return getOrCreateNode(x, y, z).getId();
}

View File

@ -34,7 +34,7 @@ public class BlockFlags {
* @param mat
* the mat
*/
public static void setFlagsAs(int id, Material mat) {
public static void setFlagsAs(String id, Material mat) {
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(mat));
}
@ -47,7 +47,7 @@ public class BlockFlags {
* @param otherId
* the other id
*/
public static void setFlagsAs(int id, int otherId) {
public static void setFlagsAs(String id, String otherId) {
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(otherId));
}
@ -59,7 +59,7 @@ public class BlockFlags {
* @param flags
* Block flags.
*/
public static void addFlags(int id, long flags) {
public static void addFlags(String id, long flags) {
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) | flags);
}
@ -72,7 +72,7 @@ public class BlockFlags {
* Block flags.
*/
public static void addFlags(Material blockType, long flags) {
addFlags(BlockProperties.getId(blockType), flags);
BlockProperties.setBlockFlags(blockType, BlockProperties.getBlockFlags(blockType) | flags);
}
/**
@ -83,7 +83,7 @@ public class BlockFlags {
* @param flags
* the flags
*/
public static void removeFlags(int id, long flags) {
public static void removeFlags(String id, long flags) {
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) & ~flags);
}

View File

@ -35,7 +35,7 @@ import fr.neatmonster.nocheatplus.utilities.ds.map.CoordMap.Entry;
public class FakeBlockCache extends BlockCache {
/** Cached type-ids. */
private final CoordMap<Integer> idMapStored = new CoordHashMap<Integer>(23);
private final CoordMap<Material> idMapStored = new CoordHashMap<Material>(23);
/** Cached data values. */
private final CoordMap<Integer> dataMapStored = new CoordHashMap<Integer>(23);
@ -110,7 +110,7 @@ public class FakeBlockCache extends BlockCache {
* the type
*/
public void set(int x, int y, int z, Material type) {
set(x, y, z, BlockProperties.getId(type));
set(x, y, z, type, 0);
}
/**
@ -128,23 +128,7 @@ public class FakeBlockCache extends BlockCache {
* the bounds
*/
public void set(int x, int y, int z, Material type, double[] bounds) {
set(x, y, z, BlockProperties.getId(type), 0, bounds);
}
/**
* Set with data=0 and bounds=full.
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param typeId
* the type id
*/
public void set(int x, int y, int z, int typeId) {
set(x, y, z, typeId, 0);
set(x, y, z, type, 0, bounds);
}
/**
@ -161,7 +145,7 @@ public class FakeBlockCache extends BlockCache {
* @param data
* the data
*/
public void set(int x, int y, int z, int typeId, int data) {
public void set(int x, int y, int z, Material typeId, int data) {
set(x, y, z, typeId, data, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
}
@ -181,7 +165,7 @@ public class FakeBlockCache extends BlockCache {
* @param bounds
* Stores the given bounds directly.
*/
public void set(int x, int y, int z, int typeId, int data, double[] bounds) {
public void set(int x, int y, int z, Material typeId, int data, double[] bounds) {
idMapStored.put(x, y, z, typeId);
dataMapStored.put(x, y, z, data);
if (bounds == null) {
@ -211,7 +195,7 @@ public class FakeBlockCache extends BlockCache {
* the type
*/
public void fill(int x1, int y1, int z1, int x2, int y2, int z2, Material type) {
fill(x1, y1, z1, x2, y2, z2, BlockProperties.getId(type), 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
fill(x1, y1, z1, x2, y2, z2, type, 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
}
/**
@ -236,7 +220,7 @@ public class FakeBlockCache extends BlockCache {
* @param bounds
* the bounds
*/
public void fill(int x1, int y1, int z1, int x2, int y2, int z2, int typeId, int data, double[] bounds) {
public void fill(int x1, int y1, int z1, int x2, int y2, int z2, Material typeId, int data, double[] bounds) {
for (int x = x1; x <= x2; x++) {
for (int y = y1; y <= y2; y ++) {
for (int z = z1; z <= z2; z++) {
@ -265,7 +249,7 @@ public class FakeBlockCache extends BlockCache {
* the type
*/
public void walls(int x1, int y1, int z1, int x2, int y2, int z2, Material type) {
walls(x1, y1, z1, x2, y2, z2, BlockProperties.getId(type), 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
walls(x1, y1, z1, x2, y2, z2, type, 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
}
/**
@ -290,7 +274,7 @@ public class FakeBlockCache extends BlockCache {
* @param bounds
* the bounds
*/
public void walls(int x1, int y1, int z1, int x2, int y2, int z2, int typeId, int data, double[] bounds) {
public void walls(int x1, int y1, int z1, int x2, int y2, int z2, Material typeId, int data, double[] bounds) {
for (int x = x1; x <= x2; x++) {
for (int y = y1; y <= y2; y ++) {
for (int z = z1; z <= z2; z++) {
@ -321,7 +305,7 @@ public class FakeBlockCache extends BlockCache {
* the type
*/
public void room(int x1, int y1, int z1, int x2, int y2, int z2, Material type) {
room(x1, y1, z1, x2, y2, z2, BlockProperties.getId(type), 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
room(x1, y1, z1, x2, y2, z2, type, 0, new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0});
}
/**
@ -346,7 +330,7 @@ public class FakeBlockCache extends BlockCache {
* @param bounds
* the bounds
*/
public void room(int x1, int y1, int z1, int x2, int y2, int z2, int typeId, int data, double[] bounds) {
public void room(int x1, int y1, int z1, int x2, int y2, int z2, Material typeId, int data, double[] bounds) {
for (int x = x1; x <= x2; x++) {
for (int y = y1; y <= y2; y ++) {
for (int z = z1; z <= z2; z++) {
@ -395,15 +379,14 @@ public class FakeBlockCache extends BlockCache {
fullBounds = null;
}
// Assume id is always set.
final Iterator<Entry<Integer>> it = idMapStored.iterator();
final int airId = BlockProperties.getId(Material.AIR);
final Iterator<Entry<Material>> it = idMapStored.iterator();
while (it.hasNext()) {
Entry<Integer> entry = it.next();
Entry<Material> entry = it.next();
final int x = entry.getX();
final int y = entry.getY();
final int z = entry.getZ();
final Integer id = entry.getValue();
if (id == airId) {
final Material id = entry.getValue();
if (id == Material.AIR) {
builder.append(fbcName + ".set(" + x + ", " + y + ", " + z + ", " + id + ");");
}
else {
@ -442,10 +425,10 @@ public class FakeBlockCache extends BlockCache {
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#fetchTypeId(int, int, int)
*/
@Override
public int fetchTypeId(int x, int y, int z) {
final Integer id = idMapStored.get(x, y, z);
public Material fetchTypeId(int x, int y, int z) {
final Material id = idMapStored.get(x, y, z);
if (id == null) {
return BlockProperties.getId(Material.AIR);
return Material.AIR;
} else {
return id;
}

View File

@ -163,7 +163,7 @@ public class TestInteractRayTracing {
public void testIngame() {
// Circle around the corners of 4 blocks with left button pressed down (random sample).
// Bad end coords (should fail):
{FakeBlockCache fbc = new FakeBlockCache(); double[] _fb = new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0};fbc.set(142, 67, 221, 3, 0, _fb);fbc.set(142, 67, 217, 3, 0, _fb);fbc.set(142, 69, 219, 0);fbc.set(142, 68, 218, 2, 0, _fb);fbc.set(142, 70, 220, 0);fbc.set(142, 71, 217, 0);fbc.set(142, 71, 221, 0);fbc.set(143, 67, 218, 3, 0, _fb);fbc.set(143, 68, 217, 2, 0, _fb);fbc.set(143, 68, 221, 2, 0, _fb);fbc.set(143, 69, 220, 0);fbc.set(143, 70, 219, 0);fbc.set(143, 71, 218, 0);fbc.set(144, 67, 219, 3, 0, _fb);fbc.set(144, 68, 220, 2, 0, _fb);fbc.set(144, 69, 217, 0);fbc.set(144, 69, 221, 31, 1, new double[] {0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(144, 70, 218, 0);fbc.set(144, 71, 219, 0);fbc.set(145, 67, 220, 3, 0, _fb);fbc.set(145, 68, 219, 2, 0, _fb);fbc.set(145, 69, 218, 0);fbc.set(145, 70, 217, 0);fbc.set(145, 70, 221, 0);fbc.set(145, 71, 220, 0);fbc.set(142, 68, 217, 2, 0, _fb);fbc.set(142, 68, 221, 2, 0, _fb);fbc.set(142, 67, 218, 3, 0, _fb);fbc.set(142, 69, 220, 0);fbc.set(142, 70, 219, 0);fbc.set(142, 71, 218, 0);fbc.set(143, 67, 217, 3, 0, _fb);fbc.set(143, 67, 221, 3, 0, _fb);fbc.set(143, 68, 218, 49, 0, _fb);fbc.set(143, 69, 219, 0);fbc.set(143, 70, 220, 0);fbc.set(143, 71, 217, 0);fbc.set(143, 71, 221, 0);fbc.set(144, 67, 220, 3, 0, _fb);fbc.set(144, 68, 219, 49, 0, _fb);fbc.set(144, 69, 218, 0);fbc.set(144, 70, 217, 0);fbc.set(144, 70, 221, 0);fbc.set(144, 71, 220, 0);fbc.set(145, 67, 219, 3, 0, _fb);fbc.set(145, 68, 220, 2, 0, _fb);fbc.set(145, 69, 217, 0);fbc.set(145, 69, 221, 50, 5, new double[] {0.4000000059604645, 0.0, 0.4000000059604645, 0.6000000238418579, 0.6000000238418579, 0.6000000238418579});fbc.set(145, 70, 218, 0);fbc.set(145, 71, 219, 0);fbc.set(142, 67, 219, 3, 0, _fb);fbc.set(142, 70, 218, 0);fbc.set(142, 69, 221, 31, 1, new double[] {0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(142, 69, 217, 0);fbc.set(142, 68, 220, 2, 0, _fb);fbc.set(142, 71, 219, 0);fbc.set(143, 67, 220, 3, 0, _fb);fbc.set(143, 68, 219, 49, 0, _fb);fbc.set(143, 69, 218, 0);fbc.set(143, 70, 217, 0);fbc.set(143, 70, 221, 0);fbc.set(143, 71, 220, 0);fbc.set(144, 67, 217, 3, 0, _fb);fbc.set(144, 67, 221, 3, 0, _fb);fbc.set(144, 68, 218, 49, 0, _fb);fbc.set(144, 69, 219, 0);fbc.set(144, 70, 220, 0);fbc.set(144, 71, 217, 0);fbc.set(144, 71, 221, 0);fbc.set(145, 67, 218, 3, 0, _fb);fbc.set(145, 68, 217, 2, 0, _fb);fbc.set(145, 68, 221, 2, 0, _fb);fbc.set(145, 69, 220, 0);fbc.set(145, 70, 219, 0);fbc.set(145, 71, 218, 0);fbc.set(142, 68, 219, 2, 0, _fb);fbc.set(142, 70, 217, 0);fbc.set(142, 67, 220, 3, 0, _fb);fbc.set(142, 69, 218, 31, 1, new double[] {0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(142, 70, 221, 0);fbc.set(142, 71, 220, 0);fbc.set(143, 67, 219, 3, 0, _fb);fbc.set(143, 68, 220, 2, 0, _fb);fbc.set(143, 69, 217, 0);fbc.set(143, 69, 221, 0);fbc.set(143, 70, 218, 0);fbc.set(143, 71, 219, 0);fbc.set(144, 67, 218, 3, 0, _fb);fbc.set(144, 68, 217, 2, 0, _fb);fbc.set(144, 68, 221, 2, 0, _fb);fbc.set(144, 69, 220, 0);fbc.set(144, 70, 219, 0);fbc.set(144, 71, 218, 0);fbc.set(145, 67, 217, 3, 0, _fb);fbc.set(145, 67, 221, 3, 0, _fb);fbc.set(145, 68, 218, 2, 0, _fb);fbc.set(145, 69, 219, 0);fbc.set(145, 70, 220, 0);fbc.set(145, 71, 217, 0);fbc.set(145, 71, 221, 0);InteractRayTracing rt = new CenteredInteractRayTracing(false, 144, 68, 218); rt.setBlockCache(fbc);TestRayTracing.runCoordinates(rt, new double[]{144.01901074886095, 70.62, 220.1221052415879, 144.07776715103876, 68.99423513239826, 219.0}, true, false, 0.0, false, "ingame");rt.cleanup(); fbc.cleanup();}
{FakeBlockCache fbc = new FakeBlockCache(); double[] _fb = new double[]{0.0, 0.0, 0.0, 1.0, 1.0, 1.0};fbc.set(142, 67, 221, Material.DIRT, 0, _fb);fbc.set(142, 67, 217, Material.GRASS, 0, _fb);fbc.set(142, 69, 219, Material.AIR);fbc.set(142, 68, 218, Material.GRASS, 0, _fb);fbc.set(142, 70, 220, Material.AIR);fbc.set(142, 71, 217, Material.AIR);fbc.set(142, 71, 221, Material.AIR);fbc.set(143, 67, 218, Material.DIRT, 0, _fb);fbc.set(143, 68, 217, Material.GRASS, 0, _fb);fbc.set(143, 68, 221, Material.GRASS, 0, _fb);fbc.set(143, 69, 220, Material.AIR);fbc.set(143, 70, 219, Material.AIR);fbc.set(143, 71, 218, Material.AIR);fbc.set(144, 67, 219, Material.DIRT, 0, _fb);fbc.set(144, 68, 220, Material.GRASS, 0, _fb);fbc.set(144, 69, 217, Material.AIR);fbc.set(144, 69, 221, Material.LONG_GRASS, 1, new double[]{0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(144, 70, 218, Material.AIR);fbc.set(144, 71, 219, Material.AIR);fbc.set(145, 67, 220, Material.DIRT, 0, _fb);fbc.set(145, 68, 219, Material.GRASS, 0, _fb);fbc.set(145, 69, 218, Material.AIR);fbc.set(145, 70, 217, Material.AIR);fbc.set(145, 70, 221, Material.AIR);fbc.set(145, 71, 220, Material.AIR);fbc.set(142, 68, 217, Material.GRASS, 0, _fb);fbc.set(142, 68, 221, Material.GRASS, 0, _fb);fbc.set(142, 67, 218, Material.DIRT, 0, _fb);fbc.set(142, 69, 220, Material.AIR);fbc.set(142, 70, 219, Material.AIR);fbc.set(142, 71, 218, Material.AIR);fbc.set(143, 67, 217, Material.DIRT, 0, _fb);fbc.set(143, 67, 221, Material.DIRT, 0, _fb);fbc.set(143, 68, 218, Material.OBSIDIAN, 0, _fb);fbc.set(143, 69, 219, Material.AIR);fbc.set(143, 70, 220, Material.AIR);fbc.set(143, 71, 217, Material.AIR);fbc.set(143, 71, 221, Material.AIR);fbc.set(144, 67, 220, Material.DIRT, 0, _fb);fbc.set(144, 68, 219, Material.OBSIDIAN, 0, _fb);fbc.set(144, 69, 218, Material.AIR);fbc.set(144, 70, 217, Material.AIR);fbc.set(144, 70, 221, Material.AIR);fbc.set(144, 71, 220, Material.AIR);fbc.set(145, 67, 219, Material.DIRT, 0, _fb);fbc.set(145, 68, 220, Material.GRASS, 0, _fb);fbc.set(145, 69, 217, Material.AIR);fbc.set(145, 69, 221, Material.TORCH, 5, new double[]{0.4000000059604645, 0.0, 0.4000000059604645, 0.6000000238418579, 0.6000000238418579, 0.6000000238418579});fbc.set(145, 70, 218, Material.AIR);fbc.set(145, 71, 219, Material.AIR);fbc.set(142, 67, 219, Material.DIRT, 0, _fb);fbc.set(142, 70, 218, Material.AIR);fbc.set(142, 69, 221, Material.LONG_GRASS, 1, new double[]{0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(142, 69, 217, Material.AIR);fbc.set(142, 68, 220, Material.GRASS, 0, _fb);fbc.set(142, 71, 219, Material.AIR);fbc.set(143, 67, 220, Material.DIRT, 0, _fb);fbc.set(143, 68, 219, Material.OBSIDIAN, 0, _fb);fbc.set(143, 69, 218, Material.AIR);fbc.set(143, 70, 217, Material.AIR);fbc.set(143, 70, 221, Material.AIR);fbc.set(143, 71, 220, Material.AIR);fbc.set(144, 67, 217, Material.DIRT, 0, _fb);fbc.set(144, 67, 221, Material.DIRT, 0, _fb);fbc.set(144, 68, 218, Material.OBSIDIAN, 0, _fb);fbc.set(144, 69, 219, Material.AIR);fbc.set(144, 70, 220, Material.AIR);fbc.set(144, 71, 217, Material.AIR);fbc.set(144, 71, 221, Material.AIR);fbc.set(145, 67, 218, Material.DIRT, 0, _fb);fbc.set(145, 68, 217, Material.GRASS, 0, _fb);fbc.set(145, 68, 221, Material.GRASS, 0, _fb);fbc.set(145, 69, 220, Material.AIR);fbc.set(145, 70, 219, Material.AIR);fbc.set(145, 71, 218, Material.AIR);fbc.set(142, 68, 219, Material.GRASS, 0, _fb);fbc.set(142, 70, 217, Material.AIR);fbc.set(142, 67, 220, Material.DIRT, 0, _fb);fbc.set(142, 69, 218, Material.LONG_GRASS, 1, new double[]{0.09999999403953552, 0.0, 0.09999999403953552, 0.8999999761581421, 0.800000011920929, 0.8999999761581421});fbc.set(142, 70, 221, Material.AIR);fbc.set(142, 71, 220, Material.AIR);fbc.set(143, 67, 219, Material.DIRT, 0, _fb);fbc.set(143, 68, 220, Material.GRASS, 0, _fb);fbc.set(143, 69, 217, Material.AIR);fbc.set(143, 69, 221, Material.AIR);fbc.set(143, 70, 218, Material.AIR);fbc.set(143, 71, 219, Material.AIR);fbc.set(144, 67, 218, Material.DIRT, 0, _fb);fbc.set(144, 68, 217, Material.GRASS, 0, _fb);fbc.set(144, 68, 221, Material.GRASS, 0, _fb);fbc.set(144, 69, 220, Material.AIR);fbc.set(144, 70, 219, Material.AIR);fbc.set(144, 71, 218, Material.AIR);fbc.set(145, 67, 217, Material.DIRT, 0, _fb);fbc.set(145, 67, 221, Material.DIRT, 0, _fb);fbc.set(145, 68, 218, Material.GRASS, 0, _fb);fbc.set(145, 69, 219, Material.AIR);fbc.set(145, 70, 220, Material.AIR);fbc.set(145, 71, 217, Material.AIR);fbc.set(145, 71, 221, Material.AIR);InteractRayTracing rt = new CenteredInteractRayTracing(false, 144, 68, 218);rt.setBlockCache(fbc);TestRayTracing.runCoordinates(rt, new double[]{144.01901074886095, 70.62, 220.1221052415879, 144.07776715103876, 68.99423513239826, 219.0}, true, false, 0.0, false, "ingame");rt.cleanup(); fbc.cleanup();}
}
}