diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index 9469d5c1..7402bffd 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -37,11 +37,16 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.IForgeRegistryEntry; import org.lwjgl.opengl.GL11; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; import java.util.List; +import java.util.Locale; import java.util.function.Consumer; import java.util.function.Function; @@ -314,4 +319,19 @@ public final class Helper { public static AxisAlignedBB aabb(Vec3d pos) { return new AxisAlignedBB(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z); } + + // This is how @ObjectHolder _SHOULD_ work... + public static > void populateObjectHolders(Class clazz, IForgeRegistry registry) { + for (Field entry : clazz.getFields()) { + if (!Modifier.isStatic(entry.getModifiers())) + continue; + String location = entry.getName().toLowerCase(Locale.ROOT); + T value = registry.getValue(new ResourceLocation(NaturesAura.MOD_ID, location)); + try { + entry.set(null, value); + } catch (IllegalAccessException e) { + NaturesAura.LOGGER.error(e); + } + } + } } diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index c29b1d72..c640fbbf 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -7,8 +7,10 @@ import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects; import de.ellpeck.naturesaura.compat.Compat; +import de.ellpeck.naturesaura.entities.ModEntities; import de.ellpeck.naturesaura.events.CommonEvents; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.packet.PacketHandler; @@ -28,16 +30,14 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.Locale; - @Mod(NaturesAura.MOD_ID) public final class NaturesAura { public static final String MOD_ID = NaturesAuraAPI.MOD_ID; - public static final String MOD_ID_UPPER = MOD_ID.toUpperCase(Locale.ROOT); public static final String MOD_NAME = "Nature's Aura"; public static final String VERSION = "@VERSION@"; @@ -49,7 +49,6 @@ public final class NaturesAura { instance = this; IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); - eventBus.addListener(this::setup); } @@ -67,6 +66,12 @@ public final class NaturesAura { } public void setup(FMLCommonSetupEvent event) { + Helper.populateObjectHolders(ModBlocks.class, ForgeRegistries.BLOCKS); + Helper.populateObjectHolders(ModTileEntities.class, ForgeRegistries.TILE_ENTITIES); + Helper.populateObjectHolders(ModEntities.class, ForgeRegistries.ENTITIES); + Helper.populateObjectHolders(ModItems.class, ForgeRegistries.ITEMS); + Helper.populateObjectHolders(ModPotions.class, ForgeRegistries.POTIONS); + this.preInit(event); this.init(event); this.postInit(event); @@ -95,7 +100,7 @@ public final class NaturesAura { public void init(FMLCommonSetupEvent event) { ModConfig.initOrReload(false); ModRecipes.init(); - ModRegistry.init(event); + ModRegistry.init(); DrainSpotEffects.init(); proxy.init(event); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java index ab91f64f..425ef5f0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java @@ -27,7 +27,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable { public BlockAnimalGenerator() { - super("animal_generator", ModTileEntities.ANIMAL_GENERATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); + super("animal_generator", () -> new TileEntityAnimalGenerator(), ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalSpawner.java index e2441a65..baa83ab9 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalSpawner.java @@ -1,11 +1,11 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalSpawner; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class BlockAnimalSpawner extends BlockContainerImpl { public BlockAnimalSpawner() { - super("animal_spawner", ModTileEntities.ANIMAL_SPAWNER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); + super("animal_spawner", TileEntityAnimalSpawner::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java index d412af9f..338f837c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; public class BlockAuraDetector extends BlockContainerImpl { public BlockAuraDetector() { - super("aura_detector", ModTileEntities.AURA_DETECTOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); + super("aura_detector", TileEntityAuraDetector::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java index 7c385524..309c5a4b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; @@ -14,7 +15,7 @@ public class BlockAutoCrafter extends BlockContainerImpl { public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public BlockAutoCrafter() { - super("auto_crafter", ModTileEntities.AUTO_CRAFTER, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD)); + super("auto_crafter", TileEntityAutoCrafter::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java index d3292a89..272fca81 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java @@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.render.IVisualizable; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; @@ -25,7 +24,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12); public BlockChunkLoader() { - super("chunk_loader", ModTileEntities.CHUNK_LOADER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); + super("chunk_loader", TileEntityChunkLoader::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); } /* TODO Chunk Loading diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index bfdda1e2..a0eb4ab4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -4,37 +4,39 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; +import de.ellpeck.naturesaura.reg.ModTileType; import net.minecraft.block.*; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.Random; +import java.util.function.Supplier; public class BlockContainerImpl extends ContainerBlock implements IModItem, IModelProvider { private final String baseName; - public final TileEntityType tileType; + private final ModTileType tileType; - public BlockContainerImpl(String baseName, TileEntityType tileClass, Block.Properties properties) { + public BlockContainerImpl(String baseName, Supplier tileSupplier, Block.Properties properties) { super(properties); this.baseName = baseName; - this.tileType = tileClass; + this.tileType = new ModTileType<>(tileSupplier, this); ModRegistry.add(this); + ModRegistry.add(this.tileType); } @Nullable @Override public TileEntity createNewTileEntity(IBlockReader worldIn) { - return this.tileType.create(); + return this.tileType.type.create(); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java index 29242f12..e8472a3c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java @@ -1,10 +1,10 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEndFlower; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; +import de.ellpeck.naturesaura.reg.ModTileType; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.BushBlock; @@ -33,9 +33,8 @@ public class BlockEndFlower extends BushBlock implements IModItem, IModelProvide public BlockEndFlower() { super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.5F).sound(SoundType.PLANT)); MinecraftForge.EVENT_BUS.register(this); - ModRegistry.add(this); - + ModRegistry.add(new ModTileType<>(TileEntityEndFlower::new, this)); } @SubscribeEvent @@ -79,7 +78,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, IModelProvide @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityEndFlower(ModTileEntities.END_FLOWER); + return new TileEntityEndFlower(); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java index a19ac345..d2e97661 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java @@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.misc.IWorldData; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate; import de.ellpeck.naturesaura.items.ModItems; @@ -47,7 +46,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider private static final ThreadLocal> CACHED_WORLD = new ThreadLocal<>(); public BlockEnderCrate() { - super("ender_crate", ModTileEntities.ENDER_CRATE, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).lightValue(7).sound(SoundType.STONE)); + super("ender_crate", TileEntityEnderCrate::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).lightValue(7).sound(SoundType.STONE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java index 0c17360c..13726585 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java @@ -24,7 +24,7 @@ import java.util.Random; public class BlockFieldCreator extends BlockContainerImpl { public BlockFieldCreator() { - super("field_creator", ModTileEntities.FIELD_CREATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); + super("field_creator", TileEntityFieldCreator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java index af65b67e..7c5b4f37 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -12,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable { public BlockFireworkGenerator() { - super("firework_generator", ModTileEntities.FIREWORK_GENERATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); + super("firework_generator", TileEntityFireworkGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java index 3e8e12e3..d0ae3345 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java @@ -1,7 +1,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.render.IVisualizable; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityFlowerGenerator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable { public BlockFlowerGenerator() { - super("flower_generator", ModTileEntities.FLOWER_GENERATOR, ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)); + super("flower_generator", TileEntityFlowerGenerator::new, ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java index 921684ff..d2c263e6 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java @@ -1,7 +1,6 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFurnaceHeater; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -37,7 +36,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl { }; public BlockFurnaceHeater() { - super("furnace_heater", ModTileEntities.FURNACE_HEATER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).harvestLevel(1).harvestTool(ToolType.PICKAXE)); + super("furnace_heater", TileEntityFurnaceHeater::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).harvestLevel(1).harvestTool(ToolType.PICKAXE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java index c65126b3..6a6a3fb1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java @@ -1,13 +1,13 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class BlockGeneratorLimitRemover extends BlockContainerImpl /*implements ITESRProvider*/ { public BlockGeneratorLimitRemover() { - super("generator_limit_remover", ModTileEntities.GENERATOR_LIMIT_REMOVER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); + super("generator_limit_remover", TileEntityGeneratorLimitRemover::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); } /*@Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java index a005593b..e8eb784c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute; import net.minecraft.block.*; import net.minecraft.block.material.Material; @@ -41,7 +40,7 @@ public class BlockGratedChute extends BlockContainerImpl { private static final VoxelShape BASE_BOTTOM = makeCuboidShape(4, 4, 4, 12, 9, 12); public BlockGratedChute() { - super("grated_chute", ModTileEntities.GRATED_CHUTE, ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL)); + super("grated_chute", TileEntityGratedChute::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java index f974fab5..c6ee185e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java @@ -1,7 +1,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.render.IVisualizable; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityHopperUpgrade; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable { public BlockHopperUpgrade() { - super("hopper_upgrade", ModTileEntities.HOPPER_UPGRADE, ModBlocks.prop(Material.IRON).hardnessAndResistance(2.5F).sound(SoundType.METAL)); + super("hopper_upgrade", TileEntityHopperUpgrade::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(2.5F).sound(SoundType.METAL)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java index e5b8c33d..7ae77686 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; @@ -13,7 +12,6 @@ public class BlockImpl extends Block implements IModItem, IModelProvider { public BlockImpl(String baseName, Block.Properties properties) { super(properties); this.baseName = baseName; - this.setRegistryName(NaturesAura.createRes(this.getBaseName())); ModRegistry.add(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java index c483e7b6..1ae4068a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java @@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable { public BlockMossGenerator() { - super("moss_generator", ModTileEntities.MOSS_GENERATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); + super("moss_generator", TileEntityMossGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java index ed847205..09492076 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java @@ -22,7 +22,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide // TODO bounds public BlockNatureAltar() { - super("nature_altar", ModTileEntities.NATURE_ALTAR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE)); + super("nature_altar", TileEntityNatureAltar::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java index bca8cc7b..722ebf73 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java @@ -24,7 +24,7 @@ import java.util.Random; public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable { public BlockOakGenerator() { - super("oak_generator", ModTileEntities.OAK_GENERATOR, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); + super("oak_generator", TileEntityOakGenerator::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java index c70967e1..c4ffe7fa 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java @@ -25,7 +25,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F); public BlockOfferingTable() { - super("offering_table", ModTileEntities.OFFERING_TABLE, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); + super("offering_table", TileEntityOfferingTable::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java index 12de720e..3042cb8e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java @@ -2,9 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.render.IVisualizable; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPickupStopper; -import de.ellpeck.naturesaura.packet.PacketHandler; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.item.ItemEntity; @@ -21,7 +19,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable { public BlockPickupStopper() { - super("pickup_stopper", ModTileEntities.PICKUP_STOPPER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); + super("pickup_stopper", TileEntityPickupStopper::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java index 327febe0..b5ffcb80 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityPlacer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -13,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class BlockPlacer extends BlockContainerImpl implements IVisualizable { public BlockPlacer() { - super("placer", ModTileEntities.PLACER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); + super("placer", TileEntityPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java index 247e89ba..3cc9a589 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java @@ -1,11 +1,12 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class BlockPotionGenerator extends BlockContainerImpl { public BlockPotionGenerator() { - super("potion_generator", ModTileEntities.POTION_GENERATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).harvestTool(ToolType.PICKAXE).harvestLevel(1)); + super("potion_generator", TileEntityPotionGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).harvestTool(ToolType.PICKAXE).harvestLevel(1)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java index 88d55a0b..b8dbd8ee 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -10,7 +11,7 @@ public class BlockPowderPlacer extends BlockContainerImpl { private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 4 / 16F, 1F); public BlockPowderPlacer() { - super("powder_placer", ModTileEntities.POWDER_PLACER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2, 5F).sound(SoundType.STONE)); + super("powder_placer", TileEntityPowderPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2, 5F).sound(SoundType.STONE)); } /* @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java index a3a5c274..f893e8b3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java @@ -20,7 +20,7 @@ import net.minecraftforge.registries.ForgeRegistries; public class BlockProjectileGenerator extends BlockContainerImpl/* implements ITESRProvider*/ { public BlockProjectileGenerator() { - super("projectile_generator", ModTileEntities.PROJECTILE_GENERATOR, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); + super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockRFConverter.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockRFConverter.java index 3cf5b4ca..dc96afd1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockRFConverter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockRFConverter.java @@ -1,12 +1,13 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class BlockRFConverter extends BlockContainerImpl { public BlockRFConverter() { - super("rf_converter", ModTileEntities.RF_CONVERTER, Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(3)); + super("rf_converter", TileEntityRFConverter::new, Properties.create(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(3)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java index 155fce50..a3c00ed4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java @@ -28,7 +28,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable private static final AxisAlignedBB AABB = new AxisAlignedBB(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F); public BlockSpawnLamp() { - super("spawn_lamp", ModTileEntities.SPAWN_LAMP, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(15).sound(SoundType.METAL)); + super("spawn_lamp", TileEntitySpawnLamp::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(15).sound(SoundType.METAL)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockTimeChanger.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockTimeChanger.java index b5dded6a..fa809ed2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockTimeChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockTimeChanger.java @@ -1,11 +1,12 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityTimeChanger; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class BlockTimeChanger extends BlockContainerImpl { public BlockTimeChanger() { - super("time_changer", ModTileEntities.TIME_CHANGER, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); + super("time_changer", TileEntityTimeChanger::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java index aa231923..c8c1c13e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java @@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand; import de.ellpeck.naturesaura.reg.ITESRProvider; @@ -40,7 +39,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F); public BlockWoodStand() { - super("wood_stand", ModTileEntities.WOOD_STAND, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD).harvestLevel(0).harvestTool(ToolType.AXE)); + super("wood_stand", TileEntityWoodStand::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD).harvestLevel(0).harvestTool(ToolType.AXE)); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index 8bcf2d32..e68a720c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -1,14 +1,10 @@ package de.ellpeck.naturesaura.blocks; -import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.block.Block; -import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; -import net.minecraftforge.registries.ObjectHolder; @SuppressWarnings("FieldNamingConvention") -@ObjectHolder(NaturesAura.MOD_ID) public final class ModBlocks { public static Block ANCIENT_LOG; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/Slab.java b/src/main/java/de/ellpeck/naturesaura/blocks/Slab.java index f9fa391b..79159f0d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/Slab.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/Slab.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.SlabBlock; public class Slab extends SlabBlock implements IModItem, IModelProvider { @@ -11,6 +12,7 @@ public class Slab extends SlabBlock implements IModItem, IModelProvider { public Slab(String baseName, Properties properties) { super(properties); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/ModTileEntities.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/ModTileEntities.java index b9063c15..66957e4a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/ModTileEntities.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/ModTileEntities.java @@ -5,7 +5,6 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.registries.ObjectHolder; @SuppressWarnings("FieldNamingConvention") -@ObjectHolder(NaturesAura.MOD_ID) public final class ModTileEntities { public static TileEntityType ANCIENT_LEAVES; public static TileEntityType ANIMAL_GENERATOR; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java index 95bc5251..5f088999 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java @@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; public class TileEntityAncientLeaves extends TileEntityImpl { @@ -25,8 +24,8 @@ public class TileEntityAncientLeaves extends TileEntityImpl { } }; - public TileEntityAncientLeaves(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityAncientLeaves() { + super(ModTileEntities.ANCIENT_LEAVES); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java index fc9760df..df615393 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java @@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.BlockPos; public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickableTileEntity { @@ -10,8 +9,8 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab private int timeRemaining; private int amountToRelease; - public TileEntityAnimalGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityAnimalGenerator() { + super(ModTileEntities.ANIMAL_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java index 26f286e9..c5cb16c4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java @@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -30,8 +29,8 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable private int time; private Entity entityClient; - public TileEntityAnimalSpawner(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityAnimalSpawner() { + super(ModTileEntities.ANIMAL_SPAWNER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java index 9b3bee12..c9cdf656 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAuraDetector.java @@ -2,15 +2,14 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; public class TileEntityAuraDetector extends TileEntityImpl implements ITickableTileEntity { public int redstonePower; - public TileEntityAuraDetector(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityAuraDetector() { + super(ModTileEntities.AURA_DETECTOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java index 2bc725ee..77f49c4f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java @@ -10,7 +10,6 @@ import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.EntityPredicates; import net.minecraft.util.NonNullList; @@ -27,8 +26,8 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi } }, 3, 3); - public TileEntityAutoCrafter(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityAutoCrafter() { + super(ModTileEntities.AUTO_CRAFTER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java index 4519bcbb..645c4fcc 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java @@ -2,14 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; // TODO chunk loader public class TileEntityChunkLoader extends TileEntityImpl implements ITickableTileEntity { - public TileEntityChunkLoader(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityChunkLoader() { + super(ModTileEntities.CHUNK_LOADER); } //private Ticket ticket; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java index 9ebebb9c..89f52a0e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java @@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.EntityPredicates; import net.minecraft.util.math.AxisAlignedBB; @@ -46,8 +45,8 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile public boolean isDrainMode; - public TileEntityEndFlower(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityEndFlower() { + super(ModTileEntities.END_FLOWER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java index bf93b5c5..d1077c4b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java @@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.blocks.BlockEnderCrate; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.IItemHandlerModifiable; @@ -67,8 +66,8 @@ public class TileEntityEnderCrate extends TileEntityImpl { }; public String name; - public TileEntityEnderCrate(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityEnderCrate() { + super(ModTileEntities.ENDER_CRATE); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java index f217e3b5..9fe47e28 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java @@ -11,7 +11,6 @@ import net.minecraft.item.ShearsItem; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -35,8 +34,8 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT public boolean isCharged; private int chargeTimer; - public TileEntityFieldCreator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityFieldCreator() { + super(ModTileEntities.FIELD_CREATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java index 9699a2dd..bd851e90 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java @@ -9,7 +9,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EntityPredicates; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -27,8 +26,8 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick private int toRelease; private int releaseTimer; - public TileEntityFireworkGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityFireworkGenerator() { + super(ModTileEntities.FIREWORK_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java index 17de10ec..5fd7a5fd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java @@ -25,8 +25,8 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab private final Map consumedRecently = new HashMap<>(); - public TileEntityFlowerGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityFlowerGenerator() { + super(ModTileEntities.FLOWER_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java index 639b31ea..13daa0db 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java @@ -15,8 +15,8 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable public boolean isActive; - public TileEntityFurnaceHeater(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityFurnaceHeater() { + super(ModTileEntities.FURNACE_HEATER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java index 2a277965..7030e3b1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java @@ -7,8 +7,8 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class TileEntityGeneratorLimitRemover extends TileEntityImpl { - public TileEntityGeneratorLimitRemover(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityGeneratorLimitRemover() { + super(ModTileEntities.GENERATOR_LIMIT_REMOVER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java index 96657f85..a28e19d7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java @@ -34,8 +34,8 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickableTi public boolean isBlacklist; private int cooldown; - public TileEntityGratedChute(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityGratedChute() { + super(ModTileEntities.GRATED_CHUTE); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java index ad98d667..ba0aea5d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java @@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.HopperTileEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -17,8 +16,8 @@ import net.minecraftforge.items.IItemHandler; import java.util.List; public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickableTileEntity { - public TileEntityHopperUpgrade(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityHopperUpgrade() { + super(ModTileEntities.HOPPER_UPGRADE); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java index f58e1926..02bd102e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java @@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -13,8 +12,8 @@ import java.util.List; public class TileEntityMossGenerator extends TileEntityImpl implements ITickableTileEntity { - public TileEntityMossGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityMossGenerator() { + super(ModTileEntities.MOSS_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java index 69abedda..74e69a0c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java @@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; @@ -61,8 +60,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi private int lastAura; - public TileEntityNatureAltar(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityNatureAltar() { + super(ModTileEntities.NATURE_ALTAR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java index 8ed7553c..60f38a2f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java @@ -13,8 +13,8 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT public Queue scheduledBigTrees = new ArrayDeque<>(); - public TileEntityOakGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityOakGenerator() { + super(ModTileEntities.OAK_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java index e500f22b..48545174 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java @@ -29,8 +29,8 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable }; private final Queue itemsToSpawn = new ArrayDeque<>(); - public TileEntityOfferingTable(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityOfferingTable() { + super(ModTileEntities.OFFERING_TABLE); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPickupStopper.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPickupStopper.java index 35114b48..249c9db6 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPickupStopper.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPickupStopper.java @@ -4,8 +4,8 @@ import net.minecraft.tileentity.TileEntityType; public class TileEntityPickupStopper extends TileEntityImpl { - public TileEntityPickupStopper(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityPickupStopper() { + super(ModTileEntities.PICKUP_STOPPER); } public float getRadius() { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java index 47e20758..6aa8b126 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java @@ -2,22 +2,17 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; -import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.item.ItemFrameEntity; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.items.CapabilityItemHandler; @@ -28,8 +23,8 @@ import java.util.List; public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEntity { - public TileEntityPlacer(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityPlacer() { + super(ModTileEntities.PLACER); } @Override @@ -140,7 +135,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEnt return false; this.world.setBlockState(pos, plant); } else*/ - return false; + return false; /*stack.shrink(1); return true;*/ diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java index 8980aa70..4f88d872 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java @@ -7,7 +7,6 @@ import net.minecraft.potion.Effect; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Potion; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; @@ -16,8 +15,8 @@ import java.util.List; public class TileEntityPotionGenerator extends TileEntityImpl implements ITickableTileEntity { - public TileEntityPotionGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityPotionGenerator() { + super(ModTileEntities.POTION_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java index 95809008..24b19877 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java @@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.EntityPredicates; import net.minecraft.util.math.AxisAlignedBB; @@ -15,8 +14,8 @@ import java.util.List; public class TileEntityPowderPlacer extends TileEntityImpl { - public TileEntityPowderPlacer(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityPowderPlacer() { + super(ModTileEntities.POWDER_PLACER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java index 0ff06dbf..e302916b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java @@ -1,15 +1,14 @@ package de.ellpeck.naturesaura.blocks.tiles; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; public class TileEntityProjectileGenerator extends TileEntityImpl { public Direction nextSide = Direction.NORTH; - public TileEntityProjectileGenerator(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityProjectileGenerator() { + super(ModTileEntities.PROJECTILE_GENERATOR); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java index d65d9c4c..915d23d5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java @@ -23,8 +23,8 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickableTi public final RFStorage storage = new RFStorage(); private int lastEnergy; - public TileEntityRFConverter(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityRFConverter() { + super(ModTileEntities.RF_CONVERTER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpawnLamp.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpawnLamp.java index 82de41ef..600b219b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpawnLamp.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntitySpawnLamp.java @@ -1,11 +1,9 @@ package de.ellpeck.naturesaura.blocks.tiles; -import net.minecraft.tileentity.TileEntityType; - public class TileEntitySpawnLamp extends TileEntityImpl { - public TileEntitySpawnLamp(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntitySpawnLamp() { + super(ModTileEntities.SPAWN_LAMP); } public int getRadius() { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java index 47a8666f..430b0ca3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java @@ -13,7 +13,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.play.server.SUpdateTimePacket; import net.minecraft.server.management.PlayerList; import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EntityPredicates; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -27,8 +26,8 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickableTi private long goalTime; - public TileEntityTimeChanger(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityTimeChanger() { + super(ModTileEntities.TIME_CHANGER); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index f742753b..b5684a24 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -13,7 +13,6 @@ import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; @@ -39,8 +38,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile private BlockPos ritualPos; private int timer; - public TileEntityWoodStand(TileEntityType tileEntityTypeIn) { - super(tileEntityTypeIn); + public TileEntityWoodStand() { + super(ModTileEntities.WOOD_STAND); } public void setRitual(BlockPos pos, TreeRitualRecipe recipe) { diff --git a/src/main/java/de/ellpeck/naturesaura/entities/ModEntities.java b/src/main/java/de/ellpeck/naturesaura/entities/ModEntities.java index a47196ce..a3b87eae 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/ModEntities.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/ModEntities.java @@ -5,7 +5,6 @@ import net.minecraft.entity.EntityType; import net.minecraftforge.registries.ObjectHolder; @SuppressWarnings("FieldNamingConvention") -@ObjectHolder(NaturesAura.MOD_ID) public final class ModEntities { public static EntityType MOVER_MINECART; public static EntityType EFFECT_INHIBITOR; diff --git a/src/main/java/de/ellpeck/naturesaura/items/AuraBottle.java b/src/main/java/de/ellpeck/naturesaura/items/AuraBottle.java index 009f7193..8ce3b7ba 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/AuraBottle.java +++ b/src/main/java/de/ellpeck/naturesaura/items/AuraBottle.java @@ -5,56 +5,53 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.reg.IColorProvidingItem; -import net.minecraft.block.DispenserBlock; import net.minecraft.block.BlockState; +import net.minecraft.block.DispenserBlock; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.item.ItemGroup; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.SoundEvents; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundCategory; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceContext; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense; public class AuraBottle extends ItemImpl implements IColorProvidingItem { - public AuraBottle() { + public AuraBottle(Item emptyBottle) { super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB)); MinecraftForge.EVENT_BUS.register(this); - DispenserBlock.registerDispenseBehavior(ModItems.BOTTLE_TWO, (source, stack) -> { - World world = source.getWorld(); - BlockState state = source.getBlockState(); - Direction facing = state.get(DispenserBlock.FACING); - BlockPos offset = source.getBlockPos().offset(facing); - BlockState offsetState = world.getBlockState(offset); + DispenserBlock.registerDispenseBehavior(emptyBottle, (source, stack) -> { + World world = source.getWorld(); + BlockState state = source.getBlockState(); + Direction facing = state.get(DispenserBlock.FACING); + BlockPos offset = source.getBlockPos().offset(facing); + BlockState offsetState = world.getBlockState(offset); - ItemStack dispense = stack.split(1); - if (offsetState.getBlock().isAir(offsetState, world, offset)) { - if (IAuraChunk.getAuraInArea(world, offset, 30) >= 100000) { - dispense = setType(new ItemStack(AuraBottle.this), IAuraType.forWorld(world)); + ItemStack dispense = stack.split(1); + if (offsetState.getBlock().isAir(offsetState, world, offset)) { + if (IAuraChunk.getAuraInArea(world, offset, 30) >= 100000) { + dispense = setType(new ItemStack(AuraBottle.this), IAuraType.forWorld(world)); - BlockPos spot = IAuraChunk.getHighestSpot(world, offset, 30, offset); - IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 20000); - } + BlockPos spot = IAuraChunk.getHighestSpot(world, offset, 30, offset); + IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 20000); } + } - doDispense(world, dispense, 6, facing, DispenserBlock.getDispensePosition(source)); - return stack; + doDispense(world, dispense, 6, facing, DispenserBlock.getDispensePosition(source)); + return stack; }); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java index b176d35a..a60fa9e2 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java @@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.item.Item; public class ItemImpl extends Item implements IModItem, IModelProvider { @@ -16,7 +17,7 @@ public class ItemImpl extends Item implements IModItem, IModelProvider { public ItemImpl(String baseName, Item.Properties properties) { super(properties); this.baseName = baseName; - this.setRegistryName(NaturesAura.createRes(this.getBaseName())); + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index 23aa69fe..6539f37d 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -5,7 +5,6 @@ import net.minecraft.item.Item; import net.minecraftforge.registries.ObjectHolder; @SuppressWarnings("FieldNamingConvention") -@ObjectHolder(NaturesAura.MOD_ID) public final class ModItems { public static Item INFUSED_PICKAXE; public static Item INFUSED_AXE; diff --git a/src/main/java/de/ellpeck/naturesaura/items/MultiblockMaker.java b/src/main/java/de/ellpeck/naturesaura/items/MultiblockMaker.java index 3d28d857..2d6b5750 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/MultiblockMaker.java +++ b/src/main/java/de/ellpeck/naturesaura/items/MultiblockMaker.java @@ -6,12 +6,9 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; -import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; @@ -41,7 +38,10 @@ public class MultiblockMaker extends ItemImpl { public ActionResultType onItemUse(ItemUseContext context) { PlayerEntity player = context.getPlayer(); if (player.isCreative()) { - IMultiblock multi = multiblocks().get(getMultiblock(player.getHeldItem(context.getHand()))); + int id = getMultiblock(player.getHeldItem(context.getHand())); + if (id < 0) + return ActionResultType.PASS; + IMultiblock multi = multiblocks().get(id); if (multi == null) return ActionResultType.PASS; @@ -59,13 +59,16 @@ public class MultiblockMaker extends ItemImpl { @Override public ITextComponent getDisplayName(ItemStack stack) { ITextComponent name = super.getDisplayName(stack); - IMultiblock multi = multiblocks().get(getMultiblock(stack)); + int id = getMultiblock(stack); + if (id < 0) + return name; + IMultiblock multi = multiblocks().get(id); return multi == null ? name : name.appendText(" (" + multi.getName() + ")"); } private static int getMultiblock(ItemStack stack) { if (!stack.hasTag()) - return 0; + return -1; return stack.getTag().getInt("multiblock"); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Armor.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Armor.java index 65b9decc..6770e346 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Armor.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Armor.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.inventory.EquipmentSlotType; @@ -32,8 +33,8 @@ public class Armor extends ArmorItem implements IModItem, IModelProvider { public Armor(String baseName, IArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) { super(materialIn, equipmentSlotIn, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; - MinecraftForge.EVENT_BUS.register(this); + ModRegistry.add(this); } @SubscribeEvent diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Axe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Axe.java index 3104d2cb..e50acc51 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Axe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Axe.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.item.AxeItem; @@ -21,6 +22,7 @@ public class Axe extends AxeItem implements IModItem, IModelProvider { public Axe(String baseName, IItemTier material, float damage, float speed) { super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Hoe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Hoe.java index a930ddfc..d34d4311 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Hoe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Hoe.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.*; import net.minecraft.nbt.CompoundNBT; @@ -23,6 +24,7 @@ public class Hoe extends HoeItem implements IModItem, IModelProvider { public Hoe(String baseName, IItemTier material, float speed) { super(material, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Pickaxe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Pickaxe.java index 14b16e74..5592991f 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Pickaxe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Pickaxe.java @@ -6,6 +6,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.IItemTier; @@ -27,6 +28,7 @@ public class Pickaxe extends PickaxeItem implements IModItem, IModelProvider { public Pickaxe(String baseName, IItemTier material, int damage, float speed) { super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Shovel.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Shovel.java index f9efa20b..4943712b 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Shovel.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Shovel.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.material.Material; @@ -30,6 +31,7 @@ public class Shovel extends ShovelItem implements IModItem, IModelProvider { public Shovel(String baseName, IItemTier material, float damage, float speed) { super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/Sword.java b/src/main/java/de/ellpeck/naturesaura/items/tools/Sword.java index 856b30a3..d4af32c9 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/Sword.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/Sword.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.LivingEntity; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; @@ -22,6 +23,7 @@ public class Sword extends SwordItem implements IModItem, IModelProvider { public Sword(String baseName, IItemTier material, int damage, float speed) { super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); this.baseName = baseName; + ModRegistry.add(this); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java b/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java index 75a0123f..d197ca91 100644 --- a/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java +++ b/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java @@ -5,7 +5,6 @@ import net.minecraft.potion.Effect; import net.minecraftforge.registries.ObjectHolder; @SuppressWarnings("FieldNamingConvention") -@ObjectHolder(NaturesAura.MOD_ID) public final class ModPotions { public static Effect BREATHLESS; diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java deleted file mode 100644 index 2eff36a8..00000000 --- a/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.ellpeck.naturesaura.reg; - -import net.minecraft.item.BlockItem; - -public interface ICustomItemBlockProvider { - - BlockItem getItemBlock(); - -} diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IModItem.java b/src/main/java/de/ellpeck/naturesaura/reg/IModItem.java index e531af8d..dc430843 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IModItem.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IModItem.java @@ -1,12 +1,12 @@ package de.ellpeck.naturesaura.reg; +import net.minecraftforge.registries.ForgeRegistryEntry; + public interface IModItem { String getBaseName(); - //void onPreInit(FMLCommonSetupEvent event); - - //void onInit(FMLCommonSetupEvent event); - - //void onPostInit(FMLCommonSetupEvent event); + default ForgeRegistryEntry getRegistryEntry() { + return (ForgeRegistryEntry) this; + } } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index 04a6240b..1c96a01b 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -22,28 +22,29 @@ import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; -@Mod.EventBusSubscriber +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public final class ModRegistry { - private static final List ALL_ITEMS = new ArrayList<>(); + private static final Set ALL_ITEMS = new HashSet<>(); public static void add(IModItem item) { ALL_ITEMS.add(item); + item.getRegistryEntry().setRegistryName(item.getBaseName()); } @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { + BlockImpl temp; event.getRegistry().registerAll( new BlockAncientLog("ancient_log"), new BlockAncientLog("ancient_bark"), - new BlockImpl("ancient_planks", ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)), - new BlockStairsNA("ancient_stairs", ModBlocks.ANCIENT_PLANKS::getDefaultState, ModBlocks.prop(ModBlocks.ANCIENT_PLANKS)), - new Slab("ancient_slab", ModBlocks.prop(ModBlocks.ANCIENT_PLANKS)), + temp = new BlockImpl("ancient_planks", ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)), + new BlockStairsNA("ancient_stairs", temp::getDefaultState, ModBlocks.prop(temp)), + new Slab("ancient_slab", ModBlocks.prop(temp)), new BlockAncientLeaves(), new BlockAncientSapling(), new BlockNatureAltar(), @@ -51,12 +52,12 @@ public final class ModRegistry { new BlockGoldenLeaves(), new BlockGoldPowder(), new BlockWoodStand(), - new BlockImpl("infused_stone", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.75F)), - new BlockStairsNA("infused_stairs", ModBlocks.INFUSED_STONE::getDefaultState, ModBlocks.prop(ModBlocks.INFUSED_STONE)), - new Slab("infused_slab", ModBlocks.prop(ModBlocks.INFUSED_STONE)), - new BlockImpl("infused_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.5F)), - new BlockStairsNA("infused_brick_stairs", ModBlocks.INFUSED_BRICK::getDefaultState, ModBlocks.prop(ModBlocks.INFUSED_BRICK)), - new Slab("infused_brick_slab", ModBlocks.prop(ModBlocks.INFUSED_BRICK)), + temp = new BlockImpl("infused_stone", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.75F)), + new BlockStairsNA("infused_stairs", temp::getDefaultState, ModBlocks.prop(temp)), + new Slab("infused_slab", ModBlocks.prop(temp)), + temp = new BlockImpl("infused_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.5F)), + new BlockStairsNA("infused_brick_stairs", temp::getDefaultState, ModBlocks.prop(temp)), + new Slab("infused_brick_slab", ModBlocks.prop(temp)), new BlockFurnaceHeater(), new BlockPotionGenerator(), new BlockAuraDetector(), @@ -97,16 +98,15 @@ public final class ModRegistry { @SubscribeEvent public static void registerItems(RegistryEvent.Register event) { - for (IModItem item : ALL_ITEMS) { - if (item instanceof Block) { - if (item instanceof ICustomItemBlockProvider) { - event.getRegistry().register(((ICustomItemBlockProvider) item).getItemBlock()); - } else { - event.getRegistry().register(new BlockItem((Block) item, new Item.Properties())); - } + for (IModItem block : ALL_ITEMS) { + if (block instanceof Block) { + BlockItem item = new BlockItem((Block) block, new Item.Properties().group(NaturesAura.CREATIVE_TAB)); + item.setRegistryName(block.getBaseName()); + event.getRegistry().register(item); } } + Item temp; event.getRegistry().registerAll( new Pickaxe("infused_iron_pickaxe", NAItemTier.INFUSED, 8, 3.2F), new Axe("infused_iron_axe", NAItemTier.INFUSED, 8.25F, 3.2F), @@ -128,8 +128,8 @@ public final class ModRegistry { new AuraCache("aura_trove", 1200000), new ShockwaveCreator(), new MultiblockMaker(), - new ItemImpl("bottle_two_the_rebottling"), - new AuraBottle(), + temp = new ItemImpl("bottle_two_the_rebottling"), + new AuraBottle(temp), new ItemImpl("farming_stencil"), new ItemImpl("sky_ingot"), new Glowing("calling_spirit"), @@ -154,8 +154,8 @@ public final class ModRegistry { @SubscribeEvent public static void registerTiles(RegistryEvent.Register> event) { for (IModItem item : ALL_ITEMS) { - if (item instanceof BlockContainerImpl) - event.getRegistry().register(((BlockContainerImpl) item).tileType.setRegistryName(item.getBaseName())); + if (item instanceof ModTileType) + event.getRegistry().register(((ModTileType) item).type); } } @@ -243,7 +243,7 @@ public final class ModRegistry { } */ - public static void init(FMLCommonSetupEvent event) { + public static void init() { for (IModItem item : ALL_ITEMS) { if (item instanceof IColorProvidingBlock) { NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item); diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModTileType.java b/src/main/java/de/ellpeck/naturesaura/reg/ModTileType.java new file mode 100644 index 00000000..814d145b --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModTileType.java @@ -0,0 +1,29 @@ +package de.ellpeck.naturesaura.reg; + +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.registries.ForgeRegistryEntry; + +import java.util.function.Supplier; + +public class ModTileType implements IModItem { + + public final TileEntityType type; + public final String name; + + public ModTileType(Supplier supplier, IModItem block) { + this.type = TileEntityType.Builder.create(supplier, (Block) block).build(null); + this.name = block.getBaseName(); + } + + @Override + public String getBaseName() { + return this.name; + } + + @Override + public ForgeRegistryEntry getRegistryEntry() { + return this.type; + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index e39c6b38..79d9e96e 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -29,8 +29,7 @@ displayName="Nature's Aura" #mandatory authors="Ellpeck" #optional # The description text for the mod (multi line!) (#mandatory) description=''' -Nature's Aura is a Minecraft mod about collecting, using and replenishing the Aura naturally present in the world to create useful devices and unique mechanics. -''' +Nature's Aura is a Minecraft mod about collecting, using and replenishing the Aura naturally present in the world to create useful devices and unique mechanics.''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.naturesaura]] #optional # the modid of the dependency diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 62ede5dc..b87564c4 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -3,4 +3,5 @@ "description": "Nature's Aura", "pack_format": 4, "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." - } \ No newline at end of file + } +} \ No newline at end of file