Jump to content

Recommended Posts

Posted

 

good days

 

i been working in a custome villager, and end in the conclusion than the best way to make it spawn in all the villages including mod villages is to catch the event when a vainilla villager spawns in the world and spawns mi villager in that same spot.

 

but for reasons i end whith villages whith 10 vainilla villagers and 200 of mi custome villagers when there must be like three or four  max 6

 

 

i been using this

i tink for some reason is trigering more than one time per spawned villager

 

// ########################################################################################################################3
// replace mobs
@SubscribeEvent
public void onEntityEnter(EnteringChunk event) {

	boolean disable = false;
	boolean enable = true;

	if ( enable & event.entity instanceof EntityVillager & !(event.entity instanceof aldeanoMercenario )) {

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


		if (R < 60)
		{

			mercenarymod.entidades.aldeanoMercenario aldeanoMercenario = new mercenarymod.entidades.aldeanoMercenario(event.entity.worldObj);

			aldeanoMercenario.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
			event.entity.worldObj.spawnEntityInWorld(aldeanoMercenario);
			//event.entity.setDead();
		}

	}
	}

 

 

 

¿¿¿ another event bether suited for this or another solution  would be very apreciated

 

Thanks for reading

 

Posted
EntityJoinWorldEvent

is fired when an entity is spawned in the world. You can cancel it to prevent the entity from spawning.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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