Jump to content

Help with Tile Entity Basics


intermediateuser

Recommended Posts

There are bits and pieces of up-to-date information about Tile Entities here, on the wiki, on YouTube videos, and of course in Minecraft's source itself, but while I have been looking through all these things for hours I can't get a clear picture of how I'm supposed to make and use Tile Entities.

 

Can someone tell me the fundamentals of making and using them?

 

As an example, I'd like to make a block that, when right-clicked, will open up a trade window that's essentially identical to a villager's trade window.

Link to comment
Share on other sites

I think more information might help me get an answer while I'm AFK so hopefully when I come back I can progress.

 

I've already made a block, and I've got a tile entity class for it (but I don't know if the tile entity class is functional or even written properly).  I've read about "containers" but I don't think the word "container" means the same thing when making a tile entity that it does in game.  I think I have a container class, but I don't really know what it does.  And I don't know how to draw the gui.

 

The only reason I'm asking such broad questions here is because I can't find any good, up-to-date, and comprehensive information anywhere else.  I am not a total noob; I know how to do use Forge and I know intermediate Java.  I already have done some significant work on my mod, I just need to know the procedure for making and using tile entities to do what I mentioned in the original post.

 

Any help at all would be appreciated.  Thanks :)

Link to comment
Share on other sites

Step 1:

 

class MyTileEntityBlock extends BlockContainer

 

Yes, it creates a container but that's because the original vanilla TE objects have inventories.  You don't need to utilize this fact, nor do you need to utilize the NBT data that can easily get saved via entities.

 

Step 2:

 

class MyTileEntityEntity extends TileEntity

 

This class is what's created when you place the block.  The parent class (BlockContainer) will throw an "add unimplemented methods" error, one of which will be function that returns a tile entity.  You'd add "return new MyTileEntityEntity()" there.  WARNING: do not pass parameters or change properties of the TE at this point, as you will want to read these values from the NBT data or they'll get reset on world load.

 

Step 3

 

public class MyTileEntityRenderer extends TileEntitySpecialRenderer

 

This will handle your TE rendering.  You may also have a model that you're using or you might use the tessalator directly.  I've done both.

 

Step 4

 

In your base mod class:

RenderingRegistry.registerBlockHandler(new MyTileEntityRenderer());

You should also use RenderingRegistry.getNextAvailableRenderId() to get a rendering ID and pass it to both your block and render class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Eurgh. I think it's more readable if you name those ContainerMyBlock, TileEntityMyBlock, and RenderMyBlock respectively. In fact, I need to get my partner atrain99 to rename our classes like that :P

 

Whichever.  A lot of tutorials and such always do it as MyFoo and MyBar

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Step 1:

 

class MyTileEntityBlock extends BlockContainer

 

Yes, it creates a container but that's because the original vanilla TE objects have inventories.  You don't need to utilize this fact, nor do you need to utilize the NBT data that can easily get saved via entities.

 

Step 2:

 

class MyTileEntityEntity extends TileEntity

 

This class is what's created when you place the block.  The parent class (BlockContainer) will throw an "add unimplemented methods" error, one of which will be function that returns a tile entity.  You'd add "return new MyTileEntityEntity()" there.  WARNING: do not pass parameters or change properties of the TE at this point, as you will want to read these values from the NBT data or they'll get reset on world load.

 

Step 3

 

public class MyTileEntityRenderer extends TileEntitySpecialRenderer

 

This will handle your TE rendering.  You may also have a model that you're using or you might use the tessalator directly.  I've done both.

 

Step 4

 

In your base mod class:

RenderingRegistry.registerBlockHandler(new MyTileEntityRenderer());

You should also use RenderingRegistry.getNextAvailableRenderId() to get a rendering ID and pass it to both your block and render class.

 

Thanks so much.  Just understanding the basic structure of what I'm trying to do here will help a good deal.  In this example, should MyTileEntityRenderer also implement IMerchant and IInventory?  Rendering a gui is still a little confusing to me, but I know I need at least one of those two.

Link to comment
Share on other sites

Thanks so much.  Just understanding the basic structure of what I'm trying to do here will help a good deal.  In this example, should MyTileEntityRenderer also implement IMerchant and IInventory?  Rendering a gui is still a little confusing to me, but I know I need at least one of those two.

 

Maybe?  I don't recognize those two classes at the moment.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Thanks so much.  Just understanding the basic structure of what I'm trying to do here will help a good deal.  In this example, should MyTileEntityRenderer also implement IMerchant and IInventory?  Rendering a gui is still a little confusing to me, but I know I need at least one of those two.

Your TileEntity, *not* your TESR, should extend IInventory. I don't know about IMerchant.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

Actually now that I have a chance to work on this some more, this whole bit just confuses me.  Why do I need a special renderer?  Can I just have a block, a tile entity, and have that tile entity called in onBlockActivated()?

 

The whole point is to draw a GUI when a block is right-clicked, and I'm not seeing much information about drawing a gui anywhere really.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Selamat datang di AGEN777 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor AGEN777 ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini AGEN777.
    • Selamat datang di SLOT777 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor SLOT777 ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini SLOT777.
    • DAFTAR DEPO 50 BONUS 50 | DEPOSIT 50 BONUS 50 TO KECIL 3X 5X 7X 10X 12X 15X DI AWAL   ⚡️ KLIK DAFTAR BONUS NEW MEMBER 100 DI AWAL ⚡️ ⚡️ LINK SLOT GACOR BONUS NEW MEMBER 100 DI DEPAN ⚡   PROMO SLOT GACOR TERBARU PALING DICARI TAHUN 2024 ADALAH DEPO 50 BONUS 50 | DEPO 50 BONUS 50 TO KECIL | DEPOSIT 50 BONUS 50 TO KECIL 3X 5X 7X 10X 12X 15X DI AWAL?Apa sih yang dimaksud dengan DEPOSIT 50 BONUS 50 TO KECIL 3X 5X 7X ? DEPOSIT 50 BONUS 50 TO KECIL 3X 5X 7X adalah sebuah bonus yang telah disiapkan oleh situs khusus slot online untuk for member baru yang baru bergabung. Dan 100 sendiri adalah nilai dari bonus yang diberikan untuk member baru tersebut. Untuk Bonus yang tersedia adalah deposit 50 bonus 50 to 3x & deposit 50 bonus 50 to 5x & deposit 50 bonus 50 to 7x & depo 50 bonus 50 to 3x & depo 50 bonus 50 to 7x adalah bonus yang sangat terbaik dikelasnya dikarenakan memberikan nilai lebih dalam melakukan permainan agar bisa penarikan dengan sangat cepat yang diharapkan oleh setiap member.   DEPO 50 BONUS 50 Jadi situs judi slot online gampang berhasil deposit pulsa tanpa potongan pula membagikan keringanan dalam melaksanakan deposit duit asli lewat pulsa. Kalian dapat bermain slot deposit minimun 10 rb yg salah satu taruhan taruhan terkecil serta paling murah. jadi dengan taruhan deposit kecil pulsa tanpa potongan serta memainkan game slot Gampang jackpot ditambah promo bonus slot member baru 100, hingga profit di depan mata kalian. Selanjutnya ini ialah berkas 50 daftar julukan julukan slot online mudah berhasil yg sesuai buat kalian selaku pendatang baru dengan memakai bonus slot member baru 100 di awal.
    • DEPO 100 BONUS 100 | DEPOSIT 100 BONUS 100 TO KECIL 3X 5X 7X 10X 12X 15X DI AWAL     ⚡️ KLIK DAFTAR BONUS NEW MEMBER 100 DI AWAL ⚡️ ⚡️ LINK SLOT GACOR BONUS NEW MEMBER 100 DI DEPAN ⚡   DEPO 100 BONUS 100 | DEPO 100 BONUS 100 TO KECIL | DEPOSIT 100 BONUS 100 TO KECIL 3X 5X 7X 10X 12X 15X DI AWAL?Apa sih yang dimaksud dengan DEPOSIT 100 BONUS 100 TO KECIL 3X 5X 7X ? DEPOSIT 100 BONUS 100 TO KECIL 3X 5X 7X adalah sebuah bonus yang telah disiapkan oleh situs khusus slot online untuk for member baru yang baru bergabung. Dan 100 sendiri adalah nilai dari bonus yang diberikan untuk member baru tersebut. Untuk Bonus yang tersedia adalah deposit 100 bonus 100 to 3x & deposit 100 bonus 100 to 5x & deposit 100 bonus 100 to 7x & depo 100 bonus 100 to 3x & depo 100 bonus100 to 7x adalah bonus yang sangat terbaik dikelasnya dikarenakan memberikan nilai lebih dalam melakukan permainan agar bisa penarikan dengan sangat cepat yang diharapkan oleh setiap member. Depo 100 Bonus 100 – Depo 100 bonus 100 to 3x – Deposit 100 Bonus 100 To Kecil – Deposit 100k Bonus 100k – Deposit 100 Bonus 100 – Depo 100 Bonus 100 To 3x – Depo 100 Bonus 100 To 5x – Depo 100 Bonus 100 TO Kecil – Depo 100 Bonus 100 To 3x – Depo 100 Bonus 100 Tanpa To – Depo 100 Bonus 100 – Depo 100 Bonus 35 To 5x DEPO 100 BONUS 100 Jadi situs judi slot online gampang berhasil deposit pulsa tanpa potongan pula membagikan keringanan dalam melaksanakan deposit duit asli lewat pulsa. Kalian dapat bermain slot deposit minimun 10 rb yg salah satu taruhan taruhan terkecil serta paling murah. jadi dengan taruhan deposit kecil pulsa tanpa potongan serta memainkan game slot Gampang jackpot ditambah promo bonus slot member baru 100, hingga profit di depan mata kalian. Selanjutnya ini ialah berkas 20 daftar julukan julukan slot online mudah berhasil yg sesuai buat kalian selaku pendatang baru dengan memakai bonus slot member baru 100 di awal.
    • Slot Freebet Tanpa Syarat Bermain Slot Online tentu dapat dimainkan dengan Tanpa Syarat dengan bergabung bersama kami di freebet slot jadi kalian tinggal daftar dan langsung login ke dalam akun dan saldo akan bertambah otomatis dan dapat di klaim setiap harinya. Dengan layanan ini dapat membuat kalian menjadi pemenang setiap harinya dari mendapatkan slot Freebet Tanpa Syarat dan langsung masuk tanpa harus di klaim. Slot Freebet Tanpa Syarat dapat dimainkan di semua jenis permainan Slot Online dengan tujuan memudahkan para pemain dalam mendapatkan kemenangan dari layanan Freebet Tanpa Syarat 2024. DAFTAR KLIK DI SINI https://umpo.ac.id/assets/css/pages/-/depo-25-bonus-25/ DAFTAR KLIK DI SINI  http://seminarmajlisdekan.upsi.edu.my/depo25/ Untuk mendapatkan freebet slot tanpa Syarat kalian hanya perlu tahu informasi terlebih dahulu dalam tata cara mendapatkan hal tersebut. Bersama kami saat ini freebet 15k tanpa Syarat 2024 didapatkan dengan mudah yaitu dengan hanya melakukan pendaftaran dan mendapatkan userid maka kami dapat menjamin saldo akan masuk langsung ke dalam akun kalian. Berbagai jenis hadiah jackpot sensasional bisa didapatkan dengan mengandalkan Freebet Tanpa Syarat langsung masuk 2024 dan pastinya anti kalah. Saat ini telah banyak orang yang mengetahui layanan yang kami sediakan sehingga setiap harinya ada ratusan member yang telah bergabung dan mendapatkan layanan freebet 100k Asli secara langsung. Sistem permainan yang ditawarkan telah mendapatkan kepercayaan dari berbagai member yang sudah mendapatkan keuntungan dari hal itu yang berasal dari permainan Slot Online. Keyword Terkait : slot freebet 30k tanpa deposit slot freebet slot freebet tanpa deposit slot freebet new member situs slot freebet situs slot freebet tanpa deposit slot freebet tanpa deposit 2023 slot freebet 20k slot freebet gratis link slot freebet:
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.