1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-28 16:22:18 +00:00

Fix a couple of rendering issues

- Fix printouts in item frames being rendered too far foward.
 - Fix wired modems being flipped.
This commit is contained in:
Jonathan Coates 2025-05-10 17:51:48 +01:00
parent 0a0c80db41
commit e13e8ff92e
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
5 changed files with 51 additions and 62 deletions

View File

@ -58,7 +58,7 @@ junitPlatform = "1.11.4"
jmh = "1.37" jmh = "1.37"
# Build tools # Build tools
cctJavadoc = "1.8.4" cctJavadoc = "1.8.5"
checkstyle = "10.21.4" checkstyle = "10.21.4"
errorProne-core = "2.37.0" errorProne-core = "2.37.0"
errorProne-plugin = "4.1.0" errorProne-plugin = "4.1.0"

View File

@ -123,7 +123,7 @@ public class BlockModelProvider {
generators.blockStateOutput.accept( generators.blockStateOutput.accept(
createSimpleBlock(ModRegistry.Blocks.LECTERN.get(), plainVariant(getModelLocation(Blocks.LECTERN))) createSimpleBlock(ModRegistry.Blocks.LECTERN.get(), plainVariant(getModelLocation(Blocks.LECTERN)))
.with(createHorizontalFacingDispatch()) .with(ROTATION_HORIZONTAL_FACING)
); );
} }
@ -142,7 +142,7 @@ public class BlockModelProvider {
generators.modelOutput generators.modelOutput
); );
})) }))
.with(createHorizontalFacingDispatch()) .with(ROTATION_HORIZONTAL_FACING)
); );
generators.registerSimpleItemModel(diskDrive, getModelLocation(diskDrive, "_empty")); generators.registerSimpleItemModel(diskDrive, getModelLocation(diskDrive, "_empty"));
} }
@ -170,7 +170,7 @@ public class BlockModelProvider {
generators.modelOutput generators.modelOutput
); );
})) }))
.with(createHorizontalFacingDispatch()) .with(ROTATION_HORIZONTAL_FACING)
); );
generators.registerSimpleItemModel(printer, getModelLocation(printer, "_empty")); generators.registerSimpleItemModel(printer, getModelLocation(printer, "_empty"));
} }
@ -189,7 +189,7 @@ public class BlockModelProvider {
generators.modelOutput generators.modelOutput
); );
})) }))
.with(createHorizontalFacingDispatch()) .with(ROTATION_HORIZONTAL_FACING)
); );
generators.registerSimpleItemModel(block, getModelLocation(block, "_blinking")); generators.registerSimpleItemModel(block, getModelLocation(block, "_blinking"));
} }
@ -234,7 +234,7 @@ public class BlockModelProvider {
.with(createModelDispatch(WirelessModemBlock.ON, .with(createModelDispatch(WirelessModemBlock.ON,
on -> modemModel(generators, getModelLocation(block, on ? "_on" : "_off"), getBlockTexture(block, "_face" + (on ? "_on" : ""))) on -> modemModel(generators, getModelLocation(block, on ? "_on" : "_off"), getBlockTexture(block, "_face" + (on ? "_on" : "")))
)) ))
.with(createFacingDispatch())); .with(ROTATION_FACING));
generators.registerSimpleItemModel(block, getModelLocation(block, "_off")); generators.registerSimpleItemModel(block, getModelLocation(block, "_off"));
} }
@ -289,7 +289,7 @@ public class BlockModelProvider {
generators.blockStateOutput.accept(MultiVariantGenerator.dispatch(block) generators.blockStateOutput.accept(MultiVariantGenerator.dispatch(block)
.with(createModelDispatch(MonitorBlock.STATE, edge -> getModelLocation(block, edge == MonitorEdgeState.NONE ? "" : "_" + edge.getSerializedName()))) .with(createModelDispatch(MonitorBlock.STATE, edge -> getModelLocation(block, edge == MonitorEdgeState.NONE ? "" : "_" + edge.getSerializedName())))
.with(createHorizontalFacingDispatch()) .with(ROTATION_HORIZONTAL_FACING)
.with(createVerticalFacingDispatch(MonitorBlock.ORIENTATION)) .with(createVerticalFacingDispatch(MonitorBlock.ORIENTATION))
); );
generators.registerSimpleItemModel(block, monitorModel(generators, block, "_item", 15, 4, 0, 32)); generators.registerSimpleItemModel(block, monitorModel(generators, block, "_item", 15, 4, 0, 32));
@ -373,8 +373,8 @@ public class BlockModelProvider {
generator.with( generator.with(
condition().term(CableBlock.MODEM, CableModemVariant.from(direction, on, peripheral)), condition().term(CableBlock.MODEM, CableModemVariant.from(direction, on, peripheral)),
plainVariant(ResourceLocation.fromNamespaceAndPath(ComputerCraftAPI.MOD_ID, "block/wired_modem" + suffix)) plainVariant(ResourceLocation.fromNamespaceAndPath(ComputerCraftAPI.MOD_ID, "block/wired_modem" + suffix))
.with(VariantMutator.X_ROT.withValue(toXAngle(direction.getOpposite()))) .with(VariantMutator.X_ROT.withValue(toXAngle(direction)))
.with(VariantMutator.Y_ROT.withValue(toYAngle(direction.getOpposite()))) .with(VariantMutator.Y_ROT.withValue(toYAngle(direction)))
); );
} }
} }
@ -440,15 +440,6 @@ public class BlockModelProvider {
}; };
} }
private static PropertyDispatch<VariantMutator> createHorizontalFacingDispatch() {
/*var dispatch = PropertyDispatch.modify(BlockStateProperties.HORIZONTAL_FACING);
for (var direction : BlockStateProperties.HORIZONTAL_FACING.getPossibleValues()) {
dispatch.select(direction, Variant.variant().with(VariantProperties.Y_ROT, toYAngle(direction)));
}
return dispatch;*/
return BlockModelGenerators.ROTATION_HORIZONTAL_FACING;
}
private static PropertyDispatch<VariantMutator> createVerticalFacingDispatch(Property<Direction> property) { private static PropertyDispatch<VariantMutator> createVerticalFacingDispatch(Property<Direction> property) {
var dispatch = PropertyDispatch.modify(property); var dispatch = PropertyDispatch.modify(property);
for (var direction : property.getPossibleValues()) { for (var direction : property.getPossibleValues()) {
@ -457,10 +448,6 @@ public class BlockModelProvider {
return dispatch; return dispatch;
} }
private static PropertyDispatch<VariantMutator> createFacingDispatch() {
return BlockModelGenerators.ROTATION_FACING;
}
private static <T extends Comparable<T>> PropertyDispatch<MultiVariant> createModelDispatch(Property<T> property, Function<T, ResourceLocation> makeModel) { private static <T extends Comparable<T>> PropertyDispatch<MultiVariant> createModelDispatch(Property<T> property, Function<T, ResourceLocation> makeModel) {
var variant = PropertyDispatch.initial(property); var variant = PropertyDispatch.initial(property);
for (var value : property.getPossibleValues()) { for (var value : property.getPossibleValues()) {

View File

@ -61,64 +61,64 @@
{"apply": {"model": "computercraft:block/cable_arm"}, "when": {"south": "true"}}, {"apply": {"model": "computercraft:block/cable_arm"}, "when": {"south": "true"}},
{"apply": {"model": "computercraft:block/cable_arm", "y": 90}, "when": {"west": "true"}}, {"apply": {"model": "computercraft:block/cable_arm", "y": 90}, "when": {"west": "true"}},
{"apply": {"model": "computercraft:block/cable_arm", "y": 270}, "when": {"east": "true"}}, {"apply": {"model": "computercraft:block/cable_arm", "y": 270}, "when": {"east": "true"}},
{"apply": {"model": "computercraft:block/wired_modem_off", "x": 270}, "when": {"modem": "down_off"}}, {"apply": {"model": "computercraft:block/wired_modem_off", "x": 90}, "when": {"modem": "down_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "x": 270},
"when": {"modem": "down_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "x": 270}, "when": {"modem": "down_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "x": 270},
"when": {"modem": "down_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off", "x": 90}, "when": {"modem": "up_off"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "x": 90}, "apply": {"model": "computercraft:block/wired_modem_off_peripheral", "x": 90},
"when": {"modem": "up_off_peripheral"} "when": {"modem": "down_off_peripheral"}
}, },
{"apply": {"model": "computercraft:block/wired_modem_on", "x": 90}, "when": {"modem": "up_on"}}, {"apply": {"model": "computercraft:block/wired_modem_on", "x": 90}, "when": {"modem": "down_on"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "x": 90}, "apply": {"model": "computercraft:block/wired_modem_on_peripheral", "x": 90},
"when": {"modem": "down_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off", "x": 270}, "when": {"modem": "up_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "x": 270},
"when": {"modem": "up_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "x": 270}, "when": {"modem": "up_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "x": 270},
"when": {"modem": "up_on_peripheral"} "when": {"modem": "up_on_peripheral"}
}, },
{"apply": {"model": "computercraft:block/wired_modem_off", "y": 180}, "when": {"modem": "north_off"}}, {"apply": {"model": "computercraft:block/wired_modem_off"}, "when": {"modem": "north_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 180},
"when": {"modem": "north_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "y": 180}, "when": {"modem": "north_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 180},
"when": {"modem": "north_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off"}, "when": {"modem": "south_off"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_off_peripheral"}, "apply": {"model": "computercraft:block/wired_modem_off_peripheral"},
"when": {"modem": "south_off_peripheral"} "when": {"modem": "north_off_peripheral"}
}, },
{"apply": {"model": "computercraft:block/wired_modem_on"}, "when": {"modem": "south_on"}}, {"apply": {"model": "computercraft:block/wired_modem_on"}, "when": {"modem": "north_on"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_on_peripheral"}, "apply": {"model": "computercraft:block/wired_modem_on_peripheral"},
"when": {"modem": "north_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off", "y": 180}, "when": {"modem": "south_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 180},
"when": {"modem": "south_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "y": 180}, "when": {"modem": "south_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 180},
"when": {"modem": "south_on_peripheral"} "when": {"modem": "south_on_peripheral"}
}, },
{"apply": {"model": "computercraft:block/wired_modem_off", "y": 90}, "when": {"modem": "west_off"}}, {"apply": {"model": "computercraft:block/wired_modem_off", "y": 270}, "when": {"modem": "west_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 90},
"when": {"modem": "west_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "y": 90}, "when": {"modem": "west_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 90},
"when": {"modem": "west_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off", "y": 270}, "when": {"modem": "east_off"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 270}, "apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 270},
"when": {"modem": "east_off_peripheral"} "when": {"modem": "west_off_peripheral"}
}, },
{"apply": {"model": "computercraft:block/wired_modem_on", "y": 270}, "when": {"modem": "east_on"}}, {"apply": {"model": "computercraft:block/wired_modem_on", "y": 270}, "when": {"modem": "west_on"}},
{ {
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 270}, "apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 270},
"when": {"modem": "west_on_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_off", "y": 90}, "when": {"modem": "east_off"}},
{
"apply": {"model": "computercraft:block/wired_modem_off_peripheral", "y": 90},
"when": {"modem": "east_off_peripheral"}
},
{"apply": {"model": "computercraft:block/wired_modem_on", "y": 90}, "when": {"modem": "east_on"}},
{
"apply": {"model": "computercraft:block/wired_modem_on_peripheral", "y": 90},
"when": {"modem": "east_on_peripheral"} "when": {"modem": "east_on_peripheral"}
} }
] ]

View File

@ -75,6 +75,7 @@ public class PocketAPI implements ILuaAPI {
* @return The result of equipping. * @return The result of equipping.
* @cc.treturn boolean If an item was equipped. * @cc.treturn boolean If an item was equipped.
* @cc.treturn string|nil The reason an item was not equipped. * @cc.treturn string|nil The reason an item was not equipped.
* @since 1.116.0
*/ */
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final Object[] equipBottom() { public final Object[] equipBottom() {
@ -125,6 +126,7 @@ public class PocketAPI implements ILuaAPI {
* @return The result of unequipping. * @return The result of unequipping.
* @cc.treturn boolean If the upgrade was unequipped. * @cc.treturn boolean If the upgrade was unequipped.
* @cc.treturn string|nil The reason an upgrade was not unequipped. * @cc.treturn string|nil The reason an upgrade was not unequipped.
* @since 1.116.0
*/ */
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public final Object[] unequipBottom() { public final Object[] unequipBottom() {

View File

@ -22,7 +22,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
class ItemFrameRendererMixin { class ItemFrameRendererMixin {
@Inject( @Inject(
method = "render(Lnet/minecraft/client/renderer/entity/state/ItemFrameRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", method = "render(Lnet/minecraft/client/renderer/entity/state/ItemFrameRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/state/ItemFrameRenderState;mapId:Lnet/minecraft/world/level/saveddata/maps/MapId;", opcode = Opcodes.GETFIELD), at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/state/ItemFrameRenderState;mapId:Lnet/minecraft/world/level/saveddata/maps/MapId;", opcode = Opcodes.GETFIELD, ordinal = 1),
cancellable = true cancellable = true
) )
@SuppressWarnings("unused") @SuppressWarnings("unused")