Fix inconsistencies with model/blockstate datagen

This commit is contained in:
tterrag 2020-07-18 18:34:27 -04:00
parent 96b9a057b7
commit a3edfd3748
54 changed files with 247 additions and 146 deletions

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/door_bottom", "parent": "minecraft:block/door_bottom",
"textures": { "textures": {
"bottom": "block/acacia_door_bottom", "bottom": "minecraft:block/acacia_door_bottom",
"top": "block/acacia_door_top" "top": "minecraft:block/acacia_door_top"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/door_bottom_rh", "parent": "minecraft:block/door_bottom_rh",
"textures": { "textures": {
"bottom": "block/acacia_door_bottom", "bottom": "minecraft:block/acacia_door_bottom",
"top": "block/acacia_door_top" "top": "minecraft:block/acacia_door_top"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/door_top", "parent": "minecraft:block/door_top",
"textures": { "textures": {
"bottom": "block/acacia_door_bottom", "bottom": "minecraft:block/acacia_door_bottom",
"top": "block/acacia_door_top" "top": "minecraft:block/acacia_door_top"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/door_top_rh", "parent": "minecraft:block/door_top_rh",
"textures": { "textures": {
"bottom": "block/acacia_door_bottom", "bottom": "minecraft:block/acacia_door_bottom",
"top": "block/acacia_door_top" "top": "minecraft:block/acacia_door_top"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate", "parent": "minecraft:block/template_fence_gate",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_open", "parent": "minecraft:block/template_fence_gate_open",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_wall", "parent": "minecraft:block/template_fence_gate_wall",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_wall_open", "parent": "minecraft:block/template_fence_gate_wall_open",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/fence_post", "parent": "minecraft:block/fence_post",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/fence_side", "parent": "minecraft:block/fence_side",
"textures": { "textures": {
"texture": "block/acacia_planks" "texture": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/cube_column", "parent": "minecraft:block/cube_column",
"textures": { "textures": {
"side": "block/acacia_log", "side": "minecraft:block/acacia_log",
"end": "block/acacia_log_top" "end": "minecraft:block/acacia_log_top"
} }
} }

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/cube_column_horizontal",
"textures": {
"side": "minecraft:block/acacia_log",
"end": "minecraft:block/acacia_log_top"
}
}

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/slab", "parent": "minecraft:block/slab",
"textures": { "textures": {
"side": "block/acacia_planks", "side": "minecraft:block/acacia_planks",
"bottom": "block/acacia_planks", "bottom": "minecraft:block/acacia_planks",
"top": "block/acacia_planks" "top": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/slab_top", "parent": "minecraft:block/slab_top",
"textures": { "textures": {
"side": "block/acacia_planks", "side": "minecraft:block/acacia_planks",
"bottom": "block/acacia_planks", "bottom": "minecraft:block/acacia_planks",
"top": "block/acacia_planks" "top": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/stairs", "parent": "minecraft:block/stairs",
"textures": { "textures": {
"side": "block/acacia_planks", "side": "minecraft:block/acacia_planks",
"bottom": "block/acacia_planks", "bottom": "minecraft:block/acacia_planks",
"top": "block/acacia_planks" "top": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/inner_stairs", "parent": "minecraft:block/inner_stairs",
"textures": { "textures": {
"side": "block/acacia_planks", "side": "minecraft:block/acacia_planks",
"bottom": "block/acacia_planks", "bottom": "minecraft:block/acacia_planks",
"top": "block/acacia_planks" "top": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/outer_stairs", "parent": "minecraft:block/outer_stairs",
"textures": { "textures": {
"side": "block/acacia_planks", "side": "minecraft:block/acacia_planks",
"bottom": "block/acacia_planks", "bottom": "minecraft:block/acacia_planks",
"top": "block/acacia_planks" "top": "minecraft:block/acacia_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_orientable_trapdoor_bottom", "parent": "minecraft:block/template_orientable_trapdoor_bottom",
"textures": { "textures": {
"texture": "block/acacia_trapdoor" "texture": "minecraft:block/acacia_trapdoor"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_orientable_trapdoor_open", "parent": "minecraft:block/template_orientable_trapdoor_open",
"textures": { "textures": {
"texture": "block/acacia_trapdoor" "texture": "minecraft:block/acacia_trapdoor"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_orientable_trapdoor_top", "parent": "minecraft:block/template_orientable_trapdoor_top",
"textures": { "textures": {
"texture": "block/acacia_trapdoor" "texture": "minecraft:block/acacia_trapdoor"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/cube_bottom_top", "parent": "minecraft:block/cube_bottom_top",
"textures": { "textures": {
"side": "block/barrel_side", "side": "minecraft:block/barrel_side",
"bottom": "block/barrel_bottom", "bottom": "minecraft:block/barrel_bottom",
"top": "block/barrel_top" "top": "minecraft:block/barrel_top"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/cube_bottom_top", "parent": "minecraft:block/cube_bottom_top",
"textures": { "textures": {
"side": "block/barrel_side", "side": "minecraft:block/barrel_side",
"bottom": "block/barrel_bottom", "bottom": "minecraft:block/barrel_bottom",
"top": "block/barrel_top_open" "top": "minecraft:block/barrel_top_open"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate", "parent": "minecraft:block/template_fence_gate",
"textures": { "textures": {
"texture": "block/birch_planks" "texture": "minecraft:block/birch_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_open", "parent": "minecraft:block/template_fence_gate_open",
"textures": { "textures": {
"texture": "block/birch_planks" "texture": "minecraft:block/birch_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_wall", "parent": "minecraft:block/template_fence_gate_wall",
"textures": { "textures": {
"texture": "block/birch_planks" "texture": "minecraft:block/birch_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_fence_gate_wall_open", "parent": "minecraft:block/template_fence_gate_wall_open",
"textures": { "textures": {
"texture": "block/birch_planks" "texture": "minecraft:block/birch_planks"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_wall_post", "parent": "minecraft:block/template_wall_post",
"textures": { "textures": {
"wall": "block/cobblestone" "wall": "minecraft:block/cobblestone"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_wall_side", "parent": "minecraft:block/template_wall_side",
"textures": { "textures": {
"wall": "block/cobblestone" "wall": "minecraft:block/cobblestone"
} }
} }

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_wall_side_tall",
"textures": {
"wall": "minecraft:block/cobblestone"
}
}

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/orientable", "parent": "minecraft:block/orientable",
"textures": { "textures": {
"side": "block/furnace_side", "side": "minecraft:block/furnace_side",
"front": "block/furnace_front", "front": "minecraft:block/furnace_front",
"top": "block/furnace_top" "top": "minecraft:block/furnace_top"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/orientable", "parent": "minecraft:block/orientable",
"textures": { "textures": {
"side": "block/furnace_side", "side": "minecraft:block/furnace_side",
"front": "block/furnace_front_on", "front": "minecraft:block/furnace_front_on",
"top": "block/furnace_top" "top": "minecraft:block/furnace_top"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_glass_pane_noside", "parent": "minecraft:block/template_glass_pane_noside",
"textures": { "textures": {
"pane": "block/glass" "pane": "minecraft:block/glass"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_glass_pane_noside_alt", "parent": "minecraft:block/template_glass_pane_noside_alt",
"textures": { "textures": {
"pane": "block/glass" "pane": "minecraft:block/glass"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/template_glass_pane_post", "parent": "minecraft:block/template_glass_pane_post",
"textures": { "textures": {
"pane": "block/glass", "pane": "minecraft:block/glass",
"edge": "block/glass_pane_top" "edge": "minecraft:block/glass_pane_top"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/template_glass_pane_side", "parent": "minecraft:block/template_glass_pane_side",
"textures": { "textures": {
"pane": "block/glass", "pane": "minecraft:block/glass",
"edge": "block/glass_pane_top" "edge": "minecraft:block/glass_pane_top"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"parent": "block/template_glass_pane_side_alt", "parent": "minecraft:block/template_glass_pane_side_alt",
"textures": { "textures": {
"pane": "block/glass", "pane": "minecraft:block/glass",
"edge": "block/glass_pane_top" "edge": "minecraft:block/glass_pane_top"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_trapdoor_bottom", "parent": "minecraft:block/template_trapdoor_bottom",
"textures": { "textures": {
"texture": "block/oak_trapdoor" "texture": "minecraft:block/oak_trapdoor"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_trapdoor_open", "parent": "minecraft:block/template_trapdoor_open",
"textures": { "textures": {
"texture": "block/oak_trapdoor" "texture": "minecraft:block/oak_trapdoor"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_trapdoor_top", "parent": "minecraft:block/template_trapdoor_top",
"textures": { "textures": {
"texture": "block/oak_trapdoor" "texture": "minecraft:block/oak_trapdoor"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "minecraft:block/cube_all",
"textures": { "textures": {
"all": "block/stone" "all": "minecraft:block/stone"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/template_torch", "parent": "minecraft:block/template_torch",
"textures": { "textures": {
"torch": "block/torch" "torch": "minecraft:block/torch"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/torch_wall", "parent": "minecraft:block/template_torch_wall",
"textures": { "textures": {
"torch": "block/torch" "torch": "minecraft:block/torch"
} }
} }

View File

@ -1,14 +1,14 @@
{ {
"parent": "item/handheld_rod", "parent": "minecraft:item/handheld_rod",
"textures": { "textures": {
"layer0": "item/fishing_rod" "layer0": "minecraft:item/fishing_rod"
}, },
"overrides": [ "overrides": [
{ {
"predicate": { "predicate": {
"cast": 1.0 "minecraft:cast": 1.0
}, },
"model": "item/fishing_rod_cast" "model": "minecraft:item/fishing_rod_cast"
} }
] ]
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "data_gen_test:item/fishing_rod", "parent": "data_gen_test:item/fishing_rod",
"textures": { "textures": {
"layer0": "item/fishing_rod_cast" "layer0": "minecraft:item/fishing_rod_cast"
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"parent": "block/block", "parent": "minecraft:block/block",
"textures": { "textures": {
"all": "block/dirt", "all": "minecraft:block/dirt",
"top": "block/stone" "top": "minecraft:block/stone"
}, },
"elements": [ "elements": [
{ {

View File

@ -1,6 +1,6 @@
{ {
"parent": "item/generated", "parent": "minecraft:item/generated",
"textures": { "textures": {
"layer0": "block/stone" "layer0": "minecraft:block/stone"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"variants": { "variants": {
"axis=x": { "axis=x": {
"model": "data_gen_test:block/acacia_log", "model": "data_gen_test:block/acacia_log_horizontal",
"x": 90, "x": 90,
"y": 90 "y": 90
}, },
@ -9,7 +9,7 @@
"model": "data_gen_test:block/acacia_log" "model": "data_gen_test:block/acacia_log"
}, },
"axis=z": { "axis=z": {
"model": "data_gen_test:block/acacia_log", "model": "data_gen_test:block/acacia_log_horizontal",
"x": 90 "x": 90
} }
} }

View File

@ -8,6 +8,26 @@
"model": "data_gen_test:block/cobblestone_wall_post" "model": "data_gen_test:block/cobblestone_wall_post"
} }
}, },
{
"when": {
"east": "low"
},
"apply": {
"model": "data_gen_test:block/cobblestone_wall_side",
"y": 90,
"uvlock": true
}
},
{
"when": {
"east": "tall"
},
"apply": {
"model": "data_gen_test:block/cobblestone_wall_side_tall",
"y": 90,
"uvlock": true
}
},
{ {
"when": { "when": {
"north": "low" "north": "low"
@ -17,6 +37,15 @@
"uvlock": true "uvlock": true
} }
}, },
{
"when": {
"north": "tall"
},
"apply": {
"model": "data_gen_test:block/cobblestone_wall_side_tall",
"uvlock": true
}
},
{ {
"when": { "when": {
"south": "low" "south": "low"
@ -27,6 +56,16 @@
"uvlock": true "uvlock": true
} }
}, },
{
"when": {
"south": "tall"
},
"apply": {
"model": "data_gen_test:block/cobblestone_wall_side_tall",
"y": 180,
"uvlock": true
}
},
{ {
"when": { "when": {
"west": "low" "west": "low"
@ -39,11 +78,11 @@
}, },
{ {
"when": { "when": {
"east": "low" "west": "tall"
}, },
"apply": { "apply": {
"model": "data_gen_test:block/cobblestone_wall_side", "model": "data_gen_test:block/cobblestone_wall_side_tall",
"y": 90, "y": 270,
"uvlock": true "uvlock": true
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "minecraft:block/cube_all",
"textures": { "textures": {
"all": "block/furnace_top" "all": "minecraft:block/furnace_top"
} }
} }

View File

@ -35,6 +35,7 @@ import org.apache.logging.log4j.Logger;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
@ -54,9 +55,11 @@ import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock; import net.minecraft.block.StairsBlock;
import net.minecraft.block.TrapDoorBlock; import net.minecraft.block.TrapDoorBlock;
import net.minecraft.block.WallBlock; import net.minecraft.block.WallBlock;
import net.minecraft.block.WallHeight;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache; import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IDataProvider; import net.minecraft.data.IDataProvider;
import net.minecraft.state.Property;
import net.minecraft.state.properties.AttachFace; import net.minecraft.state.properties.AttachFace;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.DoorHingeSide; import net.minecraft.state.properties.DoorHingeSide;
@ -202,17 +205,17 @@ public abstract class BlockStateProvider implements IDataProvider {
} }
public void axisBlock(RotatedPillarBlock block, ResourceLocation side, ResourceLocation end) { public void axisBlock(RotatedPillarBlock block, ResourceLocation side, ResourceLocation end) {
axisBlock(block, models().cubeColumn(name(block), side, end)); axisBlock(block, models().cubeColumn(name(block), side, end), models().cubeColumnHorizontal(name(block) + "_horizontal", side, end));
} }
public void axisBlock(RotatedPillarBlock block, ModelFile model) { public void axisBlock(RotatedPillarBlock block, ModelFile vertical, ModelFile horizontal) {
getVariantBuilder(block) getVariantBuilder(block)
.partialState().with(RotatedPillarBlock.AXIS, Axis.Y) .partialState().with(RotatedPillarBlock.AXIS, Axis.Y)
.modelForState().modelFile(model).addModel() .modelForState().modelFile(vertical).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Axis.Z) .partialState().with(RotatedPillarBlock.AXIS, Axis.Z)
.modelForState().modelFile(model).rotationX(90).addModel() .modelForState().modelFile(horizontal).rotationX(90).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Axis.X) .partialState().with(RotatedPillarBlock.AXIS, Axis.X)
.modelForState().modelFile(model).rotationX(90).rotationY(90).addModel(); .modelForState().modelFile(horizontal).rotationX(90).rotationY(90).addModel();
} }
private static final int DEFAULT_ANGLE_OFFSET = 180; private static final int DEFAULT_ANGLE_OFFSET = 180;
@ -417,14 +420,35 @@ public abstract class BlockStateProvider implements IDataProvider {
} }
private void wallBlockInternal(WallBlock block, String baseName, ResourceLocation texture) { private void wallBlockInternal(WallBlock block, String baseName, ResourceLocation texture) {
wallBlock(block, models().wallPost(baseName + "_post", texture), models().wallSide(baseName + "_side", texture)); wallBlock(block, models().wallPost(baseName + "_post", texture), models().wallSide(baseName + "_side", texture), models().wallSideTall(baseName + "_side_tall", texture));
} }
public static final ImmutableMap<Direction, Property<WallHeight>> WALL_PROPS = ImmutableMap.<Direction, Property<WallHeight>>builder()
.put(Direction.EAST, BlockStateProperties.field_235908_S_)
.put(Direction.NORTH, BlockStateProperties.field_235909_T_)
.put(Direction.SOUTH, BlockStateProperties.field_235910_U_)
.put(Direction.WEST, BlockStateProperties.field_235911_V_)
.build();
public void wallBlock(WallBlock block, ModelFile post, ModelFile side) { public void wallBlock(WallBlock block, ModelFile post, ModelFile side, ModelFile sideTall) {
MultiPartBlockStateBuilder builder = getMultipartBuilder(block) MultiPartBlockStateBuilder builder = getMultipartBuilder(block)
.part().modelFile(post).addModel() .part().modelFile(post).addModel()
.condition(WallBlock.UP, true).end(); .condition(WallBlock.UP, true).end();
fourWayMultipart(builder, side); WALL_PROPS.entrySet().stream()
.filter(e -> e.getKey().getAxis().isHorizontal())
.forEach(e -> {
wallSidePart(builder, side, e, WallHeight.LOW);
wallSidePart(builder, sideTall, e, WallHeight.TALL);
});
}
private void wallSidePart(MultiPartBlockStateBuilder builder, ModelFile model, Map.Entry<Direction, Property<WallHeight>> entry, WallHeight height) {
builder.part()
.modelFile(model)
.rotationY((((int) entry.getKey().getHorizontalAngle()) + 180) % 360)
.uvLock(true)
.addModel()
.condition(entry.getValue(), height);
} }
public void paneBlock(PaneBlock block, ResourceLocation pane, ResourceLocation edge) { public void paneBlock(PaneBlock block, ResourceLocation pane, ResourceLocation edge) {

View File

@ -92,9 +92,9 @@ public class ItemModelBuilder extends ModelBuilder<ItemModelBuilder> {
JsonObject toJson() { JsonObject toJson() {
JsonObject ret = new JsonObject(); JsonObject ret = new JsonObject();
JsonObject predicatesJson = new JsonObject(); JsonObject predicatesJson = new JsonObject();
predicates.forEach((key, val) -> predicatesJson.addProperty(serializeLoc(key), val)); predicates.forEach((key, val) -> predicatesJson.addProperty(key.toString(), val));
ret.add("predicate", predicatesJson); ret.add("predicate", predicatesJson);
ret.addProperty("model", serializeLoc(model.getLocation())); ret.addProperty("model", model.getLocation().toString());
return ret; return ret;
} }
} }

View File

@ -198,7 +198,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
public JsonObject toJson() { public JsonObject toJson() {
JsonObject root = new JsonObject(); JsonObject root = new JsonObject();
if (this.parent != null) { if (this.parent != null) {
root.addProperty("parent", serializeLoc(this.parent.getLocation())); root.addProperty("parent", this.parent.getLocation().toString());
} }
if (!this.ambientOcclusion) { if (!this.ambientOcclusion) {
@ -296,14 +296,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
if (tex.charAt(0) == '#') { if (tex.charAt(0) == '#') {
return tex; return tex;
} }
return serializeLoc(new ResourceLocation(tex)); return new ResourceLocation(tex).toString();
}
String serializeLoc(ResourceLocation loc) {
if (loc.getNamespace().equals("minecraft")) {
return loc.getPath();
}
return loc.toString();
} }
private JsonArray serializeVector3f(Vector3f vec) { private JsonArray serializeVector3f(Vector3f vec) {

View File

@ -173,6 +173,12 @@ public abstract class ModelProvider<T extends ModelBuilder<T>> implements IDataP
.texture("end", end); .texture("end", end);
} }
public T cubeColumnHorizontal(String name, ResourceLocation side, ResourceLocation end) {
return withExistingParent(name, BLOCK_FOLDER + "/cube_column_horizontal")
.texture("side", side)
.texture("end", end);
}
public T orientableVertical(String name, ResourceLocation side, ResourceLocation front) { public T orientableVertical(String name, ResourceLocation side, ResourceLocation front) {
return withExistingParent(name, BLOCK_FOLDER + "/orientable_vertical") return withExistingParent(name, BLOCK_FOLDER + "/orientable_vertical")
.texture("side", side) .texture("side", side)
@ -257,6 +263,10 @@ public abstract class ModelProvider<T extends ModelBuilder<T>> implements IDataP
public T wallSide(String name, ResourceLocation wall) { public T wallSide(String name, ResourceLocation wall) {
return singleTexture(name, BLOCK_FOLDER + "/template_wall_side", "wall", wall); return singleTexture(name, BLOCK_FOLDER + "/template_wall_side", "wall", wall);
} }
public T wallSideTall(String name, ResourceLocation wall) {
return singleTexture(name, BLOCK_FOLDER + "/template_wall_side_tall", "wall", wall);
}
public T wallInventory(String name, ResourceLocation wall) { public T wallInventory(String name, ResourceLocation wall) {
return singleTexture(name, BLOCK_FOLDER + "/wall_inventory", "wall", wall); return singleTexture(name, BLOCK_FOLDER + "/wall_inventory", "wall", wall);
@ -339,7 +349,7 @@ public abstract class ModelProvider<T extends ModelBuilder<T>> implements IDataP
} }
public T torchWall(String name, ResourceLocation torch) { public T torchWall(String name, ResourceLocation torch) {
return singleTexture(name, BLOCK_FOLDER + "/torch_wall", "torch", torch); return singleTexture(name, BLOCK_FOLDER + "/template_torch_wall", "torch", torch);
} }
public T carpet(String name, ResourceLocation wool) { public T carpet(String name, ResourceLocation wool) {

View File

@ -272,7 +272,9 @@ public class DataGeneratorTest
.texture("layer0", mcLoc("item/fishing_rod_cast")); .texture("layer0", mcLoc("item/fishing_rod_cast"));
} }
private static final Set<String> IGNORED_MODELS = ImmutableSet.of("test_generated_model", "test_block_model"); private static final Set<String> IGNORED_MODELS = ImmutableSet.of("test_generated_model", "test_block_model",
"fishing_rod", "fishing_rod_cast" // Vanilla doesn't generate these yet, so they don't match due to having the minecraft domain
);
@Override @Override
public void act(DirectoryCache cache) throws IOException public void act(DirectoryCache cache) throws IOException
@ -436,7 +438,9 @@ public class DataGeneratorTest
// Testing the outputs // Testing the outputs
private static final Set<Block> IGNORED_BLOCKS = ImmutableSet.of(Blocks.BIRCH_FENCE_GATE, Blocks.STONE); private static final Set<Block> IGNORED_BLOCKS = ImmutableSet.of(Blocks.BIRCH_FENCE_GATE, Blocks.STONE);
private static final Set<ResourceLocation> IGNORED_MODELS = ImmutableSet.of(); // Vanilla doesn't generate these models yet, so they have minor discrepancies that are hard to test
// This list should probably be cleared and investigated after each major version update
private static final Set<ResourceLocation> IGNORED_MODELS = ImmutableSet.of(new ResourceLocation(MODID, "block/cube"));
private List<String> errors = new ArrayList<>(); private List<String> errors = new ArrayList<>();
@ -648,6 +652,24 @@ public class DataGeneratorTest
} }
} }
} }
JsonElement generatedTextures = generated.remove("textures");
JsonElement vanillaTextures = existing.remove("textures");
if (generatedTextures == null && vanillaTextures != null) {
ret.add("Model " + loc + " is missing textures");
} else if (generatedTextures != null && vanillaTextures == null) {
ret.add("Model " + loc + " has textures when vanilla equivalent does not");
} else if (generatedTextures != null) { // Both must be non-null
for (Map.Entry<String, JsonElement> e : generatedTextures.getAsJsonObject().entrySet()) {
String vanillaTexture = vanillaTextures.getAsJsonObject().get(e.getKey()).getAsString();
if (!e.getValue().getAsString().equals(vanillaTexture)) {
ret.add("Texture for variable '" + e.getKey() + "' for model " + loc + " does not match vanilla equivalent");
}
}
if (generatedTextures.getAsJsonObject().size() != vanillaTextures.getAsJsonObject().size()) {
ret.add("Model " + loc + " is missing textures from vanilla equivalent");
}
}
if (!existing.equals(generated)) { if (!existing.equals(generated)) {
ret.add("Model " + loc + " does not match vanilla equivalent"); ret.add("Model " + loc + " does not match vanilla equivalent");
@ -662,6 +684,6 @@ public class DataGeneratorTest
private static String toVanillaModel(String model) { private static String toVanillaModel(String model) {
// We generate our own model jsons to test model building, but otherwise our blockstates should be identical // We generate our own model jsons to test model building, but otherwise our blockstates should be identical
// So remove modid to match // So remove modid to match
return model.replaceAll("^\\w+:", ""); return model.replaceAll("^\\w+:", "minecraft:");
} }
} }