fix waterlogged blockstate to not be part of blockstate json files

This commit is contained in:
LordGrimmauld 2020-06-19 21:49:49 +02:00
parent 38dbed2518
commit a6fab28722
10 changed files with 78 additions and 200 deletions

View file

@ -32,7 +32,7 @@ cbcdab42d01f8085db9e5f8db884f8adf7f17625 assets\create\blockstates\chiseled_scor
291952556c52fba2af5bbd793c71af81abd27e71 assets\create\blockstates\chiseled_weathered_limestone.json
4947c261310445fa55b92038326ac82967d192dd assets\create\blockstates\clockwork_bearing.json
1f33834c685e3243882acfe20183fe64dfa872be assets\create\blockstates\clutch.json
7854040f0570146b9823270fea7ea88c0048c316 assets\create\blockstates\cogwheel.json
e5e3757e99c139d67b2a70288466d8a74d818841 assets\create\blockstates\cogwheel.json
f8eff64c75fc599e9a44a003f54ae9931cd8ce7c assets\create\blockstates\copper_block.json
cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets\create\blockstates\copper_casing.json
3355a852cdc717e257ca19b3db836068964733e3 assets\create\blockstates\copper_ore.json
@ -147,7 +147,7 @@ be3bef7e091d8b50bfc1c6b7275946d1f636aefd assets\create\blockstates\horizontal_fr
18d9fdaa1352a7e2ec91135e46dae5c02ccd8f8f assets\create\blockstates\horizontal_framed_glass_pane.json
5d851c90d23de5087ce546d4bbe509e112b84c49 assets\create\blockstates\jungle_window.json
b15bea757ef981e0ca60f740ca234ee2014eb7b7 assets\create\blockstates\jungle_window_pane.json
fff1af0ff50d756efb027b6f3a6610c182138520 assets\create\blockstates\large_cogwheel.json
f651091db216b009b3379b2f48d56d03481c8675 assets\create\blockstates\large_cogwheel.json
a38184e035c2ebca7471e1714494fea213af259e assets\create\blockstates\layered_andesite.json
0fef29f4bfe8e1258427252ef0ff1a414c194969 assets\create\blockstates\layered_dark_scoria.json
924a0291410406c86ded448f95c97ac3b9d2bd2e assets\create\blockstates\layered_diorite.json
@ -178,10 +178,10 @@ ddcf4bb281e046fbb1026b8f46a2cf12448598df assets\create\blockstates\mechanical_be
0fb175e5260ec60e130e589d682a4d3301d7364e assets\create\blockstates\mechanical_harvester.json
d9afcfa27c42df5fd54a7b783acb0eb45ddf5aa5 assets\create\blockstates\mechanical_mixer.json
da612a05f94dc19e07e250efc35a7b2839d2ee76 assets\create\blockstates\mechanical_piston.json
f656c6bf544015299e129367c9528c7c4322d9d0 assets\create\blockstates\mechanical_piston_head.json
94ec340a50b2406f833735f7501a1840c692e32a assets\create\blockstates\mechanical_piston_head.json
debef0f5dde74103aaf4422de4bc90e4099b0c47 assets\create\blockstates\mechanical_plough.json
92269fe66d7b83095a2e04e121af0be792f55dd6 assets\create\blockstates\mechanical_press.json
3868d093b03a50adb239cff78597f94f004cd425 assets\create\blockstates\mechanical_pump.json
b7c4a0ff0c6f16e14d71fc0fb7fc66d032b65cf3 assets\create\blockstates\mechanical_pump.json
1478fc76afb9b186fd3fddc20c29525d60d692bc assets\create\blockstates\mechanical_saw.json
4e48ad0936647065c2322390e7c0fe115c853a98 assets\create\blockstates\millstone.json
468202df0802e17c75fcad0993daf1bc5300ca91 assets\create\blockstates\minecart_anchor.json
@ -247,7 +247,7 @@ c17d334e938dcb742550ba8307ca8266a1fc9b49 assets\create\blockstates\paved_weather
cb23aef25f3106b06c8fa8f152c638bb0d2185d8 assets\create\blockstates\paved_weathered_limestone_slab.json
d62b0992cec1de45dad1f2c273132225f4ef33a0 assets\create\blockstates\paved_weathered_limestone_stairs.json
dba4cf86e82ed4502fffed363fbce226a445e774 assets\create\blockstates\paved_weathered_limestone_wall.json
6266a03c4468e15119e70ce004c572a118000057 assets\create\blockstates\piston_extension_pole.json
975c97018e9e2419943eaab43aed0970e96feaf7 assets\create\blockstates\piston_extension_pole.json
2f764f460aa1d75ba995da180bc6f8d2bd9db385 assets\create\blockstates\polished_dark_scoria.json
262b22dcf3e151e63f58710f6b6fe4fc4fc2a70c assets\create\blockstates\polished_dark_scoria_slab.json
a0dbcb7651b02a4f5c747ad2c6d35da60f768d9b assets\create\blockstates\polished_dark_scoria_stairs.json
@ -277,7 +277,7 @@ b7829c2ef2c47188713f8cab21b2c9bc7f9c5b79 assets\create\blockstates\portable_stor
e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggle_latch.json
3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json
469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json
89b63c6e5875da07226854651079bcea85439f5b assets\create\blockstates\radial_chassis.json
8d7e653bfd9846e684a0d3725595714a19201017 assets\create\blockstates\radial_chassis.json
8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json
c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json
1eac804cba08aebb5f4646758ae1ef9b32e01365 assets\create\blockstates\reinforced_rail.json
@ -298,7 +298,7 @@ b6e50f46a02f833f2f2bafa8585a909b6da5e229 assets\create\blockstates\scoria_cobble
46641fdbc6bdc05829153bc28efb90cae26a51f8 assets\create\blockstates\scoria_pillar.json
89e10f35b93b5c72dd235eb79e5fc6f3655027a1 assets\create\blockstates\secondary_linear_chassis.json
81931eb1027dfb42ba4b2186185a4c0a36e0dbe4 assets\create\blockstates\sequenced_gearshift.json
c47db604f854d2ff7132da88c25780a5501e2161 assets\create\blockstates\shaft.json
79ae6d86a829b9ce82fce68a6377d3810fcfcb10 assets\create\blockstates\shaft.json
e815bfd854c2653f10828bb11950f7fb991d7efc assets\create\blockstates\speedometer.json
d62b7908119fa4f51715a186d0882b388bb25cab assets\create\blockstates\spruce_window.json
8d7dfa60630a8b4bae4e8eca5c66e1cfa34dda1f assets\create\blockstates\spruce_window_pane.json

