Skip to content

Commit

Permalink
feat(gui): revamp extreme smithing table UI and functionality
Browse files Browse the repository at this point in the history
- Update ExtremeSmithingMenu to remove block position parameter
- Adjust slot positions in createInputSlotDefinitions method
- Modify ExtremeSmithingScreen to reposition title and adjust layout
- Update recipe for creative storage upgrade in ModRecipes
- fix #108 Add DRAWERS tag in ModTags for Storage Drawers compatibility
- Translate "infinity_smithing" to "extreme_smithing" in Chinese language file
  • Loading branch information
cnlimiter committed Dec 19, 2024
1 parent aa7ae8a commit f391d4f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ExtremeSmithingScreen extends ItemCombinerScreen<ExtremeSmithingMen
private static final List<ResourceLocation> EMPTY_SLOT_SMITHING_TEMPLATES = List.of(EMPTY_SLOT_SMITHING_TEMPLATE_NETHERITE_UPGRADE);
public ExtremeSmithingScreen(ExtremeSmithingMenu pMenu, Inventory pPlayerInventory, Component pTitle) {
super(pMenu, pPlayerInventory, pTitle, SMITHING_LOCATION);
this.titleLabelX = 72;
this.titleLabelY = 7;
}

private boolean hasRecipeError() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ExtremeSmithingTableBlock() {
@Override
public MenuProvider getMenuProvider(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos) {
return new SimpleMenuProvider((i, inventory, player) -> {
return new ExtremeSmithingMenu(i, inventory, pPos);
return new ExtremeSmithingMenu(i, inventory);
}, CONTAINER_TITLE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public class ExtremeSmithingMenu extends ItemCombinerMenu {
private final List<SmithingRecipe> recipes;

public ExtremeSmithingMenu(int id, Inventory playerInventory, FriendlyByteBuf buffer) {
this(id, playerInventory, buffer.readBlockPos());
this(id, playerInventory);
}
public ExtremeSmithingMenu(int pContainerId, Inventory pPlayerInventory, BlockPos pBlockPos) {
super(ModMenus.extreme_smithing_table.get(), pContainerId, pPlayerInventory, ContainerLevelAccess.create(pPlayerInventory.player.level(), pBlockPos));
public ExtremeSmithingMenu(int pContainerId, Inventory pPlayerInventory) {
super(ModMenus.extreme_smithing_table.get(), pContainerId, pPlayerInventory, ContainerLevelAccess.NULL);
this.level = pPlayerInventory.player.level();
this.recipes = this.level.getRecipeManager().getAllRecipesFor(ModRecipeTypes.EXTREME_SMITHING_RECIPE.get());
}
Expand Down Expand Up @@ -81,27 +81,27 @@ public void createResult() {

@Override
protected @NotNull ItemCombinerMenuSlotDefinition createInputSlotDefinitions() {
return ItemCombinerMenuSlotDefinition.create().withSlot(0, 8, 48, (stack) -> {
return ItemCombinerMenuSlotDefinition.create().withSlot(0, 31, 35, (stack) -> {
return this.recipes.stream().anyMatch((recipe) -> {
return recipe.isTemplateIngredient(stack);
});
}).withSlot(1, 26, 48, (stack) -> {
}).withSlot(1, 49, 35, (stack) -> {
return this.recipes.stream().anyMatch((recipe) -> {
return recipe.isBaseIngredient(stack);
});
}).withSlot(2, 44, 48, (stack) -> {
}).withSlot(2, 67, 35, (stack) -> {
return this.recipes.stream().anyMatch((recipe) -> {
return recipe.isAdditionIngredient(stack);
});
}).withSlot(3, 26, 30, (stack) -> {
}).withSlot(3, 49, 17, (stack) -> {
return this.recipes.stream().anyMatch((recipe) -> {
return recipe.isAdditionIngredient(stack);
});
}).withSlot(4, 26, 66, (stack) -> {
}).withSlot(4, 49, 53, (stack) -> {
return this.recipes.stream().anyMatch((recipe) -> {
return recipe.isAdditionIngredient(stack);
});
}).withResultSlot(5, 98, 48).build();
}).withResultSlot(5, 121, 35).build();
}

private List<ItemStack> getRelevantItems() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import committee.nova.mods.avaritia.init.registry.ModBlocks;
import committee.nova.mods.avaritia.init.registry.ModItems;
import committee.nova.mods.avaritia.init.registry.ModSingularities;
import committee.nova.mods.avaritia.init.registry.ModTags;
import committee.nova.mods.avaritia.util.SingularityUtils;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
Expand Down Expand Up @@ -998,7 +999,7 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
).build(consumer, Static.rl("tc3_creative_slot_upgrades"));

ConditionalRecipe.builder().addCondition(modLoaded("storagedrawers")).addRecipe(
ModShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ResourceLocation.tryBuild("storagedrawers", "creative_vending_upgrade"))
ModShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, ResourceLocation.tryBuild("storagedrawers", "creative_storage_upgrade"))
.pattern(" S ")
.pattern(" NDDDDDN ")
.pattern(" DNDDDND ")
Expand All @@ -1008,10 +1009,9 @@ protected void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.pattern(" DNDDDND ")
.pattern(" NDDDDDN ")
.pattern(" S ")

.define('N', ModItems.infinity_ingot.get())
.define('S', ModItems.infinity_catalyst.get())
.define('D', Static.getIngredient("storagedrawers", "oak_full_drawers_1"))
.define('N', ModItems.neutron_nugget.get())
.define('S', Items.NETHER_STAR)
.define('D', ModTags.DRAWERS)
.define('E', Static.getIngredient("storagedrawers", "emerald_storage_upgrade"))
.unlockedBy("has_item", has(Static.getItem("storagedrawers", "emerald_storage_upgrade")))::save
).build(consumer, Static.rl("sd_creative_vending_upgrade"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package committee.nova.mods.avaritia.init.registry;

import committee.nova.mods.avaritia.Static;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

/**
* @Project: Avaritia-forge
Expand All @@ -14,4 +17,5 @@

public class ModTags {
public static final TagKey<Item> SINGULARITY = ItemTags.create(Static.rl("singularity"));
public static final TagKey<Item> DRAWERS = ItemTags.create(new ResourceLocation("storagedrawers", "drawers"));
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/avaritia/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"container.dense_neutron_collector": "致密中子态素收集器",
"container.denser_neutron_collector": "高致密中子态素收集器",
"container.densest_neutron_collector": "终极致密中子态素收集器",
"container.infinity_smithing": "无尽锻造台",
"container.extreme_smithing": "终焉锻造台",
"container.sculk_crafting_table": "幽匿工作台",
"container.nether_crafting_table": "炼狱工作台",
"container.end_crafting_table": "终末工作台",
Expand Down

0 comments on commit f391d4f

Please sign in to comment.