Add some more 1.12 format compatibillity
This commit is contained in:
parent
190d65ca7f
commit
cee881ccb5
|
@ -122,14 +122,13 @@ public class BlockIdConfig implements BlockIdMapper {
|
|||
@Override
|
||||
public BlockState get(String id, int numeralId, int meta) {
|
||||
if (numeralId == 0) return BlockState.AIR;
|
||||
|
||||
BlockIDMeta idmeta = new BlockIDMeta(id, meta);
|
||||
BlockState state = idMappings.get(idmeta);
|
||||
|
||||
BlockNumeralIDMeta numidmeta = new BlockNumeralIDMeta(numeralId, meta);
|
||||
BlockState state = numeralMappings.get(numidmeta);
|
||||
if (state == null) {
|
||||
BlockNumeralIDMeta numidmeta = new BlockNumeralIDMeta(numeralId, meta);
|
||||
state = numeralMappings.get(numidmeta);
|
||||
BlockIDMeta idmeta = new BlockIDMeta(id, meta);
|
||||
state = idMappings.get(idmeta);
|
||||
if (state == null) {
|
||||
|
||||
state = idMappings.get(new BlockIDMeta(id, 0));
|
||||
if (state == null) {
|
||||
state = numeralMappings.get(new BlockNumeralIDMeta(numeralId, 0));
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.google.common.util.concurrent.UncheckedExecutionException;
|
|||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.BlockStateExtension;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.DoorExtension;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.DoubleChestExtension;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.DoublePlantExtension;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.FireExtension;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.GlassPaneConnectExtension;
|
||||
|
@ -97,6 +98,7 @@ public class MCAWorld implements World {
|
|||
registerBlockStateExtension(new WoodenFenceConnectExtension());
|
||||
registerBlockStateExtension(new GlassPaneConnectExtension());
|
||||
registerBlockStateExtension(new DoublePlantExtension());
|
||||
registerBlockStateExtension(new DoubleChestExtension());
|
||||
}
|
||||
|
||||
private final UUID uuid;
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* This file is part of BlueMap, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package de.bluecolored.bluemap.core.mca.extensions;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import de.bluecolored.bluemap.core.mca.MCAWorld;
|
||||
import de.bluecolored.bluemap.core.util.Direction;
|
||||
import de.bluecolored.bluemap.core.world.BlockState;
|
||||
|
||||
public class DoubleChestExtension implements BlockStateExtension {
|
||||
|
||||
private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList(
|
||||
"minecraft:chest",
|
||||
"minecraft:trapped_chest"
|
||||
);
|
||||
|
||||
@Override
|
||||
public BlockState extend(MCAWorld world, Vector3i pos, BlockState state) {
|
||||
Direction dir = Direction.fromString(state.getProperties().getOrDefault("facing", "north"));
|
||||
|
||||
BlockState left = world.getBlockState(pos.add(dir.left().toVector()));
|
||||
if (left.getFullId().equals(state.getFullId())) return state.with("type", "right");
|
||||
|
||||
BlockState right = world.getBlockState(pos.add(dir.right().toVector()));
|
||||
if (right.getFullId().equals(state.getFullId())) return state.with("type", "left");
|
||||
|
||||
return state.with("type", "single");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getAffectedBlockIds() {
|
||||
return AFFECTED_BLOCK_IDS;
|
||||
}
|
||||
|
||||
}
|
|
@ -76,6 +76,11 @@ public class RedstoneExtension implements BlockStateExtension {
|
|||
BlockState next = world.getBlockState(pos.add(directionVector));
|
||||
if (CONNECTIBLE.contains(next.getFullId())) return "side";
|
||||
|
||||
if (next.equals(BlockState.AIR)) {
|
||||
BlockState nextdown = world.getBlockState(pos.add(directionVector.getX(), directionVector.getY() - 1, directionVector.getZ()));
|
||||
if (nextdown.getFullId().equals("minecraft:redstone_wire")) return "side";
|
||||
}
|
||||
|
||||
if (!upBlocking) {
|
||||
BlockState nextup = world.getBlockState(pos.add(directionVector.getX(), directionVector.getY() + 1, directionVector.getZ()));
|
||||
if (nextup.getFullId().equals("minecraft:redstone_wire")) return "up";
|
||||
|
|
|
@ -67,7 +67,7 @@ public class StairShapeExtension implements BlockStateExtension {
|
|||
|
||||
if (!isStairs(next) || !isEqualStairs(state, next)) {
|
||||
|
||||
if (backFacing == rotateYCCW(facing)){
|
||||
if (backFacing == facing.left()){
|
||||
return state.with("shape", "outer_left");
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class StairShapeExtension implements BlockStateExtension {
|
|||
BlockState next = world.getBlockState(pos.add(frontFacing.toVector()));
|
||||
|
||||
if (!isStairs(next) || !isEqualStairs(state, next)) {
|
||||
if (frontFacing == rotateYCCW(facing)){
|
||||
if (frontFacing == facing.left()){
|
||||
return state.with("shape", "inner_left");
|
||||
}
|
||||
|
||||
|
@ -110,16 +110,6 @@ public class StairShapeExtension implements BlockStateExtension {
|
|||
stair1.getProperties().get("facing").equals(stair2.getProperties().get("facing")) &&
|
||||
stair1.getProperties().get("half").equals(stair2.getProperties().get("half"));
|
||||
}
|
||||
|
||||
private Direction rotateYCCW(Direction dir) {
|
||||
switch (dir) {
|
||||
case NORTH: return Direction.WEST;
|
||||
case WEST: return Direction.SOUTH;
|
||||
case SOUTH: return Direction.EAST;
|
||||
case EAST: return Direction.NORTH;
|
||||
default: return dir;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getAffectedBlockIds() {
|
||||
|
|
|
@ -27,6 +27,7 @@ package de.bluecolored.bluemap.core.resourcepack;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
@ -259,8 +260,10 @@ public class BlockModelResource {
|
|||
|
||||
private BlockModelResource buildNoReset(String modelPath, boolean renderElements, String topModelPath) throws IOException, ParseResourceException {
|
||||
BlockModelResource blockModel = new BlockModelResource();
|
||||
|
||||
InputStream fileIn = sourcesAccess.readFile(modelPath);
|
||||
ConfigurationNode config = GsonConfigurationLoader.builder()
|
||||
.setSource(() -> new BufferedReader(new InputStreamReader(sourcesAccess.readFile(modelPath), StandardCharsets.UTF_8)))
|
||||
.setSource(() -> new BufferedReader(new InputStreamReader(fileIn, StandardCharsets.UTF_8)))
|
||||
.build()
|
||||
.load();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ package de.bluecolored.bluemap.core.resourcepack;
|
|||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
@ -159,10 +160,12 @@ public class BlockStateResource {
|
|||
}
|
||||
|
||||
public BlockStateResource build(String blockstateFile) throws IOException {
|
||||
|
||||
InputStream fileIn = sourcesAccess.readFile(blockstateFile);
|
||||
ConfigurationNode config = GsonConfigurationLoader.builder()
|
||||
.setSource(() -> new BufferedReader(
|
||||
new InputStreamReader(sourcesAccess.readFile(blockstateFile), StandardCharsets.UTF_8)))
|
||||
.build().load();
|
||||
.setSource(() -> new BufferedReader(new InputStreamReader(fileIn, StandardCharsets.UTF_8)))
|
||||
.build()
|
||||
.load();
|
||||
|
||||
if (!config.getNode("forge_marker").isVirtual()) {
|
||||
return buildForge(config, blockstateFile);
|
||||
|
|
|
@ -43,11 +43,25 @@ public enum Direction {
|
|||
SOUTH.opposite = NORTH;
|
||||
WEST.opposite = EAST;
|
||||
EAST.opposite = WEST;
|
||||
|
||||
UP.left = UP;
|
||||
DOWN.left = DOWN;
|
||||
NORTH.left = WEST;
|
||||
SOUTH.left = EAST;
|
||||
WEST.left = SOUTH;
|
||||
EAST.left = NORTH;
|
||||
|
||||
UP.right = UP;
|
||||
DOWN.right = DOWN;
|
||||
NORTH.right = EAST;
|
||||
SOUTH.right = WEST;
|
||||
WEST.right = NORTH;
|
||||
EAST.right = SOUTH;
|
||||
}
|
||||
|
||||
private Vector3i dir;
|
||||
private Axis axis;
|
||||
private Direction opposite;
|
||||
private Direction opposite, left, right;
|
||||
|
||||
private Direction(int x, int y, int z, Axis axis) {
|
||||
this.dir = new Vector3i(x, y, z);
|
||||
|
@ -63,6 +77,14 @@ public enum Direction {
|
|||
return opposite;
|
||||
}
|
||||
|
||||
public Direction left() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public Direction right() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public Axis getAxis() {
|
||||
return axis;
|
||||
}
|
||||
|
|
|
@ -154,6 +154,22 @@
|
|||
"24:1": "minecraft:chiseled_sandstone",
|
||||
"24:2": "minecraft:cut_sandstone",
|
||||
"25:0": "minecraft:note_block",
|
||||
"26:0": "minecraft:blue_bed[part=foot,facing=south]",
|
||||
"26:1": "minecraft:blue_bed[part=foot,facing=west]",
|
||||
"26:2": "minecraft:blue_bed[part=foot,facing=north]",
|
||||
"26:3": "minecraft:blue_bed[part=foot,facing=east]",
|
||||
"26:4": "minecraft:blue_bed[part=foot,facing=south]",
|
||||
"26:5": "minecraft:blue_bed[part=foot,facing=west]",
|
||||
"26:6": "minecraft:blue_bed[part=foot,facing=north]",
|
||||
"26:7": "minecraft:blue_bed[part=foot,facing=east]",
|
||||
"26:8": "minecraft:blue_bed[part=head,facing=south]",
|
||||
"26:9": "minecraft:blue_bed[part=head,facing=west]",
|
||||
"26:10": "minecraft:blue_bed[part=head,facing=north]",
|
||||
"26:11": "minecraft:blue_bed[part=head,facing=east]",
|
||||
"26:12": "minecraft:blue_bed[part=head,facing=south]",
|
||||
"26:13": "minecraft:blue_bed[part=head,facing=west]",
|
||||
"26:14": "minecraft:blue_bed[part=head,facing=north]",
|
||||
"26:15": "minecraft:blue_bed[part=head,facing=east]",
|
||||
"27:0": "minecraft:powered_rail[powered=false,shape=north_south]",
|
||||
"27:1": "minecraft:powered_rail[powered=false,shape=east_west]",
|
||||
"27:2": "minecraft:powered_rail[powered=false,shape=ascending_east]",
|
||||
|
@ -317,6 +333,10 @@
|
|||
"53:5": "minecraft:oak_stairs[facing=west,half=top,shape=straight]",
|
||||
"53:6": "minecraft:oak_stairs[facing=south,half=top,shape=straight]",
|
||||
"53:7": "minecraft:oak_stairs[facing=north,half=top,shape=straight]",
|
||||
"54:2": "minecraft:chest[type=single,facing=north]",
|
||||
"54:3": "minecraft:chest[type=single,facing=south]",
|
||||
"54:4": "minecraft:chest[type=single,facing=west]",
|
||||
"54:5": "minecraft:chest[type=single,facing=east]",
|
||||
"55:0": "minecraft:redstone_wire[west=none,east=none,power=0,south=none,north=none]",
|
||||
"55:1": "minecraft:redstone_wire[west=none,east=none,power=1,south=none,north=none]",
|
||||
"55:2": "minecraft:redstone_wire[west=none,east=none,power=2,south=none,north=none]",
|
||||
|
@ -360,6 +380,22 @@
|
|||
"62:3": "minecraft:furnace[facing=south,lit=true]",
|
||||
"62:4": "minecraft:furnace[facing=west,lit=true]",
|
||||
"62:5": "minecraft:furnace[facing=east,lit=true]",
|
||||
"63:0": "minecraft:oak_sign[rotation=0]",
|
||||
"63:1": "minecraft:oak_sign[rotation=1]",
|
||||
"63:2": "minecraft:oak_sign[rotation=2]",
|
||||
"63:3": "minecraft:oak_sign[rotation=3]",
|
||||
"63:4": "minecraft:oak_sign[rotation=4]",
|
||||
"63:5": "minecraft:oak_sign[rotation=5]",
|
||||
"63:6": "minecraft:oak_sign[rotation=6]",
|
||||
"63:7": "minecraft:oak_sign[rotation=7]",
|
||||
"63:8": "minecraft:oak_sign[rotation=8]",
|
||||
"63:9": "minecraft:oak_sign[rotation=9]",
|
||||
"63:10": "minecraft:oak_sign[rotation=10]",
|
||||
"63:11": "minecraft:oak_sign[rotation=11]",
|
||||
"63:12": "minecraft:oak_sign[rotation=12]",
|
||||
"63:13": "minecraft:oak_sign[rotation=13]",
|
||||
"63:14": "minecraft:oak_sign[rotation=14]",
|
||||
"63:15": "minecraft:oak_sign[rotation=15]",
|
||||
"64:0": "minecraft:oak_door[hinge=right,facing=east,half=lower,powered=false,open=false]",
|
||||
"64:1": "minecraft:oak_door[hinge=right,facing=south,half=lower,powered=false,open=false]",
|
||||
"64:2": "minecraft:oak_door[hinge=right,facing=west,half=lower,powered=false,open=false]",
|
||||
|
@ -394,6 +430,10 @@
|
|||
"67:5": "minecraft:cobblestone_stairs[facing=west,half=top,shape=straight]",
|
||||
"67:6": "minecraft:cobblestone_stairs[facing=south,half=top,shape=straight]",
|
||||
"67:7": "minecraft:cobblestone_stairs[facing=north,half=top,shape=straight]",
|
||||
"68:2": "minecraft:oak_wall_sign[facing=north]",
|
||||
"68:3": "minecraft:oak_wall_sign[facing=south]",
|
||||
"68:4": "minecraft:oak_wall_sign[facing=west]",
|
||||
"68:5": "minecraft:oak_wall_sign[facing=east]",
|
||||
"69:0": "minecraft:lever[facing=west,face=ceiling,powered=false]",
|
||||
"69:1": "minecraft:lever[facing=east,face=wall,powered=false]",
|
||||
"69:2": "minecraft:lever[facing=west,face=wall,powered=false]",
|
||||
|
@ -763,6 +803,10 @@
|
|||
"128:6": "minecraft:sandstone_stairs[facing=south,half=top,shape=straight]",
|
||||
"128:7": "minecraft:sandstone_stairs[facing=north,half=top,shape=straight]",
|
||||
"129:0": "minecraft:emerald_ore",
|
||||
"130:2": "minecraft:ender_chest[facing=north]",
|
||||
"130:3": "minecraft:ender_chest[facing=south]",
|
||||
"130:4": "minecraft:ender_chest[facing=west]",
|
||||
"130:5": "minecraft:ender_chest[facing=east]",
|
||||
"131:0": "minecraft:tripwire_hook[attached=false,facing=south,powered=false]",
|
||||
"131:1": "minecraft:tripwire_hook[attached=false,facing=west,powered=false]",
|
||||
"131:2": "minecraft:tripwire_hook[attached=false,facing=north,powered=false]",
|
||||
|
@ -883,6 +927,10 @@
|
|||
"145:9": "minecraft:damaged_anvil[facing=west]",
|
||||
"145:10": "minecraft:damaged_anvil[facing=north]",
|
||||
"145:11": "minecraft:damaged_anvil[facing=east]",
|
||||
"146:2": "minecraft:trapped_chest[type=single,facing=north]",
|
||||
"146:3": "minecraft:trapped_chest[type=single,facing=south]",
|
||||
"146:4": "minecraft:trapped_chest[type=single,facing=west]",
|
||||
"146:5": "minecraft:trapped_chest[type=single,facing=east]",
|
||||
"147:0": "minecraft:light_weighted_pressure_plate[power=0]",
|
||||
"147:1": "minecraft:light_weighted_pressure_plate[power=1]",
|
||||
"147:2": "minecraft:light_weighted_pressure_plate[power=2]",
|
||||
|
|
Loading…
Reference in New Issue