mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 20:16:41 +00:00
Remove string switches for BlockType
This commit is contained in:
@ -197,24 +197,24 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> void run(int x, int y, int z, B block) {
|
||||
BlockType type = block.getBlockType();
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "ACACIA_STAIRS":
|
||||
case "BIRCH_STAIRS":
|
||||
case "BRICK_STAIRS":
|
||||
case "COBBLESTONE_STAIRS":
|
||||
case "DARK_OAK_STAIRS":
|
||||
case "DARK_PRISMARINE_STAIRS":
|
||||
case "JUNGLE_STAIRS":
|
||||
case "NETHER_BRICK_STAIRS":
|
||||
case "OAK_STAIRS":
|
||||
case "PRISMARINE_BRICK_STAIRS":
|
||||
case "PRISMARINE_STAIRS":
|
||||
case "PURPUR_STAIRS":
|
||||
case "QUARTZ_STAIRS":
|
||||
case "RED_SANDSTONE_STAIRS":
|
||||
case "SANDSTONE_STAIRS":
|
||||
case "SPRUCE_STAIRS":
|
||||
case "STONE_BRICK_STAIRS":
|
||||
switch (type.getInternalId()) {
|
||||
case BlockID.ACACIA_STAIRS:
|
||||
case BlockID.BIRCH_STAIRS:
|
||||
case BlockID.BRICK_STAIRS:
|
||||
case BlockID.COBBLESTONE_STAIRS:
|
||||
case BlockID.DARK_OAK_STAIRS:
|
||||
case BlockID.DARK_PRISMARINE_STAIRS:
|
||||
case BlockID.JUNGLE_STAIRS:
|
||||
case BlockID.NETHER_BRICK_STAIRS:
|
||||
case BlockID.OAK_STAIRS:
|
||||
case BlockID.PRISMARINE_BRICK_STAIRS:
|
||||
case BlockID.PRISMARINE_STAIRS:
|
||||
case BlockID.PURPUR_STAIRS:
|
||||
case BlockID.QUARTZ_STAIRS:
|
||||
case BlockID.RED_SANDSTONE_STAIRS:
|
||||
case BlockID.SANDSTONE_STAIRS:
|
||||
case BlockID.SPRUCE_STAIRS:
|
||||
case BlockID.STONE_BRICK_STAIRS:
|
||||
Object half = block.getState(PropertyKey.HALF);
|
||||
Direction facing = block.getState(PropertyKey.FACING);
|
||||
|
||||
@ -301,38 +301,38 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
}
|
||||
|
||||
private int group(BlockType type) {
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "ACACIA_FENCE":
|
||||
case "BIRCH_FENCE":
|
||||
case "DARK_OAK_FENCE":
|
||||
case "JUNGLE_FENCE":
|
||||
case "OAK_FENCE":
|
||||
case "SPRUCE_FENCE":
|
||||
switch (type.getInternalId()) {
|
||||
case BlockID.ACACIA_FENCE:
|
||||
case BlockID.BIRCH_FENCE:
|
||||
case BlockID.DARK_OAK_FENCE:
|
||||
case BlockID.JUNGLE_FENCE:
|
||||
case BlockID.OAK_FENCE:
|
||||
case BlockID.SPRUCE_FENCE:
|
||||
return 0;
|
||||
case "NETHER_BRICK_FENCE":
|
||||
case BlockID.NETHER_BRICK_FENCE:
|
||||
return 1;
|
||||
case "COBBLESTONE_WALL":
|
||||
case "MOSSY_COBBLESTONE_WALL":
|
||||
case BlockID.COBBLESTONE_WALL:
|
||||
case BlockID.MOSSY_COBBLESTONE_WALL:
|
||||
return 2;
|
||||
case "IRON_BARS":
|
||||
case "BLACK_STAINED_GLASS_PANE":
|
||||
case "BLUE_STAINED_GLASS_PANE":
|
||||
case "BROWN_MUSHROOM_BLOCK":
|
||||
case "BROWN_STAINED_GLASS_PANE":
|
||||
case "CYAN_STAINED_GLASS_PANE":
|
||||
case "GLASS_PANE":
|
||||
case "GRAY_STAINED_GLASS_PANE":
|
||||
case "GREEN_STAINED_GLASS_PANE":
|
||||
case "LIGHT_BLUE_STAINED_GLASS_PANE":
|
||||
case "LIGHT_GRAY_STAINED_GLASS_PANE":
|
||||
case "LIME_STAINED_GLASS_PANE":
|
||||
case "MAGENTA_STAINED_GLASS_PANE":
|
||||
case "ORANGE_STAINED_GLASS_PANE":
|
||||
case "PINK_STAINED_GLASS_PANE":
|
||||
case "PURPLE_STAINED_GLASS_PANE":
|
||||
case "RED_STAINED_GLASS_PANE":
|
||||
case "WHITE_STAINED_GLASS_PANE":
|
||||
case "YELLOW_STAINED_GLASS_PANE":
|
||||
case BlockID.IRON_BARS:
|
||||
case BlockID.BLACK_STAINED_GLASS_PANE:
|
||||
case BlockID.BLUE_STAINED_GLASS_PANE:
|
||||
case BlockID.BROWN_MUSHROOM_BLOCK:
|
||||
case BlockID.BROWN_STAINED_GLASS_PANE:
|
||||
case BlockID.CYAN_STAINED_GLASS_PANE:
|
||||
case BlockID.GLASS_PANE:
|
||||
case BlockID.GRAY_STAINED_GLASS_PANE:
|
||||
case BlockID.GREEN_STAINED_GLASS_PANE:
|
||||
case BlockID.LIGHT_BLUE_STAINED_GLASS_PANE:
|
||||
case BlockID.LIGHT_GRAY_STAINED_GLASS_PANE:
|
||||
case BlockID.LIME_STAINED_GLASS_PANE:
|
||||
case BlockID.MAGENTA_STAINED_GLASS_PANE:
|
||||
case BlockID.ORANGE_STAINED_GLASS_PANE:
|
||||
case BlockID.PINK_STAINED_GLASS_PANE:
|
||||
case BlockID.PURPLE_STAINED_GLASS_PANE:
|
||||
case BlockID.RED_STAINED_GLASS_PANE:
|
||||
case BlockID.WHITE_STAINED_GLASS_PANE:
|
||||
case BlockID.YELLOW_STAINED_GLASS_PANE:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -82,13 +83,16 @@ public final class HeightMapMCADrawer {
|
||||
int waterId = gen.primtives.waterId;
|
||||
int waterColor = 0;
|
||||
BlockType waterType = BlockTypes.get(waterId);
|
||||
String s = waterType.getResource().toUpperCase();
|
||||
if (waterType == BlockTypes.WATER) {
|
||||
color = tu.averageColor((0x11 << 16) + (0x66 << 8) + (0xCC), color);
|
||||
} else if (waterType == BlockTypes.LAVA) {
|
||||
color = (0xCC << 16) + (0x33 << 8) + (0);
|
||||
} else {
|
||||
color = tu.getColor(waterType);
|
||||
switch (waterType.getInternalId()) {
|
||||
case BlockID.WATER:
|
||||
color = tu.averageColor((0x11 << 16) + (0x66 << 8) + (0xCC), color);
|
||||
break;
|
||||
case BlockID.LAVA:
|
||||
color = (0xCC << 16) + (0x33 << 8) + (0);
|
||||
break;
|
||||
default:
|
||||
color = tu.getColor(waterType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
raw[index] = color;
|
||||
|
@ -17,6 +17,7 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
@ -446,16 +447,20 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
private final void setLayerHeight(int index, int blockHeight, int layerHeight) {
|
||||
int floorState = floor.get()[index];
|
||||
BlockType type = BlockTypes.getFromStateId(floorState);
|
||||
if (type == BlockTypes.SNOW || type == BlockTypes.SNOW_BLOCK) {
|
||||
if (layerHeight != 0) {
|
||||
this.heights.setByte(index, (byte) (blockHeight + 1));
|
||||
this.floor.setInt(index, (BlockTypes.SNOW.getInternalId() + layerHeight));
|
||||
} else {
|
||||
switch (type.getInternalId()) {
|
||||
case BlockID.SNOW:
|
||||
case BlockID.SNOW_BLOCK:
|
||||
if (layerHeight != 0) {
|
||||
this.heights.setByte(index, (byte) (blockHeight + 1));
|
||||
this.floor.setInt(index, (BlockTypes.SNOW.getInternalId() + layerHeight));
|
||||
} else {
|
||||
this.heights.setByte(index, (byte) (blockHeight));
|
||||
this.floor.setInt(index, (BlockTypes.SNOW_BLOCK.getInternalId()));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this.heights.setByte(index, (byte) (blockHeight));
|
||||
this.floor.setInt(index, (BlockTypes.SNOW_BLOCK.getInternalId()));
|
||||
}
|
||||
} else {
|
||||
this.heights.setByte(index, (byte) (blockHeight));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,16 +473,20 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
private final void setLayerHeightRaw(int index, int blockHeight, int layerHeight) {
|
||||
int floorState = floor.get()[index];
|
||||
BlockType type = BlockTypes.getFromStateId(floorState);
|
||||
if (type == BlockTypes.SNOW || type == BlockTypes.SNOW_BLOCK) {
|
||||
if (layerHeight != 0) {
|
||||
this.heights.getByteArray()[index] = (byte) (blockHeight + 1);
|
||||
this.floor.getIntArray()[index] = (BlockTypes.SNOW.getInternalId() + layerHeight);
|
||||
} else {
|
||||
switch (type.getInternalId()) {
|
||||
case BlockID.SNOW:
|
||||
case BlockID.SNOW_BLOCK:
|
||||
if (layerHeight != 0) {
|
||||
this.heights.getByteArray()[index] = (byte) (blockHeight + 1);
|
||||
this.floor.getIntArray()[index] = (BlockTypes.SNOW.getInternalId() + layerHeight);
|
||||
} else {
|
||||
this.heights.getByteArray()[index] = (byte) (blockHeight);
|
||||
this.floor.getIntArray()[index] = (BlockTypes.SNOW_BLOCK.getInternalId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this.heights.getByteArray()[index] = (byte) (blockHeight);
|
||||
this.floor.getIntArray()[index] = (BlockTypes.SNOW_BLOCK.getInternalId());
|
||||
}
|
||||
} else {
|
||||
this.heights.getByteArray()[index] = (byte) (blockHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -176,8 +177,11 @@ public class CavesGen extends GenBase {
|
||||
BlockStateHolder material = chunk.getLazyBlock(bx + local_x, local_y, bz + local_z);
|
||||
BlockStateHolder materialAbove = chunk.getLazyBlock(bx + local_x, local_y + 1, bz + local_z);
|
||||
BlockType blockType = material.getBlockType();
|
||||
if (blockType == BlockTypes.MYCELIUM || blockType == BlockTypes.GRASS) {
|
||||
grassFound = true;
|
||||
switch (blockType.getInternalId()) {
|
||||
case BlockID.MYCELIUM:
|
||||
case BlockID.GRASS:
|
||||
grassFound = true;
|
||||
|
||||
}
|
||||
if (this.isSuitableBlock(material, materialAbove)) {
|
||||
if (local_y - 1 < 10) {
|
||||
@ -206,13 +210,13 @@ public class CavesGen extends GenBase {
|
||||
}
|
||||
|
||||
protected boolean isSuitableBlock(BlockStateHolder material, BlockStateHolder materialAbove) {
|
||||
switch (material.getBlockType().getResource().toUpperCase()) {
|
||||
case "AIR":
|
||||
case "CAVE_AIR":
|
||||
case "VOID_AIR":
|
||||
case "WATER":
|
||||
case "LAVA":
|
||||
case "BEDROCK":
|
||||
switch (material.getBlockType().getInternalId()) {
|
||||
case BlockID.AIR:
|
||||
case BlockID.CAVE_AIR:
|
||||
case BlockID.VOID_AIR:
|
||||
case BlockID.WATER:
|
||||
case BlockID.LAVA:
|
||||
case BlockID.BEDROCK:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user