Porting 1.18 to 1.19 - GrowthcraftCE/Growthcraft-1.19 GitHub Wiki
Remove onItemsRegistry(...)
Change ColorHandlerEvent.Item
to RegisterColorHandlersEvent.Item
Change ColorHandlerEvent.Item
to RegisterColorHandlersEvent.Item
Replace all Fluid registrations with the following:
public static final FluidRegistryContainer APPLE_CIDER_FLUID = new FluidRegistryContainer(
FluidUtils.getFluidNames(Reference.UnlocalizedName.APPLE_CIDER).get(FluidUtils.STILL),
FluidType.Properties.create().canSwim(true).canDrown(true).canPushEntity(true).supportsBoating(true),
() -> FluidRegistryContainer.createExtension(
new FluidRegistryContainer.ClientExtensions(
Reference.MODID,
FluidUtils.getFluidNames(Reference.UnlocalizedName.APPLE_CIDER).get(FluidUtils.STILL)
).tint(APPLE_CIDER_FLUID_COLOR.toIntValue())
.fogColor(
APPLE_CIDER_FLUID_COLOR.getColor().getRed(),
APPLE_CIDER_FLUID_COLOR.getColor().getGreen(),
APPLE_CIDER_FLUID_COLOR.getColor().getBlue()
)
),
BlockBehaviour.Properties.copy(Blocks.WATER),
new Item.Properties().tab(CREATIVE_TAB).stacksTo(1)
);
Remove all Fluid classes.
Replace excludeBlockItemRegistry
with
private static RegistryObject<Block> registerBlock(String name, Supplier<Block> block) {
return registerBlock(name, block, false);
}
private static RegistryObject<Block> registerBlock(String name, Supplier<Block> block, boolean excludeBlockItemRegistry) {
RegistryObject<Block> registryObject = BLOCKS.register(name, block);
if (!excludeBlockItemRegistry) {
registerBlockItem(name, registryObject);
}
return registryObject;
}
private static void registerBlockItem(String name, RegistryObject<Block> blockRegistryObject) {
GrowthcraftApiaryItems.ITEMS.register(
name,
() -> new BlockItem(blockRegistryObject.get(), getDefaultItemProperties())
);
}
private static Item.Properties getDefaultItemProperties() {
Item.Properties properties = new Item.Properties();
properties.tab(CREATIVE_TAB);
return properties;
}
@Deprecated
private static boolean excludeBlockItemRegistry(ResourceLocation registryName) {
ArrayList<String> excludeBlocks = new ArrayList<>();
//excludeBlocks.add(Reference.MODID + ":" + Reference.UnlocalizedName.APPLE_TREE_FRUIT);
return excludeBlocks.contains(registryName.toString());
}