rebalanced lava hoarder item spawn
This commit is contained in:
parent
26f529f672
commit
3e16e93cc8
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.10.6+build.214
|
loader_version=0.10.6+build.214
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.16.4.3
|
mod_version = 1.16.4.4
|
||||||
maven_group = de.jottyfan.minecraft
|
maven_group = de.jottyfan.minecraft
|
||||||
archives_base_name = quickiefabric
|
archives_base_name = quickiefabric
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import net.minecraft.block.Blocks;
|
|||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.util.Tickable;
|
import net.minecraft.util.Tickable;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
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())) {
|
} else if (Blocks.LAVA.equals(world.getBlockState(pos).getBlock())) {
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
BlockPos up = pos.up();
|
BlockPos up = pos.up();
|
||||||
|
Random random = new Random();
|
||||||
|
if (random.nextFloat() > 0.9f) {
|
||||||
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
|
world.spawnEntity(new ItemEntity(world, up.getX(), up.getY(), up.getZ(),
|
||||||
new ItemStack(QuickieItems.SULPHOR, new Random().nextInt(4))));
|
new ItemStack(QuickieItems.SULPHOR, 1 + 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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2,6 +2,7 @@ package de.jottyfan.minecraft.quickiefabric.blocks;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
|
import de.jottyfan.minecraft.quickiefabric.blockentity.EmptyLavaHoarderBlockEntity;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
@ -54,8 +55,22 @@ public class BlockLavahoarder extends Block implements BlockEntityProvider {
|
|||||||
Integer amount = handStack.getCount();
|
Integer amount = handStack.getCount();
|
||||||
ItemStack lavaBucketStack = new ItemStack(Items.LAVA_BUCKET, 1);
|
ItemStack lavaBucketStack = new ItemStack(Items.LAVA_BUCKET, 1);
|
||||||
ItemStack emptyBucketStack = new ItemStack(Items.BUCKET, amount - 1);
|
ItemStack emptyBucketStack = new ItemStack(Items.BUCKET, amount - 1);
|
||||||
|
if (emptyBucketStack.getCount() < 1) {
|
||||||
|
player.setStackInHand(hand, lavaBucketStack);
|
||||||
|
} else {
|
||||||
player.setStackInHand(hand, emptyBucketStack);
|
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(), 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());
|
world.setBlockState(pos, QuickieBlocks.EMPTYLAVAHOARDER.getDefaultState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user