diff --git a/gradle.properties b/gradle.properties index e6fa1d5..1282ab0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.10.6+build.214 # Mod Properties - mod_version = 1.16.4.3 + mod_version = 1.16.4.4 maven_group = de.jottyfan.minecraft archives_base_name = quickiefabric diff --git a/src/main/java/de/jottyfan/minecraft/quickiefabric/blockentity/EmptyLavaHoarderBlockEntity.java b/src/main/java/de/jottyfan/minecraft/quickiefabric/blockentity/EmptyLavaHoarderBlockEntity.java index 0c22f39..df7c4d0 100644 --- a/src/main/java/de/jottyfan/minecraft/quickiefabric/blockentity/EmptyLavaHoarderBlockEntity.java +++ b/src/main/java/de/jottyfan/minecraft/quickiefabric/blockentity/EmptyLavaHoarderBlockEntity.java @@ -8,7 +8,6 @@ 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; @@ -37,18 +36,11 @@ public class EmptyLavaHoarderBlockEntity extends BlockEntity implements Tickable } 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)))); + Random random = new Random(); + if (random.nextFloat() > 0.9f) { + world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(), + new ItemStack(QuickieItems.SULPHOR, 1 + new Random().nextInt(4)))); + } return true; } return false; diff --git a/src/main/java/de/jottyfan/minecraft/quickiefabric/blocks/BlockLavahoarder.java b/src/main/java/de/jottyfan/minecraft/quickiefabric/blocks/BlockLavahoarder.java index 9e3b7e8..2500339 100644 --- a/src/main/java/de/jottyfan/minecraft/quickiefabric/blocks/BlockLavahoarder.java +++ b/src/main/java/de/jottyfan/minecraft/quickiefabric/blocks/BlockLavahoarder.java @@ -2,6 +2,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks; import java.util.ArrayList; import java.util.List; +import java.util.Random; import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; @@ -27,7 +28,7 @@ import net.minecraft.world.World; * @author jotty * */ -public class BlockLavahoarder extends Block implements BlockEntityProvider { +public class BlockLavahoarder extends Block implements BlockEntityProvider { public BlockLavahoarder() { super(FabricBlockSettings.of(Material.STONE).hardness(2.5f).luminance(16)); @@ -54,8 +55,22 @@ public class BlockLavahoarder extends Block implements BlockEntityProvider { Integer amount = handStack.getCount(); ItemStack lavaBucketStack = new ItemStack(Items.LAVA_BUCKET, 1); ItemStack emptyBucketStack = new ItemStack(Items.BUCKET, amount - 1); - player.setStackInHand(hand, emptyBucketStack); - world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), lavaBucketStack)); + if (emptyBucketStack.getCount() < 1) { + player.setStackInHand(hand, lavaBucketStack); + } else { + player.setStackInHand(hand, emptyBucketStack); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), lavaBucketStack)); + } + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), + new ItemStack(Items.DIAMOND, new Random().nextInt(2)))); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), + new ItemStack(Items.EMERALD, new Random().nextInt(2)))); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), + new ItemStack(Items.GOLD_NUGGET, new Random().nextInt(2)))); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), + new ItemStack(Items.IRON_NUGGET, new Random().nextInt(2)))); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), + new ItemStack(Items.LAPIS_LAZULI, new Random().nextInt(2)))); world.setBlockState(pos, QuickieBlocks.EMPTYLAVAHOARDER.getDefaultState()); } }