This commit is contained in:
Electroblob77
2020-06-09 17:07:36 +01:00
parent a4d342caa1
commit 038ead0d55
@@ -28,6 +28,13 @@ public class WizardTradeTweaksHandler {
private static final ResourceLocation NEW_SPELL_ICON = new ResourceLocation(Wizardry.MODID, "textures/gui/container/new_spell_indicator.png");
private static final int ICON_WIDTH = 8;
private static final int ICON_HEIGHT = 8;
private static final int ANIMATION_FRAMES = 4;
private static final int ANIMATION_FRAME_TIME = 2; // In ticks
private static final int ANIMATION_PERIOD = 40; // In frame durations
private static int tradeIndex; // Mirrors GuiMerchant#selectedMerchantRecipe (don't want to reflect into it every frame)
@SubscribeEvent(priority = EventPriority.LOWEST)
@@ -93,13 +100,14 @@ public class WizardTradeTweaksHandler {
int x = gui.inventorySlots.getSlot(2).xPos + 14;
int y = gui.inventorySlots.getSlot(2).yPos - 17;
int w = 8;
int h = 8;
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.color(1, 1, 1);
Minecraft.getMinecraft().renderEngine.bindTexture(NEW_SPELL_ICON);
DrawingUtils.drawTexturedRect(x, y, 0, Math.max(player.ticksExisted/2 % 40 - 36, 0) * 8, w, h, 8, 32);
int frame = Math.max(player.ticksExisted/ANIMATION_FRAME_TIME % ANIMATION_PERIOD - (ANIMATION_PERIOD - ANIMATION_FRAMES), 0);
DrawingUtils.drawTexturedRect(x, y, 0, frame * ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT * ANIMATION_FRAMES);
RenderHelper.disableStandardItemLighting();
// int mouseX = event.getMouseX() - gui.getGuiLeft();