Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
fixed block states on portal hubs
Browse files Browse the repository at this point in the history
Fixed that, when portal hubs were generated A) the properties of the palette in the JSON file were not properly parsed and B) the parsed properties weren't in uppercase leading to a crash, when the Game tried looking up the values in an enum
  • Loading branch information
Tz3r0 committed Mar 31, 2020
1 parent 9e53b7b commit 2b062d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public StructureValues loadStructure(JsonObject structureJson) {
if (name.equals("palette")) {
JsonArray list = JsonHelper.getArray(valueArray, "list");
list.forEach(jsonElement1 -> {
Map<String, String> blockPropertyMap = new HashMap<>();
JsonArray paletteProperties = jsonElement1.getAsJsonArray();
paletteProperties.forEach(jsonElement2 -> {
JsonObject paletteProperty = jsonElement2.getAsJsonObject();
String propertyName = JsonHelper.getString(paletteProperty, "name");
Map<String, String> blockPropertyMap = new HashMap<>();
if (propertyName.equals("Name")) {
structure.setBlockProperties(blockPropertyMap);
String blockId = JsonHelper.getString(paletteProperty, "value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,21 @@ public static void placeBlock(IWorld world, BlockPos pos, String block, Map<Stri
world.setBlockState(pos, world.getBlockState(pos).with(Properties.CHEST_TYPE, ChestType.valueOf(properties.get("type"))), 2);
} else {
//TODO: [Slabs]
world.setBlockState(pos, world.getBlockState(pos).with(Properties.SLAB_TYPE, SlabType.valueOf(properties.get("type"))), 2);
world.setBlockState(pos, world.getBlockState(pos).with(Properties.SLAB_TYPE, SlabType.valueOf(properties.get("type").toUpperCase())), 2);
}
} if (properties.get("half") != null) {
//TODO: [Stairs]
world.setBlockState(pos, world.getBlockState(pos).with(Properties.BLOCK_HALF, BlockHalf.valueOf(properties.get("half"))), 2);
world.setBlockState(pos, world.getBlockState(pos).with(Properties.BLOCK_HALF, BlockHalf.valueOf(properties.get("half").toUpperCase())), 2);
} if (properties.get("shape") != null) {
//TODO: [Stairs]
world.setBlockState(pos, world.getBlockState(pos).with(Properties.STAIR_SHAPE, StairShape.valueOf(properties.get("shape"))), 2);
world.setBlockState(pos, world.getBlockState(pos).with(Properties.STAIR_SHAPE, StairShape.valueOf(properties.get("shape").toUpperCase())), 2);
} if (properties.get("facing") != null) {
if (block.equals("minecraft:barrel")) {
//TODO: Barrel
world.setBlockState(pos, world.getBlockState(pos).with(Properties.FACING, Direction.valueOf(facing)), 2);
world.setBlockState(pos, world.getBlockState(pos).with(Properties.FACING, Direction.valueOf(facing.toUpperCase())), 2);
} else {
//TODO: [Anvils], [Chests], [Stairs], Bell, Blast_Furnace, Furnace, Grindstone, Smoker, Stonecutter,
world.setBlockState(pos, world.getBlockState(pos).with(Properties.HORIZONTAL_FACING, Direction.valueOf(facing)), 2);
world.setBlockState(pos, world.getBlockState(pos).with(Properties.HORIZONTAL_FACING, Direction.valueOf(facing.toUpperCase())), 2);
}
} if (properties.get("north") != null || properties.get("west") != null || properties.get("south") != null || properties.get("east") != null) {
//TODO: [Fences], [Walls], Iron bar
Expand Down

0 comments on commit 2b062d3

Please sign in to comment.