Add universal dyed catwalk railings - #281
Open
viralhysteria wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Catwalk stairs currently support attaching a railing to their left/right side, but the attached railing's texture was hard-tied to a single state shared by both sides — meaning a railing could only ever be textured as whatever metal or color happened to occupy that one shared property, and mixing metals/colors on the same stair, or applying a universal dyed railing to a stair of a different metal, wasn't representable in the block state at all.
This PR splits railing color into independent per-side state, introduces a proper
RailingColortype that distinguishes "this side's own metal" from "a universal dye," and updates the data-driven texture wiring (blockstates + models) so any combination of metal stair + dyed or standard railing renders correctly. No existing metal-only railing behavior changes — a stair with only standard railings placed behaves exactly as it did before this PR, both visually and in terms of block state defaults.Changes
RailingColor(new)A 7-value enum: 7 of the 16 vanilla
DyeColors, plus aNATURALsentinel meaning "no dye — use this stair's own metal-matched rail texture." This is intentionally its own type rather than reusingDyeColordirectly, sinceDyeColorhas no way to express "undyed."fromRegistryPrefix(String)resolves a placed railing item's registry name back into the correctRailingColor, falling back toNATURALfor anything that isn't a recognized universal dye.BlockRegistryDYED_CATWALK_RAILINGSHashMap to map each dyed variant as a modifier of Andedsite catwalksCatwalksrecipeDyeRailingmethod for allowing shapeless crafting of dyed railings by pairing a single dye with an Andesite railingCatwalkBlockisPathFindableoverride to fix mob pathfindingCatwalkStairBlockRAILING_LEFT_COLORandRAILING_RIGHT_COLOR, each defaulting toRailingColor.NATURAL.onSneakWrenchednow reads the removed side's own color property and returns the matching item — a metal-matched standard railing when that side wasNATURAL, or the correct dyed railing item when it wasn't — instead of always assuming the stair's base metal.RailingBlockItemuseOnnow gates whether a railing is allowed to attach to a stair at all, rather than always attaching and only varying the resulting texture.resolveMaterialKey, which determines whichBlockRegistry.CATWALK_RAILINGSentry (a metal name like"Iron", or a dye name like"Blue") the clicked item's registry path corresponds to.isMetalis derived by checking whether the resolved key exists inItemRegistry.METAL_TYPES— the same mapItemRegistryitself uses to define what a "metal" is, so there's no separate metal enumeration to keep in sync.Assets (blockstates + models)
<color>_catwalk_stairs_rail_left/right.json) replace per-metal-only overlay models for dyed cases, parented off the existing shared rail geometry so no new geometry was authored.railing_left_color/railing_right_colorconditions: anaturalcase (pointing at that metal's existing, unmodified_rail_left/_rail_rightmodel) plus one case per registered dye color.<metal>_catwalk_stairs.jsonmodel (stair body + fixed corner-post texture) is untouched in behavior — it still always renders with that metal's own native texture, since it isn't state-conditional. Only the attachable railing overlay is dyeable per instance.Why existing metal variants are unaffected
NATURALon both sides. Any stair placed or already in the world with no railing color explicitly set behaves exactly as before — same texture, same lookup path (<metal>_catwalk_stairs_rail_left/right), same recipe/wrench return.naturalblockstate branch is structurally identical to the original. For each metal, the regenerated blockstate'snatural-conditioned entries are a 1:1 match to the pre-existingrailing_left/railing_rightentries, just with an addedrailing_left_color: natural/railing_right_color: naturalcondition — same model reference, sameyrotation per facing.Known limitation / follow-up
The stair's baked-in corner-post nub (part of the always-applied base model, not the removable railing) still always renders in the stair's native metal color, even when a dyed railing is attached next to it. Making the nub match the attached side's dye would require splitting that geometry out per side and adding its own state-conditioned multipart entries — left as a possible follow-up rather than bundled into this PR, since it's a larger structural change and not required for the core feature. I also chose to limit the initial selection of variants due to the nature of how the initial implementation relies on expanding blockstate json files based on which colors seemed most applicable to real world examples of guard rails for worksafe safety compliance.
Testing
runData/buildpass with no registry or asset-loading errors.