Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make clay oven more moddable #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Craluminum2413
Copy link

@Craluminum2413 Craluminum2413 commented Mar 1, 2024

Don't hardcode contents model (ovenFuelShape), get ovenFuelShape from collectible attributes of containing item instead.

In this example I made peat brick a suitable fuel for clay oven. by adding this to attributes in blocktypes/soil/peatbrick.json:

isClayOvenFuel: true,
ovenFuelShape: "block/peatbrick",

and this to textures:

"0": {base: "block/soil/peat"},

image

Don't hardcode ovenFuelShape
@Craluminum2413
Copy link
Author

Strange, it somehow changed entire file

@Craluminum2413
Copy link
Author

Oh this is why
image

So basically all I do is changing this line:

var loc = AssetLocation.Create(Block.Attributes["ovenFuelShape"].AsString(), Block.Code.Domain).WithPathPrefixOnce("shapes/").WithPathAppendixOnce(".json");

to these lines:

string shapeLoc = this.Block.Attributes["ovenFuelShape"].AsString();
if (this.FuelSlot?.Itemstack?.Collectible.Attributes.KeyExists("ovenFuelShape") == true)
{
    shapeLoc = this.FuelSlot.Itemstack.Collectible.Attributes["ovenFuelShape"].AsString();
}

var loc = AssetLocation.Create(shapeLoc, Block.Code.Domain).WithPathPrefixOnce("shapes/").WithPathAppendixOnce(".json");

@Craluminum2413
Copy link
Author

Craluminum2413 commented Mar 1, 2024

@Craluminum2413 Craluminum2413 changed the title Make clay oven less hardcoded Make clay oven more moddable Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant