Jump to content

Know who requests tile's entity


target.san

Recommended Posts

Hi everyone!

 

I'm constructing kinda strange entity container block, which contains one other item/block (like pipe or wire) for each of its sides.

What I wanna is to make my container simulate like it's one of its contained items.

Example: I'm putting glass cable into my container's west slot, then put regular glass wire adjacent to it, and when glass wire block looks up for the neighbour wire blocks, my container pretends to be glass wire and the two happily connect.

Per my investigation on MC code, there's always World.getBlockTileEntity that returns exact raw entity for the provided coordinate, without any notion of requester's identity. So my crazy idea seems to be impossible to implement. But I'm pretty new to Minecraft modding and might be mistaken.

 

Thanks

 

Link to comment
Share on other sites

eh, if I'm correct it could be done using ASM library - adding a hook to the getBlockTileEntity (you have to be a core mod in order to be able to do that), then you could find out who's called that method (more here or here). but the perfomance cost wouldn't be small and it is quite extreme and messy solution. I don't recommend this, but it is imho doable...

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

I don't think it would be a good idea for me to use instrumentation and like, as i highly doubt that other people would be grateful for such a hack  ;D

Anyway, many thanks for confirming my suspicions.

 

[EDIT]

 

At least, TileEntity retrieval can be hooked by wrapping getChunkBlockTileEntity via instrumentation. Still requires ASM toolset and a coremod, though can partially solve issue with posing one entity as other one.

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.