Jump to content

[1.7.10] Gui without tileEntity?


Awesome_Spider

Recommended Posts

So I'm looking at a tutorial for gui's and it talks about TileEntities, Blocks, Containers, etc. But the thing is I don't want to create a gui based off a block. I want to create a gui that just simply opens when a button is pressed. I have the key bindings ready but I'm just confused at how to make a gui that doesn't use TileEntities and such. Could anyone point towards a good tutorial?

Link to comment
Share on other sites

Make your gui extend

GuiScreen

instead.

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

Yeah, I've been working a lot with custom block GUIs lately and I should probably write a tutorial.  Like the question in this thread, the first thing is to understand the gui needs to have a container/inventory and secondly whether it needs to have a tile entity associated with it.

 

Basically there are four possible scenarios:

1) Simple GUI without container or tile entity -- e.g. some sort of sign or simple information GUI that doesn't need player to put items in or out.

2) GUI with container but without tile entity -- if all the functionality of your GUI happens while the player is viewing the gui then you don't need a tile entity.  For example a crafting table.

3) GUI with container and tile entity -- if you need to have the block do functionality even while player is not in GUI, like how a furnace will cook/smelt over time, then you should use a tile entity.

4) GUI without container but with a tile entity -- like maybe a machine that you turn on in the GUI and then it continues to do something after you exit the GUI.

 

If you need an container then you need to associate it with something that implements IInventory.  That can either be a separate class, or can be the tile entity (if you have one).

 

Anyway, it sounds like you're just doing case #1.  For that you just need a GUI class and don't need a container or tile entity class.  Open the GUI just like you would in all cases -- in your block's onBlockActivated() method.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Well, I'm actually doing more of situation #2, like a crafting table but without a block. It's a dismantler, an un-crafting table you might say.

 

That's funny because that's exactly what I spent the weekend making.  But yeah I didn't need a tile entity for it since like a crafting table the output was instantaneous.

 

Some of the tricky things to think about with an un-crafting table:

1) Some crafting recipes produce multiple of an item (like 3 paper) so when you're uncrafting you need to decide what to do.  Right now I have mine working so you have to put the same amount (or more) into the input for it to decraft.  But my kids want me to make some exceptions, for example a door  takes 6 wood to make 3 doors so they want 1 door to un-craft to 2 wood.  I haven't coded that yet because it gets tricky -- there are some multiples that wouldn't work to divide the input like railroad tracks. 

2) You need to consider the damage values in some cases -- like you want magenta dye to return the proper result different from the default dye.  But damage values are also used on tools and weapons and armor to reflect actual damage, so you need to think through how to code this carefully.

 

Once I get it working a bit better I might write a tutorial on an uncrafting table (I call it a "deconstructor").  But it sounds like you're taking the right approach.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Cool, I haven't coded the gui yet because i'm trying to get the functionality first. Also, another thing to think about: You can make it so if other mods want to add an item to un-craft they can. They would have to be an extension to your mod though.

 

The way mine works so far is using hashmaps (I like HashMaps). Probably not the most efficient way, but I can get to making it more efficient when I release the mod. Anyway, the Dismantler, that's what I'm calling it, has a method that adds an Item and an ItemStack array to the hashmap. The item is the key, the itemstack array is the value. It also takes a modid parameter just in case there is a duplicate so it can throw an exception. That way, other mods can add their items. There is also a retrieve method which is where I add all the items that can be dismantled that are in my mod and vanilla using the adding method.

 

The reason why I use an itemstack array is because than I can specify how much of the item there is, so it can stack in the gui.

 

Confusing? Yes. Not the most efficient way? Maybe. Will it work? I have no idea. lol

Link to comment
Share on other sites

Oh and I haven't worked out damage values yet.

If the thing is a wooden pickaxe and its near close to being broken, try having a random chance and if it correct maybe have a random item, like a wooden plank or stick in this case is not given back or not give any of the items at all.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

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

    • Slot Deposit 1000: Slot Online Gacor Modal Receh Minimal Deposit 1000 1rb 2rb 3rb 5rb Tanpa Potongan Terbaru ▶️▶️DAFTAR◀️◀️ ▶️▶️DAFTAR◀️◀️ Bagi para penggemar slot online yang mencari pengalaman bermain yang mengasyikkan tanpa harus mengeluarkan modal besar, Lambo77 adalah tempat yang tepat. Dengan menawarkan slot deposit 1000, Lambo77 memungkinkan pemain untuk memulai petualangan mereka dengan modal yang terjangkau. Dengan minimal deposit hanya 1000, pemain dapat menikmati berbagai permainan slot favorit mereka tanpa perlu khawatir tentang kekurangan modal. Terlebih lagi, Lambo77 menawarkan berbagai pilihan nominal deposit, mulai dari 1rb hingga 5rb, sehingga pemain memiliki fleksibilitas dalam mengelola bankroll mereka. Salah satu keunggulan utama bermain di Lambo77 adalah tidak adanya potongan dalam setiap transaksi deposit. Hal ini memastikan bahwa pemain dapat menggunakan seluruh jumlah deposit mereka untuk bermain, tanpa harus kehilangan sebagian karena biaya tambahan. Dengan fitur-fitur seperti ini, Lambo77 menjadikan pengalaman bermain slot online semakin menghibur dan menguntungkan bagi para pemain. Jadi, jangan ragu untuk mencoba keberuntungan Anda dan mulai petualangan slot Anda di Lambo77 hari ini!  
    • Selamat datang di GACOR268 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 GACOR268 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 GACOR268.
    • Slot BCA Lambo77 = Link Daftar Slot BCA Modal Receh Auto Jackpot Deposit bank BCA Tanpa Potongan 2024 ▶️▶️DAFTAR◀️◀️ ▶️▶️DAFTAR◀️◀️ Lambo77 telah menjadi tujuan utama bagi para penggemar slot online yang mencari pengalaman bermain yang aman dan terpercaya menggunakan Bank BCA. Sebagai salah satu situs slot online terkemuka di tahun 2024, Lambo77 menawarkan akses mudah dan cepat untuk melakukan deposit dan menikmati berbagai permainan slot berkualitas. Dengan layanan deposit menggunakan Bank BCA, pemain dapat dengan nyaman melakukan transaksi ke akun mereka tanpa khawatir tentang keamanan atau keandalan. Lambo77 menjamin proses transaksi yang lancar dan aman, sehingga pemain dapat fokus sepenuhnya pada pengalaman bermain mereka. Selain itu, Lambo77 juga menyediakan beragam permainan slot yang menarik dengan fitur-fitur bonus yang menggiurkan. Dari slot klasik hingga yang paling modern, pemain dapat menemukan berbagai pilihan permainan yang sesuai dengan selera dan preferensi mereka. Dengan reputasi yang solid dan komitmen untuk memberikan pengalaman bermain yang terbaik, Lambo77 terus menjadi pilihan utama bagi para penggemar slot online di tahun 2024. Jadi, jangan ragu untuk bergabung dengan Lambo77 dan rasakan sensasi menang yang tak terlupakan di setiap putaran!  
    • Selamat datang di Gacor88 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 Gacor88 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 Gacor88.
    • Selamat datang di Casino88 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 Casino88 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 Casino88.
  • Topics

×
×
  • Create New...

Important Information

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