Posted July 24, 201510 yr 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?
July 24, 201510 yr 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.
July 24, 201510 yr Author 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.