made stuff tick

This commit is contained in:
Ell 2021-12-19 15:32:45 +01:00
parent 8fd1b0333e
commit 198a4d359a
79 changed files with 142 additions and 182 deletions

View file

@ -20,7 +20,7 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
private static final VoxelShape SHAPE = box(5, 0, 5, 11, 13, 11);
public BlockAnimalContainer() {
super("animal_container", BlockEntityAnimalContainer::new, Properties.copy(Blocks.STONE));
super("animal_container", BlockEntityAnimalContainer.class, Properties.copy(Blocks.STONE));
}
@Override

View file

@ -9,9 +9,7 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.npc.Npc;
@ -31,7 +29,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockAnimalGenerator() {
super("animal_generator", BlockEntityAnimalGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("animal_generator", BlockEntityAnimalGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -7,6 +7,6 @@ import net.minecraft.world.level.material.Material;
public class BlockAnimalSpawner extends BlockContainerImpl {
public BlockAnimalSpawner() {
super("animal_spawner", BlockEntityAnimalSpawner::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("animal_spawner", BlockEntityAnimalSpawner.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
}

View file

@ -1,6 +1,8 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.*;
@ -16,11 +18,13 @@ import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.function.Supplier;
@ -86,4 +90,10 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new BlockEntityAuraBloom(pos, state);
}
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ITickableBlockEntity.createTickerHelper(type, ModBlockEntities.AURA_BLOOM);
}
}

View file

@ -4,14 +4,13 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraDetector;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
public class BlockAuraDetector extends BlockContainerImpl {
public BlockAuraDetector() {
super("aura_detector", BlockEntityAuraDetector::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("aura_detector", BlockEntityAuraDetector.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
@Override

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraTimer;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderAuraTimer;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -35,7 +35,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
private static final VoxelShape SHAPE = box(1, 0, 1, 15, 15, 15);
public BlockAuraTimer() {
super("aura_timer", BlockEntityAuraTimer::new, Properties.copy(Blocks.SMOOTH_STONE));
super("aura_timer", BlockEntityAuraTimer.class, Properties.copy(Blocks.SMOOTH_STONE));
this.registerDefaultState(this.defaultBlockState().setValue(BlockStateProperties.POWERED, false));
}
@ -83,6 +83,6 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.AURA_TIMER, RenderAuraTimer::new);
BlockEntityRenderers.register(ModBlockEntities.AURA_TIMER, RenderAuraTimer::new);
}
}

View file

@ -17,7 +17,7 @@ public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlock
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockAutoCrafter() {
super("auto_crafter", BlockEntityAutoCrafter::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
}
@Override

View file

@ -22,7 +22,7 @@ public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICus
private static final VoxelShape SHAPE = Shapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F);
public BlockBlastFurnaceBooster() {
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster::new, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
super("blast_furnace_booster", BlockEntityBlastFurnaceBooster.class, Block.Properties.copy(Blocks.BLAST_FURNACE).lightLevel(s -> 0));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
public class BlockChorusGenerator extends BlockContainerImpl implements ICustomBlockState {
public BlockChorusGenerator() {
super("chorus_generator", BlockEntityChorusGenerator::new, Properties.copy(Blocks.END_STONE));
super("chorus_generator", BlockEntityChorusGenerator.class, Properties.copy(Blocks.END_STONE));
}
@Override

View file

@ -12,7 +12,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
@ -28,7 +27,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
private static final VoxelShape SHAPE = box(4, 4, 4, 12, 12, 12);
public BlockChunkLoader() {
super("chunk_loader", BlockEntityChunkLoader::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("chunk_loader", BlockEntityChunkLoader.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
}
@Override

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.reg.ModTileType;
@ -19,6 +20,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -29,19 +31,22 @@ import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import javax.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Random;
public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
private final String baseName;
private final ModTileType<BlockEntity> tileType;
private final Class<? extends BlockEntity> tileClass;
private final ModTileType<? extends BlockEntity> tileType;
public BlockContainerImpl(String baseName, BlockEntityType.BlockEntitySupplier<BlockEntity> tileSupplier, Block.Properties properties) {
public BlockContainerImpl(String baseName, Class<? extends BlockEntity> tileClass, Block.Properties properties) {
super(properties);
this.baseName = baseName;
this.tileType = new ModTileType<>(tileSupplier, this);
this.tileClass = tileClass;
this.tileType = new ModTileType<>(this::createBlockEntity, this);
ModRegistry.add(this);
ModRegistry.add(this.tileType);
@ -85,7 +90,14 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
@org.jetbrains.annotations.Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return this.tileType.type.create(pos, state);
return this.createBlockEntity(pos, state);
}
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
if (ITickableBlockEntity.class.isAssignableFrom(this.tileClass))
return ITickableBlockEntity.createTickerHelper(type, this.tileType.type);
return null;
}
@Override
@ -164,4 +176,12 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
}
}
}
private BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
try {
return this.tileClass.getConstructor(BlockPos.class, BlockState.class).newInstance(pos, state);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IllegalStateException("Cannot construct block entity from class " + this.tileClass, e);
}
}
}

View file

@ -1,13 +1,14 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEndFlower;
import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -19,13 +20,14 @@ import net.minecraft.world.level.block.BushBlock;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.MinecraftForge;
@ -89,6 +91,12 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
return new BlockEntityEndFlower(pos, state);
}
@org.jetbrains.annotations.Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return ITickableBlockEntity.createTickerHelper(type, ModBlockEntities.END_FLOWER);
}
@Override
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
return willHarvest || super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);

