This commit is contained in:
Ellpeck 2020-01-22 01:32:26 +01:00
parent 71f1dacd67
commit 18a7cd407d
80 changed files with 244 additions and 219 deletions

View file

@ -37,11 +37,16 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
@ -314,4 +319,19 @@ public final class Helper {
public static AxisAlignedBB aabb(Vec3d pos) { public static AxisAlignedBB aabb(Vec3d pos) {
return new AxisAlignedBB(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z); return new AxisAlignedBB(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z);
} }
// This is how @ObjectHolder _SHOULD_ work...
public static <T extends IForgeRegistryEntry<T>> void populateObjectHolders(Class clazz, IForgeRegistry<T> 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);
}
}
}
} }

View file

@ -7,8 +7,10 @@ import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; 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.chunk.effect.DrainSpotEffects;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.entities.ModEntities;
import de.ellpeck.naturesaura.events.CommonEvents; import de.ellpeck.naturesaura.events.CommonEvents;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketHandler; 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.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.Locale;
@Mod(NaturesAura.MOD_ID) @Mod(NaturesAura.MOD_ID)
public final class NaturesAura { public final class NaturesAura {
public static final String MOD_ID = NaturesAuraAPI.MOD_ID; 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 MOD_NAME = "Nature's Aura";
public static final String VERSION = "@VERSION@"; public static final String VERSION = "@VERSION@";
@ -49,7 +49,6 @@ public final class NaturesAura {
instance = this; instance = this;
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
eventBus.addListener(this::setup); eventBus.addListener(this::setup);
} }
@ -67,6 +66,12 @@ public final class NaturesAura {
} }
public void setup(FMLCommonSetupEvent event) { 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.preInit(event);
this.init(event); this.init(event);
this.postInit(event); this.postInit(event);
@ -95,7 +100,7 @@ public final class NaturesAura {
public void init(FMLCommonSetupEvent event) { public void init(FMLCommonSetupEvent event) {
ModConfig.initOrReload(false); ModConfig.initOrReload(false);
ModRecipes.init(); ModRecipes.init();
ModRegistry.init(event); ModRegistry.init();
DrainSpotEffects.init(); DrainSpotEffects.init();
proxy.init(event); proxy.init(event);

View file

@ -27,7 +27,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable { public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable {
public BlockAnimalGenerator() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -1,11 +1,11 @@
package de.ellpeck.naturesaura.blocks; 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.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockAnimalSpawner extends BlockContainerImpl { public class BlockAnimalSpawner extends BlockContainerImpl {
public BlockAnimalSpawner() { 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));
} }
} }

View file

@ -12,7 +12,7 @@ import net.minecraft.world.World;
public class BlockAuraDetector extends BlockContainerImpl { public class BlockAuraDetector extends BlockContainerImpl {
public BlockAuraDetector() { 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 @Override

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
@ -14,7 +15,7 @@ public class BlockAutoCrafter extends BlockContainerImpl {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockAutoCrafter() { 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 @Override

View file

@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader; import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; 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); private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12);
public BlockChunkLoader() { 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 /* TODO Chunk Loading

View file

@ -4,37 +4,39 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.reg.ModTileType;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier;
public class BlockContainerImpl extends ContainerBlock implements IModItem, IModelProvider { public class BlockContainerImpl extends ContainerBlock implements IModItem, IModelProvider {
private final String baseName; private final String baseName;
public final TileEntityType<? extends TileEntity> tileType; private final ModTileType<? extends TileEntity> tileType;
public BlockContainerImpl(String baseName, TileEntityType tileClass, Block.Properties properties) { public BlockContainerImpl(String baseName, Supplier<TileEntity> tileSupplier, Block.Properties properties) {
super(properties); super(properties);
this.baseName = baseName; this.baseName = baseName;
this.tileType = tileClass; this.tileType = new ModTileType<>(tileSupplier, this);
ModRegistry.add(this); ModRegistry.add(this);
ModRegistry.add(this.tileType);
} }
@Nullable @Nullable
@Override @Override
public TileEntity createNewTileEntity(IBlockReader worldIn) { public TileEntity createNewTileEntity(IBlockReader worldIn) {
return this.tileType.create(); return this.tileType.type.create();
} }
@Override @Override

View file

@ -1,10 +1,10 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEndFlower; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEndFlower;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.reg.ModTileType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.BushBlock; import net.minecraft.block.BushBlock;
@ -33,9 +33,8 @@ public class BlockEndFlower extends BushBlock implements IModItem, IModelProvide
public BlockEndFlower() { public BlockEndFlower() {
super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.5F).sound(SoundType.PLANT)); super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.5F).sound(SoundType.PLANT));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModRegistry.add(this); ModRegistry.add(this);
ModRegistry.add(new ModTileType<>(TileEntityEndFlower::new, this));
} }
@SubscribeEvent @SubscribeEvent
@ -79,7 +78,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, IModelProvide
@Nullable @Nullable
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileEntityEndFlower(ModTileEntities.END_FLOWER); return new TileEntityEndFlower();
} }
@Override @Override

View file

@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.misc.IWorldData; 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.TileEntityEnderCrate;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
@ -47,7 +46,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
private static final ThreadLocal<WeakReference<World>> CACHED_WORLD = new ThreadLocal<>(); private static final ThreadLocal<WeakReference<World>> CACHED_WORLD = new ThreadLocal<>();
public BlockEnderCrate() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -24,7 +24,7 @@ import java.util.Random;
public class BlockFieldCreator extends BlockContainerImpl { public class BlockFieldCreator extends BlockContainerImpl {
public BlockFieldCreator() { 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 @Override

View file

@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -12,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable {
public BlockFireworkGenerator() { 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 @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; 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.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable {
public BlockFlowerGenerator() { 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 @Override

View file

@ -1,7 +1,6 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFurnaceHeater; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFurnaceHeater;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -37,7 +36,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
}; };
public BlockFurnaceHeater() { 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 @Override

View file

@ -1,13 +1,13 @@
package de.ellpeck.naturesaura.blocks; 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.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockGeneratorLimitRemover extends BlockContainerImpl /*implements ITESRProvider*/ { public class BlockGeneratorLimitRemover extends BlockContainerImpl /*implements ITESRProvider*/ {
public BlockGeneratorLimitRemover() { 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 /*@Override

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.material.Material; 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); private static final VoxelShape BASE_BOTTOM = makeCuboidShape(4, 4, 4, 12, 9, 12);
public BlockGratedChute() { 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 @Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; 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.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable { public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
public BlockHopperUpgrade() { 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 @Override

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; 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) { public BlockImpl(String baseName, Block.Properties properties) {
super(properties); super(properties);
this.baseName = baseName; this.baseName = baseName;
this.setRegistryName(NaturesAura.createRes(this.getBaseName()));
ModRegistry.add(this); ModRegistry.add(this);
} }

View file

@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable { public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
public BlockMossGenerator() { 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 @Override

View file

@ -22,7 +22,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
// TODO bounds // TODO bounds
public BlockNatureAltar() { 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 @Override

View file

@ -24,7 +24,7 @@ import java.util.Random;
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable { public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable {
public BlockOakGenerator() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -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); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
public BlockOfferingTable() { 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 @Override

View file

@ -2,9 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.render.IVisualizable; 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.blocks.tiles.TileEntityPickupStopper;
import de.ellpeck.naturesaura.packet.PacketHandler;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
@ -21,7 +19,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable { public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable {
public BlockPickupStopper() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPlacer;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -13,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPlacer extends BlockContainerImpl implements IVisualizable { public class BlockPlacer extends BlockContainerImpl implements IVisualizable {
public BlockPlacer() { 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 @Override

View file

@ -1,11 +1,12 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
public class BlockPotionGenerator extends BlockContainerImpl { public class BlockPotionGenerator extends BlockContainerImpl {
public BlockPotionGenerator() { 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));
} }
} }

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; 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); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 4 / 16F, 1F);
public BlockPowderPlacer() { 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 @Override

View file

@ -20,7 +20,7 @@ import net.minecraftforge.registries.ForgeRegistries;
public class BlockProjectileGenerator extends BlockContainerImpl/* implements ITESRProvider*/ { public class BlockProjectileGenerator extends BlockContainerImpl/* implements ITESRProvider*/ {
public BlockProjectileGenerator() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -1,12 +1,13 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockRFConverter extends BlockContainerImpl { public class BlockRFConverter extends BlockContainerImpl {
public BlockRFConverter() { 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));
} }
} }

View file

@ -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); private static final AxisAlignedBB AABB = new AxisAlignedBB(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
public BlockSpawnLamp() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -1,11 +1,12 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityTimeChanger;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockTimeChanger extends BlockContainerImpl { public class BlockTimeChanger extends BlockContainerImpl {
public BlockTimeChanger() { 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));
} }
} }

View file

@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; 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.TileEntityWoodStand;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand; import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
import de.ellpeck.naturesaura.reg.ITESRProvider; 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); private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
public BlockWoodStand() { 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); MinecraftForge.EVENT_BUS.register(this);
} }

View file

@ -1,14 +1,10 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor; import net.minecraft.block.material.MaterialColor;
import net.minecraftforge.registries.ObjectHolder;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModBlocks { public final class ModBlocks {
public static Block ANCIENT_LOG; public static Block ANCIENT_LOG;

View file

@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.SlabBlock; import net.minecraft.block.SlabBlock;
public class Slab extends SlabBlock implements IModItem, IModelProvider { 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) { public Slab(String baseName, Properties properties) {
super(properties); super(properties);
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModTileEntities { public final class ModTileEntities {
public static TileEntityType<TileEntityAncientLeaves> ANCIENT_LEAVES; public static TileEntityType<TileEntityAncientLeaves> ANCIENT_LEAVES;
public static TileEntityType<TileEntityAnimalGenerator> ANIMAL_GENERATOR; public static TileEntityType<TileEntityAnimalGenerator> ANIMAL_GENERATOR;

View file

@ -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.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer; import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
public class TileEntityAncientLeaves extends TileEntityImpl { public class TileEntityAncientLeaves extends TileEntityImpl {
@ -25,8 +24,8 @@ public class TileEntityAncientLeaves extends TileEntityImpl {
} }
}; };
public TileEntityAncientLeaves(TileEntityType<?> tileEntityTypeIn) { public TileEntityAncientLeaves() {
super(tileEntityTypeIn); super(ModTileEntities.ANCIENT_LEAVES);
} }
@Override @Override

View file

@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickableTileEntity { public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickableTileEntity {
@ -10,8 +9,8 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab
private int timeRemaining; private int timeRemaining;
private int amountToRelease; private int amountToRelease;
public TileEntityAnimalGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityAnimalGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.ANIMAL_GENERATOR);
} }
@Override @Override

View file

@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -30,8 +29,8 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
private int time; private int time;
private Entity entityClient; private Entity entityClient;
public TileEntityAnimalSpawner(TileEntityType<?> tileEntityTypeIn) { public TileEntityAnimalSpawner() {
super(tileEntityTypeIn); super(ModTileEntities.ANIMAL_SPAWNER);
} }
@Override @Override

View file

@ -2,15 +2,14 @@ package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
public class TileEntityAuraDetector extends TileEntityImpl implements ITickableTileEntity { public class TileEntityAuraDetector extends TileEntityImpl implements ITickableTileEntity {
public int redstonePower; public int redstonePower;
public TileEntityAuraDetector(TileEntityType<?> tileEntityTypeIn) { public TileEntityAuraDetector() {
super(tileEntityTypeIn); super(ModTileEntities.AURA_DETECTOR);
} }
@Override @Override

View file

@ -10,7 +10,6 @@ import net.minecraft.inventory.container.Container;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.EntityPredicates; import net.minecraft.util.EntityPredicates;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
@ -27,8 +26,8 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi
} }
}, 3, 3); }, 3, 3);
public TileEntityAutoCrafter(TileEntityType<?> tileEntityTypeIn) { public TileEntityAutoCrafter() {
super(tileEntityTypeIn); super(ModTileEntities.AUTO_CRAFTER);
} }
@Override @Override

View file

@ -2,14 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
// TODO chunk loader // TODO chunk loader
public class TileEntityChunkLoader extends TileEntityImpl implements ITickableTileEntity { public class TileEntityChunkLoader extends TileEntityImpl implements ITickableTileEntity {
public TileEntityChunkLoader(TileEntityType<?> tileEntityTypeIn) { public TileEntityChunkLoader() {
super(tileEntityTypeIn); super(ModTileEntities.CHUNK_LOADER);
} }
//private Ticket ticket; //private Ticket ticket;

View file

@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.EntityPredicates; import net.minecraft.util.EntityPredicates;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -46,8 +45,8 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
public boolean isDrainMode; public boolean isDrainMode;
public TileEntityEndFlower(TileEntityType<?> tileEntityTypeIn) { public TileEntityEndFlower() {
super(tileEntityTypeIn); super(ModTileEntities.END_FLOWER);
} }
@Override @Override

View file

@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.blocks.BlockEnderCrate;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
@ -67,8 +66,8 @@ public class TileEntityEnderCrate extends TileEntityImpl {
}; };
public String name; public String name;
public TileEntityEnderCrate(TileEntityType<?> tileEntityTypeIn) { public TileEntityEnderCrate() {
super(tileEntityTypeIn); super(ModTileEntities.ENDER_CRATE);
} }
@Override @Override

View file

@ -11,7 +11,6 @@ import net.minecraft.item.ShearsItem;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -35,8 +34,8 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT
public boolean isCharged; public boolean isCharged;
private int chargeTimer; private int chargeTimer;
public TileEntityFieldCreator(TileEntityType<?> tileEntityTypeIn) { public TileEntityFieldCreator() {
super(tileEntityTypeIn); super(ModTileEntities.FIELD_CREATOR);
} }
@Override @Override

View file

@ -9,7 +9,6 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT; import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EntityPredicates; import net.minecraft.util.EntityPredicates;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -27,8 +26,8 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
private int toRelease; private int toRelease;
private int releaseTimer; private int releaseTimer;
public TileEntityFireworkGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityFireworkGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.FIREWORK_GENERATOR);
} }
@Override @Override

View file

@ -25,8 +25,8 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>(); private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
public TileEntityFlowerGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityFlowerGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.FLOWER_GENERATOR);
} }
@Override @Override

