Jump to content

Recommended Posts

Posted

I've been getting used to Minecraft Forge, and have ran into an issue. I want to cause an anvil to "explode" when it reaches the ground, so I thought there would be a forge event that would allow this, but I am wrong. Before I got too complex, and over think it I wanted to see if there was an easier way. So what would be the simplest way to track if an anvil is falling, or has fallen?

Posted

Block that can fall (including Anvil) extend BlockFalling class and the moment of their "fall" they are "transformed" into an entity that ships all data about falling block. Then, when "EntityFallingBlock" hits the ground - it uses saved data to recreate block on hit ground.

 

Now - the problem is obviously in fact that Forge has only LivingUpdateEvent that runs for living things. EntityFallingBlock is not living entity.

Why is that? It is probably reasonable to not fire events for non-living things (performance or hard to implemets for all cases), yet I for example think thare should be some events regarding updating "dead" entities, e.g - falling blocks.

 

Anyway, if you can't find anything useful on this field (look for things that would allow you to pick moment of EntityFallingBlock death), then what you simply do:

 

Subscribe to "EntityJoinWorldEvent", check if entity is EntityFallingBlock, then check if EntityFallingBlock.fallTile is Anvil. Extend EntityFallingBlock with your MyEntityFallingBlock and override onUpdate() method adding a subtle change that will instead of placing anvil on ground-hit, spawn an explosion in world (spawn boom on server). Obviously - you will want to remove old EntityFallingBlock and replace it with new one MyEntityFallingBlock by simple spawning it in same place as precedessor.

1.7.10 is no longer supported by forge, you are on your own.

Posted

That could work, thanks for your input. Any other ways are appreciated as well. The more the better for learning.

 

 

Also, how can I learn how to mod when there are few tutorials, and no documentation? All I have to work from is what I have in my libs directory, and some of the methods are still not decoded.

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.