Jump to content

How to inherit class/entityclass from bloomeries?


Recommended Posts

I am working on a mod to add bloomeries made out of refractory bricks, and I've managed to get the recipes/drops working fine. all that's missing is getting the base to properly act like a normal bloomery. I have this at the start of my base block .JSON:

"code": "betterbloomerybase",
  "class": "game:BlockBloomery",
  "entityClass": "game:Bloomery",

 

And I've tried it without "game:" without luck. Are there any extra hoops I need to jump thru in order to inherit the bloomery class? I should also mention that my added blocks (base & chimney) follow a block-{direction}-{tier} scheme, I don't know if that's complicating things.

  • Like 1
Link to comment
Share on other sites

On 5/21/2021 at 5:37 PM, SturgeonFish said:

I am working on a mod to add bloomeries made out of refractory bricks, and I've managed to get the recipes/drops working fine. all that's missing is getting the base to properly act like a normal bloomery. I have this at the start of my base block .JSON:

"code": "betterbloomerybase",
  "class": "game:BlockBloomery",
  "entityClass": "game:Bloomery",

 

And I've tried it without "game:" without luck. Are there any extra hoops I need to jump thru in order to inherit the bloomery class? I should also mention that my added blocks (base & chimney) follow a block-{direction}-{tier} scheme, I don't know if that's complicating things.

At a glance...

You shouldn't need the game: in there, but looking at the BlockBloomery class I immediately came across this line:

if (aboveBlock.Code.Path == "bloomerychimney")

Which could be problematic for sure.  It's expecting a block with the exact code path of "bloomerychimney".  So the vanilla chimney.

Anyways, you might have to make your own clones of the classes (BlockBloomery.cs and BEBloomery.cs) to make this work for you.

https://github.com/search?q=org%3Aanegostudios+bloomery&type=code

Link to comment
Share on other sites

23 hours ago, SturgeonFish said:

Ok, I've gone and created clone classes for the base/block entity. I've switched everything over, including all references for the chimney. I'm not seeing any of my blocks show up or any recipes working now. Does anything here stand o ut as wrong?  

BetterBloomeries.cs 26.44 kB · 1 download

Sorry I’m only on my phone for a couple days so I’ll be brief.  If you use the original vanilla classes and place a vanilla chimney on top of your new bloomery base, does it work?  I’d verify that first before testing your new class(es).  Then focus on what the server-main.txt log is complaining about to work the bugs out of the new class

Link to comment
Share on other sites

All good, I appreciate the help. I had all recipes/drops/stacking working before adding the classes and making the mod a code mod. Now that I have switched and added these classes nothing is showing up, blocks or otherwise. I'm not seeing any errors in the logs either and I'm wondering if the classes are even being registered properly.

Link to comment
Share on other sites

4 hours ago, SturgeonFish said:

All good, I appreciate the help. I had all recipes/drops/stacking working before adding the classes and making the mod a code mod. Now that I have switched and added these classes nothing is showing up, blocks or otherwise. I'm not seeing any errors in the logs either and I'm wondering if the classes are even being registered properly.

Your code is looking really good and nothing obvious stands out (other than a few minor things that likely need to be tidied up).  Can you upload the entire mod so I can take it for a spin and maybe get a handle on what the problem is?  PM it to me if you don't want to share it with the world.  :)

Link to comment
Share on other sites

Untitled.thumb.jpg.60300bed203764a4a4faec9802fd99c3.jpg

What did I change?  More than I probably should have....sorry!  Including some pretty irrelevant stuff at this point.  I kept some notes:

- added lang file (en.json)
- added creative mode "Bloomeries" tab and assets to that tab (this just makes it easier to test in creative mode)
- added -north to bbbase recipe output (and had to rework that output after rearranging variantgroups - see below)
- removed game: prefix from some things, most notably behaviors - because it was throwing errors 
- rearranged variantgroups in betterbloomerybase and everything related to that (quite sure horizontalorientation has to be the last variant in order for that to work).  It was certainly crashing the game prior to doing so.
- not sure exactly what was preventing the code from working (needed to be in a src folder?  class registrations not quite right?  I don't know for sure)

You'll see that I removed a bunch of code and tidied a bit up in order to simplifying troubleshooting and get things "functional" quickly.  Obviously you've got a ways to go!  With any luck you won't need a custom entity class for that base, but I didn't look at that code too closely. You *might* need a custom block class for the chimney in order to match tiers...maybe.  Or just let players mix and match tiers when placing blocks, but prevent interaction with the base (in your existing base block class) if the chimney is the wrong tier...if you catch my meaning.

FYI:  When it's referencing .Code.Path in the c# code it's talking about the blocks json "code" (+ variants) i.e. "betterbloomerychimney-tier1" or "betterbloomerybase-tier1-north".

BetterBloomeries2.7z

Edited by Spear and Fang
  • Like 1
Link to comment
Share on other sites

I see I had a bunch of stuff not set up right, and my project structure was off. This seems functional, all the recipes/drops/smelting and stacking are working. I like being able to mix and match tiers too. The only issue now is the textures not quite being applied right but I'll fumble around to fix that. I'll have to make proper tier textures too.

Thanks a ton for the help, I'll get this polished up but I'm definitely crediting you once I put this up for release.

  • Like 1
Link to comment
Share on other sites

I haven't used gimp in forever, I need to make 3 versions of 2 textures. Looking at tier 1, I can reuse the t1 refractory brick texture for the base, but I want to copy the tier speckling to the vanilla bloomery base and chimney textures. Is there an elegant way to copy the speckle pattern or do i need to pick the colors and try and make it convincing?

chimney.png

front.png

base.png

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.