View file

@ -15,8 +15,8 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
public boolean isActive; public boolean isActive;
public TileEntityFurnaceHeater(TileEntityType<?> tileEntityTypeIn) { public TileEntityFurnaceHeater() {
super(tileEntityTypeIn); super(ModTileEntities.FURNACE_HEATER);
} }
@Override @Override

View file

@ -7,8 +7,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class TileEntityGeneratorLimitRemover extends TileEntityImpl { public class TileEntityGeneratorLimitRemover extends TileEntityImpl {
public TileEntityGeneratorLimitRemover(TileEntityType<?> tileEntityTypeIn) { public TileEntityGeneratorLimitRemover() {
super(tileEntityTypeIn); super(ModTileEntities.GENERATOR_LIMIT_REMOVER);
} }
@Override @Override

View file

@ -34,8 +34,8 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickableTi
public boolean isBlacklist; public boolean isBlacklist;
private int cooldown; private int cooldown;
public TileEntityGratedChute(TileEntityType<?> tileEntityTypeIn) { public TileEntityGratedChute() {
super(tileEntityTypeIn); super(ModTileEntities.GRATED_CHUTE);
} }
@Override @Override

View file

@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.HopperTileEntity; import net.minecraft.tileentity.HopperTileEntity;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -17,8 +16,8 @@ import net.minecraftforge.items.IItemHandler;
import java.util.List; import java.util.List;
public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickableTileEntity { public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickableTileEntity {
public TileEntityHopperUpgrade(TileEntityType<?> tileEntityTypeIn) { public TileEntityHopperUpgrade() {
super(tileEntityTypeIn); super(ModTileEntities.HOPPER_UPGRADE);
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.util.ArrayList; import java.util.ArrayList;
@ -13,8 +12,8 @@ import java.util.List;
public class TileEntityMossGenerator extends TileEntityImpl implements ITickableTileEntity { public class TileEntityMossGenerator extends TileEntityImpl implements ITickableTileEntity {
public TileEntityMossGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityMossGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.MOSS_GENERATOR);
} }
@Override @Override

View file

@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
@ -61,8 +60,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
private int lastAura; private int lastAura;
public TileEntityNatureAltar(TileEntityType<?> tileEntityTypeIn) { public TileEntityNatureAltar() {
super(tileEntityTypeIn); super(ModTileEntities.NATURE_ALTAR);
} }
@Override @Override

View file

@ -13,8 +13,8 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>(); public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
public TileEntityOakGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityOakGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.OAK_GENERATOR);
} }
@Override @Override

View file

@ -29,8 +29,8 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
}; };
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>(); private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
public TileEntityOfferingTable(TileEntityType<?> tileEntityTypeIn) { public TileEntityOfferingTable() {
super(tileEntityTypeIn); super(ModTileEntities.OFFERING_TABLE);
} }
@Override @Override