View file

@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.misc.ILevelData;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.items.ModItems;
@ -43,7 +43,7 @@ import java.util.Random;
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<BlockEntityEnderCrate>, ICustomBlockState {
public BlockEnderCrate() {
super("ender_crate", BlockEntityEnderCrate::new, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
super("ender_crate", BlockEntityEnderCrate.class, Properties.of(Material.STONE).strength(5F).lightLevel(s -> 7).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}
@ -131,6 +131,6 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new);
BlockEntityRenderers.register(ModBlockEntities.ENDER_CRATE, RenderEnderCrate::new);
}
}

View file

@ -8,14 +8,12 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
@ -28,7 +26,7 @@ import java.util.function.Supplier;
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState, ICustomRenderType {
public BlockFieldCreator() {
super("field_creator", BlockEntityFieldCreator::new, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
super("field_creator", BlockEntityFieldCreator.class, Properties.of(Material.STONE).strength(2F).noCollission().sound(SoundType.STONE));
}
@Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFireworkGenerator() {
super("firework_generator", BlockEntityFireworkGenerator::new, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
super("firework_generator", BlockEntityFireworkGenerator.class, Properties.of(Material.STONE).strength(3F).sound(SoundType.STONE));
}
@Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFlowerGenerator() {
super("flower_generator", BlockEntityFlowerGenerator::new, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
super("flower_generator", BlockEntityFlowerGenerator.class, Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2F));
}
@Override

View file

@ -37,7 +37,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
};
public BlockFurnaceHeater() {
super("furnace_heater", BlockEntityFurnaceHeater::new, Properties.of(Material.STONE).strength(3F));
super("furnace_heater", BlockEntityFurnaceHeater.class, Properties.of(Material.STONE).strength(3F));
}
@Override

View file

@ -1,7 +1,7 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityGeneratorLimitRemover;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -13,7 +13,7 @@ import net.minecraft.world.level.material.Material;
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<BlockEntityGeneratorLimitRemover>, ICustomBlockState {
public BlockGeneratorLimitRemover() {
super("generator_limit_remover", BlockEntityGeneratorLimitRemover::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("generator_limit_remover", BlockEntityGeneratorLimitRemover.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
}
@Override
@ -26,6 +26,6 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
BlockEntityRenderers.register(ModBlockEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
}
}

View file

@ -11,7 +11,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
@ -19,7 +18,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HopperBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.Hopper;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -53,7 +51,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
private static final VoxelShape WEST_RAYTRACE_SHAPE = Shapes.or(Hopper.INSIDE, box(0.0D, 8.0D, 6.0D, 4.0D, 10.0D, 10.0D));
public BlockGratedChute() {
super("grated_chute", BlockEntityGratedChute::new, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
super("grated_chute", BlockEntityGratedChute.class, Properties.of(Material.METAL).strength(3.0F, 8.0F).sound(SoundType.METAL));
}
@Override

View file

@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
public BlockHopperUpgrade() {
super("hopper_upgrade", BlockEntityHopperUpgrade::new, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
super("hopper_upgrade", BlockEntityHopperUpgrade.class, Properties.of(Material.METAL).strength(2.5F).sound(SoundType.METAL));
}
@Override

View file

@ -9,14 +9,13 @@ import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
public class BlockItemDistributor extends BlockContainerImpl implements ICustomBlockState {
public BlockItemDistributor() {
super("item_distributor", BlockEntityItemDistributor::new, Properties.copy(Blocks.STONE_BRICKS));
super("item_distributor", BlockEntityItemDistributor.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
public BlockMossGenerator() {
super("moss_generator", BlockEntityMossGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("moss_generator", BlockEntityMossGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -35,7 +35,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
public static final BooleanProperty NETHER = BooleanProperty.create("nether");
public BlockNatureAltar() {
super("nature_altar", BlockEntityNatureAltar::new, Block.Properties.of(Material.STONE).strength(4F));
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F));
this.registerDefaultState(this.defaultBlockState().setValue(NETHER, false));
}
@ -75,6 +75,6 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new);
BlockEntityRenderers.register(ModBlockEntities.NATURE_ALTAR, RenderNatureAltar::new);
}
}

View file

@ -19,12 +19,10 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.Random;
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockOakGenerator() {
super("oak_generator", BlockEntityOakGenerator::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
super("oak_generator", BlockEntityOakGenerator.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityOfferingTable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
@ -27,7 +27,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
private static final VoxelShape SHAPE = Shapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
public BlockOfferingTable() {
super("offering_table", BlockEntityOfferingTable::new, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
super("offering_table", BlockEntityOfferingTable.class, Properties.of(Material.WOOD).strength(2F).sound(SoundType.WOOD));
}
@Override
@ -52,6 +52,6 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new);
BlockEntityRenderers.register(ModBlockEntities.OFFERING_TABLE, RenderOfferingTable::new);
}
}

View file

@ -8,11 +8,8 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
@ -24,7 +21,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPickupStopper() {
super("pickup_stopper", BlockEntityPickupStopper::new, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
super("pickup_stopper", BlockEntityPickupStopper.class, Properties.of(Material.STONE).strength(2F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -15,7 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPlacer() {
super("placer", BlockEntityPlacer::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("placer", BlockEntityPlacer.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.material.Material;
public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
public BlockPotionGenerator() {
super("potion_generator", BlockEntityPotionGenerator::new, Properties.of(Material.STONE).strength(5F));
super("potion_generator", BlockEntityPotionGenerator.class, Properties.of(Material.STONE).strength(5F));
}
@Override

View file

@ -17,7 +17,7 @@ public class BlockPowderPlacer extends BlockContainerImpl implements ICustomBloc
private static final VoxelShape SHAPE = Shapes.create(0F, 0F, 0F, 1F, 4 / 16F, 1F);
public BlockPowderPlacer() {
super("powder_placer", BlockEntityPowderPlacer::new, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
super("powder_placer", BlockEntityPowderPlacer.class, Properties.of(Material.STONE).strength(2, 5F).sound(SoundType.STONE));
}
@Override

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler;
@ -10,12 +10,10 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile;
@ -26,10 +24,8 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.ProjectileImpactEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -38,7 +34,7 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
public BlockProjectileGenerator() {
super("projectile_generator", BlockEntityProjectileGenerator::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this);
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
@ -106,6 +102,6 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
BlockEntityRenderers.register(ModBlockEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
}
}

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
public class BlockRFConverter extends BlockContainerImpl {
public BlockRFConverter() {
super("rf_converter", BlockEntityRFConverter::new, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
super("rf_converter", BlockEntityRFConverter.class, Properties.of(Material.STONE).sound(SoundType.STONE).strength(3));
}
@Override

View file

@ -6,7 +6,6 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntitySlimeSplitGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.Slime;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
@ -20,7 +19,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockSlimeSplitGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockSlimeSplitGenerator() {
super("slime_split_generator", BlockEntitySlimeSplitGenerator::new, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
super("slime_split_generator", BlockEntitySlimeSplitGenerator.class, Properties.copy(Blocks.SLIME_BLOCK).strength(2));
MinecraftForge.EVENT_BUS.register(new Events());
}

View file

@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -15,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockSnowCreator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockSnowCreator() {
super("snow_creator", BlockEntitySnowCreator::new, Properties.copy(Blocks.STONE_BRICKS));
super("snow_creator", BlockEntitySnowCreator.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -16,9 +16,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
@ -40,7 +38,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
private static final VoxelShape SHAPE = Shapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
public BlockSpawnLamp() {
super("spawn_lamp", BlockEntitySpawnLamp::new, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
super("spawn_lamp", BlockEntitySpawnLamp.class, Properties.of(Material.METAL).strength(3F).lightLevel(s -> 15).sound(SoundType.METAL));
MinecraftForge.EVENT_BUS.register(this);
}

View file

@ -19,7 +19,6 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BucketPickup;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.api.distmarker.Dist;
@ -31,7 +30,7 @@ import java.util.function.Supplier;
public class BlockSpring extends BlockContainerImpl implements ICustomBlockState, IColorProvidingBlock, IColorProvidingItem, BucketPickup, ICustomRenderType {
public BlockSpring() {
super("spring", BlockEntitySpring::new, Properties.copy(Blocks.STONE_BRICKS));
super("spring", BlockEntitySpring.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.material.Material;
public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
public BlockTimeChanger() {
super("time_changer", BlockEntityTimeChanger::new, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
super("time_changer", BlockEntityTimeChanger.class, Properties.of(Material.STONE).strength(2.5F).sound(SoundType.STONE));
}
@Override

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Blocks;
public class BlockWeatherChanger extends BlockContainerImpl implements ICustomBlockState {
public BlockWeatherChanger() {
super("weather_changer", BlockEntityWeatherChanger::new, Properties.copy(Blocks.STONE_BRICKS));
super("weather_changer", BlockEntityWeatherChanger.class, Properties.copy(Blocks.STONE_BRICKS));
}
@Override

View file

@ -3,11 +3,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityWoodStand;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
@ -15,13 +14,10 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
@ -42,7 +38,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
private static final VoxelShape SHAPE = Shapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
public BlockWoodStand() {
super("wood_stand", BlockEntityWoodStand::new, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
super("wood_stand", BlockEntityWoodStand.class, Properties.of(Material.WOOD).strength(1.5F).sound(SoundType.WOOD));
MinecraftForge.EVENT_BUS.register(this);
}
@ -115,6 +111,6 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
@Override
public void registerTESR() {
BlockEntityRenderers.register(ModTileEntities.WOOD_STAND, RenderWoodStand::new);
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
}
}

View file

@ -26,7 +26,7 @@ public class BlockEntityAncientLeaves extends BlockEntityImpl {
};
public BlockEntityAncientLeaves(BlockPos pos, BlockState state) {
super(ModTileEntities.ANCIENT_LEAVES, pos, state);
super(ModBlockEntities.ANCIENT_LEAVES, pos, state);
}
@Override

View file

@ -13,7 +13,7 @@ import java.util.Set;
public class BlockEntityAnimalContainer extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityAnimalContainer(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_CONTAINER, pos, state);
super(ModBlockEntities.ANIMAL_CONTAINER, pos, state);
}
public int getRadius() {

View file

@ -11,7 +11,7 @@ public class BlockEntityAnimalGenerator extends BlockEntityImpl implements ITick
private int amountToRelease;
public BlockEntityAnimalGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_GENERATOR, pos, state);
super(ModBlockEntities.ANIMAL_GENERATOR, pos, state);
}
@Override

View file

@ -15,7 +15,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
@ -33,7 +32,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
private Entity entityClient;
public BlockEntityAnimalSpawner(BlockPos pos, BlockState state) {
super(ModTileEntities.ANIMAL_SPAWNER, pos, state);
super(ModBlockEntities.ANIMAL_SPAWNER, pos, state);
}
@Override

View file

@ -10,7 +10,7 @@ public class BlockEntityAuraBloom extends BlockEntityImpl implements ITickableBl
public boolean justGenerated;
public BlockEntityAuraBloom(BlockPos pos, BlockState state) {
this(ModTileEntities.AURA_BLOOM, pos, state);
this(ModBlockEntities.AURA_BLOOM, pos, state);
}
protected BlockEntityAuraBloom(BlockEntityType<BlockEntityAuraBloom> type, BlockPos pos, BlockState state) {

View file

@ -10,7 +10,7 @@ public class BlockEntityAuraDetector extends BlockEntityImpl implements ITickabl
public int redstonePower;
public BlockEntityAuraDetector(BlockPos pos, BlockState state) {
super(ModTileEntities.AURA_DETECTOR, pos, state);
super(ModBlockEntities.AURA_DETECTOR, pos, state);
}
@Override

View file

@ -31,7 +31,7 @@ public class BlockEntityAuraTimer extends BlockEntityImpl implements ITickableBl
private int timer;
public BlockEntityAuraTimer(BlockPos pos, BlockState state) {
super(ModTileEntities.AURA_TIMER, pos, state);
super(ModBlockEntities.AURA_TIMER, pos, state);
}
@Override

View file

@ -5,7 +5,6 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.EntitySelector;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
@ -25,7 +24,7 @@ public class BlockEntityAutoCrafter extends BlockEntityImpl implements ITickable
}, 3, 3);
public BlockEntityAutoCrafter(BlockPos pos, BlockState state) {
super(ModTileEntities.AUTO_CRAFTER, pos, state);
super(ModBlockEntities.AUTO_CRAFTER, pos, state);
}
@Override

View file

@ -5,15 +5,12 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
@ -22,7 +19,7 @@ import java.util.List;
public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityBlastFurnaceBooster(BlockPos pos, BlockState state) {
super(ModTileEntities.BLAST_FURNACE_BOOSTER, pos, state);
super(ModBlockEntities.BLAST_FURNACE_BOOSTER, pos, state);
}
@Override

View file

@ -23,7 +23,7 @@ public class BlockEntityChorusGenerator extends BlockEntityImpl implements ITick
private int auraPerBlock;
public BlockEntityChorusGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.CHORUS_GENERATOR, pos, state);
super(ModBlockEntities.CHORUS_GENERATOR, pos, state);
}
@Override

View file

@ -20,7 +20,7 @@ public class BlockEntityChunkLoader extends BlockEntityImpl implements ITickable
private boolean firstTick = true;
public BlockEntityChunkLoader(BlockPos pos, BlockState state) {
super(ModTileEntities.CHUNK_LOADER, pos, state);
super(ModBlockEntities.CHUNK_LOADER, pos, state);
}
@Override

View file

@ -9,14 +9,11 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBlockEntity {
private final BasicAuraContainer container = new BasicAuraContainer(null, 500000) {
@ -46,7 +43,7 @@ public class BlockEntityEndFlower extends BlockEntityImpl implements ITickableBl
public boolean isDrainMode;
public BlockEntityEndFlower(BlockPos pos, BlockState state) {
super(ModTileEntities.END_FLOWER, pos, state);
super(ModBlockEntities.END_FLOWER, pos, state);
}
@Override

View file

@ -76,7 +76,7 @@ public class BlockEntityEnderCrate extends BlockEntityImpl implements MenuProvid
};
public BlockEntityEnderCrate(BlockPos pos, BlockState state) {
super(ModTileEntities.ENDER_CRATE, pos, state);
super(ModBlockEntities.ENDER_CRATE, pos, state);
}
@Override

View file

@ -10,22 +10,17 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.event.world.BlockEvent;
import java.util.List;
public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockPos connectionOffset;
@ -34,7 +29,7 @@ public class BlockEntityFieldCreator extends BlockEntityImpl implements ITickabl
private int chargeTimer;
public BlockEntityFieldCreator(BlockPos pos, BlockState state) {
super(ModTileEntities.FIELD_CREATOR, pos, state);
super(ModBlockEntities.FIELD_CREATOR, pos, state);
}
@Override

View file

@ -5,8 +5,6 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
@ -29,7 +27,7 @@ public class BlockEntityFireworkGenerator extends BlockEntityImpl implements ITi
private int releaseTimer;
public BlockEntityFireworkGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.FIREWORK_GENERATOR, pos, state);
super(ModBlockEntities.FIREWORK_GENERATOR, pos, state);
}
@Override

View file

@ -9,10 +9,8 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.mutable.MutableInt;
@ -27,7 +25,7 @@ public class BlockEntityFlowerGenerator extends BlockEntityImpl implements ITick
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
public BlockEntityFlowerGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.FLOWER_GENERATOR, pos, state);
super(ModBlockEntities.FLOWER_GENERATOR, pos, state);
}
@Override

View file

@ -8,17 +8,14 @@ import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticleStream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.AbstractFurnaceBlock;
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.SmokerBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
@ -31,7 +28,7 @@ public class BlockEntityFurnaceHeater extends BlockEntityImpl implements ITickab
public boolean isActive;
public BlockEntityFurnaceHeater(BlockPos pos, BlockState state) {
super(ModTileEntities.FURNACE_HEATER, pos, state);
super(ModBlockEntities.FURNACE_HEATER, pos, state);
}
public static ContainerData getFurnaceData(AbstractFurnaceBlockEntity tile) {

View file

@ -9,7 +9,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockEntityGeneratorLimitRemover extends BlockEntityImpl {
public BlockEntityGeneratorLimitRemover(BlockPos pos, BlockState state) {
super(ModTileEntities.GENERATOR_LIMIT_REMOVER, pos, state);
super(ModBlockEntities.GENERATOR_LIMIT_REMOVER, pos, state);
}
@Override

View file

@ -5,18 +5,13 @@ import de.ellpeck.naturesaura.blocks.BlockGratedChute;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import java.util.List;
public class BlockEntityGratedChute extends BlockEntityImpl implements ITickableBlockEntity {
public boolean isBlacklist;
@ -34,7 +29,7 @@ public class BlockEntityGratedChute extends BlockEntityImpl implements ITickable
private int cooldown;
public BlockEntityGratedChute(BlockPos pos, BlockState state) {
super(ModTileEntities.GRATED_CHUTE, pos, state);
super(ModBlockEntities.GRATED_CHUTE, pos, state);
}
@Override

View file

@ -13,14 +13,11 @@ import net.minecraft.world.level.block.entity.HopperBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.List;
public class BlockEntityHopperUpgrade extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityHopperUpgrade(BlockPos pos, BlockState state) {
super(ModTileEntities.HOPPER_UPGRADE, pos, state);
super(ModBlockEntities.HOPPER_UPGRADE, pos, state);
}
private static boolean isValidHopper(BlockEntity tile) {

View file

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -19,7 +18,7 @@ public class BlockEntityItemDistributor extends BlockEntityImpl implements ITick
public boolean isRandomMode;
public BlockEntityItemDistributor(BlockPos pos, BlockState state) {
super(ModTileEntities.ITEM_DISTRIBUTOR, pos, state);
super(ModBlockEntities.ITEM_DISTRIBUTOR, pos, state);
}
@Override

View file

@ -15,7 +15,7 @@ import java.util.List;
public class BlockEntityMossGenerator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityMossGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.MOSS_GENERATOR, pos, state);
super(ModBlockEntities.MOSS_GENERATOR, pos, state);
}
@Override

View file

@ -65,7 +65,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
private boolean firstTick = true;
public BlockEntityNatureAltar(BlockPos pos, BlockState state) {
super(ModTileEntities.NATURE_ALTAR, pos, state);
super(ModBlockEntities.NATURE_ALTAR, pos, state);
}
@Override

View file

@ -14,7 +14,7 @@ public class BlockEntityOakGenerator extends BlockEntityImpl implements ITickabl
public Queue<BlockPos> scheduledBigTrees = new ArrayDeque<>();
public BlockEntityOakGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.OAK_GENERATOR, pos, state);
super(ModBlockEntities.OAK_GENERATOR, pos, state);
}
@Override

View file

@ -9,9 +9,7 @@ import de.ellpeck.naturesaura.recipes.OfferingRecipe;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -23,7 +21,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickableBlockEntity {
@ -37,7 +34,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
private final Queue<ItemStack> itemsToSpawn = new ArrayDeque<>();
public BlockEntityOfferingTable(BlockPos pos, BlockState state) {
super(ModTileEntities.OFFERING_TABLE, pos, state);
super(ModBlockEntities.OFFERING_TABLE, pos, state);
}
private OfferingRecipe getRecipe(ItemStack input) {

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockEntityPickupStopper extends BlockEntityImpl {
public BlockEntityPickupStopper(BlockPos pos, BlockState state) {
super(ModTileEntities.PICKUP_STOPPER, pos, state);
super(ModBlockEntities.PICKUP_STOPPER, pos, state);
}
public float getRadius() {

View file

@ -13,15 +13,12 @@ import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.ArrayList;
import java.util.List;
@ -29,7 +26,7 @@ import java.util.List;
public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityPlacer(BlockPos pos, BlockState state) {
super(ModTileEntities.PLACER, pos, state);
super(ModBlockEntities.PLACER, pos, state);
}
@Override

View file

@ -4,20 +4,15 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.core.BlockPos;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITickableBlockEntity {
public BlockEntityPotionGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.POTION_GENERATOR, pos, state);
super(ModBlockEntities.POTION_GENERATOR, pos, state);
}
@Override

View file

@ -5,19 +5,14 @@ import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.List;
public class BlockEntityPowderPlacer extends BlockEntityImpl {
public BlockEntityPowderPlacer(BlockPos pos, BlockState state) {
super(ModTileEntities.POWDER_PLACER, pos, state);
super(ModBlockEntities.POWDER_PLACER, pos, state);
}
@Override

View file

@ -10,7 +10,7 @@ public class BlockEntityProjectileGenerator extends BlockEntityImpl {
public Direction nextSide = Direction.NORTH;
public BlockEntityProjectileGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.PROJECTILE_GENERATOR, pos, state);
super(ModBlockEntities.PROJECTILE_GENERATOR, pos, state);
}
@Override

View file

@ -9,7 +9,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
@ -26,7 +25,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
private int lastEnergy;
public BlockEntityRFConverter(BlockPos pos, BlockState state) {
super(ModTileEntities.RF_CONVERTER, pos, state);
super(ModBlockEntities.RF_CONVERTER, pos, state);
}
@Override

View file

@ -15,7 +15,7 @@ public class BlockEntitySlimeSplitGenerator extends BlockEntityImpl implements I
private int color;
public BlockEntitySlimeSplitGenerator(BlockPos pos, BlockState state) {
super(ModTileEntities.SLIME_SPLIT_GENERATOR, pos, state);
super(ModBlockEntities.SLIME_SPLIT_GENERATOR, pos, state);
}
@Override

View file

@ -13,7 +13,6 @@ import net.minecraft.world.entity.animal.SnowGolem;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickableBlockEntity {
@ -21,7 +20,7 @@ public class BlockEntitySnowCreator extends BlockEntityImpl implements ITickable
private int snowmanCount;
public BlockEntitySnowCreator(BlockPos pos, BlockState state) {
super(ModTileEntities.SNOW_CREATOR, pos, state);
super(ModBlockEntities.SNOW_CREATOR, pos, state);
}
public int getRange() {

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.state.BlockState;
public class BlockEntitySpawnLamp extends BlockEntityImpl {
public BlockEntitySpawnLamp(BlockPos pos, BlockState state) {
super(ModTileEntities.SPAWN_LAMP, pos, state);
super(ModBlockEntities.SPAWN_LAMP, pos, state);
}
public int getRadius() {

View file

@ -11,7 +11,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.common.FarmlandWaterManager;
@ -30,7 +29,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
private AABBTicket waterTicket;
public BlockEntitySpring(BlockPos pos, BlockState state) {
super(ModTileEntities.SPRING, pos, state);
super(ModBlockEntities.SPRING, pos, state);
}
@Override

View file

@ -9,26 +9,21 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.phys.AABB;
import java.util.List;
public class BlockEntityTimeChanger extends BlockEntityImpl implements ITickableBlockEntity {
private long goalTime;
public BlockEntityTimeChanger(BlockPos pos, BlockState state) {
super(ModTileEntities.TIME_CHANGER, pos, state);
super(ModBlockEntities.TIME_CHANGER, pos, state);
}
@Override

View file

@ -14,9 +14,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
import java.util.Map;
public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITickableBlockEntity {
private int processTime;
@ -24,7 +21,7 @@ public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITicka
private int itemAmount;
public BlockEntityWeatherChanger(BlockPos pos, BlockState state) {
super(ModTileEntities.WEATHER_CHANGER, pos, state);
super(ModBlockEntities.WEATHER_CHANGER, pos, state);
}
@Override

View file

@ -17,7 +17,6 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
@ -40,7 +39,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
private int timer;
public BlockEntityWoodStand(BlockPos pos, BlockState state) {
super(ModTileEntities.WOOD_STAND, pos, state);
super(ModBlockEntities.WOOD_STAND, pos, state);
}
public void setRitual(BlockPos pos, TreeRitualRecipe recipe) {

View file

@ -1,8 +1,14 @@
package de.ellpeck.naturesaura.blocks.tiles;
// TODO actually call this from the base entity block thing, and possibly others if not all use the base one!
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
public interface ITickableBlockEntity {
void tick();
static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> actual, BlockEntityType<E> expected) {
return expected == actual ? (l, p, s, e) -> ((ITickableBlockEntity) e).tick() : null;
}
}

View file

@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.world.level.block.entity.BlockEntityType;
@SuppressWarnings("FieldNamingConvention")
public final class ModTileEntities {
public final class ModBlockEntities {
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
public static BlockEntityType<BlockEntityAnimalGenerator> ANIMAL_GENERATOR;

View file

@ -6,7 +6,7 @@ import de.ellpeck.naturesaura.api.misc.ILevelData;
import de.ellpeck.naturesaura.blocks.*;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
import de.ellpeck.naturesaura.entities.*;
@ -236,7 +236,7 @@ public final class ModRegistry {
if (item instanceof ModTileType type)
event.getRegistry().register(type.type);
}
Helper.populateObjectHolders(ModTileEntities.class, event.getRegistry());
Helper.populateObjectHolders(ModBlockEntities.class, event.getRegistry());
}
@SubscribeEvent