Jump to content

Entity Item


ashtonr12

Recommended Posts

i dont know much about entity items but i had a good idea for a mod. so my question is,

Is it possible to make a certain entity item check what block it landed on/is on and then do something?

eg if a rotten flesh lands on a dirt could i put a block of waste on top of the dirt?

if you have seen/done this before any help would be great as it sound quite hard to programme this to me and this has to be done without editing base classes as per always :)

Thankyou!

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

If you have access to the location of the entityItem then I'm not sure how it could be a problem?

 

entityItem extends Entity, so all entityItem's have a XYZ position which you can use.

and every entity has a world which it is inn. What more do you need to know to do what you want to? :)

 

Edit:

 

IF it's an custom item it's sure quite easy to check it's position on update etc.

As for messing with a vanilla entityItem I'm not sure how you could do that easily, my first guess would be reflection and such but there are probably easier ways to do that.

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

What i suggest is using an entity spawn event, then use entity instanceof entityItem, then if entityItem.itemStack.id-256 = rottenflesh.id, then convert the items position to an int, check if the block at that position-1 is grass, then replacing it.

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Link to comment
Share on other sites

ok so  im not to great with java atm but i found this

 

http://linode.narc.ro/forge-javadoc/net/minecraftforge/event/entity/living/LivingSpawnEvent.html

 

but i dont know how to use it :/

 

An example would be most helpful but i can understand if you don't want to provide one as some people think it is you writing my mod for me, as  i have been told before :)

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

Step 1: Make a new class

Step 2: Extend the event class that has the method your looking for (all of them are in minecraftforge.events)

Step 3: Override the method your looking for

Step 4: in your main class, in init put minecraftforge.registerEventBus

 

Also I think you may want to do an entity update , then check if it's on the ground, then check the rest

 

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Link to comment
Share on other sites

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.