Jump to content

[1.11.2] Checking if an anvil falls on a block


megaloloful

Recommended Posts

Hello everybody! I'm currently learning how to write minecraft mods and I'm trying to make a techy mod without machines. And i'm trying to implement crushing as an anvil falling on a block. This is my code right now: http://pastebin.com/BKYgx2Su But it doesn't work. It would be really nice if somebody could help me with this problem. thanks in advance^^

Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

On top of what @Pingubro already said, LivingDeathEvent will not fire for anvil entities, mainly because an anvil is not alive.

Yeah aenterprise just wrote me on twitter I have to hook into the world to check when entitys get removed. But he doesn't know how since he hasn't modded since 1.6.4 could you please help me on this? 

Link to comment
Share on other sites

40 minutes ago, diesieben07 said:

Implement IWorldEventListener and register it to every (server) world in WorldEvent.Load. Then you will get notified via the onEntityRemoved method.

right..

So This is my crushing class rn http://pastebin.com/na0sy5ui

This is the Mod Class http://pastebin.com/9Kz1iS8X

And this is my WorldEvent class http://pastebin.com/fydY3nGQ

But I still get some errors. Sorry if I did some things utterly wrong. I'm new to modding

Link to comment
Share on other sites

9 minutes ago, diesieben07 said:

No, you are new to Java. Basic Java knowledge is required for making a mod. Your code is not even remotely close to being valid Java code.

Jeah sorry, I've only had a semester of java like 3 years ago and I haven't done any coding since. Sorry for wasting your time

Link to comment
Share on other sites

Ok,

I try to explain what I have investigated about the things diesieben7 said and what you are doing:

1. You use the FALSE event. You need to register/listen to the "WorldEvent.Load" and use getWorld(). Then you need to inject your IWorldEventListener using addEventListener.

2. You are getting Errors because you are implementing an Interface so you HAVE TO implement all given Methods. In your IWorldEventListener Class you are only overriding one

Method. Not all Methods need a correct implementation only the ones you are using but you need to have the signatures in your Class. If you are using an IDE this should be easy to solve.

 

I hope you can get your major mistakes now.

 

P.S. dont quit now you may need to read and learn. 

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.



×
×
  • Create New...

Important Information

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