Jump to content

Recommended Posts

Posted

Look at the code for render player.  I've found it helpful to limit the distance it can be seen as well as direct line of sight.  Avoids detection through wall.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

@Elyon it worked :) thank you

 

EDIT:

How would i get it to say something when the custom entity dies? In my case i need it to say "Smith was killed by Player"

Posted

@Elyon it worked :) thank you

 

EDIT:

How would i get it to say something when the custom entity dies? In my case i need it to say "Smith was killed by Player"

 

If it is your custom entity, you can override the onDeath() method.

 

For general entities you can use handle the LivingDeathEvent.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Make a list of all the player entities in the world and use a for loop to go through them and add a message to all of them.

 

I have something similar in my mod, and this is how I would use it in your case (put it all in the event or method of your preference):

 

List<EntityPlayerMP> players = world.playerEntities;

for (int i = 0; i < players.size(); i++) {
players.get(i).addChatMessage(/* Insert Message Here */);
}

 

You could probably also do:

 

for (EntityPlayerMP player : world.playerEntities) {
player.addChatMessage(/* Insert Message Here */);
}

 

I don't know about the second method, but the first method works fine for me.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information

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.