rebalanced lava hoarder item spawn

This commit is contained in:
Jörg Henke 2021-01-02 17:36:18 +01:00
parent 26f529f672
commit 3e16e93cc8
3 changed files with 24 additions and 17 deletions

View File

@ -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

View File

@ -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;

View File

@ -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());
}
}