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:
@@ -18,6 +18,8 @@ import net.cmr.jurassicrevived.util.FenceClimbClientHandler;
|
|||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.entity.NoopRenderer;
|
import net.minecraft.client.renderer.entity.NoopRenderer;
|
||||||
import dev.architectury.event.events.common.LifecycleEvent;
|
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.Item;
|
||||||
import net.minecraft.world.item.SpawnEggItem;
|
import net.minecraft.world.item.SpawnEggItem;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@@ -127,7 +129,11 @@ public class CommonClientClass {
|
|||||||
});
|
});
|
||||||
//?}
|
//?}
|
||||||
|
|
||||||
|
if (Platform.isFabric()) {
|
||||||
registerSpawnEggColors();
|
registerSpawnEggColors();
|
||||||
|
} else {
|
||||||
|
ClientLifecycleEvent.CLIENT_SETUP.register(mc -> registerSpawnEggColors());
|
||||||
|
}
|
||||||
|
|
||||||
LifecycleEvent.SETUP.register(() -> {
|
LifecycleEvent.SETUP.register(() -> {
|
||||||
BlockEntityRendererRegistry.register(ModBlockEntities.TANK_BE.get(), TankBlockEntityRenderer::new);
|
BlockEntityRendererRegistry.register(ModBlockEntities.TANK_BE.get(), TankBlockEntityRenderer::new);
|
||||||
@@ -136,26 +142,19 @@ public class CommonClientClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void registerSpawnEggColors() {
|
private static void registerSpawnEggColors() {
|
||||||
// Iterate through all items in your registry
|
|
||||||
ModItems.ITEMS.forEach(itemSupplier -> {
|
ModItems.ITEMS.forEach(itemSupplier -> {
|
||||||
|
Item item = itemSupplier.get();
|
||||||
|
if (item instanceof SpawnEggItem) {
|
||||||
ColorHandlerRegistry.registerItemColors(
|
ColorHandlerRegistry.registerItemColors(
|
||||||
(stack, tintIndex) -> {
|
(stack, tintIndex) -> ((SpawnEggItem) stack.getItem()).getColor(tintIndex) | 0xFF000000,
|
||||||
if (stack.getItem() instanceof SpawnEggItem egg) {
|
item
|
||||||
return egg.getColor(tintIndex) | 0xFF000000;
|
|
||||||
}
|
|
||||||
return 0xFFFFFFFF;
|
|
||||||
},
|
|
||||||
itemSupplier
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerRenderTypes() {
|
private static void registerRenderTypes() {
|
||||||
// Add all your cross-model blocks here
|
|
||||||
RenderTypeRegistry.register(RenderType.cutout(),
|
RenderTypeRegistry.register(RenderType.cutout(),
|
||||||
ModBlocks.FLUID_PIPE.get(),
|
|
||||||
ModBlocks.POWER_PIPE.get(),
|
|
||||||
ModBlocks.ITEM_PIPE.get(),
|
|
||||||
ModBlocks.ROYAL_FERN.get(),
|
ModBlocks.ROYAL_FERN.get(),
|
||||||
ModBlocks.HORSETAIL_FERN.get(),
|
ModBlocks.HORSETAIL_FERN.get(),
|
||||||
ModBlocks.WESTERN_SWORD_FERN.get(),
|
ModBlocks.WESTERN_SWORD_FERN.get(),
|
||||||
@@ -165,5 +164,10 @@ public class CommonClientClass {
|
|||||||
ModBlocks.POTTED_WESTERN_SWORD_FERN.get(),
|
ModBlocks.POTTED_WESTERN_SWORD_FERN.get(),
|
||||||
ModBlocks.POTTED_ONYCHIOPSIS.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 =
|
public static final DeferredRegister<Block> BLOCKS =
|
||||||
DeferredRegister.create(Constants.MOD_ID, Registries.BLOCK);
|
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",
|
public static final RegistrySupplier<Block> CAT_PLUSHIE = registerBlock("cat_plushie",
|
||||||
() -> new DecoBlock(BlockBehaviour.Properties.of().noOcclusion().sound(SoundType.WOOL)));
|
() -> new DecoBlock(BlockBehaviour.Properties.of().noOcclusion().sound(SoundType.WOOL)));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user