Started by
KreatorB
on
Topic category: Help with Minecraft modding (Java Edition)
I was wondering if anyone knew how to add a random drop amount to a Spawn gem procedure.
I have the random drop in place using else if and else.
I also want to know if anyone also knew of a procedure to despawn leaves after the braking of the touching logs?
Any ideas would be great.
thank you
I have posted a image of the random leaf drops
here is the link
Maybe this will help I have this Code
int x = (int) dependencies.get("x");
int y = (int) dependencies.get("y");
int z = (int) dependencies.get("z");
World world = (World) dependencies.get("world");
if ((Math.random() < 0.7)) {
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
if (!world.isRemote) {
EntityItem entityToSpawn = new EntityItem(world, x, y, z, new ItemStack(mcreator_crateNutFood.block, (int) (1)));
entityToSpawn.setPickupDelay(10);
world.spawnEntity(entityToSpawn);
}
} else if ((Math.random() < 0.1)) {
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
if (!world.isRemote) {
EntityItem entityToSpawn = new EntityItem(world, x, y, z, new ItemStack(mcreator_crateStick.block, (int) (1)));
entityToSpawn.setPickupDelay(10);
world.spawnEntity(entityToSpawn);
}
} else if ((Math.random() < 0.2)) {
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
if (!world.isRemote) {
EntityItem entityToSpawn = new EntityItem(world, x, y, z, new ItemStack(Blocks.AIR, (int) (1)));
entityToSpawn.setPickupDelay(10);
world.spawnEntity(entityToSpawn);
}
} else {
world.setBlockToAir(new BlockPos((int) x, (int) y, (int) z));
}
And I am trying to add the random to the ItemStack(mcreator_crateNutFood.block, (int) (1))); and ItemStack(mcreator_crateStick.block, (int) (1)));
I have been playing with the following if it helps!
public int quantityDropped(EntityItem entityToSpawn, int fortune, Random random) {
return random.nextInt(5) + 1;
}
Any ides or thought would be amazing!
Thank You