diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-15 16:35:56 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-15 16:35:56 +0200 |
commit | 2d923d222ebc58777dbf8523484f69a26313188c (patch) | |
tree | 278d3b9861463cbb0bf8f6fcf8a2aae425b63484 | |
parent | efb8f6791082f68a239867ed22212d5504b5bfa5 (diff) | |
parent | e1d9c8b8b1dac3be1e1fbc0ce95465a98c4be5f0 (diff) | |
download | skyhanni-2d923d222ebc58777dbf8523484f69a26313188c.tar.gz skyhanni-2d923d222ebc58777dbf8523484f69a26313188c.tar.bz2 skyhanni-2d923d222ebc58777dbf8523484f69a26313188c.zip |
Merge remote-tracking branch 'origin/master'
9 files changed, 142 insertions, 178 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java index 6777a124d..d89f92da8 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/inventory/GuiEditSignMixin.java @@ -1,7 +1,8 @@ package at.hannibal2.skyhanni.mixins.transformers.gui.inventory; - import at.hannibal2.skyhanni.sign.*; +import java.io.IOException; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -19,11 +20,9 @@ import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.io.IOException; -import java.util.List; - @Mixin(GuiEditSign.class) public class GuiEditSignMixin extends GuiScreen implements IEditSign { + private final GuiEditSign that = (GuiEditSign) (Object) this; private TextInputUtil textInputUtil; private SignSelectionList globalSelector; @@ -40,7 +39,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { @Inject(method = "initGui()V", at = @At("RETURN")) private void initGui(CallbackInfo info) { -// this.textInputUtil = new TextInputUtil(this.fontRendererObj, () -> ((IModifiedSign) this.that.tileSign).getText(this.editLine).getUnformattedText(), text -> ((IModifiedSign) this.that.tileSign).setText(this.editLine, new ChatComponentText(text)), 90); + // this.textInputUtil = new TextInputUtil(this.fontRendererObj, () -> ((IModifiedSign) this.that.tileSign).getText(this.editLine).getUnformattedText(), text -> ((IModifiedSign) this.that.tileSign).setText(this.editLine, new ChatComponentText(text)), 90); this.textInputUtil = new TextInputUtil(this.fontRendererObj, () -> ((IModifiedSign) getTileSign(this.that)).getText(this.editLine).getUnformattedText(), text -> ((IModifiedSign) getTileSign(this.that)).setText(this.editLine, new ChatComponentText(text)), 90); if (SkyBlockEventHandler.isSkyBlock && SkyBlockcatiaConfig.enableSignSelectionList) { @@ -87,56 +86,55 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { Keyboard.enableRepeatEvents(false); if (SkyBlockEventHandler.isSkyBlock) { -// String text = this.that.tileSign.signText[0].getUnformattedText(); + // String text = this.that.tileSign.signText[0].getUnformattedText(); String text = getTileSign(this.that).signText[0].getUnformattedText(); - -// if (!StringUtils.isNullOrEmpty(text)) -// { -// if (NumberUtils.isNumericWithKM(text) && (!SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && this.isAuctionPrice() || this.isAuctionStartBidSign() || this.isBazaarPrice() || this.isBankWithdraw() || this.isBankDeposit())) -// { -// this.globalSelector.add(text); -// } -// else if (NumberUtils.isNumeric(text) && this.isBazaarOrder()) -// { -// this.globalSelector.add(text); -// } -// else if (this.isAuctionQuery()) -// { -// this.globalSelector.add(text); -// } -// } + // if (!StringUtils.isNullOrEmpty(text)) + // { + // if (NumberUtils.isNumericWithKM(text) && (!SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && this.isAuctionPrice() || this.isAuctionStartBidSign() || this.isBazaarPrice() || this.isBankWithdraw() || this.isBankDeposit())) + // { + // this.globalSelector.add(text); + // } + // else if (NumberUtils.isNumeric(text) && this.isBazaarOrder()) + // { + // this.globalSelector.add(text); + // } + // else if (this.isAuctionQuery()) + // { + // this.globalSelector.add(text); + // } + // } } -// if (!(SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && this.isAuctionPrice())) { -//// SignSelectionList.processSignData(this.that.tileSign); -// SignSelectionList.processSignData(getTileSign(this.that)); -// } + // if (!(SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && this.isAuctionPrice())) { + //// SignSelectionList.processSignData(this.that.tileSign); + // SignSelectionList.processSignData(getTileSign(this.that)); + // } info.cancel(); } } @Inject(method = "actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V", cancellable = true, at = @At(value = "INVOKE", target = "net/minecraft/tileentity/TileEntitySign.markDirty()V", shift = Shift.AFTER)) private void actionPerformed(GuiButton button, CallbackInfo info) throws IOException { -// if (SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm) -// { -// String text = this.that.tileSign.signText[0].getUnformattedText(); -// -// if (!StringUtils.isNullOrEmpty(text) && NumberUtils.isNumeric(text) && this.isAuctionPrice()) -// { -// int price = Integer.parseInt(text); -// -// if (price >= SkyBlockcatiaSettings.INSTANCE.auctionBidConfirmValue) -// { -// this.mc.displayGuiScreen(new GuiYesNo(this, LangUtils.translate("message.bid_confirm_title"), LangUtils.translate("message.bid_confirm"), 201)); -// info.cancel(); -// } -// else -// { -// this.that.tileSign.markDirty(); -// SignSelectionList.processSignData(this.that.tileSign); -// this.globalSelector.add(text); -// } -// } -// } + // if (SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm) + // { + // String text = this.that.tileSign.signText[0].getUnformattedText(); + // + // if (!StringUtils.isNullOrEmpty(text) && NumberUtils.isNumeric(text) && this.isAuctionPrice()) + // { + // int price = Integer.parseInt(text); + // + // if (price >= SkyBlockcatiaSettings.INSTANCE.auctionBidConfirmValue) + // { + // this.mc.displayGuiScreen(new GuiYesNo(this, LangUtils.translate("message.bid_confirm_title"), LangUtils.translate("message.bid_confirm"), 201)); + // info.cancel(); + // } + // else + // { + // this.that.tileSign.markDirty(); + // SignSelectionList.processSignData(this.that.tileSign); + // this.globalSelector.add(text); + // } + // } + // } } @Inject(method = "keyTyped(CI)V", cancellable = true, at = @At("HEAD")) @@ -152,7 +150,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { private void drawScreenPre(int mouseX, int mouseY, float partialTicks, CallbackInfo info) { if (SkyBlockcatiaConfig.enableOverwriteSignEditing) { this.drawDefaultBackground(); -// this.drawCenteredString(this.fontRendererObj, LangUtils.translate("sign.edit"), this.width / 2, 40, 16777215); + // this.drawCenteredString(this.fontRendererObj, LangUtils.translate("sign.edit"), this.width / 2, 40, 16777215); this.drawCenteredString(this.fontRendererObj, "Sign Edit", this.width / 2, 40, 16777215); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); @@ -160,16 +158,16 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { float f = 93.75F; GlStateManager.scale(-f, -f, -f); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); -// Block block = this.that.tileSign.getBlockType(); + // Block block = this.that.tileSign.getBlockType(); Block block = getTileSign(this.that).getBlockType(); if (block == Blocks.standing_sign) { -// float f1 = this.that.tileSign.getBlockMetadata() * 360 / 16.0F; + // float f1 = this.that.tileSign.getBlockMetadata() * 360 / 16.0F; float f1 = getTileSign(this.that).getBlockMetadata() * 360 / 16.0F; GlStateManager.rotate(f1, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, -1.0625F, 0.0F); } else { -// int i = this.that.tileSign.getBlockMetadata(); + // int i = this.that.tileSign.getBlockMetadata(); int i = getTileSign(this.that).getBlockMetadata(); float f2 = 0.0F; @@ -187,11 +185,11 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, -1.0625F, 0.0F); } -// ((IModifiedSign) this.that.tileSign).setSelectionState(this.editLine, this.textInputUtil.getSelectionStart(), this.textInputUtil.getSelectionEnd(), this.updateCounter / 6 % 2 == 0); + // ((IModifiedSign) this.that.tileSign).setSelectionState(this.editLine, this.textInputUtil.getSelectionStart(), this.textInputUtil.getSelectionEnd(), this.updateCounter / 6 % 2 == 0); ((IModifiedSign) getTileSign(this.that)).setSelectionState(this.editLine, this.textInputUtil.getSelectionStart(), this.textInputUtil.getSelectionEnd(), this.updateCounter / 6 % 2 == 0); -// TileEntityRendererDispatcher.instance.renderTileEntityAt(this.that.tileSign, -0.5D, -0.75D, -0.5D, 0.0F); + // TileEntityRendererDispatcher.instance.renderTileEntityAt(this.that.tileSign, -0.5D, -0.75D, -0.5D, 0.0F); TileEntityRendererDispatcher.instance.renderTileEntityAt(getTileSign(this.that), -0.5D, -0.75D, -0.5D, 0.0F); -// ((IModifiedSign) this.that.tileSign).resetSelectionState(); + // ((IModifiedSign) this.that.tileSign).resetSelectionState(); ((IModifiedSign) getTileSign(this.that)).resetSelectionState(); GlStateManager.popMatrix(); super.drawScreen(mouseX, mouseY, partialTicks); @@ -235,7 +233,7 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { } private boolean isAuctionStartBidSign() { -// return this.that.tileSign.signText[2].getUnformattedText().equals("Your auction") && this.that.tileSign.signText[3].getUnformattedText().equals("starting bid"); + // return this.that.tileSign.signText[2].getUnformattedText().equals("Your auction") && this.that.tileSign.signText[3].getUnformattedText().equals("starting bid"); return getTileSign(this.that).signText[2].getUnformattedText().equals("Your auction") && getTileSign(this.that).signText[3].getUnformattedText().equals("starting bid"); } @@ -262,4 +260,4 @@ public class GuiEditSignMixin extends GuiScreen implements IEditSign { private boolean isBazaarOrder() { return getTileSign(this.that).signText[2].getUnformattedText().equals("Enter amount") && getTileSign(this.that).signText[3].getUnformattedText().equals("to order"); } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/tileentity/TileEntitySignMixin.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/tileentity/TileEntitySignMixin.java index 0863def9a..9b7ca99f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/tileentity/TileEntitySignMixin.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/tileentity/TileEntitySignMixin.java @@ -6,28 +6,25 @@ import net.minecraft.util.IChatComponent; import org.spongepowered.asm.mixin.Mixin; @Mixin(TileEntitySign.class) -public class TileEntitySignMixin implements IModifiedSign -{ +public class TileEntitySignMixin implements IModifiedSign { + private final TileEntitySign that = (TileEntitySign) (Object) this; private int selectionStart = -1; private int selectionEnd = -1; private boolean caretVisible; @Override - public IChatComponent getText(int line) - { + public IChatComponent getText(int line) { return this.that.signText[line]; } @Override - public void setText(int line, IChatComponent component) - { + public void setText(int line, IChatComponent component) { this.that.signText[line] = component; } @Override - public void setSelectionState(int currentRow, int selectionStart, int selectionEnd, boolean caretVisible) - { + public void setSelectionState(int currentRow, int selectionStart, int selectionEnd, boolean caretVisible) { this.that.lineBeingEdited = currentRow; this.selectionStart = selectionStart; this.selectionEnd = selectionEnd; @@ -35,8 +32,7 @@ public class TileEntitySignMixin implements IModifiedSign } @Override - public void resetSelectionState() - { + public void resetSelectionState() { this.that.lineBeingEdited = -1; this.selectionStart = -1; this.selectionEnd = -1; @@ -44,20 +40,17 @@ public class TileEntitySignMixin implements IModifiedSign } @Override - public boolean getCaretVisible() - { + public boolean getCaretVisible() { return this.caretVisible; } @Override - public int getSelectionStart() - { + public int getSelectionStart() { return this.selectionStart; } @Override - public int getSelectionEnd() - { + public int getSelectionEnd() { return this.selectionEnd; } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/sign/IEditSign.java b/src/main/java/at/hannibal2/skyhanni/sign/IEditSign.java index 278ec7224..d7277dd26 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/IEditSign.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/IEditSign.java @@ -4,4 +4,4 @@ public interface IEditSign { TextInputUtil getTextInputUtil(); SignSelectionList getSignSelectionList(); -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/sign/IModifiedSign.java b/src/main/java/at/hannibal2/skyhanni/sign/IModifiedSign.java index 38375d5ac..912663c2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/IModifiedSign.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/IModifiedSign.java @@ -16,4 +16,4 @@ public interface IModifiedSign { int getSelectionStart(); int getSelectionEnd(); -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/sign/LorenzSignUtils.java b/src/main/java/at/hannibal2/skyhanni/sign/LorenzSignUtils.java index 5b450a734..0b52b649c 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/LorenzSignUtils.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/LorenzSignUtils.java @@ -1,20 +1,19 @@ package at.hannibal2.skyhanni.sign; +import java.lang.reflect.Field; import net.minecraft.client.gui.inventory.GuiEditSign; import net.minecraft.tileentity.TileEntitySign; -import java.lang.reflect.Field; - public class LorenzSignUtils { private static boolean once = false; private static Field field = null; + //(field_146848_f) class net.minecraft.client.gui.inventory.GuiEditSign public static TileEntitySign getTileSign(GuiEditSign editSign) { - -// Field field1 = ReflectionHelper.findField(editSign.getClass(), "editSign"); -// ObfuscationReflectionHelper.getPrivateValue(editSign.getClass(), editSign, 0) + // Field field1 = ReflectionHelper.findField(editSign.getClass(), "editSign"); + // ObfuscationReflectionHelper.getPrivateValue(editSign.getClass(), editSign, 0) if (field != null) { try { @@ -31,29 +30,28 @@ public class LorenzSignUtils { try { Class<? extends GuiEditSign> aClass = editSign.getClass(); -// System.out.println(""); -// System.out.println(""); -// System.out.println(""); + // System.out.println(""); + // System.out.println(""); + // System.out.println(""); for (Field field : aClass.getDeclaredFields()) { String name = field.getName(); Class<?> fieldDeclaringClass = field.getDeclaringClass(); -// System.out.println(""); -// System.out.println("(" + name + ") " + fieldDeclaringClass); + // System.out.println(""); + // System.out.println("(" + name + ") " + fieldDeclaringClass); field.setAccessible(true); Object o = field.get(editSign); if (o instanceof TileEntitySign) { -// System.out.println("DONE!!!!!"); + // System.out.println("DONE!!!!!"); LorenzSignUtils.field = field; return (TileEntitySign) o; } - -// System.out.println(""); + // System.out.println(""); } -// System.out.println(""); -// System.out.println(""); -// System.out.println(""); + // System.out.println(""); + // System.out.println(""); + // System.out.println(""); Field field = aClass.getDeclaredField("tileSign"); field.setAccessible(true); return (TileEntitySign) field.get(editSign); diff --git a/src/main/java/at/hannibal2/skyhanni/sign/SignSelectionList.java b/src/main/java/at/hannibal2/skyhanni/sign/SignSelectionList.java index c9c963cee..e4a6e1030 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/SignSelectionList.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/SignSelectionList.java @@ -1,5 +1,9 @@ package at.hannibal2.skyhanni.sign; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiListExtended; @@ -14,13 +18,8 @@ import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; +public class SignSelectionList extends GuiListExtended { -public class SignSelectionList extends GuiListExtended -{ public static final List<Entry> AUCTION_STARTING_BID_PRICES = new ArrayList<>(); public static final List<Entry> AUCTION_BID_PRICES = new ArrayList<>(); public static final List<Entry> AUCTION_QUERIES = new ArrayList<>(); @@ -32,40 +31,34 @@ public class SignSelectionList extends GuiListExtended private final List<SignSelectionList.Entry> list; private final String title; - public SignSelectionList(Minecraft mc, int width, int height, int top, int bottom, List<SignSelectionList.Entry> list, String title) - { + public SignSelectionList(Minecraft mc, int width, int height, int top, int bottom, List<SignSelectionList.Entry> list, String title) { super(mc, width, height, top, bottom, 16); this.list = list; this.title = title; - if (this.getSize() > 5) - { + if (this.getSize() > 5) { this.list.remove(0); } Collections.reverse(this.list); } @Override - protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) - { + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) { this.selectedSlotIndex = slotIndex; } @Override - public IGuiListEntry getListEntry(int index) - { + public IGuiListEntry getListEntry(int index) { return this.list.stream().distinct().collect(Collectors.toList()).get(index); } @Override - protected int getSize() - { + protected int getSize() { return this.list.stream().distinct().collect(Collectors.toList()).size(); } @Override - protected boolean isSelected(int index) - { + protected boolean isSelected(int index) { return index == this.selectedSlotIndex; } @@ -76,22 +69,18 @@ public class SignSelectionList extends GuiListExtended protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha) {} @Override - public int getListWidth() - { + public int getListWidth() { return 100; } @Override - public int getSlotHeight() - { + public int getSlotHeight() { return 10; } @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) - { - if (this.field_178041_q) - { + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + if (this.field_178041_q) { this.mouseX = mouseX; this.mouseY = mouseY; this.drawBackground(); @@ -101,10 +90,9 @@ public class SignSelectionList extends GuiListExtended Tessellator tessellator = Tessellator.getInstance(); this.drawContainerBackground(tessellator); int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; + int l = this.top + 4 - (int) this.amountScrolled; - if (this.hasListHeader) - { + if (this.hasListHeader) { this.drawListHeader(k, l, tessellator); } @@ -118,13 +106,11 @@ public class SignSelectionList extends GuiListExtended GlStateManager.enableDepth(); } - public void add(String value) - { + public void add(String value) { this.list.add(new Entry(value)); } - public static void clearAll() - { + public static void clearAll() { SignSelectionList.AUCTION_STARTING_BID_PRICES.clear(); SignSelectionList.AUCTION_BID_PRICES.clear(); SignSelectionList.AUCTION_QUERIES.clear(); @@ -134,14 +120,13 @@ public class SignSelectionList extends GuiListExtended SignSelectionList.BAZAAR_PRICE.clear(); } - public static class Entry implements GuiListExtended.IGuiListEntry - { + public static class Entry implements GuiListExtended.IGuiListEntry { + private final Minecraft mc; private final String value; private long lastClicked; - public Entry(String value) - { + public Entry(String value) { this.mc = Minecraft.getMinecraft(); this.value = value; } @@ -150,49 +135,45 @@ public class SignSelectionList extends GuiListExtended public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) {} @Override - public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) - { + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) { this.mc.fontRendererObj.drawString(this.value, x + 2, y + 2, 16777215); } @Override - public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY) - { -// TileEntitySign sign = ((GuiEditSign)this.mc.currentScreen).tileSign; -// TileEntitySign sign = ().tileSign; - TileEntitySign sign = LorenzSignUtils.getTileSign((GuiEditSign)this.mc.currentScreen); + public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY) { + // TileEntitySign sign = ((GuiEditSign)this.mc.currentScreen).tileSign; + // TileEntitySign sign = ().tileSign; + TileEntitySign sign = LorenzSignUtils.getTileSign((GuiEditSign) this.mc.currentScreen); sign.markDirty(); - if (Minecraft.getSystemTime() - this.lastClicked < 250L) - { -// if (SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && NumberUtils.isNumeric(this.value)) -// { -// int price = Integer.parseInt(this.value); -// -// if (price >= SkyBlockcatiaSettings.INSTANCE.auctionBidConfirmValue) -// { -// this.mc.displayGuiScreen(new GuiYesNo(this.mc.currentScreen, LangUtils.translate("message.bid_confirm_title"), LangUtils.translate("message.bid_confirm"), 201)); -// } -// else -// { -// SignSelectionList.processSignData(sign); -// this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); -// this.mc.displayGuiScreen(null); -// } -// } -// else -// { + if (Minecraft.getSystemTime() - this.lastClicked < 250L) { + // if (SkyBlockcatiaSettings.INSTANCE.auctionBidConfirm && NumberUtils.isNumeric(this.value)) + // { + // int price = Integer.parseInt(this.value); + // + // if (price >= SkyBlockcatiaSettings.INSTANCE.auctionBidConfirmValue) + // { + // this.mc.displayGuiScreen(new GuiYesNo(this.mc.currentScreen, LangUtils.translate("message.bid_confirm_title"), LangUtils.translate("message.bid_confirm"), 201)); + // } + // else + // { + // SignSelectionList.processSignData(sign); + // this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + // this.mc.displayGuiScreen(null); + // } + // } + // else + // { SignSelectionList.processSignData(sign); this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); this.mc.displayGuiScreen(null); -// } + // } } sign.signText[0] = new ChatComponentText(this.value); - if (this.mc.currentScreen instanceof IEditSign) - { - ((IEditSign)this.mc.currentScreen).getTextInputUtil().moveCaretToEnd(); + if (this.mc.currentScreen instanceof IEditSign) { + ((IEditSign) this.mc.currentScreen).getTextInputUtil().moveCaretToEnd(); } this.lastClicked = Minecraft.getSystemTime(); return false; @@ -202,14 +183,11 @@ public class SignSelectionList extends GuiListExtended public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) {} @Override - public boolean equals(Object obj) - { - if (!(obj instanceof Entry)) - { + public boolean equals(Object obj) { + if (!(obj instanceof Entry)) { return false; } - if (obj == this) - { + if (obj == this) { return true; } Entry other = (Entry) obj; @@ -217,25 +195,21 @@ public class SignSelectionList extends GuiListExtended } @Override - public int hashCode() - { + public int hashCode() { return new HashCodeBuilder().append(this.value).toHashCode(); } - public String getValue() - { + public String getValue() { return this.value; } } - public static void processSignData(TileEntitySign sign) - { + public static void processSignData(TileEntitySign sign) { NetHandlerPlayClient nethandlerplayclient = Minecraft.getMinecraft().getNetHandler(); - if (nethandlerplayclient != null) - { + if (nethandlerplayclient != null) { nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(sign.getPos(), sign.signText)); } sign.setEditable(true); } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockEventHandler.java b/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockEventHandler.java index 6934e5820..f54043a8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockEventHandler.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockEventHandler.java @@ -3,5 +3,6 @@ package at.hannibal2.skyhanni.sign; import at.hannibal2.skyhanni.utils.LorenzUtils; public class SkyBlockEventHandler { + public static boolean isSkyBlock = LorenzUtils.INSTANCE.getInSkyblock(); } diff --git a/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockcatiaConfig.java b/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockcatiaConfig.java index 2bd80e8df..c72d7d98a 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockcatiaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/SkyBlockcatiaConfig.java @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.sign; public class SkyBlockcatiaConfig { + public static boolean enableOverwriteSignEditing = true; public static boolean enableSignSelectionList = false; } - diff --git a/src/main/java/at/hannibal2/skyhanni/sign/TextInputUtil.java b/src/main/java/at/hannibal2/skyhanni/sign/TextInputUtil.java index a66b31327..25867a57b 100644 --- a/src/main/java/at/hannibal2/skyhanni/sign/TextInputUtil.java +++ b/src/main/java/at/hannibal2/skyhanni/sign/TextInputUtil.java @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.sign; +import java.util.function.Consumer; +import java.util.function.Supplier; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ChatAllowedCharacters; @@ -7,10 +9,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import org.lwjgl.input.Keyboard; -import java.util.function.Consumer; -import java.util.function.Supplier; - public class TextInputUtil { + private final FontRenderer fontRenderer; private final Supplier<String> stringSupplier; private final Consumer<String> stringConsumer; @@ -199,4 +199,4 @@ public class TextInputUtil { } return i; } -}
\ No newline at end of file +} |