reactivated itemhoarder and lavahoarder
This commit is contained in:
parent
21923dac80
commit
fdc304eb28
@ -46,15 +46,18 @@ public class EmptyLavaHoarderBlockEntity extends BlockEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void tick(World world, BlockPos pos, BlockState state, EmptyLavaHoarderBlockEntity be) {
|
||||
boolean found = be.suckLava(world, pos.north());
|
||||
found = found || be.suckLava(world, pos.south());
|
||||
found = found || be.suckLava(world, pos.east());
|
||||
found = found || be.suckLava(world, pos.west());
|
||||
found = found || be.suckLava(world, pos.up());
|
||||
found = found || be.suckLava(world, pos.down());
|
||||
public static void tick(World world, BlockPos pos, BlockState state, BlockEntity be) {
|
||||
if (be instanceof EmptyLavaHoarderBlockEntity) {
|
||||
EmptyLavaHoarderBlockEntity elhbe = (EmptyLavaHoarderBlockEntity) be;
|
||||
boolean found = elhbe.suckLava(world, pos.north());
|
||||
found = found || elhbe.suckLava(world, pos.south());
|
||||
found = found || elhbe.suckLava(world, pos.east());
|
||||
found = found || elhbe.suckLava(world, pos.west());
|
||||
found = found || elhbe.suckLava(world, pos.up());
|
||||
found = found || elhbe.suckLava(world, pos.down());
|
||||
if (found) {
|
||||
world.setBlockState(pos, QuickieBlocks.LAVAHOARDER.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.LootableContainerBlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.Entity.RemovalReason;
|
||||
@ -59,8 +60,10 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void tick(World world, BlockPos pos, BlockState state, ItemHoarderBlockEntity be) {
|
||||
Box box = new Box(pos).expand(be.getSuckradius());
|
||||
public static void tick(World world, BlockPos pos, BlockState state, BlockEntity be) {
|
||||
if (be instanceof ItemHoarderBlockEntity) {
|
||||
ItemHoarderBlockEntity ihbe = (ItemHoarderBlockEntity) be;
|
||||
Box box = new Box(pos).expand(ihbe.getSuckradius());
|
||||
List<Entity> entities = world.getOtherEntities(null, box);
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof ItemEntity) {
|
||||
@ -68,7 +71,7 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
|
||||
if (itemEntity.isAlive()) {
|
||||
ItemStack stack = itemEntity.getStack();
|
||||
if (stack != null) {
|
||||
if (ItemHoarderBlockEntity.setStackToSlots(stack, be.getStacks())) {
|
||||
if (ItemHoarderBlockEntity.setStackToSlots(stack, ihbe.getStacks())) {
|
||||
itemEntity.remove(RemovalReason.DISCARDED);
|
||||
} // else inventory is full
|
||||
}
|
||||
@ -76,6 +79,7 @@ public class ItemHoarderBlockEntity extends LootableContainerBlockEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound writeNbt(NbtCompound nbt) {
|
||||
|
@ -9,9 +9,12 @@ import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext.Builder;
|
||||
@ -42,6 +45,16 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider {
|
||||
return new ItemHoarderBlockEntity(pos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
|
||||
return (world1, pos, state1, be) -> ItemHoarderBlockEntity.tick(world1, pos, state1, be);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
|
@ -8,9 +8,12 @@ import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEnti
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -38,6 +41,16 @@ public class BlockLavahoarder extends Block implements BlockEntityProvider {
|
||||
return new EmptyLavaHoarderBlockEntity(pos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type){
|
||||
return (world1, pos, state1, be) -> EmptyLavaHoarderBlockEntity.tick(world1, pos, state1, be);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.ItemHoarderBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.MonsterHoarderBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blockentity.QuickieFabricBlockEntity;
|
||||
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
|
||||
@ -25,7 +27,6 @@ import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ComposterBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType.Builder;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@ -168,13 +169,13 @@ public class RegistryManager {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final void registerBlockEntities() {
|
||||
LOGGER.debug("registering quickiefabric block entities");
|
||||
// QuickieFabricBlockEntity.ITEMHOARDER = (BlockEntityType<ItemHoarderBlockEntity>) registerBlockEntity(
|
||||
// "itemhoarderblockentity", ItemHoarderBlockEntity::new, QuickieBlocks.ITEMHOARDER);
|
||||
QuickieFabricBlockEntity.ITEMHOARDER = (BlockEntityType<ItemHoarderBlockEntity>) registerBlockEntity(
|
||||
"itemhoarderblockentity", ItemHoarderBlockEntity::new, QuickieBlocks.ITEMHOARDER);
|
||||
QuickieFabricBlockEntity.MONSTERHOARDER = (BlockEntityType<MonsterHoarderBlockEntity>) registerBlockEntity(
|
||||
"monsterhoarderblockentity", MonsterHoarderBlockEntity::new, QuickieBlocks.MONSTERHOARDER);
|
||||
// QuickieFabricBlockEntity.EMPTYLAVAHOARDER = (BlockEntityType<EmptyLavaHoarderBlockEntity>) registerBlockEntity(
|
||||
// "emptylavahoarderblockentity", EmptyLavaHoarderBlockEntity::new, QuickieBlocks.EMPTYLAVAHOARDER,
|
||||
// QuickieBlocks.LAVAHOARDER);
|
||||
QuickieFabricBlockEntity.EMPTYLAVAHOARDER = (BlockEntityType<EmptyLavaHoarderBlockEntity>) registerBlockEntity(
|
||||
"emptylavahoarderblockentity", EmptyLavaHoarderBlockEntity::new, QuickieBlocks.EMPTYLAVAHOARDER,
|
||||
QuickieBlocks.LAVAHOARDER);
|
||||
// QuickieFabricBlockEntity.DRILL_DOWN = (BlockEntityType<DrillBlockDownEntity>) registerBlockEntity("drillblockdownentity",
|
||||
// DrillBlockDownEntity::new, QuickieBlocks.DRILL_DOWN);
|
||||
// QuickieFabricBlockEntity.DRILL_EAST = (BlockEntityType<DrillBlockEastEntity>) registerBlockEntity("drillblockeastentity",
|
||||
|
Loading…
x
Reference in New Issue
Block a user