Jump to content

Adding an interaction between Vanilla tile entities without replacing them?


Recommended Posts

For a long time I've had this idea for what I assumed would be a very basic starter mod, but one I hadn't seen anyone create. Once I got Eclipse set up and started digging, I found out it may be harder than I thought. However, I still think it will be a worthwhile mod to pursue. I have more experience in Python, but I'm able to read and muddle through in Java.


I'm looking for a way to create an interaction between any spawner and a vanilla hopper without creating a full-fledged replacement for either. Ideally, it would work on modded spawners too. If someone could point me in the right direction, I'd really appreciate it.


The trouble I'm running into is that neither has a Forge event that I can find. diesieben07 wrote a pull request for adding a 'MobSpawnerSpawn' event, but it was rejected. If I were editing Minecraft core, I'd just modify the tick() methods. If it were Python, I'd just replace the 'tick' method with my own code at runtime.


I'm going to dig in to see if there is a place I can inject a simple replacement class, but I'm not optimistic. I may need to take a step back and look at an easier starting place for my modding debut.

EDIT: I'm thinking it might be possible to tweak net.minecraft.world.spawner.AbstractSpawner to suit and then replace spawnerLogic in net.minecraft.tileentity.MobSpawnerTileEntity? I'm not sure how that is instantiated yet.


Edited by Grinneg
Link to comment
Share on other sites

That commit is over 6 years old, so I will have to ask what version is this for.

4 minutes ago, Grinneg said:

spawner and a vanilla hopper

Also, this makes little sense to me. Are you trying to stop a mob from spawning, grab it's drops, and immediately push to a hopper? If so, there is an event for that in latest called LivingSpawnEvent#CheckSpawn which has a result that you can prevent it from.

Link to comment
Share on other sites

I guess I'm not as sneaky as I thought. XD I've searched everywhere to try to answer my questions before asking - so I'm not surprised that's ancient. I'm currently working with 1.16


My general idea was to allow 'mob grinding' without spawning the mob entities. Most of the modded servers I've played on are heavily impacted by mob spawning machines of all sorts, and I thought it would be worthwhile to create an interaction where a hopper below the spawner would just output drops until the hopper gets full and then stop.


It looks like LivingSpawnEvent is the right place to look. Thanks! I need to figure out what I'm looking at there.



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.

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.