datagen continuation: finishes block and item model
This commit is contained in:
@@ -20,6 +20,10 @@ import net.minecraft.client.renderer.entity.NoopRenderer;
|
||||
import dev.architectury.event.events.common.LifecycleEvent;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BushBlock;
|
||||
import net.minecraft.world.level.block.FlowerBlock;
|
||||
import net.minecraft.world.level.block.FlowerPotBlock;
|
||||
|
||||
public class CommonClientClass {
|
||||
public static void init() {
|
||||
@@ -123,35 +127,35 @@ public class CommonClientClass {
|
||||
});
|
||||
//?}
|
||||
|
||||
registerSpawnEggColors();
|
||||
|
||||
LifecycleEvent.SETUP.register(() -> {
|
||||
// Register Block Entity Renderers (SETUP is fine for these)
|
||||
BlockEntityRendererRegistry.register(ModBlockEntities.TANK_BE.get(), TankBlockEntityRenderer::new);
|
||||
registerSpawnEggColors();
|
||||
registerRenderTypes();
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerSpawnEggColors() {
|
||||
ModItems.ITEMS.forEach(itemSupplier -> {
|
||||
Item item = itemSupplier.get();
|
||||
if (item instanceof SpawnEggItem egg) {
|
||||
ColorHandlerRegistry.registerItemColors(
|
||||
(stack, tintIndex) -> {
|
||||
// SpawnEggItem.getColor returns the raw color from the constructor.
|
||||
// We apply the alpha mask to ensure it is never transparent.
|
||||
return egg.getColor(tintIndex) | 0xFF000000;
|
||||
},
|
||||
itemSupplier
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
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(),
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ModBlockStateProvider {
|
||||
helper.simpleBlockWithExistingModel(ModBlocks.WOOD_CRATE.get(), modLoc("block/wood_crate"));
|
||||
helper.simpleBlockWithExistingModel(ModBlocks.IRON_CRATE.get(), modLoc("block/iron_crate"));
|
||||
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.GENERATOR.get());
|
||||
helper.horizontalFacingLitWithItem(ModBlocks.GENERATOR.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.DNA_EXTRACTOR.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.DNA_ANALYZER.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.FOSSIL_GRINDER.get());
|
||||
@@ -113,7 +113,7 @@ public class ModBlockStateProvider {
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.EMBRYO_CALCIFICATION_MACHINE.get());
|
||||
helper.horizontalFacingLitWithItem(ModBlocks.INCUBATOR.get());
|
||||
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.WHITE_GENERATOR.get());
|
||||
helper.horizontalFacingLitWithItem(ModBlocks.WHITE_GENERATOR.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.WHITE_DNA_EXTRACTOR.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.WHITE_DNA_ANALYZER.get());
|
||||
helper.horizontalFacingLitNoBlockstateWithItem(ModBlocks.WHITE_FOSSIL_GRINDER.get());
|
||||
|
||||
Reference in New Issue
Block a user