-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- Updated Simplified Chinese localization (#315) | ||
- fix restock amount also displaying in stacks in JEI (#318) |
33 changes: 16 additions & 17 deletions
33
...ari_023/ae2wtlib/mixin/RestockRender.java → .../de/mari_023/ae2wtlib/mixin/GuiMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
package de.mari_023.ae2wtlib.mixin; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import appeng.util.ReadableNumberConverter; | ||
import de.mari_023.ae2wtlib.wct.CraftingTerminalHandler; | ||
import net.minecraft.client.DeltaTracker; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Font; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import appeng.util.ReadableNumberConverter; | ||
|
||
import de.mari_023.ae2wtlib.wct.CraftingTerminalHandler; | ||
|
||
@Mixin(value = GuiGraphics.class, remap = false) | ||
public abstract class RestockRender { | ||
@Mixin(Gui.class) | ||
public class GuiMixin { | ||
@Final | ||
@Shadow | ||
public abstract void renderItemDecorations(Font pFont, ItemStack pStack, int pX, int pY, @Nullable String pText); | ||
private Minecraft minecraft; | ||
|
||
@Inject(method = "renderItemDecorations(Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;II)V", at = @At(value = "HEAD"), cancellable = true) | ||
public void renderGuiItemOverlay(Font font, ItemStack stack, int x, int y, CallbackInfo ci) { | ||
@Inject(method = "renderSlot(Lnet/minecraft/client/gui/GuiGraphics;IILnet/minecraft/client/DeltaTracker;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;renderItemDecorations(Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;II)V"), cancellable = true) | ||
public void restockOverlay(GuiGraphics guiGraphics, int x, int y, DeltaTracker deltaTracker, Player player, ItemStack stack, int seed, CallbackInfo ci) { | ||
if (Minecraft.getInstance().player == null || Minecraft.getInstance().player.isCreative()) | ||
return; | ||
CraftingTerminalHandler handler = CraftingTerminalHandler | ||
.getCraftingTerminalHandler(Minecraft.getInstance().player); | ||
if (!handler.isRestockEnabled() || stack.getCount() == 1 || !handler.isRestockAble(stack)) | ||
return; | ||
renderItemDecorations(font, stack, x, y, ReadableNumberConverter.format(handler.getAccessibleAmount(stack), 3)); | ||
guiGraphics.renderItemDecorations(minecraft.font, stack, x, y, ReadableNumberConverter.format(handler.getAccessibleAmount(stack), 3)); | ||
ci.cancel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters