Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

good nigths

i wanna make the zoombies drop mi custom seeds when dieded but it seems its dont wants to work

reading some guides i reach to this two methods but eithers works

 

  @EventHandler
    public void onEntityDrop(LivingDropsEvent event){
	  
	  
	  System.out.println("\nLivingDropsEvent");
	  
	if(event.entity instanceof EntityZombie){

		EntityZombie zom = (EntityZombie) event.entity;

		  int R = ((int) (Math.random() * 3)) ;
		  
		  Item tudrop = null;
		  
		  switch (R)
		  {
		  case 0: tudrop = MercenaryModItems.hierbaVerdeSemilla;
		  case 1: tudrop = MercenaryModItems.hierbaRojaSemilla;
		  case 2: tudrop = MercenaryModItems.hierbaAmarillaSemilla;
		  case 3: tudrop = MercenaryModItems.hierbaAzulSemilla;
		  }
		  
		  BlockPos bzom = zom.getPosition().add(0,1,0);
		  World bworld = zom.getEntityWorld();
		  
		  bworld.spawnEntityInWorld(new EntityItem(bworld, bzom.getX(), bzom.getY(), bzom.getZ(), new ItemStack(tudrop ,1,0)));

	}

	} 



  @EventHandler
    public void onEDeath(LivingDeathEvent   event)
    {
	  
	  System.out.println("\nLivingDeathEvent");
        //drops the item

	  if (event.entity instanceof EntityZombie) {
		  
		  EntityZombie zom = (EntityZombie) event.entity;
		  
		  System.out.println("\nZOMMMBIE");

		  int R = ((int) (Math.random() * 3)) ;
		  
		  Item tudrop = null;
		  
		  switch (R)
		  {
		  case 0: tudrop = MercenaryModItems.hierbaVerdeSemilla;
		  case 1: tudrop = MercenaryModItems.hierbaRojaSemilla;
		  case 2: tudrop = MercenaryModItems.hierbaAmarillaSemilla;
		  case 3: tudrop = MercenaryModItems.hierbaAzulSemilla;
		  }
		  
		  BlockPos bzom = zom.getPosition().add(0,1,0);
		  World bworld = zom.getEntityWorld();
		  
		  bworld.spawnEntityInWorld(new EntityItem(bworld, bzom.getX(), bzom.getY(), bzom.getZ(), new ItemStack(tudrop ,1,0)));

		   
	  }
	   

    }

 

some one can point wath i been doing wrong

 

thanks for reading

  • Author

eee

 

upss

 

Fixed

// Zombie drops
@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event) {

	if (event.entity instanceof EntityZombie) {

		int R = ((int) (Math.random() * 100));

//5%
		if (R > 94) {
			event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(MercenaryModItems.hierbaVerdeSemilla, 1)));
		}

//2%
		R = ((int) (Math.random() * 100));
		if (R > 98) {
			event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(MercenaryModItems.hierbaRojaSemilla, 1)));
		}
//2%
		R = ((int) (Math.random() * 100));
		if (R > 98) {
			event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(MercenaryModItems.hierbaAzulSemilla, 1)));
		}
//not for now
		R = ((int) (Math.random() * 100));
		if (R > 100) {
			event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(MercenaryModItems.hierbaAmarillaSemilla, 1)));
		}

	}

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.