Make everything 1.12.x compatible

This commit is contained in:
Blue (Lukas Rieger) 2020-01-07 04:14:22 +01:00
parent 1c44bd2ac4
commit b24b2241ca
20 changed files with 1014 additions and 1011 deletions

View File

@ -37,7 +37,7 @@
public class DoorExtension implements BlockStateExtension { public class DoorExtension implements BlockStateExtension {
private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList( private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList(
"minecraft:oak_door", "minecraft:wooden_door",
"minecraft:iron_door", "minecraft:iron_door",
"minecraft:spruce_door", "minecraft:spruce_door",
"minecraft:birch_door", "minecraft:birch_door",

View File

@ -36,12 +36,7 @@
public class DoublePlantExtension implements BlockStateExtension { public class DoublePlantExtension implements BlockStateExtension {
private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList( private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList(
"minecraft:sunflower", "minecraft:double_plant"
"minecraft:lilac",
"minecraft:tall_grass",
"minecraft:large_fern",
"minecraft:rose_bush",
"minecraft:peony"
); );
@Override @Override

View File

@ -35,15 +35,15 @@
public class SnowyExtension implements BlockStateExtension { public class SnowyExtension implements BlockStateExtension {
private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList( private static final Collection<String> AFFECTED_BLOCK_IDS = Lists.newArrayList(
"minecraft:grass_block", "minecraft:grass",
"minecraft:podzol" "minecraft:mycelium"
); );
@Override @Override
public BlockState extend(MCAWorld world, Vector3i pos, BlockState state) { public BlockState extend(MCAWorld world, Vector3i pos, BlockState state) {
BlockState above = world.getBlockState(pos.add(0, 1, 0)); BlockState above = world.getBlockState(pos.add(0, 1, 0));
if (above.getFullId().equals("minecraft:snow") || above.getFullId().equals("minecraft:snow_block")) { if (above.getFullId().equals("minecraft:snow_layer") || above.getFullId().equals("minecraft:snow")) {
return state.with("snowy", "true"); return state.with("snowy", "true");
} else { } else {
return state.with("snowy", "false"); return state.with("snowy", "false");

View File

@ -37,7 +37,8 @@
public class WallConnectExtension extends ConnectSameOrFullBlockExtension { public class WallConnectExtension extends ConnectSameOrFullBlockExtension {
private static final HashSet<String> AFFECTED_BLOCK_IDS = Sets.newHashSet( private static final HashSet<String> AFFECTED_BLOCK_IDS = Sets.newHashSet(
"minecraft:cobblestone_wall" "minecraft:cobblestone_wall",
"minecraft:mossy_cobblestone_wall"
); );
@Override @Override

View File

@ -32,7 +32,7 @@
public class WoodenFenceConnectExtension extends ConnectSameOrFullBlockExtension { public class WoodenFenceConnectExtension extends ConnectSameOrFullBlockExtension {
private static final HashSet<String> AFFECTED_BLOCK_IDS = Sets.newHashSet( private static final HashSet<String> AFFECTED_BLOCK_IDS = Sets.newHashSet(
"minecraft:oak_fence", "minecraft:fence",
"minecraft:spruce_fence", "minecraft:spruce_fence",
"minecraft:birch_fence", "minecraft:birch_fence",
"minecraft:jungle_fence", "minecraft:jungle_fence",

View File

@ -93,7 +93,7 @@ public HiresModel render(WorldTile tile, AABB region) {
color = MathUtils.overlayColors(blockModel.getMapColor(), color); color = MathUtils.overlayColors(blockModel.getMapColor(), color);
//TODO: quick hack to random offset grass //TODO: quick hack to random offset grass
if (block.getBlock().getId().equals("grass")){ if (block.getBlock().getFullId().equals("minecraft:tall_grass")){
float dx = (MathUtils.hashToFloat(x, y, z, 123984) - 0.5f) * 0.75f; float dx = (MathUtils.hashToFloat(x, y, z, 123984) - 0.5f) * 0.75f;
float dz = (MathUtils.hashToFloat(x, y, z, 345542) - 0.5f) * 0.75f; float dz = (MathUtils.hashToFloat(x, y, z, 345542) - 0.5f) * 0.75f;
blockModel.translate(new Vector3f(dx, 0, dz)); blockModel.translate(new Vector3f(dx, 0, dz));

View File

@ -105,9 +105,11 @@ public BlockStateModel build(BlockModelResource bmr) {
int textureId = texture.getId(); int textureId = texture.getId();
Vector3f tintcolor = Vector3f.ONE; Vector3f tintcolor = Vector3f.ONE;
/* Water is not tinted in 1.12
if (liquidBlockState.getFullId().equals("minecraft:water")) { if (liquidBlockState.getFullId().equals("minecraft:water")) {
tintcolor = colorCalculator.getWaterAverageColor(block); tintcolor = colorCalculator.getWaterAverageColor(block);
} }
*/
createElementFace(model, Direction.DOWN, c[0], c[2], c[3], c[1], tintcolor, textureId); createElementFace(model, Direction.DOWN, c[0], c[2], c[3], c[1], tintcolor, textureId);
createElementFace(model, Direction.UP, c[5], c[7], c[6], c[4], tintcolor, textureId); createElementFace(model, Direction.UP, c[5], c[7], c[6], c[4], tintcolor, textureId);

View File

@ -388,7 +388,9 @@ private Face buildFace(Element element, Direction direction, ConfigurationNode n
String dirString = node.getNode("cullface").getString(); String dirString = node.getNode("cullface").getString();
if (dirString.equals("bottom")) dirString = "down"; if (dirString.equals("bottom")) dirString = "down";
if (dirString.equals("top")) dirString = "up"; if (dirString.equals("top")) dirString = "up";
try {
face.cullface = Direction.fromString(dirString); face.cullface = Direction.fromString(dirString);
} catch (IllegalArgumentException ignore) {}
} }
return face; return face;

View File

@ -168,6 +168,9 @@ public BlockStateResource build(String blockstateFile) throws IOException {
String conditionString = entry.getKey().toString(); String conditionString = entry.getKey().toString();
ConfigurationNode transformedModelNode = entry.getValue(); ConfigurationNode transformedModelNode = entry.getValue();
//some exceptions in 1.12 resource packs that we ignore
if (conditionString.equals("all") || conditionString.equals("map")) continue;
Variant variant = blockState.new Variant(); Variant variant = blockState.new Variant();
variant.condition = parseConditionString(conditionString); variant.condition = parseConditionString(conditionString);
variant.models = loadModels(transformedModelNode, blockstateFile, null); variant.models = loadModels(transformedModelNode, blockstateFile, null);
@ -228,7 +231,7 @@ private Weighted<TransformedBlockModelResource> loadModel(ConfigurationNode node
if (namespacedModelPath == null) if (namespacedModelPath == null)
throw new ParseResourceException("No model defined!"); throw new ParseResourceException("No model defined!");
String modelPath = ResourcePack.namespacedToAbsoluteResourcePath(namespacedModelPath, "models") + ".json"; String modelPath = ResourcePack.namespacedToAbsoluteResourcePath(namespacedModelPath, "models/block") + ".json";
BlockModelResource model = resourcePack.blockModelResources.get(modelPath); BlockModelResource model = resourcePack.blockModelResources.get(modelPath);
if (model == null) { if (model == null) {
@ -274,6 +277,7 @@ private PropertyCondition parseCondition(ConfigurationNode conditionNode) {
private PropertyCondition parseConditionString(String conditionString) throws IllegalArgumentException { private PropertyCondition parseConditionString(String conditionString) throws IllegalArgumentException {
List<PropertyCondition> conditions = new ArrayList<>(); List<PropertyCondition> conditions = new ArrayList<>();
if (!conditionString.isEmpty() && !conditionString.equals("default") && !conditionString.equals("normal")) { if (!conditionString.isEmpty() && !conditionString.equals("default") && !conditionString.equals("normal")) {
String[] conditionSplit = StringUtils.split(conditionString, ','); String[] conditionSplit = StringUtils.split(conditionString, ',');
for (String element : conditionSplit) { for (String element : conditionSplit) {

View File

@ -54,8 +54,8 @@
*/ */
public class ResourcePack { public class ResourcePack {
public static final String MINECRAFT_CLIENT_VERSION = "1.14.4"; public static final String MINECRAFT_CLIENT_VERSION = "1.12.2";
public static final String MINECRAFT_CLIENT_URL = "https://launcher.mojang.com/v1/objects/8c325a0c5bd674dd747d6ebaa4c791fd363ad8a9/client.jar"; public static final String MINECRAFT_CLIENT_URL = "https://launcher.mojang.com/v1/objects/0f275bc1547d01fa5f56ba34bdc87d981ee12daf/client.jar";
private static final String[] CONFIG_FILES = { private static final String[] CONFIG_FILES = {
"blockColors.json", "blockColors.json",

View File

@ -1,5 +1,5 @@
{ {
"variants": { "variants": {
"": { "model": "block/lava" } "": { "model": "lava" }
} }
} }

View File

@ -1,5 +1,5 @@
{ {
"variants": { "variants": {
"": { "model": "block/water" } "": { "model": "water" }
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "builtin/liquid", "parent": "builtin/liquid",
"textures": { "textures": {
"particle": "block/lava_still", "particle": "blocks/lava_still",
"still": "block/lava_still", "still": "blocks/lava_still",
"flow": "block/lava_flow" "flow": "blocks/lava_flow"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "builtin/liquid", "parent": "builtin/liquid",
"textures": { "textures": {
"particle": "block/water_still", "particle": "blocks/water_still",
"still": "block/water_still", "still": "blocks/water_still",
"flow": "block/water_flow" "flow": "blocks/water_flow"
} }
} }

View File

@ -1,11 +1,11 @@
{ {
"default": "@foliage", "default": "@foliage",
"minecraft:water": "@water", "minecraft:water": "@water",
"minecraft:grass_block": "@grass",
"minecraft:grass": "@grass", "minecraft:grass": "@grass",
"minecraft:tall_grass": "@grass", "minecraft:tall_grass": "@grass",
"minecraft:double_grass": "@grass",
"minecraft:fern": "@grass", "minecraft:fern": "@grass",
"minecraft:large_fern": "@grass", "minecraft:double_fern": "@grass",
"minecraft:redstone_wire": "#ff0000", "minecraft:redstone_wire": "#ff0000",
"minecraft:birch_leaves": "#86a863", "minecraft:birch_leaves": "#86a863",
"minecraft:spruce_leaves": "#51946b" "minecraft:spruce_leaves": "#51946b"

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@
"occluding": true, "occluding": true,
"flammable": false "flammable": false
}, },
"minecraft:grass_block": { "minecraft:grass": {
"culling": true, "culling": true,
"occluding": true, "occluding": true,
"flammable": false "flammable": false
@ -524,7 +524,7 @@
"occluding": false, "occluding": false,
"flammable": false "flammable": false
}, },
"minecraft:grass": { "minecraft:tall_grass": {
"culling": false, "culling": false,
"occluding": false, "occluding": false,
"flammable": true "flammable": true
@ -2249,7 +2249,7 @@
"occluding": false, "occluding": false,
"flammable": true "flammable": true
}, },
"minecraft:tall_grass": { "minecraft:double_grass": {
"culling": false, "culling": false,
"occluding": false, "occluding": false,
"flammable": true "flammable": true

View File

@ -28,7 +28,7 @@ allprojects {
dependencies { dependencies {
compile project(':BlueMapCLI') compile project(':BlueMapCLI')
//compile project(':BlueMapSponge') compile project(':BlueMapSponge')
} }
shadowJar { shadowJar {

View File

@ -1,8 +1,8 @@
rootProject.name = 'BlueMap' rootProject.name = 'BlueMap'
include ':BlueMapCore' include ':BlueMapCore'
include ':BlueMapCLI' include ':BlueMapCLI'
//include ':BlueMapSponge' include ':BlueMapSponge'
project(':BlueMapCore').projectDir = "$rootDir/BlueMapCore" as File project(':BlueMapCore').projectDir = "$rootDir/BlueMapCore" as File
project(':BlueMapCLI').projectDir = "$rootDir/BlueMapCLI" as File project(':BlueMapCLI').projectDir = "$rootDir/BlueMapCLI" as File
//project(':BlueMapSponge').projectDir = "$rootDir/BlueMapSponge" as File project(':BlueMapSponge').projectDir = "$rootDir/BlueMapSponge" as File