Jump to content

New Furnaces, improving how furnaces are added


plnx

Recommended Posts

This might belong in "Forge Suggestions", but I feel too new to be sure of what I'm saying, and am looking for some more general comment.

 

Just as an excuse to explore the code, I wanted to add a new type of furnace, and found even if all I wanted was for it to appear differently, it isn't a trivial exercise. Before I read it, my first thought was to sub-class BlockFurnace (basically empty, just to have something to hang new asset files on) but ran first into the call to the static method setState in BlockFurnace causing my furnace to be replaced with a vanilla one when activated in-game; and shutting down my hopes of inheritance (among other points I then noticed that would make it impossible).

 

Poking around git hub, seems the going strategy instead is to sub-class farther up, resulting in a ton of copied code handling the common furnace logic.  Some people are even then duplicating it repeatedly for every new furnace they add, making it worse.  I know we're making a system do things it's designers didn't intend--this sort of thing is probably unavoidable at times--but it still just feels so wrong, especially for something I thought would be a basic change.

 

So...

 

[*]Should I work towards a contribution to Forge?  I have a feeling there's some issues I'm not aware of causing this to not already be in place.  (and I still have a lot to learn before I'm ready for that)

[*]Is there a library already out there that would at least does this duplication only once for all mods that use it?  Is there a reason why this would make more sense as a library, as opposed to, say, new event hooks for Forge?

 

Thanks.

Link to comment
Share on other sites

standards.png

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

Ha, as much as I'd agree every topic could use XKCD, I'm not advocating for a standard, and I didn't notice any competing "standards" (if by that you mean libraries) out there.  With the little experience I have around here, I'd be leaning towards the forge solution anyway--I just don't know what that means yet.

Link to comment
Share on other sites

Hi

 

Although I like the idea, in my opinion the last thing Forge needs is more specialised features that seldom get used.  It's groaning under the weight of all the "nice to haves" already, and every extra one just adds to the maintenance burden and slows down each update.

 

I'd suggest you make a good example and let folks copy it.  They'll need to update it for every minecraft update, but I think that work is better placed on the shoulders of the individual developer rather than Lex & co.

 

-TGG

 

Link to comment
Share on other sites

Pretty much unless Forge needs to be doing something, it should be left up to the individual developer.  Liquids being one example: there needs to be a single way to go "oh that's a liquid" so the various mods that have pumps and pipes can handle every mod liquid the same way.

 

Furnaces?  Not really.  There's a single furnace recipe repository and that's really all that's needed.  Various mods will do their own cooking their own way as their specs require.  Some mods might use different fuels, cook faster, cook slower, have a variety of other tweaks and alterations.  There's no "good" way to supply a common package for this.

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 guys,  both those comment help.  As an aside, being new around here, I'm often not sure when I'm looking at examples and tutorials if what I'm seeing is "crazy" because it has to be, or because the author doesn't know any better.  Don't get me wrong, I've see a lot of good stuff, but I also get the sense many people get into this with no prior development experience; and often tutorials will tell you what to do, but not why it has to be that way.

 

Anyway, I suppose I could argue what is deemed "needed" can be subjective (maybe I want "oh that's a furnace", and don't really care about liquids--just playing devil's advocate), or that one of forge's design goals in general should be to avoid plug-in authors duplicating code as much as possible (as in the case, "I want this to behave exactly like the vanilla version, even if the MC changes", not like trying to predict all bespoke variations of that logic, in which case I'd totally agree you should be on your own) ... but I take your points that this specific case is really pretty niche, I'd call it only "nice to have" too,  and it make sense that forge should keep it's patches as minimal as possible or risk becoming unmaintainable.  When I'm farther along, maybe I'll write that "common package" (or "good example"), something along the lines of duplicating TileEntityFurnace and children only with relaxed protections, more setters and so on; but for now thanks for helping me get my head on straight.

Link to comment
Share on other sites

Anyway, I suppose I could argue what is deemed "needed" can be subjective (maybe I want "oh that's a furnace", and don't really care about liquids--just playing devil's advocate), or that one of forge's design goals in general should be to avoid plug-in authors duplicating code as much as possible

 

Really though, there doesn't need to be a common furnace.  It's a TileEntity (common code) that implements ISidedInventory (probably) or at least IInventory.  Which is all that's needed for every mod ever to be able to insert items or extract them (including using the vanilla Hopper).  No other mod needs to care about how your CustomFurnace actually smelts inputs into outputs, so having a "common core" for the updateTick method is pointless.

 