View file

@ -1,27 +1,14 @@
{
"variants": {
"axis=x,waterlogged=false": {
"axis=x": {
"model": "create:block/cogwheel",
"x": 90,
"y": 90
},
"axis=y,waterlogged=false": {
"axis=y": {
"model": "create:block/cogwheel"
},
"axis=z,waterlogged=false": {
"model": "create:block/cogwheel",
"x": 90,
"y": 180
},
"axis=x,waterlogged=true": {
"model": "create:block/cogwheel",
"x": 90,
"y": 90
},
"axis=y,waterlogged=true": {
"model": "create:block/cogwheel"
},
"axis=z,waterlogged=true": {
"axis=z": {
"model": "create:block/cogwheel",
"x": 90,
"y": 180

View file

@ -1,27 +1,14 @@
{
"variants": {
"axis=x,waterlogged=false": {
"axis=x": {
"model": "create:block/large_cogwheel",
"x": 90,
"y": 90
},
"axis=y,waterlogged=false": {
"axis=y": {
"model": "create:block/large_cogwheel"
},
"axis=z,waterlogged=false": {
"model": "create:block/large_cogwheel",
"x": 90,
"y": 180
},
"axis=x,waterlogged=true": {
"model": "create:block/large_cogwheel",
"x": 90,
"y": 90
},
"axis=y,waterlogged=true": {
"model": "create:block/large_cogwheel"
},
"axis=z,waterlogged=true": {
"axis=z": {
"model": "create:block/large_cogwheel",
"x": 90,
"y": 180

View file

@ -1,105 +1,53 @@
{
"variants": {
"facing=down,type=normal,waterlogged=false": {
"facing=down,type=normal": {
"model": "create:block/mechanical_piston/normal/head",
"x": 180
},
"facing=up,type=normal,waterlogged=false": {
"facing=up,type=normal": {
"model": "create:block/mechanical_piston/normal/head"
},
"facing=north,type=normal,waterlogged=false": {
"facing=north,type=normal": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90
},
"facing=south,type=normal,waterlogged=false": {
"facing=south,type=normal": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 180
},
"facing=west,type=normal,waterlogged=false": {
"facing=west,type=normal": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 270
},
"facing=east,type=normal,waterlogged=false": {
"facing=east,type=normal": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 90
},
"facing=down,type=sticky,waterlogged=false": {
"facing=down,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 180
},
"facing=up,type=sticky,waterlogged=false": {
"facing=up,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head"
},
"facing=north,type=sticky,waterlogged=false": {
"facing=north,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90
},
"facing=south,type=sticky,waterlogged=false": {
"facing=south,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 180
},
"facing=west,type=sticky,waterlogged=false": {
"facing=west,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 270
},
"facing=east,type=sticky,waterlogged=false": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 90
},
"facing=down,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head",
"x": 180
},
"facing=up,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head"
},
"facing=north,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90
},
"facing=south,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 180
},
"facing=west,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 270
},
"facing=east,type=normal,waterlogged=true": {
"model": "create:block/mechanical_piston/normal/head",
"x": 90,
"y": 90
},
"facing=down,type=sticky,waterlogged=true": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 180
},
"facing=up,type=sticky,waterlogged=true": {
"model": "create:block/mechanical_piston/sticky/head"
},
"facing=north,type=sticky,waterlogged=true": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90
},
"facing=south,type=sticky,waterlogged=true": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 180
},
"facing=west,type=sticky,waterlogged=true": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 270
},
"facing=east,type=sticky,waterlogged=true": {
"facing=east,type=sticky": {
"model": "create:block/mechanical_piston/sticky/head",
"x": 90,
"y": 90

View file

@ -1,53 +1,27 @@
{
"variants": {
"facing=down,waterlogged=false": {
"facing=down": {
"model": "create:block/mechanical_pump/block",
"x": 180
},
"facing=up,waterlogged=false": {
"facing=up": {
"model": "create:block/mechanical_pump/block"
},
"facing=north,waterlogged=false": {
"facing=north": {
"model": "create:block/mechanical_pump/block",
"x": 90
},
"facing=south,waterlogged=false": {
"facing=south": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 180
},
"facing=west,waterlogged=false": {
"facing=west": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 270
},
"facing=east,waterlogged=false": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 90
},
"facing=down,waterlogged=true": {
"model": "create:block/mechanical_pump/block",
"x": 180
},
"facing=up,waterlogged=true": {
"model": "create:block/mechanical_pump/block"
},
"facing=north,waterlogged=true": {
"model": "create:block/mechanical_pump/block",
"x": 90
},
"facing=south,waterlogged=true": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 180
},
"facing=west,waterlogged=true": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 270
},
"facing=east,waterlogged=true": {
"facing=east": {
"model": "create:block/mechanical_pump/block",
"x": 90,
"y": 90

View file

@ -1,53 +1,27 @@
{
"variants": {
"facing=down,waterlogged=false": {
"facing=down": {
"model": "create:block/piston_extension_pole",
"x": 180
},
"facing=up,waterlogged=false": {
"facing=up": {
"model": "create:block/piston_extension_pole"
},
"facing=north,waterlogged=false": {
"facing=north": {
"model": "create:block/piston_extension_pole",
"x": 90
},
"facing=south,waterlogged=false": {
"facing=south": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 180
},
"facing=west,waterlogged=false": {
"facing=west": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 270
},
"facing=east,waterlogged=false": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 90
},
"facing=down,waterlogged=true": {
"model": "create:block/piston_extension_pole",
"x": 180
},
"facing=up,waterlogged=true": {
"model": "create:block/piston_extension_pole"
},
"facing=north,waterlogged=true": {
"model": "create:block/piston_extension_pole",
"x": 90
},
"facing=south,waterlogged=true": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 180
},
"facing=west,waterlogged=true": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 270
},
"facing=east,waterlogged=true": {
"facing=east": {
"model": "create:block/piston_extension_pole",
"x": 90,
"y": 90

View file

@ -149,8 +149,8 @@
},
{
"when": {
"axis": "x",
"sticky_north": "true"
"sticky_north": "true",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky"
@ -158,8 +158,8 @@
},
{
"when": {
"axis": "y",
"sticky_north": "true"
"sticky_north": "true",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y_sticky",
@ -168,8 +168,8 @@
},
{
"when": {
"axis": "z",
"sticky_north": "true"
"sticky_north": "true",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky",
@ -178,8 +178,8 @@
},
{
"when": {
"axis": "x",
"sticky_north": "false"
"sticky_north": "false",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x"
@ -187,8 +187,8 @@
},
{
"when": {
"axis": "y",
"sticky_north": "false"
"sticky_north": "false",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y",
@ -197,8 +197,8 @@
},
{
"when": {
"axis": "z",
"sticky_north": "false"
"sticky_north": "false",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x",

View file

@ -1,27 +1,14 @@
{
"variants": {
"axis=x,waterlogged=false": {
"axis=x": {
"model": "create:block/shaft",
"x": 90,
"y": 90
},
"axis=y,waterlogged=false": {
"axis=y": {
"model": "create:block/shaft"
},
"axis=z,waterlogged=false": {
"model": "create:block/shaft",
"x": 90,
"y": 180
},
"axis=x,waterlogged=true": {
"model": "create:block/shaft",
"x": 90,
"y": 90
},
"axis=y,waterlogged=true": {
"model": "create:block/shaft"
},
"axis=z,waterlogged=true": {
"axis=z": {
"model": "create:block/shaft",
"x": 90,
"y": 180

View file

@ -404,7 +404,7 @@ public class AllBlocks {
public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate(BlockStateGen.directionalBlockProvider(true))
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(true))
.transform(StressConfigDefaults.setImpact(4.0))
.item()
.transform(customItemModel())
@ -434,7 +434,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPistonHeadBlock> MECHANICAL_PISTON_HEAD =
REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD)
.blockstate((c, p) -> p.directionalBlock(c.get(), state -> p.models()
.blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models()
.getExistingFile(p.modLoc("block/mechanical_piston/" + state.get(MechanicalPistonHeadBlock.TYPE)
.getName() + "/head"))))
.register();
@ -442,7 +442,7 @@ public class AllBlocks {
public static final BlockEntry<PistonExtensionPoleBlock> PISTON_EXTENSION_POLE =
REGISTRATE.block("piston_extension_pole", PistonExtensionPoleBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD)
.blockstate(BlockStateGen.directionalBlockProvider(false))
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
.simpleItem()
.register();

View file

@ -58,6 +58,11 @@ public class BlockStateGen {
boolean customItem) {
return (c, p) -> p.directionalBlock(c.get(), getBlockModel(customItem, c, p));
}
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> directionalBlockProviderIgnoresWaterlogged(
boolean customItem) {
return (c, p) -> directionalBlockIgnoresWaterlogged(c, p, getBlockModel(customItem, c, p));
}
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> horizontalBlockProvider(
boolean customItem) {
@ -99,17 +104,33 @@ public class BlockStateGen {
// Generators
public static <T extends Block> void directionalBlockIgnoresWaterlogged(DataGenContext<Block, T> ctx,
RegistrateBlockstateProvider prov, Function<BlockState, ModelFile> modelFunc) {
prov.getVariantBuilder(ctx.getEntry())
.forAllStatesExcept(state -> {
Direction dir = state.get(BlockStateProperties.FACING);
return ConfiguredModel.builder()
.modelFile(modelFunc.apply(state))
.rotationX(dir == Direction.DOWN ? 180
: dir.getAxis()
.isHorizontal() ? 90 : 0)
.rotationY(dir.getAxis()
.isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + 180) % 360)
.build();
}, BlockStateProperties.WATERLOGGED);
}
public static <T extends Block> void axisBlock(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
Function<BlockState, ModelFile> modelFunc) {
prov.getVariantBuilder(ctx.getEntry())
.forAllStates(state -> {
.forAllStatesExcept(state -> {
Axis axis = state.get(BlockStateProperties.AXIS);
return ConfiguredModel.builder()
.modelFile(modelFunc.apply(state))
.rotationX(axis == Axis.Y ? 0 : 90)
.rotationY(axis == Axis.X ? 90 : axis == Axis.Z ? 180 : 0)
.build();
});
}, BlockStateProperties.WATERLOGGED);
}
public static <T extends Block> void horizontalAxisBlock(DataGenContext<Block, T> ctx,