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

Hello MCF forums,

How would i make my custom mob have a name over his head just like if i were to name a pig for example?

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

  • Author

@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"

@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/

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
  • Author

@Mitchellbrine Ok so i was doing that but what list is it (theres four of them when i try to import it)

  • Author

Oh LOL but how do i get that player that killed it?

 

EDIT: im not good with list ok im sorry!

  • Author

Ok like i said before i never worked with chat related thing until now so i dont know how i would do that.

  • Author
:P Thank you i actually tried that before but it didnt come up in Eclipse's sugestions box, it turns out i just misspelled it.

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.