enhanced lava hoarder

This commit is contained in:
Jörg Henke 2020-11-07 01:11:45 +01:00
parent 6e67d3f422
commit 71730f3172
2 changed files with 19 additions and 6 deletions

View File

@ -1,11 +1,14 @@
package de.jottyfan.minecraft.quickiefabric.blockentity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Random;
import de.jottyfan.minecraft.quickiefabric.blocks.QuickieBlocks;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -17,11 +20,8 @@ import net.minecraft.world.World;
*/
public class EmptyLavaHoarderBlockEntity extends BlockEntity implements Tickable {
private final Logger LOGGER = LogManager.getLogger(EmptyLavaHoarderBlockEntity.class);
public EmptyLavaHoarderBlockEntity() {
super(QuickieFabricBlockEntity.EMPTYLAVAHOARDER);
LOGGER.error("created empty lava hoarder block entity");
}
/**
@ -36,6 +36,19 @@ public class EmptyLavaHoarderBlockEntity extends BlockEntity implements Tickable
return false;
} else if (Blocks.LAVA.equals(world.getBlockState(pos).getBlock())) {
world.setBlockState(pos, Blocks.AIR.getDefaultState());
BlockPos up = pos.up();
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(QuickieItems.SULPHOR, new Random().nextInt(4))));
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(Items.DIAMOND, new Random().nextInt(2))));
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(Items.EMERALD, new Random().nextInt(2))));
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(Items.GOLD_NUGGET, new Random().nextInt(10))));
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(Items.IRON_NUGGET, new Random().nextInt(6))));
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
new ItemStack(Items.LAPIS_LAZULI, new Random().nextInt(5))));
return true;
}
return false;

View File

@ -30,7 +30,7 @@ import net.minecraft.world.World;
public class BlockLavahoarder extends Block implements BlockEntityProvider {
public BlockLavahoarder() {
super(FabricBlockSettings.of(Material.STONE).hardness(2.5f).lightLevel(16));
super(FabricBlockSettings.of(Material.STONE).hardness(2.5f).luminance(16));
}
@Override