Procedure Help

Started by KreatorB on Mon, 09/17/2018 - 22:46

Topic category: Help with MCreator modding

Last seen on 21:38, 4. Aug 2019
Joined May 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Procedure Help
Mon, 09/17/2018 - 22:46

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 21:38, 4. Aug 2019
Joined May 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 21:38, 4. Aug 2019
Joined May 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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