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

Fix serverside localization error, add missing localization keys #47

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import net.minecraft.util.Util;

public class TypedGroupedBlockItem extends BlockItem implements TypedGrouped {
public static final String BLOCKTYPE_BLOCK_KEY = "architecture_extensions.block_type_block";
public static final String BLOCK_TYPE_PREFIX = "architecture_extensions.block_type";
public static final String MISSING_LOCALIZATION_KEY = "architecture_extensions.i18n.missing_key";

protected final TypedGroupedBlock typedGroupedBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@

public interface TypedGrouped {
public static final String GROUPED_BLOCK_PREFIX = "architecture_extensions.grouped_block";
public static final String BLOCKTYPE_BLOCK_KEY = "architecture_extensions.block_type_block";
public static final String BLOCK_TYPE_PREFIX = "architecture_extensions.block_type";

public TypedGroupedBlock getTypedGroupedBlock();

public default MutableText getServerTranslation() {
String typeId = getTypedGroupedBlock().type().toString();
Identifier blockId = getTypedGroupedBlock().groupedBlock().id();

boolean isVanilla = blockId.getNamespace().equals("minecraft") || blockId.getNamespace().equals("");

if (isVanilla) {
//Our vanillaIntegration is legacy
String lessIdeal = GROUPED_BLOCK_PREFIX + "." + blockId.getPath();
return Text.translatable(lessIdeal);
} else {
MutableText baseBlockName = (isVanilla) ?
//Our VanillaIntegration keys are all legacy ones
Text.translatable(GROUPED_BLOCK_PREFIX + "." + blockId.getPath()) :
//Assume everyone else is not legacy
String ideal = GROUPED_BLOCK_PREFIX + "." + blockId.getNamespace() + "." + blockId.getPath();
return Text.translatable(ideal);
}
Text.translatable(GROUPED_BLOCK_PREFIX + "." + blockId.getNamespace() + "." + blockId.getPath());

MutableText blockTypeName = Text.translatable(BLOCK_TYPE_PREFIX + "." + typeId);

return Text.translatable(BLOCKTYPE_BLOCK_KEY, baseBlockName, blockTypeName);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"architecture_extensions.block_type.wall_post": "Wall Post",
"architecture_extensions.block_type.octagonal_column": "Octagonal Column",

"architecture_extensions.grouped_block.debuggy_block": "Debuggy Block",

"architecture_extensions.grouped_block.bamboo": "Bamboo",

Expand All @@ -39,6 +40,7 @@
"architecture_extensions.grouped_block.red_sand": "Red Sand",

"architecture_extensions.grouped_block.stone": "Stone",
"architecture_extensions.grouped_block.smooth_stone": "Smooth Stone",
"architecture_extensions.grouped_block.granite": "Granite",
"architecture_extensions.grouped_block.diorite": "Diorite",
"architecture_extensions.grouped_block.andesite": "Andesite",
Expand Down