How to create a custom TileEntity

Hi all! I’m fairly new to plugin making but have been working on something for my friends’ Pixlemon server. I’ve been reading through the documentation on spongeforge but it lacks describing specifically what I’m trying to do and doesn’t have many concrete examples.

I’m trying to create a TileEntity similar to a PokeGift, where it can contain one instance of a pokemon at a time and right clicking the entity will either put your currently selected pokemon in or put whatever pokemon is in the entity into the players inventory.

How do I go about creating an new TileEntity? How do I add a block texture to it? How do I hook up the entity so that when I click on it, executes a function? Any other tid bits of info would be great!

Sorry if this question has been answered before. I’ve searched the forum but couldn’t find similar, and google has only returned examples coded in forge so I can’t use those.

Thank you!

It sounds like you’re wanting to add a new TileEntity? Sponge does not have APIs to create blocks, entities etc.
Sponge is primarily a server-side API, and allows vanilla clients to connect. A limitation of the Minecraft protocol is that blocks etc must be defined on both client and server.

It sounds like you’ve already found forge examples, which is what I recommend Home - Forge Documentation

Having said that, one option you have is to use existing blocks, entities and the like to create a new “pseudo”-block. While the textures and certain properties must exist on the client, its behaviour (e.g. on-click action) is defined server-side.
If you don’t want players to install your mod on their client, this is one avenue to explore.

1 Like