mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-29 14:28:33 +01:00
IT RUNS
This commit is contained in:
parent
71f1dacd67
commit
18a7cd407d
80 changed files with 244 additions and 219 deletions
|
@ -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 <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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<? 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);
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<WeakReference<World>> 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<TileEntityAncientLeaves> ANCIENT_LEAVES;
|
||||
public static TileEntityType<TileEntityAnimalGenerator> ANIMAL_GENERATOR;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,8 +25,8 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
|
||||
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
|
||||
|
||||
public TileEntityFlowerGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public TileEntityFlowerGenerator() {
|
||||
super(ModTileEntities.FLOWER_GENERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,8 +13,8 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT
|
|||
|
||||
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
|
||||
|
||||
public TileEntityOakGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public TileEntityOakGenerator() {
|
||||
super(ModTileEntities.OAK_GENERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,8 +29,8 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
};
|
||||
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
|
||||
|
||||
public TileEntityOfferingTable(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public TileEntityOfferingTable() {
|
||||
super(ModTileEntities.OFFERING_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<EntityMoverMinecart> MOVER_MINECART;
|
||||
public static EntityType<EntityEffectInhibitor> EFFECT_INHIBITOR;
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package de.ellpeck.naturesaura.reg;
|
||||
|
||||
import net.minecraft.item.BlockItem;
|
||||
|
||||
public interface ICustomItemBlockProvider {
|
||||
|
||||
BlockItem getItemBlock();
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<IModItem> ALL_ITEMS = new ArrayList<>();
|
||||
private static final Set<IModItem> 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<Block> 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<Item> 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<TileEntityType<?>> 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);
|
||||
|
|
29
src/main/java/de/ellpeck/naturesaura/reg/ModTileType.java
Normal file
29
src/main/java/de/ellpeck/naturesaura/reg/ModTileType.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue