Procedure Help

Started by KreatorB on

Topic category: Help with modding (Java Edition)

Last seen on 20:06, 5. Feb 2023
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Procedure Help

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

Last seen on 20:06, 5. Feb 2023
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have posted a image of the…
Mon, 09/17/2018 - 22:49

I have posted a image of the random leaf drops

here is the link

 

Last seen on 20:06, 5. Feb 2023
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe this will help I have…
Sat, 09/22/2018 - 01:13

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