Skip to content

Commit

Permalink
port 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Aug 10, 2024
1 parent c1c10ef commit 1255c57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -90,7 +92,7 @@ public void setRecipe(IRecipeLayoutBuilder builder, AlchemistCauldronJeiRecipe r
}

@Override
public void draw(AlchemistCauldronJeiRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) {
public void draw(@NotNull AlchemistCauldronJeiRecipe recipe, IRecipeSlotsView recipeSlotsView, @NotNull GuiGraphics guiHelper, double mouseX, double mouseY) {
Optional<ItemStack> leftStack = recipeSlotsView.findSlotByName(inputSlotName)
.flatMap(IRecipeSlotView::getDisplayedItemStack);

Expand All @@ -100,21 +102,21 @@ public void draw(AlchemistCauldronJeiRecipe recipe, IRecipeSlotsView recipeSlots
Optional<ItemStack> outputStack = recipeSlotsView.findSlotByName(outputSlotName)
.flatMap(IRecipeSlotView::getDisplayedItemStack);

stack.pushPose();
guiHelper.pose().pushPose();
{
stack.translate((getWidth() / 2) - 8 * 1.4f, (getHeight() / 2) - 2, 0);
stack.scale(1.4f, 1.4f, 1.4f);
cauldron_block_icon.draw(stack);
guiHelper.pose().translate((getWidth() / 2) - 8 * 1.4f, (getHeight() / 2) - 2, 0);
guiHelper.pose().scale(1.4f, 1.4f, 1.4f);
cauldron_block_icon.draw(guiHelper);
}
stack.popPose();
guiHelper.pose().popPose();

if (leftStack.isPresent() && leftStack.get().is(ItemRegistry.SCROLL.get())) {
var inputText = String.format("%s%%", (int) (ServerConfigs.SCROLL_RECYCLE_CHANCE.get() * 100));

var font = Minecraft.getInstance().font;
int y = (getHeight() / 2);
int x = (getWidth() - font.width(inputText)) * 3 / 4;
font.drawShadow(stack, inputText, x, y, Math.min(ServerConfigs.SCROLL_RECYCLE_CHANCE.get(), 1d) == 1d ? ChatFormatting.GREEN.getColor() : ChatFormatting.RED.getColor());
guiHelper.drawString(font, inputText, x, y, Math.min(ServerConfigs.SCROLL_RECYCLE_CHANCE.get(), 1d) == 1d ? ChatFormatting.GREEN.getColor() : ChatFormatting.RED.getColor());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static void register(IEventBus eventBus) {
entries.accept(ItemRegistry.LIGHTNING_ROD_STAFF.get());
entries.accept(ItemRegistry.MAGEHUNTER.get());
entries.accept(ItemRegistry.KEEPER_FLAMBERGE.get());
entries.accept(ItemRegistry.SPELLBREAKER.get());
entries.accept(ItemRegistry.AMETHYST_RAPIER.get());
entries.accept(ItemRegistry.WAYWARD_COMPASS.get());

entries.accept(ItemRegistry.WANDERING_MAGICIAN_HELMET.get());
Expand Down Expand Up @@ -162,6 +164,7 @@ public static void register(IEventBus eventBus) {
entries.accept(ItemRegistry.FROSTED_HELVE.get());
entries.accept(ItemRegistry.ENERGIZED_CORE.get());
entries.accept(ItemRegistry.FURLED_MAP.get());
entries.accept(ItemRegistry.WEAPON_PARTS.get());

entries.accept(ItemRegistry.BLANK_RUNE.get());
entries.accept(ItemRegistry.FIRE_RUNE.get());
Expand Down

0 comments on commit 1255c57

Please sign in to comment.