Per liquids, I suspect it was originally because creating a new liquid was Hard* and so it was written as a base class that mods could extend in order to easily get a liquid working "like vanilla" and morphed later into the liquid registry (et cetera) due to the number of mods wanting to move liquids around and treat them in common ways without having to do a bunch of special casing.  There is IFluidBlock, which is implemented by BlockFluidBase, but it doesn't really supply all of the necessary details, as BlockFluidBase is the class that handles the Fluid object.

 

But sure, feel free to create that library if you want to.  Dollars to doughnuts no one will use it.

 

*My first attempt at a liquid, using the Forge liquid base block didn't even work correctly, just to give you an idea of how Hard it actually is!

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

> But sure, feel free to create that library if you want to.  Dollars to doughnuts no one will use it.

 

Eh, you're probably right, and I'm not that dead-set on it anyway.  Really just feeling things out at this point.  (and, hm, I can't seem to work the "insert quote" link)

 

But, pretending I am, allowing other mods to care about how a furnace smelts wasn't my point.  More like, allowing mods (and MC itself) just to know this thing is a furnace, however it works (like I said, "not like trying to predict all bespoke variations of that logic..").  Is that very useful, particularly compared to something like liquids?  Nah, probably not.  As for the library, I meant that less about providing a common furnace than giving people a base to extend, save some time.  Going back to my original example of a furnace that just looks different (it was a sandstone furnace), it seems kinda silly that I have to repeat all these classes just to do that (though I understand the reasons).  Even if no one else used it, if I was creating a mod that added a bunch of furnace, such set of classes would be my first step anyway.

Link to comment
Share on other sites

If you (generic) are creating a furnace that "just looks different" you would just have all the Blocks create the same TileEntity.  There's no reason to create a new TE class (even one that extends some generic version) just because it belongs to a different block.

 

As for "allowing mods (and MC itself) just to know this thing is a furnace": what value is there in that?  Why "furnace" instead of "grinder" "machine" "oven" "a thing that has an inventory and updates every tick and alters that inventory" or some other niche distinction?  Why is "furnace" the important distinction to make?

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

The problem lies in the TileEntityFurnace having hard-coded references to the vanilla active/idle furnace blocks, as well as using a static method 'keepInventory' - if this weren't the case, every modder could easily extend this one class, make a few minor changes and be done with it.

 

This goes for any type of machine - I've seen (and coded some myself... derp) many machine variations, grinders, furnaces, etc. that all follow the vanilla 'model' and make the same poor design decisions, but even if you were to design a more flexible class, one that say takes two Blocks in a non-static keepInventory method and by default switches between the two, what if a mod wanted 3 states? Or 4?

 

Also, the logic within the TE class itself is always going to be far too specific, whereas the fact that it implements one of the Inventory interfaces already makes it generic enough for any mod to interact with it (as Draco mentioned). The best I've come up with, not really related to furnaces per se, is to make a generic TileEntity with IInventory implementation, since I found myself repeating that code a lot.

 

If I was making lots of furnaces and other machines, I might be inspired to do something similar, but I don't think it would turn out to be as widely applicable as one might hope.

Link to comment
Share on other sites

Thanks again guys, this is all basically what I'm saying too, or would have said if I had more experience here.

 

... you would just have all the Blocks create the same TileEntity.  There's no reason to create a new TE class ...

 

Right, that's the error I was pointing out when I said "Some people are even then duplicating it repeatedly for every new furnace they add..."

 

... As for "allowing mods (and MC itself) just to know this thing is a furnace": what value is there in that? ... Why is "furnace" the important distinction to make?

 

Again, it's not, I said it's probably not very useful.  Creating a "common furnace" was a tangent I didn't mean to get so far into; this was all just an excuse to cut my teeth, I personally don't actually care that much about furnaces.

 

The problem lies in the TileEntityFurnace having hard-coded references to the vanilla active/idle furnace blocks ...

 

Yep, it's in that static method setState I mentioned.

 

if you were to design a more flexible class, one that say takes two Blocks in a non-static keepInventory method and by default switches between the two, what if a mod wanted 3 states? Or 4?

 

I wouldn't be trying to make something more flexible, I was only thinking about "relaxed protections, more setters and so on", in other words just the vanilla class, refactored to allow people to extend it (this is why I was at first thinking maybe this is something forge should patch).  If you wan more than one slot, ovverride.  If that means you'd need to basically override everything anyway, then right, not for you.

 

Well, I'm satisfied, and have some more specifics to look into now.  Just to be clear, I'm not arguing for a common furnace, and am not about to embark on some kind of Furnace Makers API. I guess I don't even know the right way to ask questions yet... turns out what I really got from all this was a better grasp on the architecture in general.

 

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

    • OLXTOTO: Menikmati Sensasi Bermain Togel dan Slot dengan Aman dan Mengasyikkan   Dunia perjudian daring terus berkembang dengan cepat, dan salah satu situs yang telah menonjol dalam pasar adalah OLXTOTO. Sebagai platform resmi untuk permainan togel dan slot, OLXTOTO telah memenangkan kepercayaan banyak pemain dengan menyediakan pengalaman bermain yang aman, adil, dan mengasyikkan.   Keamanan Sebagai Prioritas Utama   Salah satu aspek utama yang membuat OLXTOTO begitu menonjol adalah komitmennya terhadap keamanan pemain. Dengan menggunakan teknologi enkripsi terkini, situs ini memastikan bahwa semua informasi pribadi dan keuangan para pemain tetap aman dan terlindungi dari akses yang tidak sah.   Beragam Permainan yang Menarik   Di OLXTOTO, pemain dapat menemukan beragam permainan yang menarik untuk dinikmati. Mulai dari permainan klasik seperti togel hingga slot modern dengan fitur-fitur inovatif, ada sesuatu untuk setiap selera dan preferensi. Grafik yang memukau dan efek suara yang mengagumkan menambah keseruan setiap putaran. Peluang Menang yang Tinggi   Salah satu hal yang paling menarik bagi para pemain adalah peluang menang yang tinggi yang ditawarkan oleh OLXTOTO. Dengan pembayaran yang adil dan peluang yang setara bagi semua pemain, setiap taruhan memberikan kesempatan nyata untuk memenangkan hadiah besar.   Layanan Pelanggan yang Responsif   Tim layanan pelanggan OLXTOTO siap membantu para pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Dengan layanan yang ramah dan responsif, pemain dapat yakin bahwa mereka akan mendapatkan bantuan yang mereka butuhkan dengan cepat dan efisien.   Kesimpulan   OLXTOTO telah membuktikan dirinya sebagai salah satu situs terbaik untuk penggemar togel dan slot online. Dengan fokus pada keamanan, beragam permainan yang menarik, peluang menang yang tinggi, dan layanan pelanggan yang luar biasa, tidak mengherankan bahwa situs ini telah menjadi pilihan utama bagi banyak pemain.   Jadi, jika Anda mencari pengalaman bermain yang aman, adil, dan mengasyikkan, jangan ragu untuk bergabung dengan OLXTOTO hari ini dan rasakan sensasi kemenangan!      
    • i notice a change if i add the min and max ram in the line like this for example:    # Xmx and Xms set the maximum and minimum RAM usage, respectively. # They can take any number, followed by an M or a G. # M means Megabyte, G means Gigabyte. # For example, to set the maximum to 3GB: -Xmx3G # To set the minimum to 2.5GB: -Xms2500M # A good default for a modded server is 4GB. # Uncomment the next line to set it. -Xmx10240M -Xms8192M    i need to make more experiments but for now this apparently works.
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Slot Gacor untuk Sensasi Bermain Maksimal Olahraga cepat dan seru dengan slot gacor di OLXTOTO. Rasakan sensasi bermain maksimal dengan mesin slot yang memberikan kemenangan beruntun. Temukan keberuntungan Anda di antara berbagai pilihan slot gacor yang tersedia dan rasakan kegembiraan bermain judi slot yang tak terlupakan. Situs Slot Terpercaya dengan Pilihan Terlengkap OLXTOTO adalah situs slot terpercaya yang menawarkan pilihan terlengkap dalam perjudian online. Nikmati berbagai genre dan tema slot online yang menarik, dari slot klasik hingga slot video yang inovatif. Dipercaya oleh jutaan pemain, OLXTOTO memberikan pengalaman bermain yang aman dan terjamin.   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.  
    • LOGIN DAN DAFTAR DISINI SEKARANG !!!! Blacktogel adalah situs judi slot online yang menjadi pilihan banyak penggemar judi slot gacor di Indonesia. Dengan platform yang sangat user-friendly dan berbagai macam permainan slot yang tersedia, Blacktogel menjadi tempat yang tepat untuk penggemar judi slot online. Dalam artikel ini, kami akan membahas tentang Blacktogel dan keunggulan situs slot gacor online yang disediakan.  
    • Situs bandar slot online Gacor dengan bonus terbesar saat ini sedang menjadi sorotan para pemain judi online. Dengan persaingan yang semakin ketat dalam industri perjudian online, pemain mencari situs yang tidak hanya menawarkan permainan slot yang gacor (sering memberikan kemenangan), tetapi juga bonus terbesar yang bisa meningkatkan peluang menang. Daftar disini : https://gesit.io/googlegopek
  • Topics

×
×
  • Create New...

Important Information

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