Skip to content

Conversation

@snailcase
Copy link

This is a proposal to reintroduce the option to have catwalk blocks on the bottom of a block, while keeping catwalk railings as separate items and blocks.

image

Overview of changes

  • Catwalks can be toggled with a wrench between a top position (default) and a bottom position.
    • For this, two new block properties are introduced: CATWALK_TOP and CATWALK_BOTTOM.
  • Rails can be placed into bottom catwalks.
    • For this, four new block properties are introduced: RAILING_[NORTH|EAST|SOUTH|WEST]
  • Catwalk blocks and railing blocks are still distinct blocks, and any existing blocks in player’s worlds shouldn’t be affected by these changes.

2025-03-14_22 51 39

Placing Catwalks

  • Placing a catwalk still works the same way: The catwalk will initially be at the top of the block.
  • Wrenching a catwalk now toggles it between the top and bottom of the block.
  • Extending catwalks (using the placement helpers) will consider the placement of the catwalk that is being extended.

Placing Railings

  • Placing a railing on a catwalk block will have different effects depending on the state of the catwalk block:
    • If the catwalk is at the bottom of the block then the railing will be placed into the catwalk block, using the direction that the player is facing.
    • If the catwalk block is in the top position, the railing will simply be placed in the block above. This hasn’t changed.
  • Railings can still be placed as standalone railing blocks.

Interacting with catwalk blocks

  • A catwalk block with railings can be wrenched to rotate it.
  • Shift-wrenching a catwalk block will return the component that the player is looking at (i.e. either a railing or the catwalk)

Interacting with railing blocks

The existing railing blocks are mostly unchanged. However, players can now place a catwalk into a railing block. This will replace the railing block with a catwalk block.

Things I’ve tested

The additional block properties introduce some complexity, and I’ve tried my best to test a lot of scenarios. Here’s a list of things I’ve tested:

  • The hitbox of the catwalk block correctly changes based on the position of the catwalk and the presence of railings.
  • The BOTTOM block property (i.e. the full-block model for catwalks that are above support blocks) is still working. The full-block model is only visible if the catwalk is at the top of the block
  • In schematics, the cost of a catwalk block with railings is reflected correctly (i.e. a schematic with a catwalk block with two railings will need one catwalk item and two railing items).
  • Rotating and mirroring catwalk blocks in schematics works correctly.
  • Breaking a catwalk block with railings will drop the correct number of catwalk and railing items.
  • When placing catwalk or railing items into existing blocks, there’s code to make sure that the item and block have a matching metal type.
  • When the last component of a catwalk block is removed by shift-wrenching, the block will be replaced with an air block.
  • Railings cannot be placed inside the catwalk block if the catwalk is at the top.
  • Mechanical deployers can use railings on catwalks.
  • I’ve tested both the Forge and Fabric version.

Known issues

There are a couple of small things that I couldn’t fix yet. They are all related to ghost states in placement helpers. When holding an item of one metal type and looking at a block of another metal type, there’s still a ghost state presented that hints at a possible interaction. However, actually placing the item into the block doesn’t work. So it’s mostly a cosmetic issue.

Specifically, the following interactions produce ghost states that aren’t accurate:

  • holding a catwalk item and looking at a catwalk block of a different metal
  • holding a catwalk item and looking at a railing block of a different metal
  • holding a railing item and looking at a catwalk block of a different metal

None of the interactions succeed, though.

image

… stairs

This is useful for implementing the interaction between catwalk blocks and railing blocks, where we want to only
allow interactions if their metals match.
Placing a catwalk of the same metal on an existing railing block will add the catwalk to the bottom of the
railing block.
…nd presence of railings

This is an alternative approach where the catwalk block has properties to indicate whether there are railings in the block, and
whether there's a catwalk shape at the top or bottom of the block.
this is taken straight from the CatwalkRailing block code
When wrenching a catwalk block, change the state depending on the current state:

 - If the catwalk block has any railings, rotate the block using the default iWrenchable implementation
 - If there are no railing blocks, toggle between the top and bottom surface
…g block"

I prefer the approach where the Catwalk block is the main block that contains
state for railings, so the changes in this commit are no longer needed.
…esent presence of catwalk"

This reverts commit 728c8eefdc5556364a9be6ff22caf89a41d43285
(except for the block andesite_catwalk_down, which we're still using)
I've added a second function isCatwalkOrStair that has the old behaviour, but I'm not using it anywhere
because I don't yet understand why it permitted both, catwalk blocks and stairs here
I set everything to true for debugging, but realistically, initially we only
want a single catwalk.
This tweaks the interaction between catwalks and railing items. A catwalk block that has a top-side catwalk shouldn't
allow placing rails inside its block. Those would show up under the catwalk. By preventing this interaction, the railing
will simply be placed on the block above.
When placing a catwalk block into an existing railing block, the railing block is replaced
by a catwalk block with the appropriate block state set.
…and items

The placement helpers still produce ghost states, even if the metals don't match.
I haven't been able to figure out why that is.
Before, the item costs in schematics would not accurately represent how many items are actually needed,
and you could place a block with 4 railings with only a single railing item. This fixes that by specifying
the exact number of items, depending on the block state.
@snailcase snailcase changed the title Catwalks overhaul Proposal to reintroduce catwalks at the bottom of the block Mar 14, 2025
@snailcase
Copy link
Author

ah I see that there were some changes in 1.20-main yesterday. I'll resolve the conflicts and test with the new changes tomorrow!

@riggyz
Copy link

riggyz commented Mar 15, 2025

+1 to this!

Conflicts:
	common/src/main/java/com/github/talrey/createdeco/items/CatwalkBlockItem.java
	common/src/main/java/com/github/talrey/createdeco/items/RailingBlockItem.java
On 1.7, the build failed with the following error message:
* What went wrong:
A problem occurred evaluating root project 'createdeco'.
> Failed to apply plugin 'dev.architectury.loom'.
   > Could not create an instance of type net.fabricmc.loom.extension.LoomGradleExtensionImpl.
      > Could not create an instance of type net.fabricmc.loom.extension.LoomProblemReporter.
         > 'org.gradle.api.problems.ProblemReporter org.gradle.api.problems.Problems.forNamespace(java.lang.String)'

This fix is based on architectury/architectury-api#586
@snailcase snailcase marked this pull request as ready for review March 15, 2025 08:46
@snailcase
Copy link
Author

snailcase commented Mar 15, 2025

I've pulled in the changes from 1.20-main, and tested everything again with Create v6. All seems to work, still. I did have to update architectury loom to 1.9-snapshot (see 3216860). Not sure if there's a way around that... here's the error that I got with 1.7-SNAPSHOT:
loom-1.7-errors.txt

@Bugtester6977
Copy link

Hi, Very late but does this still work and do If I am on a aternos server do i have to type the code into the server.

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.

3 participants