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

    • In the perilous world of online trading, where promises of quick riches often lead to devastating losses, finding a trustworthy ally can feel like searching for a needle in a haystack. My journey began with high hopes, as I ventured into online trading with an external expert guiding my every move. Little did I know, I was stepping into a carefully orchestrated scam. After investing a substantial $380,000 deposit on an online trading platform, I found myself at the mercy of both the platform and the supposed expert leading my trades. Despite initially seeing profits, red flags began to appear when they demanded a hefty 20% fee, not from the generated profits, but from my pocket. Alarm bells rang loudly in my mind, signaling a potential scam. Thankfully, in the nick of time, I stumbled upon Wizard Web Recovery. With skepticism clouding my judgment, I cautiously reached out to them, hoping against hope for a glimmer of salvation. From the first interaction, their professionalism and expertise shone brightly, offering hope amidst the murky waters of deceit. Their approach was meticulous and methodical, as they diligently assessed my situation, leaving no stone unturned in their quest for justice. Despite the daunting odds stacked against me, Wizard Web Recovery embarked on a relentless pursuit to reclaim what was rightfully mine. Their transparency was a breath of fresh air in an industry plagued by deception. Every step of the way, they kept me informed, providing regular updates and guidance, instilling a sense of trust that had long eluded me. Their dedication to my cause was unwavering, as they navigated the complexities of online trading with finesse and precision. What truly sets Wizard Web Recovery apart is its unwavering commitment to its clients. Beyond mere restitution, they prioritize education and empowerment, equipping individuals with the knowledge and tools to navigate the treacherous waters of online trading safely. Through their expertise and tenacity, Wizard Web Recovery emerged victorious, securing the return of my hard-earned funds. But their impact extends far beyond mere financial restitution. They restored my faith in humanity, proving that amidst the darkness, there are still beacons of light shining brightly. To anyone who finds themselves ensnared in the tangled web of online trading scams, I wholeheartedly recommend Wizard Web Recovery. Their professionalism, expertise, and unwavering dedication are unmatched, offering a glimmer of hope in an otherwise bleak landscape. Trust in their abilities, for they are true wizards in the realm of recovery.
    • In the perilous world of online trading, where promises of quick riches often lead to devastating losses, finding a trustworthy ally can feel like searching for a needle in a haystack. My journey began with high hopes, as I ventured into online trading with an external expert guiding my every move. Little did I know, I was stepping into a carefully orchestrated scam. After investing a substantial $380,000 deposit on an online trading platform, I found myself at the mercy of both the platform and the supposed expert leading my trades. Despite initially seeing profits, red flags began to appear when they demanded a hefty 20% fee, not from the generated profits, but from my pocket. Alarm bells rang loudly in my mind, signaling a potential scam. Thankfully, in the nick of time, I stumbled upon Wizard Web Recovery. With skepticism clouding my judgment, I cautiously reached out to them, hoping against hope for a glimmer of salvation. From the first interaction, their professionalism and expertise shone brightly, offering hope amidst the murky waters of deceit. Their approach was meticulous and methodical, as they diligently assessed my situation, leaving no stone unturned in their quest for justice. Despite the daunting odds stacked against me, Wizard Web Recovery embarked on a relentless pursuit to reclaim what was rightfully mine. Their transparency was a breath of fresh air in an industry plagued by deception. Every step of the way, they kept me informed, providing regular updates and guidance, instilling a sense of trust that had long eluded me. Their dedication to my cause was unwavering, as they navigated the complexities of online trading with finesse and precision. What truly sets Wizard Web Recovery apart is its unwavering commitment to its clients. Beyond mere restitution, they prioritize education and empowerment, equipping individuals with the knowledge and tools to navigate the treacherous waters of online trading safely. Through their expertise and tenacity, Wizard Web Recovery emerged victorious, securing the return of my hard-earned funds. But their impact extends far beyond mere financial restitution. They restored my faith in humanity, proving that amidst the darkness, there are still beacons of light shining brightly. To anyone who finds themselves ensnared in the tangled web of online trading scams, I wholeheartedly recommend Wizard Web Recovery. Their professionalism, expertise, and unwavering dedication are unmatched, offering a glimmer of hope in an otherwise bleak landscape. Trust in their abilities, for they are true wizards in the realm of recovery.     
    • Throughout a day i tried to understand what each variable does, and at the end of a day, i finally got it, but what EXACTLY (difference between) setRotationPoint and addBox does - idk Alias for setRotationPoint = "srp", addBox = "ab" -----------------NERD-TALK----------------- SO, the most sussy value is Y-axis. Starting from srp, 24.0F - is height +0, meaning a starting point. in ab, 0.0F is also height +0. When you decrement srp or ab y-axis  values - you get height +1 with each -1, meaning you can interpretate same height in infinite ways, same for X axis but srp starting point is 0.0F, note that none of each applies to Z axis - it is 'normal' For example, task: Place cube with dimensions 3, 3, 3 to coords -1.5, 6, -4. My theory approach: Decrement cube Y dimension from ab value, and decrement srp value until satisfied(3 in this case). I think X and Z axis do not need explanation, but still: you can set -1.5 and -4 to either srp or/and ab -------------INTERESTING-PART------------- this.head = new ModelRenderer((ModelBase)this, 0, 10)). addBox(-1.5f, -3.0f, -3.0f, 3, 3, 3); # For X and Y axis - decrement its dimension to get position 0. To achieve -1.5 in X axis - add this reverted value to srp/ab (ab in this case) this.head.setRotationPoint(0.0f, 21.0f, -2.0f); # Decrementing 3 to achieve "6" height (you can do so with ab value, but NOTE that i don't know the difference between both) Edit: I Figured it out by playing with java entity class file for forge 1.7.10 Hope this helps someone if you went this far somehow
    • I have been following a tutorial for DataGen for my Minecraft Mod and I have come across an error. Caused by: java.lang.IllegalStateException: No way of obtaining recipe droidsancientrelics:lemon_juice I am not sure why this has happened for the Lemon Juice specifically, as no error is present for the Orange Juice even though the code is the same. I thought I would make a post before acting on anything in case I would create unnecessary work for myself, though I know that a possible outcome would be to go to an earlier version of the mod where the data files are still separate and go from there.  Video link for reference.
    • I removed optifine and now F3 works
  • Topics

×
×
  • Create New...

Important Information

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