diff --git a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java index ca7f86112..539523975 100644 --- a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java +++ b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java @@ -40,11 +40,16 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback; import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; @@ -101,7 +106,7 @@ public final class ComputerCraftProxyClient implements ClientModInitializer .ordinal(), () -> Registry.ModItems.POCKET_COMPUTER_NORMAL, () -> Registry.ModItems.POCKET_COMPUTER_ADVANCED ); - registerItemProperty( "state", + registerItemProperty( "coloured", ( stack, world, player, integer ) -> IColouredItem.getColourBasic( stack ) != -1 ? 1 : 0, () -> Registry.ModItems.POCKET_COMPUTER_NORMAL, () -> Registry.ModItems.POCKET_COMPUTER_ADVANCED ); @@ -132,9 +137,25 @@ public final class ComputerCraftProxyClient implements ClientModInitializer private static void registerItemProperty( String name, ClampedItemPropertyFunction getter, Supplier... items ) { ResourceLocation id = new ResourceLocation( ComputerCraft.MOD_ID, name ); + // Terrible hack, but some of our properties return values greater than 1, so we don't want to clamp. + var unclampedGetter = new ClampedItemPropertyFunction() + { + @Override + @Deprecated + public float call( @NotNull ItemStack itemStack, @Nullable ClientLevel clientLevel, @Nullable LivingEntity livingEntity, int i ) + { + return getter.unclampedCall( itemStack, clientLevel, livingEntity, i ); + } + + @Override + public float unclampedCall( ItemStack itemStack, @Nullable ClientLevel clientLevel, @Nullable LivingEntity livingEntity, int i ) + { + return getter.unclampedCall( itemStack, clientLevel, livingEntity, i ); + } + }; for( Supplier item : items ) { - FabricModelPredicateProviderRegistry.register( item.get(), id, getter ); + FabricModelPredicateProviderRegistry.register( item.get(), id, unclampedGetter ); } } } diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png index 96015e297..c84346a2c 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_advanced.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png index 2474f6baf..53d89614e 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_blink.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png index 426015e6c..dd3c350eb 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_colour.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png index 1f27b7ea9..ae5a70a12 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_frame.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png index 52f186fc7..8414ee5ee 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_light.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png index 0ee14134b..33b09b696 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_normal.png differ diff --git a/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png b/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png index c0d3956bb..bb3de3e94 100644 Binary files a/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png and b/src/main/resources/assets/computercraft/textures/item/pocket_computer_on.png differ