View file

@ -4,8 +4,8 @@ import net.minecraft.tileentity.TileEntityType;
public class TileEntityPickupStopper extends TileEntityImpl { public class TileEntityPickupStopper extends TileEntityImpl {
public TileEntityPickupStopper(TileEntityType<?> tileEntityTypeIn) { public TileEntityPickupStopper() {
super(tileEntityTypeIn); super(ModTileEntities.PICKUP_STOPPER);
} }
public float getRadius() { public float getRadius() {

View file

@ -2,22 +2,17 @@ package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.item.ItemFrameEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
@ -28,8 +23,8 @@ import java.util.List;
public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEntity { public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEntity {
public TileEntityPlacer(TileEntityType<?> tileEntityTypeIn) { public TileEntityPlacer() {
super(tileEntityTypeIn); super(ModTileEntities.PLACER);
} }
@Override @Override

View file

@ -7,7 +7,6 @@ import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
@ -16,8 +15,8 @@ import java.util.List;
public class TileEntityPotionGenerator extends TileEntityImpl implements ITickableTileEntity { public class TileEntityPotionGenerator extends TileEntityImpl implements ITickableTileEntity {
public TileEntityPotionGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityPotionGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.POTION_GENERATOR);
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.EntityPredicates; import net.minecraft.util.EntityPredicates;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -15,8 +14,8 @@ import java.util.List;
public class TileEntityPowderPlacer extends TileEntityImpl { public class TileEntityPowderPlacer extends TileEntityImpl {
public TileEntityPowderPlacer(TileEntityType<?> tileEntityTypeIn) { public TileEntityPowderPlacer() {
super(tileEntityTypeIn); super(ModTileEntities.POWDER_PLACER);
} }
@Override @Override

View file

@ -1,15 +1,14 @@
package de.ellpeck.naturesaura.blocks.tiles; package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
public class TileEntityProjectileGenerator extends TileEntityImpl { public class TileEntityProjectileGenerator extends TileEntityImpl {
public Direction nextSide = Direction.NORTH; public Direction nextSide = Direction.NORTH;
public TileEntityProjectileGenerator(TileEntityType<?> tileEntityTypeIn) { public TileEntityProjectileGenerator() {
super(tileEntityTypeIn); super(ModTileEntities.PROJECTILE_GENERATOR);
} }
@Override @Override

View file

@ -23,8 +23,8 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickableTi
public final RFStorage storage = new RFStorage(); public final RFStorage storage = new RFStorage();
private int lastEnergy; private int lastEnergy;
public TileEntityRFConverter(TileEntityType<?> tileEntityTypeIn) { public TileEntityRFConverter() {
super(tileEntityTypeIn); super(ModTileEntities.RF_CONVERTER);
} }
@Override @Override

View file

@ -1,11 +1,9 @@
package de.ellpeck.naturesaura.blocks.tiles; package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.tileentity.TileEntityType;
public class TileEntitySpawnLamp extends TileEntityImpl { public class TileEntitySpawnLamp extends TileEntityImpl {
public TileEntitySpawnLamp(TileEntityType<?> tileEntityTypeIn) { public TileEntitySpawnLamp() {
super(tileEntityTypeIn); super(ModTileEntities.SPAWN_LAMP);
} }
public int getRadius() { public int getRadius() {

View file

@ -13,7 +13,6 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SUpdateTimePacket; import net.minecraft.network.play.server.SUpdateTimePacket;
import net.minecraft.server.management.PlayerList; import net.minecraft.server.management.PlayerList;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.EntityPredicates; import net.minecraft.util.EntityPredicates;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -27,8 +26,8 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickableTi
private long goalTime; private long goalTime;
public TileEntityTimeChanger(TileEntityType<?> tileEntityTypeIn) { public TileEntityTimeChanger() {
super(tileEntityTypeIn); super(ModTileEntities.TIME_CHANGER);
} }
@Override @Override

View file

@ -13,7 +13,6 @@ import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
@ -39,8 +38,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
private BlockPos ritualPos; private BlockPos ritualPos;
private int timer; private int timer;
public TileEntityWoodStand(TileEntityType<?> tileEntityTypeIn) { public TileEntityWoodStand() {
super(tileEntityTypeIn); super(ModTileEntities.WOOD_STAND);
} }
public void setRitual(BlockPos pos, TreeRitualRecipe recipe) { public void setRitual(BlockPos pos, TreeRitualRecipe recipe) {

View file

@ -5,7 +5,6 @@ import net.minecraft.entity.EntityType;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModEntities { public final class ModEntities {
public static EntityType<EntityMoverMinecart> MOVER_MINECART; public static EntityType<EntityMoverMinecart> MOVER_MINECART;
public static EntityType<EntityEffectInhibitor> EFFECT_INHIBITOR; public static EntityType<EntityEffectInhibitor> EFFECT_INHIBITOR;

View file

@ -5,38 +5,35 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import net.minecraft.block.DispenserBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.DispenserBlock;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemGroup;
import net.minecraft.entity.player.PlayerEntity; 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.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.*;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceContext; import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World; 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.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; 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; import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense;
public class AuraBottle extends ItemImpl implements IColorProvidingItem { public class AuraBottle extends ItemImpl implements IColorProvidingItem {
public AuraBottle() { public AuraBottle(Item emptyBottle) {
super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB)); super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
DispenserBlock.registerDispenseBehavior(ModItems.BOTTLE_TWO, (source, stack) -> { DispenserBlock.registerDispenseBehavior(emptyBottle, (source, stack) -> {
World world = source.getWorld(); World world = source.getWorld();
BlockState state = source.getBlockState(); BlockState state = source.getBlockState();
Direction facing = state.get(DispenserBlock.FACING); Direction facing = state.get(DispenserBlock.FACING);

View file

@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.item.Item; import net.minecraft.item.Item;
public class ItemImpl extends Item implements IModItem, IModelProvider { 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) { public ItemImpl(String baseName, Item.Properties properties) {
super(properties); super(properties);
this.baseName = baseName; this.baseName = baseName;
this.setRegistryName(NaturesAura.createRes(this.getBaseName())); ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import net.minecraft.item.Item;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModItems { public final class ModItems {
public static Item INFUSED_PICKAXE; public static Item INFUSED_PICKAXE;
public static Item INFUSED_AXE; public static Item INFUSED_AXE;

View file

@ -6,12 +6,9 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -41,7 +38,10 @@ public class MultiblockMaker extends ItemImpl {
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
PlayerEntity player = context.getPlayer(); PlayerEntity player = context.getPlayer();
if (player.isCreative()) { 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) if (multi == null)
return ActionResultType.PASS; return ActionResultType.PASS;
@ -59,13 +59,16 @@ public class MultiblockMaker extends ItemImpl {
@Override @Override
public ITextComponent getDisplayName(ItemStack stack) { public ITextComponent getDisplayName(ItemStack stack) {
ITextComponent name = super.getDisplayName(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() + ")"); return multi == null ? name : name.appendText(" (" + multi.getName() + ")");
} }
private static int getMultiblock(ItemStack stack) { private static int getMultiblock(ItemStack stack) {
if (!stack.hasTag()) if (!stack.hasTag())
return 0; return -1;
return stack.getTag().getInt("multiblock"); return stack.getTag().getInt("multiblock");
} }

View file

@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType; 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) { public Armor(String baseName, IArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) {
super(materialIn, equipmentSlotIn, new Properties().group(NaturesAura.CREATIVE_TAB)); super(materialIn, equipmentSlotIn, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModRegistry.add(this);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.AxeItem; 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) { public Axe(String baseName, IItemTier material, float damage, float speed) {
super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.nbt.CompoundNBT; 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) { public Hoe(String baseName, IItemTier material, float speed) {
super(material, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); super(material, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -6,6 +6,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier; 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) { public Pickaxe(String baseName, IItemTier material, int damage, float speed) {
super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material; 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) { public Shovel(String baseName, IItemTier material, float damage, float speed) {
super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack; 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) { public Sword(String baseName, IItemTier material, int damage, float speed) {
super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB)); super(material, damage, speed, new Properties().group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName; this.baseName = baseName;
ModRegistry.add(this);
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import net.minecraft.potion.Effect;
import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ObjectHolder;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("FieldNamingConvention")
@ObjectHolder(NaturesAura.MOD_ID)
public final class ModPotions { public final class ModPotions {
public static Effect BREATHLESS; public static Effect BREATHLESS;

View file

@ -1,9 +0,0 @@
package de.ellpeck.naturesaura.reg;
import net.minecraft.item.BlockItem;
public interface ICustomItemBlockProvider {
BlockItem getItemBlock();
}

View file

@ -1,12 +1,12 @@
package de.ellpeck.naturesaura.reg; package de.ellpeck.naturesaura.reg;
import net.minecraftforge.registries.ForgeRegistryEntry;
public interface IModItem { public interface IModItem {
String getBaseName(); String getBaseName();
//void onPreInit(FMLCommonSetupEvent event); default ForgeRegistryEntry getRegistryEntry() {
return (ForgeRegistryEntry) this;
//void onInit(FMLCommonSetupEvent event); }
//void onPostInit(FMLCommonSetupEvent event);
} }

View file

@ -22,28 +22,29 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import java.util.ArrayList; import java.util.HashSet;
import java.util.List; import java.util.Set;
@Mod.EventBusSubscriber @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ModRegistry { public final class ModRegistry {
private static final List<IModItem> ALL_ITEMS = new ArrayList<>(); private static final Set<IModItem> ALL_ITEMS = new HashSet<>();
public static void add(IModItem item) { public static void add(IModItem item) {
ALL_ITEMS.add(item); ALL_ITEMS.add(item);
item.getRegistryEntry().setRegistryName(item.getBaseName());
} }
@SubscribeEvent @SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) { public static void registerBlocks(RegistryEvent.Register<Block> event) {
BlockImpl temp;
event.getRegistry().registerAll( event.getRegistry().registerAll(
new BlockAncientLog("ancient_log"), new BlockAncientLog("ancient_log"),
new BlockAncientLog("ancient_bark"), new BlockAncientLog("ancient_bark"),
new BlockImpl("ancient_planks", ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)), temp = 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 BlockStairsNA("ancient_stairs", temp::getDefaultState, ModBlocks.prop(temp)),
new Slab("ancient_slab", ModBlocks.prop(ModBlocks.ANCIENT_PLANKS)), new Slab("ancient_slab", ModBlocks.prop(temp)),
new BlockAncientLeaves(), new BlockAncientLeaves(),
new BlockAncientSapling(), new BlockAncientSapling(),
new BlockNatureAltar(), new BlockNatureAltar(),
@ -51,12 +52,12 @@ public final class ModRegistry {
new BlockGoldenLeaves(), new BlockGoldenLeaves(),
new BlockGoldPowder(), new BlockGoldPowder(),
new BlockWoodStand(), new BlockWoodStand(),
new BlockImpl("infused_stone", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.75F)), temp = 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 BlockStairsNA("infused_stairs", temp::getDefaultState, ModBlocks.prop(temp)),
new Slab("infused_slab", ModBlocks.prop(ModBlocks.INFUSED_STONE)), new Slab("infused_slab", ModBlocks.prop(temp)),
new BlockImpl("infused_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(1.5F)), temp = 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 BlockStairsNA("infused_brick_stairs", temp::getDefaultState, ModBlocks.prop(temp)),
new Slab("infused_brick_slab", ModBlocks.prop(ModBlocks.INFUSED_BRICK)), new Slab("infused_brick_slab", ModBlocks.prop(temp)),
new BlockFurnaceHeater(), new BlockFurnaceHeater(),
new BlockPotionGenerator(), new BlockPotionGenerator(),
new BlockAuraDetector(), new BlockAuraDetector(),
@ -97,16 +98,15 @@ public final class ModRegistry {
@SubscribeEvent @SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) { public static void registerItems(RegistryEvent.Register<Item> event) {
for (IModItem item : ALL_ITEMS) { for (IModItem block : ALL_ITEMS) {
if (item instanceof Block) { if (block instanceof Block) {
if (item instanceof ICustomItemBlockProvider) { BlockItem item = new BlockItem((Block) block, new Item.Properties().group(NaturesAura.CREATIVE_TAB));
event.getRegistry().register(((ICustomItemBlockProvider) item).getItemBlock()); item.setRegistryName(block.getBaseName());
} else { event.getRegistry().register(item);
event.getRegistry().register(new BlockItem((Block) item, new Item.Properties()));
}
} }
} }
Item temp;
event.getRegistry().registerAll( event.getRegistry().registerAll(
new Pickaxe("infused_iron_pickaxe", NAItemTier.INFUSED, 8, 3.2F), new Pickaxe("infused_iron_pickaxe", NAItemTier.INFUSED, 8, 3.2F),
new Axe("infused_iron_axe", NAItemTier.INFUSED, 8.25F, 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 AuraCache("aura_trove", 1200000),
new ShockwaveCreator(), new ShockwaveCreator(),
new MultiblockMaker(), new MultiblockMaker(),
new ItemImpl("bottle_two_the_rebottling"), temp = new ItemImpl("bottle_two_the_rebottling"),
new AuraBottle(), new AuraBottle(temp),
new ItemImpl("farming_stencil"), new ItemImpl("farming_stencil"),
new ItemImpl("sky_ingot"), new ItemImpl("sky_ingot"),
new Glowing("calling_spirit"), new Glowing("calling_spirit"),
@ -154,8 +154,8 @@ public final class ModRegistry {
@SubscribeEvent @SubscribeEvent
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) { public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
for (IModItem item : ALL_ITEMS) { for (IModItem item : ALL_ITEMS) {
if (item instanceof BlockContainerImpl) if (item instanceof ModTileType)
event.getRegistry().register(((BlockContainerImpl) item).tileType.setRegistryName(item.getBaseName())); 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) { for (IModItem item : ALL_ITEMS) {
if (item instanceof IColorProvidingBlock) { if (item instanceof IColorProvidingBlock) {
NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item); NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item);

View file

@ -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<T extends TileEntity> implements IModItem {
public final TileEntityType<T> type;
public final String name;
public ModTileType(Supplier<T> 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;
}
}

View file

@ -29,8 +29,7 @@ displayName="Nature's Aura" #mandatory
authors="Ellpeck" #optional authors="Ellpeck" #optional
# The description text for the mod (multi line!) (#mandatory) # The description text for the mod (multi line!) (#mandatory)
description=''' 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. # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.naturesaura]] #optional [[dependencies.naturesaura]] #optional
# the modid of the dependency # the modid of the dependency

View file

@ -4,3 +4,4 @@
"pack_format": 4, "pack_format": 4,
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
} }
}