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;
|
2020-01-24 17:05:41 +01:00
|
|
|
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
2019-11-04 19:08:49 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.*;
|
2020-01-23 16:05:52 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
2020-02-25 15:56:46 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
2020-01-24 17:05:41 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
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.*;
|
2020-01-23 19:20:47 +01:00
|
|
|
import de.ellpeck.naturesaura.entities.render.RenderEffectInhibitor;
|
|
|
|
import de.ellpeck.naturesaura.entities.render.RenderMoverMinecart;
|
2020-04-27 18:30:44 +02:00
|
|
|
import de.ellpeck.naturesaura.entities.render.RenderStub;
|
2020-02-25 15:14:56 +01:00
|
|
|
import de.ellpeck.naturesaura.gen.ModFeatures;
|
|
|
|
import de.ellpeck.naturesaura.gen.WorldGenAncientTree;
|
|
|
|
import de.ellpeck.naturesaura.gen.WorldGenAuraBloom;
|
|
|
|
import de.ellpeck.naturesaura.gen.WorldGenNetherWartMushroom;
|
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;
|
2018-10-13 20:35:18 +02:00
|
|
|
import net.minecraft.block.Block;
|
2020-01-30 16:04:40 +01:00
|
|
|
import net.minecraft.block.Blocks;
|
2020-02-25 15:14:56 +01:00
|
|
|
import net.minecraft.block.FlowerPotBlock;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.block.SoundType;
|
|
|
|
import net.minecraft.block.material.Material;
|
2020-05-20 14:55:59 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2020-05-22 12:26:35 +02:00
|
|
|
import net.minecraft.client.renderer.entity.EntityRenderer;
|
|
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
2020-05-20 14:55:59 +02:00
|
|
|
import net.minecraft.client.renderer.entity.SpriteRenderer;
|
2020-01-25 19:18:45 +01:00
|
|
|
import net.minecraft.enchantment.Enchantment;
|
2020-01-21 23:02:39 +01:00
|
|
|
import net.minecraft.entity.EntityClassification;
|
|
|
|
import net.minecraft.entity.EntityType;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.inventory.EquipmentSlotType;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraft.inventory.container.ContainerType;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.item.BlockItem;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.item.Item;
|
2020-04-29 16:38:50 +02:00
|
|
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.potion.Effect;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.tileentity.TileEntityType;
|
2021-01-29 18:19:04 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2020-12-02 19:53:14 +01:00
|
|
|
import net.minecraft.util.registry.Registry;
|
|
|
|
import net.minecraft.util.registry.WorldGenRegistries;
|
2020-09-22 03:17:02 +02:00
|
|
|
import net.minecraft.world.World;
|
2020-02-25 15:14:56 +01:00
|
|
|
import net.minecraft.world.gen.feature.Feature;
|
2020-09-22 03:17:02 +02:00
|
|
|
import net.minecraft.world.gen.feature.structure.Structure;
|
2021-01-11 23:39:19 +01:00
|
|
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
2020-01-24 17:05:41 +01:00
|
|
|
import net.minecraftforge.common.extensions.IForgeContainerType;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2020-05-22 12:26:35 +02:00
|
|
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
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;
|
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"),
|
2020-10-17 21:13:45 +02:00
|
|
|
temp = new BlockImpl("ancient_planks", Block.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)),
|
|
|
|
new BlockStairsNA("ancient_stairs", "ancient_planks", temp::getDefaultState, Block.Properties.from(temp)),
|
|
|
|
new Slab("ancient_slab", "ancient_planks", Block.Properties.from(temp)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockAncientLeaves(),
|
|
|
|
new BlockAncientSapling(),
|
|
|
|
new BlockNatureAltar(),
|
|
|
|
new BlockDecayedLeaves(),
|
|
|
|
new BlockGoldenLeaves(),
|
|
|
|
new BlockGoldPowder(),
|
|
|
|
new BlockWoodStand(),
|
2020-10-17 21:13:45 +02:00
|
|
|
temp = new BlockImpl("infused_stone", Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.75F)),
|
|
|
|
new BlockStairsNA("infused_stairs", "infused_stone", temp::getDefaultState, Block.Properties.from(temp)),
|
|
|
|
new Slab("infused_slab", "infused_stone", Block.Properties.from(temp)),
|
|
|
|
temp = new BlockImpl("infused_brick", Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.5F)),
|
|
|
|
new BlockStairsNA("infused_brick_stairs", "infused_brick", temp::getDefaultState, Block.Properties.from(temp)),
|
|
|
|
new Slab("infused_brick_slab", "infused_brick", Block.Properties.from(temp)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockFurnaceHeater(),
|
|
|
|
new BlockPotionGenerator(),
|
|
|
|
new BlockAuraDetector(),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockCatalyst("conversion_catalyst", Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2.5F)),
|
|
|
|
new BlockCatalyst("crushing_catalyst", Block.Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2.5F)),
|
2019-11-04 19:08:49 +01:00
|
|
|
new BlockFlowerGenerator(),
|
|
|
|
new BlockPlacer(),
|
|
|
|
new BlockHopperUpgrade(),
|
|
|
|
new BlockFieldCreator(),
|
|
|
|
new BlockOakGenerator(),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockImpl("infused_iron_block", Block.Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(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(),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockImpl("gold_brick", Block.Properties.from(Blocks.STONE_BRICKS)),
|
|
|
|
new BlockImpl("gold_nether_brick", Block.Properties.from(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(),
|
2020-09-22 03:17:02 +02:00
|
|
|
new BlockDimensionRail("overworld", World.field_234918_g_, World.field_234919_h_, World.field_234920_i_),
|
|
|
|
new BlockDimensionRail("nether", World.field_234919_h_, World.field_234918_g_),
|
|
|
|
new BlockDimensionRail("end", World.field_234920_i_, World.field_234918_g_),
|
2020-01-30 16:04:40 +01:00
|
|
|
new BlockBlastFurnaceBooster(),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockImpl("nether_wart_mushroom", Block.Properties.from(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),
|
2020-10-17 21:13:45 +02:00
|
|
|
new BlockImpl("tainted_gold_block", Block.Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(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) {
|
2020-01-22 01:32:26 +01:00
|
|
|
for (IModItem block : ALL_ITEMS) {
|
2020-02-25 15:14:56 +01:00
|
|
|
if (block instanceof Block && !(block instanceof INoItemBlock)) {
|
2020-01-22 01:32:26 +01:00
|
|
|
BlockItem item = new BlockItem((Block) block, new Item.Properties().group(NaturesAura.CREATIVE_TAB));
|
|
|
|
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),
|
|
|
|
new ItemArmor("infused_iron_helmet", ModArmorMaterial.INFUSED, EquipmentSlotType.HEAD),
|
|
|
|
new ItemArmor("infused_iron_chest", ModArmorMaterial.INFUSED, EquipmentSlotType.CHEST),
|
|
|
|
new ItemArmor("infused_iron_pants", ModArmorMaterial.INFUSED, EquipmentSlotType.LEGS),
|
|
|
|
new ItemArmor("infused_iron_shoes", ModArmorMaterial.INFUSED, EquipmentSlotType.FEET),
|
|
|
|
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),
|
|
|
|
new ItemArmor("sky_helmet", ModArmorMaterial.SKY, EquipmentSlotType.HEAD),
|
|
|
|
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlotType.CHEST),
|
|
|
|
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlotType.LEGS),
|
2020-05-20 14:55:59 +02:00
|
|
|
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlotType.FEET),
|
2021-01-14 23:42:53 +01:00
|
|
|
new ItemStructureFinder("fortress_finder", Structure.field_236378_n_, 0xba2800, 1024),
|
|
|
|
new ItemStructureFinder("end_city_finder", Structure.field_236379_o_, 0xca5cd6, 1024),
|
|
|
|
new ItemStructureFinder("outpost_finder", Structure.field_236366_b_, 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
|
|
|
|
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
|
2020-10-19 03:05:13 +02:00
|
|
|
// add tile entities that support multiple blocks
|
|
|
|
add(new ModTileType<>(TileEntityAuraBloom::new, "aura_bloom", ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
|
|
|
|
|
2020-01-21 23:02:39 +01:00
|
|
|
for (IModItem item : ALL_ITEMS) {
|
2020-01-22 01:32:26 +01:00
|
|
|
if (item instanceof ModTileType)
|
|
|
|
event.getRegistry().register(((ModTileType) item).type);
|
2020-01-21 23:02:39 +01:00
|
|
|
}
|
2020-01-23 16:05:52 +01:00
|
|
|
Helper.populateObjectHolders(ModTileEntities.class, event.getRegistry());
|
2019-11-04 19:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerPotions(RegistryEvent.Register<Effect> 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
|
|
|
|
public static void registerContainers(RegistryEvent.Register<ContainerType<?>> event) {
|
|
|
|
event.getRegistry().registerAll(
|
|
|
|
IForgeContainerType.create((windowId, inv, data) -> {
|
|
|
|
TileEntity tile = inv.player.world.getTileEntity(data.readBlockPos());
|
|
|
|
if (tile instanceof TileEntityEnderCrate)
|
2020-10-19 21:26:32 +02:00
|
|
|
return new ContainerEnderCrate(ModContainers.ENDER_CRATE, windowId, inv.player, ((TileEntityEnderCrate) tile).getItemHandler());
|
2020-01-24 17:05:41 +01:00
|
|
|
return null;
|
|
|
|
}).setRegistryName("ender_crate"),
|
|
|
|
IForgeContainerType.create((windowId, inv, data) -> {
|
|
|
|
IItemHandler handler = IWorldData.getOverworldData(inv.player.world).getEnderStorage(data.readString());
|
|
|
|
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-05-22 12:26:35 +02:00
|
|
|
@SuppressWarnings("Convert2Lambda")
|
2020-01-21 23:02:39 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerEntities(RegistryEvent.Register<EntityType<?>> event) {
|
|
|
|
event.getRegistry().registerAll(
|
|
|
|
EntityType.Builder.create(EntityMoverMinecart::new, EntityClassification.MISC)
|
2020-01-23 19:20:47 +01:00
|
|
|
.size(1, 1).setShouldReceiveVelocityUpdates(true)
|
2020-01-21 23:02:39 +01:00
|
|
|
.setTrackingRange(64).setUpdateInterval(3).immuneToFire().build(NaturesAura.MOD_ID + ":mover_minecart")
|
|
|
|
.setRegistryName("mover_cart"),
|
|
|
|
EntityType.Builder.create(EntityEffectInhibitor::new, EntityClassification.MISC)
|
2020-01-23 19:20:47 +01:00
|
|
|
.size(1, 1).setShouldReceiveVelocityUpdates(true)
|
2020-01-21 23:02:39 +01:00
|
|
|
.setTrackingRange(64).setUpdateInterval(20).immuneToFire().build(NaturesAura.MOD_ID + ":effect_inhibitor")
|
2020-04-27 18:30:44 +02:00
|
|
|
.setRegistryName("effect_inhibitor"),
|
|
|
|
EntityType.Builder.<EntityLightProjectile>create(EntityLightProjectile::new, EntityClassification.MISC)
|
|
|
|
.size(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
|
|
|
|
.setTrackingRange(64).setUpdateInterval(3).immuneToFire().build(NaturesAura.MOD_ID + ":light_projectile")
|
2020-05-20 14:55:59 +02:00
|
|
|
.setRegistryName("light_projectile"),
|
|
|
|
EntityType.Builder.create(EntityStructureFinder::new, EntityClassification.MISC)
|
|
|
|
.size(0.5F, 0.5F).setShouldReceiveVelocityUpdates(true)
|
|
|
|
.setTrackingRange(64).setUpdateInterval(2).immuneToFire().build(NaturesAura.MOD_ID + ":structure_finder")
|
|
|
|
.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());
|
2020-01-23 19:20:47 +01:00
|
|
|
|
2020-01-28 18:08:56 +01:00
|
|
|
NaturesAura.proxy.registerEntityRenderer(ModEntities.MOVER_CART, () -> RenderMoverMinecart::new);
|
|
|
|
NaturesAura.proxy.registerEntityRenderer(ModEntities.EFFECT_INHIBITOR, () -> RenderEffectInhibitor::new);
|
2020-04-27 18:30:44 +02:00
|
|
|
NaturesAura.proxy.registerEntityRenderer(ModEntities.LIGHT_PROJECTILE, () -> RenderStub::new);
|
2020-05-22 12:26:35 +02:00
|
|
|
// for some reason, only this one causes classloading issues if shortened to a lambda, what
|
|
|
|
NaturesAura.proxy.registerEntityRenderer(ModEntities.STRUCTURE_FINDER, () -> new IRenderFactory<EntityStructureFinder>() {
|
|
|
|
@Override
|
|
|
|
public EntityRenderer<? super EntityStructureFinder> createRenderFor(EntityRendererManager m) {
|
|
|
|
return new SpriteRenderer<>(m, Minecraft.getInstance().getItemRenderer());
|
|
|
|
}
|
|
|
|
});
|
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(
|
2020-10-19 03:05:13 +02:00
|
|
|
new WorldGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false).setRegistryName("aura_bloom"),
|
|
|
|
new WorldGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false).setRegistryName("aura_cactus"),
|
|
|
|
new WorldGenAuraBloom(ModBlocks.WARPED_AURA_MUSHROOM, 10, true).setRegistryName("warped_aura_mushroom"),
|
|
|
|
new WorldGenAuraBloom(ModBlocks.CRIMSON_AURA_MUSHROOM, 10, true).setRegistryName("crimson_aura_mushroom"),
|
|
|
|
new WorldGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false).setRegistryName("aura_mushroom"),
|
2020-02-25 15:14:56 +01:00
|
|
|
new WorldGenAncientTree().setRegistryName("ancient_tree"),
|
|
|
|
new WorldGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
|
|
|
);
|
|
|
|
Helper.populateObjectHolders(ModFeatures.class, event.getRegistry());
|
|
|
|
}
|
|
|
|
|
2020-04-29 16:38:50 +02:00
|
|
|
@SubscribeEvent
|
|
|
|
public static void registerRecipes(RegistryEvent.Register<IRecipeSerializer<?>> event) {
|
|
|
|
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() {
|
2018-10-13 20:35:18 +02:00
|
|
|
for (IModItem item : ALL_ITEMS) {
|
2020-01-23 16:05:52 +01:00
|
|
|
if (item instanceof IColorProvidingBlock)
|
2018-10-13 20:35:18 +02:00
|
|
|
NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item);
|
2020-01-23 16:05:52 +01:00
|
|
|
if (item instanceof IColorProvidingItem)
|
2018-10-13 20:35:18 +02:00
|
|
|
NaturesAura.proxy.addColorProvidingItem((IColorProvidingItem) item);
|
2020-01-23 16:05:52 +01:00
|
|
|
if (item instanceof ITESRProvider)
|
2018-11-21 20:36:55 +01:00
|
|
|
NaturesAura.proxy.registerTESR((ITESRProvider) item);
|
2018-10-13 20:35:18 +02:00
|
|
|
}
|
2020-12-02 19:53:14 +01:00
|
|
|
|
2021-01-29 18:19:04 +01:00
|
|
|
// register features again for some reason
|
|
|
|
Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(NaturesAura.MOD_ID, "aura_bloom"), ModFeatures.Configured.AURA_BLOOM);
|
|
|
|
Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(NaturesAura.MOD_ID, "aura_cactus"), ModFeatures.Configured.AURA_CACTUS);
|
|
|
|
Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(NaturesAura.MOD_ID, "crimson_aura_mushroom"), ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
|
|
|
|
Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(NaturesAura.MOD_ID, "warped_aura_mushroom"), ModFeatures.Configured.WARPED_AURA_MUSHROOM);
|
|
|
|
Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(NaturesAura.MOD_ID, "aura_mushroom"), ModFeatures.Configured.AURA_MUSHROOM);
|
2020-02-25 15:14:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Block createFlowerPot(Block block) {
|
|
|
|
Block.Properties props = Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0F);
|
|
|
|
Block potted = new BlockFlowerPot(() -> (FlowerPotBlock) Blocks.FLOWER_POT, block::getBlock, props);
|
|
|
|
((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(block.getRegistryName(), () -> potted);
|
|
|
|
return potted;
|
2018-10-13 20:35:18 +02:00
|
|
|
}
|
|
|
|
}
|