fixed monster hoarder block entity
This commit is contained in:
parent
292c0746c1
commit
21923dac80
@ -18,19 +18,22 @@ import net.minecraft.world.World;
|
||||
public class MonsterHoarderBlockEntity extends BlockEntity {
|
||||
|
||||
private float suckradius;
|
||||
|
||||
|
||||
public MonsterHoarderBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(QuickieFabricBlockEntity.MONSTERHOARDER, pos, state);
|
||||
setSuckradius(8f); // TODO: make it level up - able and start with 2
|
||||
}
|
||||
|
||||
public static void tick(World world, BlockPos pos, BlockState state, MonsterHoarderBlockEntity be) {
|
||||
Box box = new Box(pos).expand(be.getSuckradius());
|
||||
List<Entity> entities = world.getOtherEntities(null, box);
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof HostileEntity) {
|
||||
HostileEntity mobEntity = (HostileEntity) entity;
|
||||
mobEntity.setOnFireFor(90);
|
||||
public static void tick(World world, BlockPos pos, BlockState state, BlockEntity be) {
|
||||
if (be instanceof MonsterHoarderBlockEntity) {
|
||||
MonsterHoarderBlockEntity mhbe = (MonsterHoarderBlockEntity) be;
|
||||
Box box = new Box(pos).expand(mhbe.getSuckradius());
|
||||
List<Entity> entities = world.getOtherEntities(null, box);
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof HostileEntity) {
|
||||
HostileEntity mobEntity = (HostileEntity) entity;
|
||||
mobEntity.setOnFireFor(90);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ public class BlockMonsterhoarder extends Block implements BlockEntityProvider {
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
|
||||
return checkType(type, QuickieBlocks.MONSTERHOARDER, (world1, pos, state1, be) -> MonsterHoarderBlockEntity.tick(world1, pos, state1, be));
|
||||
return (world1, pos, state1, be) -> MonsterHoarderBlockEntity.tick(world1, pos, state1, be);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
|
@ -160,7 +160,7 @@ public class RegistryManager {
|
||||
public static final <T extends BlockEntity> BlockEntityType<? extends T> registerBlockEntity(String name,
|
||||
FabricBlockEntityTypeBuilder.Factory<? extends T> supplier, Block... blocks) {
|
||||
String fullname = new StringBuilder().append(QUICKIEFABRIC).append(":").append(name).toString();
|
||||
Builder<? extends T> builder = FabricBlockEntityTypeBuilder.create(supplier, blocks);
|
||||
FabricBlockEntityTypeBuilder<? extends T> builder = FabricBlockEntityTypeBuilder.create(supplier, blocks);
|
||||
BlockEntityType<? extends T> blockEntityType = builder.build(null);
|
||||
return Registry.register(Registry.BLOCK_ENTITY_TYPE, fullname, blockEntityType);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user