More explicit flags for blocks.
This commit is contained in:
parent
0a77c07b21
commit
982fda081a
|
@ -107,7 +107,7 @@ public class BlockInit {
|
|||
* @param newId
|
||||
*/
|
||||
public static void setInstantAir(String newId) {
|
||||
BlockFlags.setFlagsAs(newId, Material.AIR);
|
||||
BlockFlags.setFlagsAs(newId, Material.AIR); // TODO: Problematic, should be F_IGN_PASSABLE
|
||||
BlockProperties.setBlockProps(newId, BlockProperties.instantType);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,6 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
|||
}
|
||||
|
||||
// Passable (alive) coral parts.
|
||||
for (Material mat : MaterialUtil.PASSABLE_CORAL_PARTS) {
|
||||
BlockInit.setInstantAir(mat);
|
||||
}
|
||||
|
||||
// Dead coral parts (solid + ground already set).
|
||||
for (Material mat : MaterialUtil.DEAD_CORAL_PARTS) {
|
||||
|
@ -63,18 +60,14 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
|||
}
|
||||
|
||||
// Kelp.
|
||||
BlockInit.setInstantAir("KELP");
|
||||
|
||||
// Fern.
|
||||
BlockInit.setInstantAir("FERN");
|
||||
|
||||
// Bubble column.
|
||||
// TODO: Drag down effect: probably not using velocity.
|
||||
BlockInit.setAs("BUBBLE_COLUMN", Material.WATER);
|
||||
|
||||
// Further melon/pumpkin stems.
|
||||
BlockInit.setInstantAir("ATTACHED_MELON_STEM");
|
||||
BlockInit.setInstantAir("ATTACHED_PUMPKIN_STEM");
|
||||
|
||||
// Wall torch
|
||||
BlockInit.setInstantAir("WALL_TORCH");
|
||||
|
@ -87,7 +80,7 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
|||
// Stone types.
|
||||
for (Material mat : BridgeMaterial.getAllBlocks("andesite", "diorite", "granite",
|
||||
"polished_andesite", "polished_diorite", "polished_granite",
|
||||
"smooth_stone")) {
|
||||
"smooth_stone", "nether_wart", "nether_warts")) {
|
||||
BlockInit.setAs(mat, Material.STONE);
|
||||
}
|
||||
|
||||
|
@ -176,7 +169,6 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
|||
BlockProperties.noTool, 0.5f, BlockProperties.secToMs(0.7)));
|
||||
|
||||
// Grass path.
|
||||
// TODO: HEIGHT16_15 instead.
|
||||
BlockFlags.removeFlags(Material.GRASS_PATH, BlockProperties.F_HEIGHT100);
|
||||
BlockFlags.addFlags(Material.GRASS_PATH,
|
||||
BlockProperties.F_XZ100 | BlockProperties.F_HEIGHT16_15);
|
||||
|
|
|
@ -609,58 +609,6 @@ public class BlockProperties {
|
|||
/** Returned if unknown. */
|
||||
private static BlockProps defaultBlockProps = instantType;
|
||||
|
||||
/** The Constant instantMat. */
|
||||
protected static final Material[] instantMat = new Material[]{
|
||||
// Named in wiki.
|
||||
BridgeMaterial.WHEAT_CROPS,
|
||||
Material.TRIPWIRE_HOOK, Material.TRIPWIRE,
|
||||
Material.TORCH,
|
||||
Material.TNT,
|
||||
BridgeMaterial.SUGAR_CANE,
|
||||
BridgeMaterial.get("red_rose"), BridgeMaterial.DANDELION,
|
||||
BridgeMaterial.get("blue_orchid"),
|
||||
Material.REDSTONE_WIRE,
|
||||
BridgeMaterial.get("REDSTONE_TORCH_ON"),
|
||||
BridgeMaterial.get("REDSTONE_TORCH_OFF"),
|
||||
BridgeMaterial.get("DIODE_BLOCK_ON"), BridgeMaterial.get("DIODE_BLOCK_OFF"),
|
||||
BridgeMaterial.get("repeater"),
|
||||
Material.PUMPKIN_STEM,
|
||||
BridgeMaterial.getBlock("NETHER_WART"),
|
||||
BridgeMaterial.getBlock("NETHER_WARTS"), // TODO: Bug or very old?
|
||||
Material.BROWN_MUSHROOM, Material.RED_MUSHROOM,
|
||||
Material.MELON_STEM,
|
||||
BridgeMaterial.LILY_PAD,
|
||||
BridgeMaterial.TALL_GRASS,
|
||||
BridgeMaterial.GRASS,
|
||||
Material.FIRE,
|
||||
//
|
||||
BridgeMaterial.WHEAT_CROPS,
|
||||
|
||||
// 1.4
|
||||
BridgeMaterial.COMMAND_BLOCK,
|
||||
BridgeMaterial.CARROTS,
|
||||
BridgeMaterial.POTATOES,
|
||||
|
||||
// 1.13 /...
|
||||
BridgeMaterial.get("allium"),
|
||||
BridgeMaterial.get("azure_bluet"),
|
||||
BridgeMaterial.get("dandelion"),
|
||||
BridgeMaterial.getBlock("dandelion_yellow"),
|
||||
BridgeMaterial.get("kelp_plant"),
|
||||
BridgeMaterial.get("large_fern"),
|
||||
BridgeMaterial.get("lilac"),
|
||||
BridgeMaterial.get("oxeye_daisy"),
|
||||
BridgeMaterial.get("peony"),
|
||||
BridgeMaterial.get("poppy"),
|
||||
BridgeMaterial.get("redstone_torch"),
|
||||
BridgeMaterial.get("redstone_wall_torch"),
|
||||
BridgeMaterial.getBlock("rose_red"),
|
||||
BridgeMaterial.get("seagrass"),
|
||||
BridgeMaterial.get("sea_pickle"),
|
||||
BridgeMaterial.get("sunflower"),
|
||||
BridgeMaterial.get("tall_seagrass"),
|
||||
};
|
||||
|
||||
/** The rt ray. */
|
||||
private static ICollidePassable rtRay = null;
|
||||
|
||||
|
@ -1154,9 +1102,6 @@ public class BlockProperties {
|
|||
setFlag(mat, F_IGN_PASSABLE);
|
||||
}
|
||||
}
|
||||
for (final Material mat : MaterialUtil.WOODEN_PRESSURE_PLATES) {
|
||||
setFlag(mat, F_IGN_PASSABLE);
|
||||
}
|
||||
|
||||
// ? Extra flag for COCOA, ANVIL: depends on data value (other issue)
|
||||
|
||||
|
@ -1247,20 +1192,34 @@ public class BlockProperties {
|
|||
}
|
||||
// Set block break properties.
|
||||
// Instantly breakable.
|
||||
for (final Material mat : instantMat) {
|
||||
for (final Material mat : new Material[]{
|
||||
Material.TRIPWIRE_HOOK, Material.TRIPWIRE,
|
||||
Material.TORCH,
|
||||
Material.TNT,
|
||||
Material.REDSTONE_WIRE,
|
||||
BridgeMaterial.get("REDSTONE_TORCH_ON"),
|
||||
BridgeMaterial.get("REDSTONE_TORCH_OFF"),
|
||||
BridgeMaterial.get("DIODE_BLOCK_ON"), BridgeMaterial.get("DIODE_BLOCK_OFF"),
|
||||
BridgeMaterial.get("repeater"),
|
||||
BridgeMaterial.LILY_PAD,
|
||||
Material.FIRE,
|
||||
BridgeMaterial.COMMAND_BLOCK,
|
||||
BridgeMaterial.get("sea_pickle"),
|
||||
}) {
|
||||
if (mat != null) {
|
||||
setBlock(mat, instantType);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Set<Material>> instantSets = Arrays.asList(
|
||||
MaterialUtil.BUSHES, MaterialUtil.TULIPS,
|
||||
MaterialUtil.SAPLINGS
|
||||
);
|
||||
for (final Set<Material> set : instantSets) {
|
||||
for (final Material mat : set) {
|
||||
setBlock(mat, instantType);
|
||||
for (final Material mat : MaterialUtil.INSTANT_PLANTS) {
|
||||
setBlock(mat, instantType);
|
||||
}
|
||||
// Instant break and fully passable.
|
||||
for (Material mat : new Material[] {
|
||||
BridgeMaterial.get("redstone_torch"),
|
||||
BridgeMaterial.get("redstone_wall_torch"),
|
||||
}) {
|
||||
setBlock(mat, instantType);
|
||||
BlockFlags.addFlags(mat, F_IGN_PASSABLE);
|
||||
}
|
||||
|
||||
// Leaf type
|
||||
|
@ -1305,7 +1264,7 @@ public class BlockProperties {
|
|||
setBlock(Material.LADDER, new BlockProps(noTool, 0.4f, secToMs(0.6), 2.5f));
|
||||
setBlock(Material.CACTUS, new BlockProps(noTool, 0.4f, secToMs(0.6)));
|
||||
for (Material mat : MaterialUtil.WOODEN_PRESSURE_PLATES) {
|
||||
setBlock(mat, new BlockProps(woodAxe, 0.5f, secToMs(0.75, 0.4, 0.2, 0.15, 0.1, 0.1)));
|
||||
setBlockProps(mat, new BlockProps(woodAxe, 0.5f, secToMs(0.75, 0.4, 0.2, 0.15, 0.1, 0.1)));
|
||||
}
|
||||
setBlock(BridgeMaterial.STONE_PRESSURE_PLATE, new BlockProps(woodPickaxe, 0.5f, secToMs(2.5, 0.4, 0.2, 0.15, 0.1, 0.07)));
|
||||
setBlock(Material.SAND, sandType);
|
||||
|
@ -1584,6 +1543,12 @@ public class BlockProperties {
|
|||
| BlockProperties.F_SOLID);
|
||||
}
|
||||
|
||||
// Fully passable blocks.
|
||||
for (Material mat : MaterialUtil.FULLY_PASSABLE_BLOCKS) {
|
||||
BlockFlags.addFlags(mat, F_IGN_PASSABLE);
|
||||
BlockFlags.removeFlags(mat, F_SOLID | F_GROUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,6 +145,12 @@ public class MaterialUtil {
|
|||
// (May not always have all aspects in common.)
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
public static final Set<Material> ALL_BUTTONS = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("_button", AlmostBoolean.YES, "legacy"));
|
||||
|
||||
public static final Set<Material> ALL_PRESSURE_PLATES = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("_pressure_plate", AlmostBoolean.YES, "legacy"));
|
||||
|
||||
public static final Set<Material> BANNERS = Collections.unmodifiableSet(addBlocks(
|
||||
BridgeMaterial.getByPrefixAndSuffix(
|
||||
null,
|
||||
|
@ -168,10 +174,6 @@ public class MaterialUtil {
|
|||
BOATS = Collections.unmodifiableSet(temp);
|
||||
}
|
||||
|
||||
/** Bushes (block). */
|
||||
public static final Set<Material> BUSHES = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("bush", AlmostBoolean.YES, "legacy", "potted"));
|
||||
|
||||
public static final Set<Material> CARPETS = Collections.unmodifiableSet(addBlocks(
|
||||
BridgeMaterial.getBySuffix("_carpet", AlmostBoolean.YES, "legacy"),
|
||||
"carpet"));
|
||||
|
@ -248,7 +250,7 @@ public class MaterialUtil {
|
|||
public static final Set<Material> LEAVES = Collections.unmodifiableSet(addBlocks(
|
||||
BridgeMaterial.getByPrefixAndSuffix(
|
||||
woodTypes,
|
||||
Arrays.asList("_leaves"), // Strictly _pressure_plate for 1.13.
|
||||
Arrays.asList("_leaves"),
|
||||
AlmostBoolean.YES
|
||||
// , ...
|
||||
), "leaves", "leaves_2"));
|
||||
|
@ -270,15 +272,6 @@ public class MaterialUtil {
|
|||
"legacy"
|
||||
), "mushroom_stem" , "huge_mushroom_1", "huge_mushroom_2"));
|
||||
|
||||
/** Coral parts that are passable when alive, but become solid when dead. */
|
||||
public static final Set<Material> PASSABLE_CORAL_PARTS = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getByPrefixAndSuffix(
|
||||
null,
|
||||
Arrays.asList("coral_fan", "coral_wall_fan", "coral"),
|
||||
AlmostBoolean.YES,
|
||||
"dead", "legacy"
|
||||
));
|
||||
|
||||
public static final Set<Material> PLANKS = Collections.unmodifiableSet(addBlocks(
|
||||
BridgeMaterial.getBySuffix("_planks", AlmostBoolean.YES, "legacy"),
|
||||
"wood"));
|
||||
|
@ -287,10 +280,6 @@ public class MaterialUtil {
|
|||
public static final Set<Material> RAILS = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix(Arrays.asList("rail", "rails"), AlmostBoolean.YES, "legacy"));
|
||||
|
||||
/** Places saplings (block). */
|
||||
public static final Set<Material> SAPLINGS = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("sapling", AlmostBoolean.YES, "legacy", "potted"));
|
||||
|
||||
public static final Set<Material> SHULKER_BOXES = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("shulker_box", AlmostBoolean.YES, "legacy"));
|
||||
|
||||
|
@ -325,10 +314,6 @@ public class MaterialUtil {
|
|||
"terracotta", "hard_clay", "stained_clay"
|
||||
));
|
||||
|
||||
/** Tulips (block). */
|
||||
public static final Set<Material> TULIPS = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getBySuffix("tulip", AlmostBoolean.YES, "legacy", "potted"));
|
||||
|
||||
/**
|
||||
* Collect fully solid blocks, that are not contained in other collections
|
||||
* (of blocks that are fully solid too).
|
||||
|
@ -340,8 +325,7 @@ public class MaterialUtil {
|
|||
"andesite", "diorite", "granite",
|
||||
"sandstone",
|
||||
"command_block"
|
||||
),
|
||||
AlmostBoolean.YES, "legacy"),
|
||||
), AlmostBoolean.YES, "legacy"),
|
||||
"observer", "structure_block",
|
||||
"note_block", "tnt",
|
||||
"piston", "sticky_piston", "piston_base", "piston_sticky_base",
|
||||
|
@ -353,7 +337,7 @@ public class MaterialUtil {
|
|||
"emerald_block", "lapis_block", "redstone_block",
|
||||
"purpur_block", "smooth_stone", "smooth_quartz", "quartz_block",
|
||||
"sand", "stone", "gravel", "dirt", "grass_block", "grass",
|
||||
"sea_lantern", "redstone_lamp", "sponge", "wet_sponge"
|
||||
"sea_lantern", "redstone_lamp", "glowstone", "sponge", "wet_sponge"
|
||||
));
|
||||
|
||||
public static final Set<Material> WALL_BANNERS = Collections.unmodifiableSet(addBlocks(
|
||||
|
@ -454,6 +438,31 @@ public class MaterialUtil {
|
|||
// Collections of collections
|
||||
///////////////////////////////
|
||||
|
||||
/** Instantly breakable, fully passable. */
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final Set<Material> INSTANT_PLANTS = Collections.unmodifiableSet(join(
|
||||
BridgeMaterial.getBySuffix(Arrays.asList(
|
||||
"bush", "sapling", "tulip", "orchid", "mushroom", "bluet"),
|
||||
AlmostBoolean.YES, "legacy", "potted"),
|
||||
BridgeMaterial.getByPrefixAndSuffix(
|
||||
null,
|
||||
Arrays.asList("coral_fan", "coral_wall_fan", "coral"),
|
||||
AlmostBoolean.YES, "dead", "legacy"),
|
||||
BridgeMaterial.getAllBlocks("attached_melon_stem", "attached_pumpkin_stem",
|
||||
"allium", "dandelion",
|
||||
"dandelion_yellow", "fern", "kelp", "kelp_plant",
|
||||
"large_fern", "lilac", "melon_stem", "oxeye_daisy",
|
||||
"peony", "poppy", "red_rose", "rose_red", "seagrass",
|
||||
"sunflower", "tall_seagrass"
|
||||
// TODO: Ground or not: "beetroots", "beetroot_block"
|
||||
),
|
||||
new HashSet<Material>(Arrays.asList(BridgeMaterial.TALL_GRASS,
|
||||
BridgeMaterial.WHEAT_CROPS, BridgeMaterial.CARROTS,
|
||||
BridgeMaterial.POTATOES, BridgeMaterial.GRASS,
|
||||
Material.PUMPKIN_STEM, Material.MELON_STEM,
|
||||
Material.SUGAR_CANE))
|
||||
));
|
||||
|
||||
/**
|
||||
* Sets of fully solid blocks (in terms of: can walk on, can't pass through,
|
||||
* full bounds - not necessarily 'solid' officially).
|
||||
|
@ -478,6 +487,20 @@ public class MaterialUtil {
|
|||
WOOL_BLOCKS
|
||||
));
|
||||
|
||||
/**
|
||||
* Collections of blocks that are fully passable.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final Set<Material> FULLY_PASSABLE_BLOCKS = Collections.unmodifiableSet(join(
|
||||
ALL_BUTTONS,
|
||||
ALL_PRESSURE_PLATES,
|
||||
BANNERS,
|
||||
RAILS,
|
||||
WALL_BANNERS,
|
||||
INSTANT_PLANTS,
|
||||
BridgeMaterial.getAllBlocks("lever")
|
||||
));
|
||||
|
||||
////////////////////
|
||||
// Access methods.
|
||||
////////////////////
|
||||
|
|
Loading…
Reference in New Issue