Search in sources :

Example 1 with CustomHoneyBottleItem

use of com.teamresourceful.resourcefulbees.item.CustomHoneyBottleItem in project ResourcefulBees by Resourceful-Bees.

the class RegistryHandler method registerHoneyBottle.

// TODO does this need to use the codec? - epic
private static void registerHoneyBottle(String name, JsonObject honeyData) {
    HoneyBottleData honeyBottleData = HoneyBottleData.CODEC.parse(JsonOps.INSTANCE, honeyData).getOrThrow(false, s -> ResourcefulBees.LOGGER.error("Could not create Custom Honey Data for {} honey", name));
    final RegistryObject<Item> customHoneyBottle = ModItems.ITEMS.register(name + "_honey_bottle", () -> new CustomHoneyBottleItem(honeyBottleData.getProperties(), honeyBottleData));
    honeyBottleData.setHoneyBottleRegistryObject(customHoneyBottle);
    honeyBottleData.setName(name);
    if (Config.HONEY_GENERATE_BLOCKS.get() && honeyBottleData.doGenerateHoneyBlock()) {
        final RegistryObject<Block> customHoneyBlock = ModBlocks.BLOCKS.register(name + "_honey_block", () -> new CustomHoneyBlock(honeyBottleData));
        final RegistryObject<Item> customHoneyBlockItem = ModItems.ITEMS.register(name + "_honey_block", () -> new BlockItem(customHoneyBlock.get(), new Item.Properties().tab(ItemGroupResourcefulBees.RESOURCEFUL_BEES)));
        honeyBottleData.setHoneyBlockRegistryObject(customHoneyBlock);
        honeyBottleData.setHoneyBlockItemRegistryObject(customHoneyBlockItem);
    }
    if (Config.HONEY_GENERATE_FLUIDS.get() && honeyBottleData.doGenerateHoneyFluid()) {
        stillFluids.put(name, ModFluids.FLUIDS.register(name + "_honey", () -> new CustomHoneyFluid.Source(makeProperties(name, honeyBottleData), honeyBottleData)));
        flowingFluids.put(name, ModFluids.FLUIDS.register(name + "_honey_flowing", () -> new CustomHoneyFluid.Flowing(makeProperties(name, honeyBottleData), honeyBottleData)));
        honeyBuckets.put(name, ModItems.ITEMS.register(name + "_honey_fluid_bucket", () -> new CustomHoneyBucketItem(stillFluids.get(name), new Item.Properties().tab(ItemGroupResourcefulBees.RESOURCEFUL_BEES).craftRemainder(Items.BUCKET).stacksTo(1), honeyBottleData)));
        fluidBlocks.put(name, ModBlocks.BLOCKS.register(name + "_honey", () -> new CustomHoneyFluidBlock(stillFluids.get(name), BlockBehaviour.Properties.of(Material.WATER).noCollission().strength(100.0F).noDrops(), honeyBottleData)));
        honeyBottleData.setHoneyStillFluidRegistryObject(stillFluids.get(name));
        honeyBottleData.setHoneyFlowingFluidRegistryObject(flowingFluids.get(name));
        honeyBottleData.setHoneyBucketItemRegistryObject(honeyBuckets.get(name));
        honeyBottleData.setHoneyFluidBlockRegistryObject(fluidBlocks.get(name));
    }
    HoneyRegistry.getRegistry().registerHoney(name, honeyBottleData);
}
Also used : CustomHoneyBucketItem(com.teamresourceful.resourcefulbees.item.CustomHoneyBucketItem) HoneyBottleData(com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData) CustomHoneyFluidBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyFluidBlock) BlockItem(net.minecraft.world.item.BlockItem) Item(net.minecraft.world.item.Item) CustomHoneyBottleItem(com.teamresourceful.resourcefulbees.item.CustomHoneyBottleItem) BlockItem(net.minecraft.world.item.BlockItem) CustomHoneyBucketItem(com.teamresourceful.resourcefulbees.item.CustomHoneyBucketItem) BeeSpawnEggItem(com.teamresourceful.resourcefulbees.item.BeeSpawnEggItem) HoneycombItem(com.teamresourceful.resourcefulbees.item.HoneycombItem) CustomHoneyBottleItem(com.teamresourceful.resourcefulbees.item.CustomHoneyBottleItem) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock) LiquidBlock(net.minecraft.world.level.block.LiquidBlock) CustomHoneyFluidBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyFluidBlock) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock) HoneycombBlock(com.teamresourceful.resourcefulbees.block.HoneycombBlock) DispenserBlock(net.minecraft.world.level.block.DispenserBlock) Block(net.minecraft.world.level.block.Block)

Aggregations

HoneyBottleData (com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData)1 CustomHoneyBlock (com.teamresourceful.resourcefulbees.block.CustomHoneyBlock)1 CustomHoneyFluidBlock (com.teamresourceful.resourcefulbees.block.CustomHoneyFluidBlock)1 HoneycombBlock (com.teamresourceful.resourcefulbees.block.HoneycombBlock)1 BeeSpawnEggItem (com.teamresourceful.resourcefulbees.item.BeeSpawnEggItem)1 CustomHoneyBottleItem (com.teamresourceful.resourcefulbees.item.CustomHoneyBottleItem)1 CustomHoneyBucketItem (com.teamresourceful.resourcefulbees.item.CustomHoneyBucketItem)1 HoneycombItem (com.teamresourceful.resourcefulbees.item.HoneycombItem)1 BlockItem (net.minecraft.world.item.BlockItem)1 Item (net.minecraft.world.item.Item)1 Block (net.minecraft.world.level.block.Block)1 DispenserBlock (net.minecraft.world.level.block.DispenserBlock)1 LiquidBlock (net.minecraft.world.level.block.LiquidBlock)1