Skip to content

Commit

Permalink
improved code for setting display name of blueprint in workbench
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Feb 6, 2025
1 parent 67de0d6 commit 767c0e2
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public ItemStack clickSlot(int i, ClickType clickType, Player player, AbstractCo
CraftingRecipe recipe = optional.get();
ItemStack result = recipe.assemble(craftingGrid);
if (!result.isEmpty()) {
ItemStack blueprint = new ItemStack(GTCoreItems.Blueprint, item.getCount());
StringTag name = StringTag.valueOf(Component.Serializer.toJson(result.getHoverName()));
CompoundTag display = new CompoundTag();
display.put("Name", name);
blueprint.getOrCreateTag().put("display", display);
ItemStack blueprint = new ItemStack(GTCoreItems.Blueprint, item.getCount()).setHoverName(result.getHoverName());
blueprint.getOrCreateTag().putString("recipeId", recipe.getId().toString());
this.set(blueprint);
serverPlayer.connection.send(new ClientboundContainerSetSlotPacket(abstractContainerMenu.containerId, abstractContainerMenu.getStateId(), 31, blueprint));
Expand Down

0 comments on commit 767c0e2

Please sign in to comment.