fixes spawneggitem colors for all 4 targets, and removes unused test block registry entry, starts fixing render types for pipes and other blocks

This commit is contained in:
2026-01-16 22:16:51 -05:00
parent 5af5faf7e7
commit 38b89d0d0a
2 changed files with 20 additions and 20 deletions
@@ -18,6 +18,8 @@ import net.cmr.jurassicrevived.util.FenceClimbClientHandler;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.NoopRenderer;
import dev.architectury.event.events.common.LifecycleEvent;
import dev.architectury.event.events.client.ClientLifecycleEvent;
import dev.architectury.platform.Platform;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.level.block.Block;
@@ -127,7 +129,11 @@ public class CommonClientClass {
});
//?}
registerSpawnEggColors();
if (Platform.isFabric()) {
registerSpawnEggColors();
} else {
ClientLifecycleEvent.CLIENT_SETUP.register(mc -> registerSpawnEggColors());
}
LifecycleEvent.SETUP.register(() -> {
BlockEntityRendererRegistry.register(ModBlockEntities.TANK_BE.get(), TankBlockEntityRenderer::new);
@@ -136,26 +142,19 @@ public class CommonClientClass {
}
private static void registerSpawnEggColors() {
// Iterate through all items in your registry
ModItems.ITEMS.forEach(itemSupplier -> {
ColorHandlerRegistry.registerItemColors(
(stack, tintIndex) -> {
if (stack.getItem() instanceof SpawnEggItem egg) {
return egg.getColor(tintIndex) | 0xFF000000;
}
return 0xFFFFFFFF;
},
itemSupplier
);
Item item = itemSupplier.get();
if (item instanceof SpawnEggItem) {
ColorHandlerRegistry.registerItemColors(
(stack, tintIndex) -> ((SpawnEggItem) stack.getItem()).getColor(tintIndex) | 0xFF000000,
item
);
}
});
}
private static void registerRenderTypes() {
// Add all your cross-model blocks here
RenderTypeRegistry.register(RenderType.cutout(),
ModBlocks.FLUID_PIPE.get(),
ModBlocks.POWER_PIPE.get(),
ModBlocks.ITEM_PIPE.get(),
ModBlocks.ROYAL_FERN.get(),
ModBlocks.HORSETAIL_FERN.get(),
ModBlocks.WESTERN_SWORD_FERN.get(),
@@ -165,5 +164,10 @@ public class CommonClientClass {
ModBlocks.POTTED_WESTERN_SWORD_FERN.get(),
ModBlocks.POTTED_ONYCHIOPSIS.get()
);
RenderTypeRegistry.register(RenderType.translucent(),
ModBlocks.FLUID_PIPE.get(),
ModBlocks.POWER_PIPE.get(),
ModBlocks.ITEM_PIPE.get()
);
}
}
@@ -22,10 +22,6 @@ public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS =
DeferredRegister.create(Constants.MOD_ID, Registries.BLOCK);
// --- Examples ---
public static final RegistrySupplier<Block> FOSSIL_ORE = registerBlock("fossil_ore",
() -> new Block(BlockBehaviour.Properties.of().strength(3.0f)));
public static final RegistrySupplier<Block> CAT_PLUSHIE = registerBlock("cat_plushie",
() -> new DecoBlock(BlockBehaviour.Properties.of().noOcclusion().sound(SoundType.WOOL)));