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;
|
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;
|
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.*;
|
2021-12-04 15:40:09 +01:00
|
|
|
import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
|
|
|
|
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
|
|
|
|
import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom;
|
2021-12-04 19:17:21 +01:00
|
|
|
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;
|
2021-01-11 23:39:19 +01:00
|
|
|
import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
2020-04-29 16:38:50 +02:00
|
|
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.core.Registry;
|
|
|
|
import net.minecraft.data.BuiltinRegistries;
|
2022-03-04 15:59:04 +01:00
|
|
|
import net.minecraft.data.worldgen.StructureFeatures;
|
|
|
|
import net.minecraft.data.worldgen.features.FeatureUtils;
|
|
|
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraft.world.effect.MobEffect;
|
2021-12-05 23:32:31 +01:00
|
|
|
import net.minecraft.world.entity.EntityType;
|
|
|
|
import net.minecraft.world.entity.EquipmentSlot;
|
|
|
|
import net.minecraft.world.entity.MobCategory;
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraft.world.inventory.MenuType;
|
|
|
|
import net.minecraft.world.item.BlockItem;
|
|
|
|
import net.minecraft.world.item.Item;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraft.world.item.enchantment.Enchantment;
|
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;
|
2021-12-15 14:26:42 +01:00
|
|
|
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.block.entity.BlockEntityType;
|
2021-12-19 16:51:20 +01:00
|
|
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
2021-12-05 23:32:31 +01:00
|
|
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
2022-03-04 15:59:04 +01:00
|
|
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
|
|
|
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
2021-12-19 16:51:20 +01:00
|
|
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
2021-12-05 23:32:31 +01:00
|
|
|
import net.minecraft.world.level.material.Material;
|
2021-01-11 23:39:19 +01:00
|
|
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
2021-12-04 19:17:21 +01:00
|
|
|
import net.minecraftforge.common.extensions.IForgeMenuType;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
|
|
import net.minecraftforge.fml.common.Mod;
|
2021-12-19 16:51:20 +01:00
|
|
|
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraftforge.items.IItemHandler;
|
2018-10-13 20:35:18 +02:00
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
2021-12-19 16:51:20 +01:00
|
|
|
import java.util.function.Supplier;
|
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 {
|
|
|
|
|
2020-01-23 16:05:52 +01:00
|
|
|
public static final Set<IModItem> ALL_ITEMS = new HashSet<>();
|
2018-10-13 20:35:18 +02:00
|
|
|
|
2018-11-29 17:58:47 +01:00
|
|
|
public static void add(IModItem item) {
|
2018-10-13 20:35:18 +02:00
|
|
|
ALL_ITEMS.add(item);
|
2020-01-22 01:32:26 +01:00
|
|
|
item.getRegistryEntry().setRegistryName(item.getBaseName());
|
2018-10-13 20:35:18 +02:00
|
|
|
}
|
|
|
|
|
2019-11-04 19:08:49 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
2020-02-25 15:14:56 +01:00
|
|
|
Block temp;
|
2019-11-04 19:08:49 +01:00
|
|
|
event.getRegistry().registerAll(
|
|
|
|
new BlockAncientLog("ancient_log"),
|
|
|
|
new BlockAncientLog("ancient_bark"),
|
2021-12-15 14:26:42 +01:00
|
|
|
temp = new BlockImpl("ancient_planks", Block.Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F)),
|
|
|
|
new BlockStairsNA("ancient_stairs", "ancient_planks", temp::defaultBlockState, Block.Properties.copy(temp)),
|
2021-12-05 23:32:31 +01:00
|
|
|
new Slab("ancient_slab", "ancient_planks", Block.Properties.copy(temp)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockAncientLeaves(),
|
|
|
|
new BlockAncientSapling(),
|
|
|
|
new BlockNatureAltar(),
|
|
|
|
new BlockDecayedLeaves(),
|
|
|
|
new BlockGoldenLeaves(),
|
|
|
|
new BlockGoldPowder(),
|
|
|
|
new BlockWoodStand(),
|
2021-12-15 14:26:42 +01:00
|
|
|
temp = new BlockImpl("infused_stone", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(1.75F)),
|
|
|
|
new BlockStairsNA("infused_stairs", "infused_stone", temp::defaultBlockState, Block.Properties.copy(temp)),
|
|
|
|
new Slab("infused_slab", "infused_stone", Block.Properties.copy(temp)),
|
|
|
|
temp = new BlockImpl("infused_brick", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(1.5F)),
|
|
|
|
new BlockStairsNA("infused_brick_stairs", "infused_brick", temp::defaultBlockState, Block.Properties.copy(temp)),
|
|
|
|
new Slab("infused_brick_slab", "infused_brick", Block.Properties.copy(temp)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockFurnaceHeater(),
|
|
|
|
new BlockPotionGenerator(),
|
|
|
|
new BlockAuraDetector(),
|
2021-12-15 14:26:42 +01:00
|
|
|
new BlockCatalyst("conversion_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)),
|
|
|
|
new BlockCatalyst("crushing_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockFlowerGenerator(),
|
|
|
|
new BlockPlacer(),
|
|
|
|
new BlockHopperUpgrade(),
|
|
|
|
new BlockFieldCreator(),
|
|
|
|
new BlockOakGenerator(),
|
2021-12-15 14:26:42 +01:00
|
|
|
new BlockImpl("infused_iron_block", Block.Properties.of(Material.METAL).sound(SoundType.METAL).strength(3F)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockOfferingTable(),
|
|
|
|
new BlockPickupStopper(),
|
|
|
|
new BlockSpawnLamp(),
|
|
|
|
new BlockAnimalGenerator(),
|
|
|
|
new BlockEndFlower(),
|
|
|
|
new BlockGratedChute(),
|
|
|
|
new BlockAnimalSpawner(),
|
|
|
|
new BlockAutoCrafter(),
|
2021-12-05 23:32:31 +01:00
|
|
|
new BlockImpl("gold_brick", Block.Properties.copy(Blocks.STONE_BRICKS)),
|
|
|
|
new BlockImpl("gold_nether_brick", Block.Properties.copy(Blocks.NETHER_BRICKS)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockMossGenerator(),
|
|
|
|
new BlockTimeChanger(),
|
|
|
|
new BlockGeneratorLimitRemover(),
|
|
|
|
new BlockEnderCrate(),
|
|
|
|
new BlockPowderPlacer(),
|
|
|
|
new BlockFireworkGenerator(),
|
|
|
|
new BlockProjectileGenerator(),
|
2021-12-05 23:32:31 +01:00
|
|
|
new BlockDimensionRail("overworld", Level.OVERWORLD, Level.NETHER, Level.END),
|
|
|
|
new BlockDimensionRail("nether", Level.NETHER, Level.OVERWORLD),
|
|
|
|
new BlockDimensionRail("end", Level.END, Level.OVERWORLD),
|
2020-01-30 16:04:40 +01:00
|
|
|
new BlockBlastFurnaceBooster(),
|
2021-12-05 23:32:31 +01:00
|
|
|
new BlockImpl("nether_wart_mushroom", Block.Properties.copy(Blocks.RED_MUSHROOM_BLOCK)),
|
2020-02-02 22:21:55 +01:00
|
|
|
new BlockAnimalContainer(),
|
2020-02-21 18:15:37 +01:00
|
|
|
new BlockSnowCreator(),
|
2020-02-25 15:14:56 +01:00
|
|
|
new BlockItemDistributor(),
|
2020-10-19 03:05:13 +02:00
|
|
|
temp = new BlockAuraBloom("aura_bloom", Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.PODZOL, Blocks.COARSE_DIRT, Blocks.FARMLAND),
|
2020-02-25 15:56:46 +01:00
|
|
|
createFlowerPot(temp),
|
2020-10-19 03:05:13 +02:00
|
|
|
temp = new BlockAuraBloom("aura_cactus", Blocks.SAND, Blocks.RED_SAND),
|
|
|
|
createFlowerPot(temp),
|
|
|
|
temp = new BlockAuraBloom("warped_aura_mushroom", Blocks.WARPED_NYLIUM),
|
|
|
|
createFlowerPot(temp),
|
|
|
|
temp = new BlockAuraBloom("crimson_aura_mushroom", Blocks.CRIMSON_NYLIUM),
|
|
|
|
createFlowerPot(temp),
|
|
|
|
temp = new BlockAuraBloom("aura_mushroom", Blocks.MYCELIUM),
|
2020-02-26 12:03:36 +01:00
|
|
|
createFlowerPot(temp),
|
2021-12-05 23:32:31 +01:00
|
|
|
new BlockImpl("tainted_gold_block", Block.Properties.of(Material.METAL).sound(SoundType.METAL).strength(3F)),
|
2020-04-27 18:30:44 +02:00
|
|
|
new BlockNetherGrass(),
|
2020-05-04 23:39:57 +02:00
|
|
|
new BlockLight(),
|
2020-05-05 19:43:27 +02:00
|
|
|
new BlockChorusGenerator(),
|
2020-09-28 16:45:37 +02:00
|
|
|
new BlockAuraTimer(),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockSlimeSplitGenerator(),
|
2020-10-24 15:58:38 +02:00
|
|
|
new BlockSpring(),
|
2021-01-11 23:39:19 +01:00
|
|
|
new BlockWeatherChanger(),
|
|
|
|
new BlockRFConverter(),
|
|
|
|
new BlockChunkLoader()
|
2020-02-26 19:32:42 +01:00
|
|
|
);
|
2020-01-23 16:05:52 +01:00
|
|
|
Helper.populateObjectHolders(ModBlocks.class, event.getRegistry());
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerItems(RegistryEvent.Register<Item> event) {
|
2021-12-15 14:26:42 +01:00
|
|
|
for (var block : ALL_ITEMS) {
|
2020-02-25 15:14:56 +01:00
|
|
|
if (block instanceof Block && !(block instanceof INoItemBlock)) {
|
2021-12-15 14:26:42 +01:00
|
|
|
var item = new BlockItem((Block) block, new Item.Properties().tab(NaturesAura.CREATIVE_TAB));
|
2020-01-22 01:32:26 +01:00
|
|
|
item.setRegistryName(block.getBaseName());
|
|
|
|
event.getRegistry().register(item);
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
Item temp;
|
2019-11-04 19:08:49 +01:00
|
|
|
event.getRegistry().registerAll(
|
2020-01-26 01:41:49 +01:00
|
|
|
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),
|
2020-09-22 03:17:02 +02:00
|
|
|
new ItemHoe("infused_iron_hoe", ModItemTier.INFUSED, -1),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemSword("infused_iron_sword", ModItemTier.INFUSED, 3, -2.4F),
|
2021-12-05 23:32:31 +01:00
|
|
|
new ItemArmor("infused_iron_helmet", ModArmorMaterial.INFUSED, EquipmentSlot.HEAD),
|
|
|
|
new ItemArmor("infused_iron_chest", ModArmorMaterial.INFUSED, EquipmentSlot.CHEST),
|
|
|
|
new ItemArmor("infused_iron_pants", ModArmorMaterial.INFUSED, EquipmentSlot.LEGS),
|
|
|
|
new ItemArmor("infused_iron_shoes", ModArmorMaterial.INFUSED, EquipmentSlot.FEET),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemEye("eye"),
|
|
|
|
new ItemEye("eye_improved"),
|
|
|
|
new ItemGoldFiber(),
|
2019-11-04 19:08:49 +01:00
|
|
|
new ItemImpl("gold_leaf"),
|
|
|
|
new ItemImpl("infused_iron"),
|
|
|
|
new ItemImpl("ancient_stick"),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemColorChanger(),
|
|
|
|
new ItemAuraCache("aura_cache", 400000),
|
|
|
|
new ItemAuraCache("aura_trove", 1200000),
|
|
|
|
new ItemShockwaveCreator(),
|
|
|
|
new ItemMultiblockMaker(),
|
2020-01-22 01:32:26 +01:00
|
|
|
temp = new ItemImpl("bottle_two_the_rebottling"),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemAuraBottle(temp),
|
2019-11-04 19:08:49 +01:00
|
|
|
new ItemImpl("farming_stencil"),
|
|
|
|
new ItemImpl("sky_ingot"),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemGlowing("calling_spirit"),
|
|
|
|
new ItemEffectPowder(),
|
|
|
|
new ItemBirthSpirit(),
|
|
|
|
new ItemMoverMinecart(),
|
|
|
|
new ItemRangeVisualizer(),
|
2019-11-04 19:08:49 +01:00
|
|
|
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"),
|
2020-01-26 01:41:49 +01:00
|
|
|
new ItemEnderAccess(),
|
2020-01-30 16:04:40 +01:00
|
|
|
new ItemCaveFinder(),
|
2020-02-07 23:50:16 +01:00
|
|
|
new ItemCrimsonMeal(),
|
2020-02-26 12:03:36 +01:00
|
|
|
new ItemDeathRing(),
|
2020-02-28 15:36:12 +01:00
|
|
|
new ItemImpl("tainted_gold"),
|
2020-04-27 18:30:44 +02:00
|
|
|
new ItemLootFinder(),
|
2020-05-13 15:52:46 +02:00
|
|
|
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),
|
2020-09-22 03:17:02 +02:00
|
|
|
new ItemHoe("sky_hoe", ModItemTier.SKY, -1),
|
2020-05-13 15:52:46 +02:00
|
|
|
new ItemSword("sky_sword", ModItemTier.SKY, 3, -2.4F),
|
2021-12-05 23:32:31 +01:00
|
|
|
new ItemArmor("sky_helmet", ModArmorMaterial.SKY, EquipmentSlot.HEAD),
|
|
|
|
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlot.CHEST),
|
|
|
|
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlot.LEGS),
|
|
|
|
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlot.FEET),
|
2022-03-04 15:59:04 +01:00
|
|
|
new ItemStructureFinder("fortress_finder", StructureFeatures.FORTRESS, 0xba2800, 1024),
|
|
|
|
new ItemStructureFinder("end_city_finder", StructureFeatures.END_CITY, 0xca5cd6, 1024),
|
|
|
|
new ItemStructureFinder("outpost_finder", StructureFeatures.PILLAGER_OUTPOST, 0xab9f98, 2048),
|
2020-09-30 03:03:29 +02:00
|
|
|
new ItemBreakPrevention(),
|
2020-10-13 23:30:47 +02:00
|
|
|
new ItemPetReviver(),
|
|
|
|
new ItemNetheriteFinder()
|
2019-11-04 19:08:49 +01:00
|
|
|
);
|
2020-01-23 16:05:52 +01:00
|
|
|
Helper.populateObjectHolders(ModItems.class, event.getRegistry());
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
2021-12-04 15:40:09 +01:00
|
|
|
public static void registerTiles(RegistryEvent.Register<BlockEntityType<?>> event) {
|
2020-10-19 03:05:13 +02:00
|
|
|
// add tile entities that support multiple blocks
|
2021-12-04 15:40:09 +01:00
|
|
|
add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
|
2020-10-19 03:05:13 +02:00
|
|
|
|
2021-12-15 14:26:42 +01:00
|
|
|
for (var item : ALL_ITEMS) {
|
2021-12-05 23:32:31 +01:00
|
|
|
if (item instanceof ModTileType type)
|
|
|
|
event.getRegistry().register(type.type);
|
2020-01-21 23:02:39 +01:00
|
|
|
}
|
2021-12-19 15:32:45 +01:00
|
|
|
Helper.populateObjectHolders(ModBlockEntities.class, event.getRegistry());
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
2021-12-04 19:17:21 +01:00
|
|
|
public static void registerPotions(RegistryEvent.Register<MobEffect> event) {
|
2020-01-21 23:02:39 +01:00
|
|
|
event.getRegistry().registerAll(
|
|
|
|
new PotionBreathless()
|
|
|
|
);
|
2020-01-23 16:05:52 +01:00
|
|
|
Helper.populateObjectHolders(ModPotions.class, event.getRegistry());
|
2020-01-21 23:02:39 +01:00
|
|
|
}
|
2019-11-04 19:08:49 +01:00
|
|
|
|
2020-01-24 17:05:41 +01:00
|
|
|
@SubscribeEvent
|
2021-12-04 19:17:21 +01:00
|
|
|
public static void registerContainers(RegistryEvent.Register<MenuType<?>> event) {
|
2020-01-24 17:05:41 +01:00
|
|
|
event.getRegistry().registerAll(
|
2021-12-04 19:17:21 +01:00
|
|
|
IForgeMenuType.create((windowId, inv, data) -> {
|
2021-12-15 14:26:42 +01:00
|
|
|
var tile = inv.player.level.getBlockEntity(data.readBlockPos());
|
2021-12-04 19:17:21 +01:00
|
|
|
if (tile instanceof BlockEntityEnderCrate crate)
|
|
|
|
return new ContainerEnderCrate(ModContainers.ENDER_CRATE, windowId, inv.player, crate.getItemHandler());
|
2020-01-24 17:05:41 +01:00
|
|
|
return null;
|
|
|
|
}).setRegistryName("ender_crate"),
|
2021-12-04 19:17:21 +01:00
|
|
|
IForgeMenuType.create((windowId, inv, data) -> {
|
|
|
|
IItemHandler handler = ILevelData.getOverworldData(inv.player.level).getEnderStorage(data.readUtf());
|
2020-01-24 17:05:41 +01:00
|
|
|
return new ContainerEnderCrate(ModContainers.ENDER_ACCESS, windowId, inv.player, handler);
|
|
|
|
}).setRegistryName("ender_access")
|
|
|
|
);
|
|
|
|
Helper.populateObjectHolders(ModContainers.class, event.getRegistry());
|
|
|
|
}
|
|
|
|
|
2020-01-25 19:18:45 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerEnchantments(RegistryEvent.Register<Enchantment> event) {
|
|
|
|
event.getRegistry().registerAll(
|
|
|
|
new AuraMendingEnchantment()
|
|
|
|
);
|
|
|
|
Helper.populateObjectHolders(ModEnchantments.class, event.getRegistry());
|
|
|
|
}
|
|
|
|
|
2020-01-21 23:02:39 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerEntities(RegistryEvent.Register<EntityType<?>> event) {
|
|
|
|
event.getRegistry().registerAll(
|
2021-12-05 23:32:31 +01:00
|
|
|
EntityType.Builder.of(EntityMoverMinecart::new, MobCategory.MISC)
|
|
|
|
.sized(1, 1).setShouldReceiveVelocityUpdates(true)
|
|
|
|
.setTrackingRange(64).setUpdateInterval(3).fireImmune().build(NaturesAura.MOD_ID + ":mover_minecart")
|
2020-01-21 23:02:39 +01:00
|
|
|
.setRegistryName("mover_cart"),
|
2021-12-05 23:32:31 +01:00
|
|
|
EntityType.Builder.of(EntityEffectInhibitor::new, MobCategory.MISC)
|
|
|
|
.sized(1, 1).setShouldReceiveVelocityUpdates(true)
|
|
|
|
.setTrackingRange(64).setUpdateInterval(20).fireImmune().build(NaturesAura.MOD_ID + ":effect_inhibitor")
|
2020-04-27 18:30:44 +02:00
|
|
|
.setRegistryName("effect_inhibitor"),
|
2021-12-05 23:32:31 +01:00
|
|
|
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")
|
2020-05-20 14:55:59 +02:00
|
|
|
.setRegistryName("light_projectile"),
|
2021-12-05 23:32:31 +01:00
|
|
|
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")
|
2020-05-20 14:55:59 +02:00
|
|
|
.setRegistryName("structure_finder")
|
2020-01-21 23:02:39 +01:00
|
|
|
);
|
2020-01-23 16:05:52 +01:00
|
|
|
Helper.populateObjectHolders(ModEntities.class, event.getRegistry());
|
2018-11-29 17:58:47 +01:00
|
|
|
}
|
|
|
|
|
2020-02-25 15:14:56 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerFeatures(RegistryEvent.Register<Feature<?>> event) {
|
|
|
|
event.getRegistry().registerAll(
|
2021-12-04 15:40:09 +01:00
|
|
|
new LevelGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false).setRegistryName("aura_bloom"),
|
|
|
|
new LevelGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false).setRegistryName("aura_cactus"),
|
|
|
|
new LevelGenAuraBloom(ModBlocks.WARPED_AURA_MUSHROOM, 10, true).setRegistryName("warped_aura_mushroom"),
|
|
|
|
new LevelGenAuraBloom(ModBlocks.CRIMSON_AURA_MUSHROOM, 10, true).setRegistryName("crimson_aura_mushroom"),
|
|
|
|
new LevelGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false).setRegistryName("aura_mushroom"),
|
|
|
|
new LevelGenAncientTree().setRegistryName("ancient_tree"),
|
|
|
|
new LevelGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
2020-02-25 15:14:56 +01:00
|
|
|
);
|
|
|
|
Helper.populateObjectHolders(ModFeatures.class, event.getRegistry());
|
|
|
|
}
|
|
|
|
|
2020-04-29 16:38:50 +02:00
|
|
|
@SubscribeEvent
|
2021-12-15 14:26:42 +01:00
|
|
|
public static void registerRecipes(RegistryEvent.Register<RecipeSerializer<?>> event) {
|
2020-04-29 16:38:50 +02:00
|
|
|
ModRecipes.register(event.getRegistry());
|
2021-01-11 23:39:19 +01:00
|
|
|
CraftingHelper.register(new EnabledCondition.Serializer());
|
2020-04-29 16:38:50 +02:00
|
|
|
}
|
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
public static void init() {
|
2022-03-04 15:59:04 +01:00
|
|
|
ModFeatures.Configured.AURA_BLOOM = FeatureUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.AURA_BLOOM, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
ModFeatures.Configured.AURA_CACTUS = FeatureUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.AURA_CACTUS, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
ModFeatures.Configured.WARPED_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.WARPED_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.CRIMSON_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
ModFeatures.Configured.AURA_MUSHROOM = FeatureUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
ModFeatures.Configured.ANCIENT_TREE = FeatureUtils.register(ModFeatures.ANCIENT_TREE.getRegistryName().toString(), ModFeatures.ANCIENT_TREE, new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
|
|
|
|
ModFeatures.Configured.NETHER_WART_MUSHROOM = FeatureUtils.register(ModFeatures.NETHER_WART_MUSHROOM.getRegistryName().toString(), ModFeatures.NETHER_WART_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
|
|
|
|
|
|
|
ModFeatures.Placed.AURA_BLOOM = PlacementUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.Configured.AURA_BLOOM);
|
|
|
|
ModFeatures.Placed.AURA_CACTUS = PlacementUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.Configured.AURA_CACTUS);
|
|
|
|
ModFeatures.Placed.WARPED_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.WARPED_AURA_MUSHROOM);
|
|
|
|
ModFeatures.Placed.CRIMSON_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
|
|
|
|
ModFeatures.Placed.AURA_MUSHROOM = PlacementUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.AURA_MUSHROOM);
|
2020-02-25 15:14:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Block createFlowerPot(Block block) {
|
2021-12-15 14:26:42 +01:00
|
|
|
var props = Block.Properties.of(Material.DECORATION).strength(0F);
|
|
|
|
Block potted = new BlockFlowerPot(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> block, props);
|
2020-02-25 15:14:56 +01:00
|
|
|
((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(block.getRegistryName(), () -> potted);
|
|
|
|
return potted;
|
2018-10-13 20:35:18 +02:00
|
|
|
}
|
|
|
|
}
|