NaturesAura/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java

369 lines
22 KiB
Java
Raw Normal View History

2018-10-13 20:35:18 +02:00
package de.ellpeck.naturesaura.reg;
2020-01-23 16:05:52 +01:00
import de.ellpeck.naturesaura.Helper;
2018-10-13 20:35:18 +02:00
import de.ellpeck.naturesaura.NaturesAura;
2024-03-10 15:54:58 +01:00
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
2021-12-04 15:40:09 +01:00
import de.ellpeck.naturesaura.api.misc.ILevelData;
2019-11-04 19:08:49 +01:00
import de.ellpeck.naturesaura.blocks.*;
2021-12-04 15:40:09 +01:00
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
2021-12-19 15:32:45 +01:00
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
2023-07-25 14:04:48 +02:00
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
2020-01-25 19:18:45 +01:00
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
2020-05-20 14:55:59 +02:00
import de.ellpeck.naturesaura.entities.*;
import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom;
import de.ellpeck.naturesaura.gen.ModFeatures;
2020-01-24 17:05:41 +01:00
import de.ellpeck.naturesaura.gui.ContainerEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers;
2019-11-04 19:08:49 +01:00
import de.ellpeck.naturesaura.items.*;
import de.ellpeck.naturesaura.items.tools.*;
2020-01-23 16:05:52 +01:00
import de.ellpeck.naturesaura.potion.ModPotions;
2020-01-21 23:02:39 +01:00
import de.ellpeck.naturesaura.potion.PotionBreathless;
2020-04-29 16:38:50 +02:00
import de.ellpeck.naturesaura.recipes.ModRecipes;
2023-07-25 14:04:48 +02:00
import net.minecraft.core.registries.BuiltInRegistries;
2024-03-10 11:29:12 +01:00
import net.minecraft.core.registries.Registries;
2023-07-25 14:04:48 +02:00
import net.minecraft.network.chat.Component;
2022-06-27 15:24:04 +02:00
import net.minecraft.resources.ResourceLocation;
2021-12-05 23:32:31 +01:00
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
2023-07-25 14:04:48 +02:00
import net.minecraft.world.item.*;
import net.minecraft.world.level.ItemLike;
2021-12-05 23:32:31 +01:00
import net.minecraft.world.level.Level;
2021-12-04 19:17:21 +01:00
import net.minecraft.world.level.block.Block;
2021-12-05 23:32:31 +01:00
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FlowerPotBlock;
2021-12-05 23:32:31 +01:00
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
2024-02-03 14:56:07 +01:00
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
2024-03-10 15:54:58 +01:00
import net.neoforged.neoforge.capabilities.Capabilities.EnergyStorage;
import net.neoforged.neoforge.capabilities.Capabilities.FluidHandler;
import net.neoforged.neoforge.capabilities.Capabilities.ItemHandler;
2024-03-10 11:29:12 +01:00
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
2024-02-03 14:56:07 +01:00
import net.neoforged.neoforge.items.IItemHandler;
2024-03-10 15:54:58 +01:00
import net.neoforged.neoforge.registries.NeoForgeRegistries;
2024-02-03 14:56:07 +01:00
import net.neoforged.neoforge.registries.RegisterEvent;
2024-03-10 15:54:58 +01:00
import vazkii.patchouli.api.PatchouliAPI;
2018-10-13 20:35:18 +02:00
2023-07-25 14:04:48 +02:00
import java.util.ArrayList;
import java.util.List;
2018-10-13 20:35:18 +02:00
2020-01-22 01:32:26 +01:00
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
2018-10-13 20:35:18 +02:00
public final class ModRegistry {
2023-07-25 14:04:48 +02:00
// we use a list so that the creative tab maintains addition order
public static final List<IModItem> ALL_ITEMS = new ArrayList<>();
2018-10-13 20:35:18 +02:00
2019-11-04 19:08:49 +01:00
@SubscribeEvent
2022-06-27 15:24:04 +02:00
public static void register(RegisterEvent event) {
2024-03-10 11:29:12 +01:00
event.register(Registries.BLOCK, h -> {
2022-06-27 15:24:04 +02:00
Block temp;
ModRegistry.registerAll(h,
new BlockAncientLog("ancient_log"),
new BlockAncientLog("ancient_bark"),
2023-07-08 12:32:27 +02:00
temp = new BlockImpl("ancient_planks", Block.Properties.of().sound(SoundType.WOOD).strength(2F)),
2024-03-10 11:29:12 +01:00
new BlockStairsNA("ancient_stairs", "ancient_planks", temp::defaultBlockState, Block.Properties.ofFullCopy(temp)),
new Slab("ancient_slab", "ancient_planks", Block.Properties.ofFullCopy(temp)),
2022-06-27 15:24:04 +02:00
new BlockAncientLeaves(),
new BlockAncientSapling(),
new BlockNatureAltar(),
new BlockDecayedLeaves(),
new BlockGoldenLeaves(),
new BlockGoldPowder(),
new BlockWoodStand(),
2023-07-08 12:32:27 +02:00
temp = new BlockImpl("infused_stone", Block.Properties.of().sound(SoundType.STONE).strength(1.75F)),
2024-03-10 11:29:12 +01:00
new BlockStairsNA("infused_stairs", "infused_stone", temp::defaultBlockState, Block.Properties.ofFullCopy(temp)),
new Slab("infused_slab", "infused_stone", Block.Properties.ofFullCopy(temp)),
2023-07-08 12:32:27 +02:00
temp = new BlockImpl("infused_brick", Block.Properties.of().sound(SoundType.STONE).strength(1.5F)),
2024-03-10 11:29:12 +01:00
new BlockStairsNA("infused_brick_stairs", "infused_brick", temp::defaultBlockState, Block.Properties.ofFullCopy(temp)),
new Slab("infused_brick_slab", "infused_brick", Block.Properties.ofFullCopy(temp)),
2022-06-27 15:24:04 +02:00
new BlockFurnaceHeater(),
new BlockPotionGenerator(),
new BlockAuraDetector(),
2023-07-08 12:32:27 +02:00
new BlockImpl("conversion_catalyst", Block.Properties.of().sound(SoundType.STONE).strength(2.5F)),
new BlockImpl("crushing_catalyst", Block.Properties.of().sound(SoundType.STONE).strength(2.5F)),
2022-06-27 15:24:04 +02:00
new BlockFlowerGenerator(),
new BlockPlacer(),
new BlockHopperUpgrade(),
new BlockFieldCreator(),
new BlockOakGenerator(),
2023-07-08 12:32:27 +02:00
new BlockImpl("infused_iron_block", Block.Properties.of().sound(SoundType.METAL).strength(3F)),
2022-06-27 15:24:04 +02:00
new BlockOfferingTable(),
new BlockPickupStopper(),
new BlockSpawnLamp(),
new BlockAnimalGenerator(),
new BlockEndFlower(),
new BlockGratedChute(),
new BlockAnimalSpawner(),
new BlockAutoCrafter(),
2024-03-10 11:29:12 +01:00
new BlockImpl("gold_brick", Block.Properties.ofFullCopy(Blocks.STONE_BRICKS)),
new BlockImpl("gold_nether_brick", Block.Properties.ofFullCopy(Blocks.NETHER_BRICKS)),
2022-06-27 15:24:04 +02:00
new BlockMossGenerator(),
new BlockTimeChanger(),
new BlockGeneratorLimitRemover(),
new BlockEnderCrate(),
new BlockPowderPlacer(),
new BlockFireworkGenerator(),
new BlockProjectileGenerator(),
new BlockDimensionRail("overworld", Level.OVERWORLD, Level.NETHER, Level.END),
new BlockDimensionRail("nether", Level.NETHER, Level.OVERWORLD),
new BlockDimensionRail("end", Level.END, Level.OVERWORLD),
new BlockBlastFurnaceBooster(),
2024-03-10 11:29:12 +01:00
new BlockImpl("nether_wart_mushroom", Block.Properties.ofFullCopy(Blocks.RED_MUSHROOM_BLOCK)),
2022-06-27 15:24:04 +02:00
new BlockAnimalContainer(),
new BlockSnowCreator(),
new BlockItemDistributor(),
temp = new BlockAuraBloom("aura_bloom", Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.PODZOL, Blocks.COARSE_DIRT, Blocks.FARMLAND),
ModRegistry.createFlowerPot(temp),
temp = new BlockAuraBloom("aura_cactus", Blocks.SAND, Blocks.RED_SAND),
ModRegistry.createFlowerPot(temp),
temp = new BlockAuraBloom("warped_aura_mushroom", Blocks.WARPED_NYLIUM),
ModRegistry.createFlowerPot(temp),
temp = new BlockAuraBloom("crimson_aura_mushroom", Blocks.CRIMSON_NYLIUM),
ModRegistry.createFlowerPot(temp),
temp = new BlockAuraBloom("aura_mushroom", Blocks.MYCELIUM),
ModRegistry.createFlowerPot(temp),
2023-07-08 12:32:27 +02:00
new BlockImpl("tainted_gold_block", Block.Properties.of().sound(SoundType.METAL).strength(3F)),
2022-06-27 15:24:04 +02:00
new BlockNetherGrass(),
new BlockLight(),
new BlockChorusGenerator(),
new BlockAuraTimer(),
new BlockSlimeSplitGenerator(),
new BlockSpring(),
new BlockWeatherChanger(),
new BlockRFConverter(),
2023-02-16 19:03:26 +01:00
new BlockChunkLoader(),
2023-02-17 11:10:06 +01:00
new BlockLowerLimiter(),
2023-07-08 12:32:27 +02:00
new BlockImpl("sky_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(4F)),
new BlockImpl("depth_ingot_block", Block.Properties.of().sound(SoundType.METAL).strength(6F))
2023-02-16 19:03:26 +01:00
);
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModBlocks.class, BuiltInRegistries.BLOCK);
2022-06-27 15:24:04 +02:00
});
2019-11-04 19:08:49 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.ITEM, h -> {
2022-06-27 15:24:04 +02:00
for (var block : ModRegistry.ALL_ITEMS) {
if (block instanceof Block && !(block instanceof INoItemBlock)) {
2023-07-08 12:32:27 +02:00
var item = new BlockItem((Block) block, new Item.Properties());
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, block.getBaseName()), item);
}
2019-11-04 19:08:49 +01:00
}
2022-06-27 15:24:04 +02:00
Item temp;
ModRegistry.registerAll(h,
new ItemPickaxe("infused_iron_pickaxe", ModItemTier.INFUSED, 1, -2.8F),
new ItemAxe("infused_iron_axe", ModItemTier.INFUSED, 6.0F, -3.1F),
new ItemShovel("infused_iron_shovel", ModItemTier.INFUSED, 1.5F, -3.0F),
new ItemHoe("infused_iron_hoe", ModItemTier.INFUSED, -1),
new ItemSword("infused_iron_sword", ModItemTier.INFUSED, 3, -2.4F),
2023-07-08 12:32:27 +02:00
new ItemArmor("infused_iron_helmet", ModArmorMaterial.INFUSED, ArmorItem.Type.HELMET),
new ItemArmor("infused_iron_chest", ModArmorMaterial.INFUSED, ArmorItem.Type.CHESTPLATE),
new ItemArmor("infused_iron_pants", ModArmorMaterial.INFUSED, ArmorItem.Type.LEGGINGS),
new ItemArmor("infused_iron_shoes", ModArmorMaterial.INFUSED, ArmorItem.Type.BOOTS),
2022-06-27 15:24:04 +02:00
new ItemEye("eye"),
new ItemEye("eye_improved"),
new ItemGoldFiber(),
new ItemImpl("gold_leaf"),
new ItemImpl("infused_iron"),
new ItemImpl("ancient_stick"),
new ItemColorChanger(),
new ItemAuraCache("aura_cache", 400000),
new ItemAuraCache("aura_trove", 1200000),
new ItemShockwaveCreator(),
new ItemMultiblockMaker(),
temp = new ItemImpl("bottle_two_the_rebottling"),
new ItemAuraBottle(temp),
new ItemImpl("farming_stencil"),
new ItemImpl("sky_ingot"),
new ItemGlowing("calling_spirit"),
new ItemEffectPowder(),
new ItemBirthSpirit(),
new ItemMoverMinecart(),
new ItemRangeVisualizer(),
new ItemImpl("clock_hand"),
new ItemImpl("token_joy"),
new ItemImpl("token_fear"),
new ItemImpl("token_anger"),
new ItemImpl("token_sorrow"),
new ItemImpl("token_euphoria"),
new ItemImpl("token_terror"),
new ItemImpl("token_rage"),
new ItemImpl("token_grief"),
new ItemEnderAccess(),
new ItemCaveFinder(),
new ItemCrimsonMeal(),
new ItemDeathRing(),
new ItemImpl("tainted_gold"),
new ItemLootFinder(),
new ItemLightStaff(),
new ItemPickaxe("sky_pickaxe", ModItemTier.SKY, 1, -2.8F),
new ItemAxe("sky_axe", ModItemTier.SKY, 5.0F, -3.0F),
new ItemShovel("sky_shovel", ModItemTier.SKY, 1.5F, -3.0F),
new ItemHoe("sky_hoe", ModItemTier.SKY, -1),
new ItemSword("sky_sword", ModItemTier.SKY, 3, -2.4F),
2023-07-08 12:32:27 +02:00
new ItemArmor("sky_helmet", ModArmorMaterial.SKY, ArmorItem.Type.HELMET),
new ItemArmor("sky_chest", ModArmorMaterial.SKY, ArmorItem.Type.CHESTPLATE),
new ItemArmor("sky_pants", ModArmorMaterial.SKY, ArmorItem.Type.LEGGINGS),
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, ArmorItem.Type.BOOTS),
new ItemStructureFinder("fortress_finder", BuiltinStructures.FORTRESS, 0xba2800, 1024),
new ItemStructureFinder("end_city_finder", BuiltinStructures.END_CITY, 0xca5cd6, 1024),
new ItemStructureFinder("outpost_finder", BuiltinStructures.PILLAGER_OUTPOST, 0xab9f98, 2048),
2022-06-27 15:24:04 +02:00
new ItemBreakPrevention(),
new ItemPetReviver(),
2023-02-16 16:24:47 +01:00
new ItemNetheriteFinder(),
2023-02-17 11:10:06 +01:00
new ItemImpl("vacuum_bottle"),
2023-02-17 14:21:39 +01:00
new ItemImpl("depth_ingot"),
new ItemPickaxe("depth_pickaxe", ModItemTier.DEPTH, 1, -2.8F),
new ItemAxe("depth_axe", ModItemTier.DEPTH, 5, -3),
new ItemShovel("depth_shovel", ModItemTier.DEPTH, 1.5F, -3),
new ItemHoe("depth_hoe", ModItemTier.DEPTH, -1),
new ItemSword("depth_sword", ModItemTier.DEPTH, 3, -2.4F),
2023-07-08 12:32:27 +02:00
new ItemArmor("depth_helmet", ModArmorMaterial.DEPTH, ArmorItem.Type.HELMET),
new ItemArmor("depth_chest", ModArmorMaterial.DEPTH, ArmorItem.Type.CHESTPLATE),
new ItemArmor("depth_pants", ModArmorMaterial.DEPTH, ArmorItem.Type.LEGGINGS),
new ItemArmor("depth_shoes", ModArmorMaterial.DEPTH, ArmorItem.Type.BOOTS)
2022-06-27 15:24:04 +02:00
);
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModItems.class, BuiltInRegistries.ITEM);
2022-06-27 15:24:04 +02:00
});
2019-11-04 19:08:49 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.BLOCK_ENTITY_TYPE, h -> {
2022-06-27 15:24:04 +02:00
// add tile entities that support multiple blocks
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ModRegistry.ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
2020-10-19 03:05:13 +02:00
2022-06-27 15:24:04 +02:00
for (var item : ModRegistry.ALL_ITEMS) {
2023-02-15 23:45:50 +01:00
if (item instanceof ModTileType<?> type)
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, type.getBaseName()), type.type);
}
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModBlockEntities.class, BuiltInRegistries.BLOCK_ENTITY_TYPE);
2022-06-27 15:24:04 +02:00
});
2019-11-04 19:08:49 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.MOB_EFFECT, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "breathless"), new PotionBreathless());
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModPotions.class, BuiltInRegistries.MOB_EFFECT);
2022-06-27 15:24:04 +02:00
});
2019-11-04 19:08:49 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.MENU, h -> {
2024-02-03 14:56:07 +01:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "ender_crate"), IMenuTypeExtension.create((windowId, inv, data) -> {
2023-07-08 12:32:27 +02:00
var tile = inv.player.level().getBlockEntity(data.readBlockPos());
2022-06-27 15:24:04 +02:00
if (tile instanceof BlockEntityEnderCrate crate)
return new ContainerEnderCrate(ModContainers.ENDER_CRATE, windowId, inv.player, crate.getItemHandler());
return null;
}));
2024-02-03 14:56:07 +01:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "ender_access"), IMenuTypeExtension.create((windowId, inv, data) -> {
2023-07-08 12:32:27 +02:00
IItemHandler handler = ILevelData.getOverworldData(inv.player.level()).getEnderStorage(data.readUtf());
2022-06-27 15:24:04 +02:00
return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, inv.player, handler);
}));
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModContainers.class, BuiltInRegistries.MENU);
2022-06-27 15:24:04 +02:00
});
2020-01-24 17:05:41 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.ENCHANTMENT, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_mending"), new AuraMendingEnchantment());
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModEnchantments.class, BuiltInRegistries.ENCHANTMENT);
2022-06-27 15:24:04 +02:00
});
2020-01-25 19:18:45 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.ENTITY_TYPE, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "mover_cart"), EntityType.Builder
.of(EntityMoverMinecart::new, MobCategory.MISC)
.sized(1, 1).setShouldReceiveVelocityUpdates(true)
.setTrackingRange(64).setUpdateInterval(3).fireImmune().build(NaturesAura.MOD_ID + ":mover_minecart"));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "effect_inhibitor"), EntityType.Builder
.of(EntityEffectInhibitor::new, MobCategory.MISC)
.sized(1, 1).setShouldReceiveVelocityUpdates(true)
.setTrackingRange(64).setUpdateInterval(20).fireImmune().build(NaturesAura.MOD_ID + ":effect_inhibitor"));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "light_projectile"), EntityType.Builder
.<EntityLightProjectile>of(EntityLightProjectile::new, MobCategory.MISC)
.sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
.setTrackingRange(64).setUpdateInterval(3).fireImmune().build(NaturesAura.MOD_ID + ":light_projectile"));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "structure_finder"), EntityType.Builder
.of(EntityStructureFinder::new, MobCategory.MISC)
.sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
.setTrackingRange(64).setUpdateInterval(2).fireImmune().build(NaturesAura.MOD_ID + ":structure_finder"));
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModEntities.class, BuiltInRegistries.ENTITY_TYPE);
2022-06-27 15:24:04 +02:00
});
2018-11-29 17:58:47 +01:00
2024-03-10 11:29:12 +01:00
event.register(Registries.FEATURE, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_bloom"), new LevelGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_cactus"), new LevelGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "warped_aura_mushroom"), new LevelGenAuraBloom(ModBlocks.WARPED_AURA_MUSHROOM, 10, true));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "crimson_aura_mushroom"), new LevelGenAuraBloom(ModBlocks.CRIMSON_AURA_MUSHROOM, 10, true));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_mushroom"), new LevelGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "ancient_tree"), new LevelGenAncientTree());
h.register(new ResourceLocation(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
2024-03-10 11:29:12 +01:00
Helper.populateObjectHolders(ModFeatures.class, BuiltInRegistries.FEATURE);
2022-06-27 15:24:04 +02:00
});
2024-03-10 11:29:12 +01:00
event.register(Registries.RECIPE_TYPE, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "altar"), ModRecipes.ALTAR_TYPE);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "animal_spawner"), ModRecipes.ANIMAL_SPAWNER_TYPE);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "offering"), ModRecipes.OFFERING_TYPE);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"), ModRecipes.TREE_RITUAL_TYPE);
});
2024-03-10 11:29:12 +01:00
event.register(Registries.RECIPE_SERIALIZER, h -> {
2022-06-27 15:24:04 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "altar"), ModRecipes.ALTAR_SERIALIZER);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "animal_spawner"), ModRecipes.ANIMAL_SPAWNER_SERIALIZER);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "offering"), ModRecipes.OFFERING_SERIALIZER);
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"), ModRecipes.TREE_RITUAL_SERIALIZER);
});
2023-07-25 14:04:48 +02:00
2024-03-10 11:29:12 +01:00
event.register(Registries.CREATIVE_MODE_TAB, h -> {
2023-07-25 14:04:48 +02:00
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tab"), CreativeModeTab.builder()
.title(Component.translatable("item_group." + NaturesAura.MOD_ID + ".tab"))
.icon(() -> new ItemStack(ModItems.GOLD_LEAF))
.displayItems((params, output) -> {
output.accept(PatchouliAPI.get().getBookStack(PatchouliCompat.BOOK));
ModRegistry.ALL_ITEMS.forEach(i -> {
if (i instanceof ICustomCreativeTab c) {
output.acceptAll(c.getCreativeTabItems());
} else if (i instanceof ItemLike l) {
if (l.asItem() != Items.AIR)
output.accept(l);
}
});
})
.build()
);
});
2024-03-10 15:54:58 +01:00
event.register(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, h -> {
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_chunk"), NaturesAuraAPI.AURA_CHUNK_ATTACHMENT);
});
2020-04-29 16:38:50 +02:00
}
2024-03-10 11:29:12 +01:00
@SubscribeEvent
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
2024-03-10 15:54:58 +01:00
event.registerBlockEntity(FluidHandler.BLOCK, ModBlockEntities.SPRING, (e, c) -> e.tank);
event.registerBlockEntity(EnergyStorage.BLOCK, ModBlockEntities.RF_CONVERTER, (e, c) -> e.storage);
event.registerBlockEntity(NaturesAuraAPI.AURA_CONTAINER_BLOCK_CAPABILITY, ModBlockEntities.NATURE_ALTAR, (e, c) -> e.container);
event.registerBlockEntity(NaturesAuraAPI.AURA_CONTAINER_BLOCK_CAPABILITY, ModBlockEntities.ANCIENT_LEAVES, (e, c) -> e.container);
event.registerBlockEntity(NaturesAuraAPI.AURA_CONTAINER_BLOCK_CAPABILITY, ModBlockEntities.END_FLOWER, (e, c) -> e.container);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.BLAST_FURNACE_BOOSTER, (e, c) -> e.getItemHandler());
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.OFFERING_TABLE, (e, c) -> e.items);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.GRATED_CHUTE, (e, c) -> e.items);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.NATURE_ALTAR, (e, c) -> e.items);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.WOOD_STAND, (e, c) -> e.items);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.ENDER_CRATE, (e, c) -> e.canOpen() ? e.wrappedEnderStorage : null);
event.registerBlockEntity(ItemHandler.BLOCK, ModBlockEntities.AURA_TIMER, (e, c) -> e.itemHandler);
2024-03-10 11:29:12 +01:00
}
2020-02-25 15:14:56 +01:00
public static Block createFlowerPot(Block block) {
2023-07-08 12:32:27 +02:00
var props = Block.Properties.of().strength(0F);
Block potted = new BlockFlowerPot(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> block, props);
2024-03-10 11:29:12 +01:00
((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(BuiltInRegistries.BLOCK.getKey(block), () -> potted);
2020-02-25 15:14:56 +01:00
return potted;
2018-10-13 20:35:18 +02:00
}
2022-06-27 15:24:04 +02:00
@SafeVarargs
private static <T> void registerAll(RegisterEvent.RegisterHelper<T> helper, T... items) {
for (var item : items)
helper.register(new ResourceLocation(NaturesAura.MOD_ID, ((IModItem) item).getBaseName()), item);
}
2023-07-25 14:04:48 +02:00
2018-10-13 20:35:18 +02:00
}