Fixed chained crafters not taking over the name of the root crafter. Fixes #3418
This commit is contained in:
@@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed chained crafters not taking over the name of the root crafter.
|
||||
|
||||
## [v1.11.1] - 2022-10-30
|
||||
|
||||
### Fixed
|
||||
|
@@ -86,11 +86,23 @@ public interface ICraftingPatternContainer {
|
||||
|
||||
/**
|
||||
* The name of this container for categorizing in the Crafting Manager GUI.
|
||||
* Will return the name of the root container if we're in a chained scenario.
|
||||
*
|
||||
* @return the name of this container
|
||||
*/
|
||||
Component getName();
|
||||
|
||||
/**
|
||||
* The custom name of this container, as set in an anvil for example.
|
||||
* Can be null.
|
||||
*
|
||||
* @return the name of this container
|
||||
*/
|
||||
@Nullable
|
||||
default Component getCustomName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the position of this container
|
||||
*/
|
||||
|
@@ -298,11 +298,21 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getName() {
|
||||
if (displayName != null) {
|
||||
@Nullable
|
||||
public Component getCustomName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getName() {
|
||||
ICraftingPatternContainer root = getRootContainer();
|
||||
if (root != null) {
|
||||
Component displayNameOfRoot = root.getCustomName();
|
||||
if (displayNameOfRoot != null) {
|
||||
return displayNameOfRoot;
|
||||
}
|
||||
}
|
||||
|
||||
BlockEntity facing = getConnectedBlockEntity();
|
||||
|
||||
if (facing instanceof Nameable && ((Nameable) facing).getName() != null) {
|
||||
|
Reference in New Issue
Block a user