diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-19 12:16:12 +1000 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-19 12:16:12 +1000 |
| commit | ea1391e0c6f0db863bbb61511eb6e9acb57a5968 (patch) | |
| tree | 16e0b8a76055838b6cc1963f56c1327cd8850c66 /src/main/java | |
| parent | 0c23f52d2be811d74a3b6ef598dd9de7ccb763ab (diff) | |
| download | NotEnoughUpdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.gz NotEnoughUpdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.bz2 NotEnoughUpdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.zip | |
1.1.5
Diffstat (limited to 'src/main/java')
19 files changed, 1212 insertions, 175 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java new file mode 100644 index 00000000..500587f5 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java @@ -0,0 +1,244 @@ +package io.github.moulberry.notenoughupdates; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.EntityViewRenderEvent; +import net.minecraftforge.client.event.RenderBlockOverlayEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Vector3f; + +import java.util.HashSet; +import java.util.LinkedList; + +public class CustomItemEffects { + + public static final CustomItemEffects INSTANCE = new CustomItemEffects(); + + public int aoteUseTicks = 0; + public int aoteTeleportationTicks = 0; + public Vector3f aoteTeleportationLast = null; + public Vector3f aoteTeleportationCurr = null; + public boolean teleported = false; + public float partialTicks; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if(aoteTeleportationTicks > 7) aoteTeleportationTicks = 7; + + if(aoteUseTicks > 20 && aoteTeleportationCurr != null && !teleported) { + aoteTeleportationCurr = null; + aoteTeleportationTicks = 0; + } + + if(aoteTeleportationCurr != null && aoteTeleportationTicks > 0) { + aoteUseTicks++; + if(teleported) { + float factor = 1f/aoteTeleportationTicks; + + aoteTeleportationLast = new Vector3f(aoteTeleportationCurr); + + float dX = aoteTeleportationCurr.x - (float)Minecraft.getMinecraft().thePlayer.posX; + float dY = aoteTeleportationCurr.y - (float)Minecraft.getMinecraft().thePlayer.posY; + float dZ = aoteTeleportationCurr.z - (float)Minecraft.getMinecraft().thePlayer.posZ; + + aoteTeleportationCurr.x -= dX*factor; + aoteTeleportationCurr.y -= dY*factor; + aoteTeleportationCurr.z -= dZ*factor; + + aoteTeleportationTicks--; + } else { + aoteTeleportationCurr.x = (float) Minecraft.getMinecraft().thePlayer.posX; + aoteTeleportationCurr.y = (float) Minecraft.getMinecraft().thePlayer.posY; + aoteTeleportationCurr.z = (float) Minecraft.getMinecraft().thePlayer.posZ; + aoteTeleportationLast = new Vector3f(aoteTeleportationCurr); + } + } else { + aoteTeleportationCurr = null; + aoteUseTicks = 0; + teleported = false; + } + } + + public Vector3f getCurrentPosition() { + if(!teleported || aoteTeleportationLast == null || aoteTeleportationCurr == null) return null; + return new Vector3f(aoteTeleportationLast.x + (aoteTeleportationCurr.x - aoteTeleportationLast.x) * partialTicks, + aoteTeleportationLast.y + (aoteTeleportationCurr.y - aoteTeleportationLast.y) * partialTicks, + aoteTeleportationLast.z + (aoteTeleportationCurr.z - aoteTeleportationLast.z) * partialTicks); + } + + @SubscribeEvent + public void renderBlockOverlay(DrawBlockHighlightEvent event) { + if(aoteTeleportationCurr != null && aoteTeleportationTicks > 0 && teleported) { + event.setCanceled(true); + } + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + if(heldInternal != null) { + if(heldInternal.equals("JUNGLE_AXE") || heldInternal.equals("TREECAPITATOR_AXE")) { + int maxWood = 10; + if(heldInternal.equals("TREECAPITATOR_AXE")) maxWood = 35; + + if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + GL11.glLineWidth(2.0F); + GlStateManager.disableTexture2D(); + GlStateManager.depthMask(false); + float f = 0.002F; + //BlockPos blockpos = ; + //Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockpos).getBlock(); + + if(Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()).getBlock() == Blocks.log || + Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos()).getBlock() == Blocks.log2) { + EntityPlayer player = event.player; + + int woods = 0; + + HashSet<BlockPos> candidatesOld = new HashSet<>(); + LinkedList<BlockPos> candidates = new LinkedList<>(); + LinkedList<BlockPos> candidatesNew = new LinkedList<>(); + + candidatesNew.add(event.target.getBlockPos()); + + while(woods < maxWood) { + if(candidatesNew.isEmpty()) { + break; + } + + candidates.addAll(candidatesNew); + candidatesNew.clear(); + + woods += candidates.size(); + boolean random = woods > maxWood; + + while(!candidates.isEmpty()) { + BlockPos candidate = candidates.pop(); + Block block = Minecraft.getMinecraft().theWorld.getBlockState(candidate).getBlock(); + + candidatesOld.add(candidate); + + for(int x = -1; x <= 1; x++) { + for(int y = -1; y <= 1; y++) { + for(int z = -1; z <= 1; z++) { + if(x != 0 || y != 0 || z != 0) { + BlockPos posNew = candidate.add(x, y, z); + if(!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) { + Block blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew).getBlock(); + if(blockNew == Blocks.log || blockNew == Blocks.log2) { + candidatesNew.add(posNew); + } + } + } + } + } + } + + block.setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate); + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks; + double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks; + + drawSelectionBoundingBox(block.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate) + .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), + random ? 0.1f : 0.2f); + } + } + } + + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + } + } + } + + public static void drawSelectionBoundingBox(AxisAlignedBB p_181561_0_, float alpha) { + GlStateManager.color(64/255f, 224/255f, 208/255f, alpha); + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + //vertical + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + //x + + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + + //z + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + + } + + @SubscribeEvent + public void onPlayerInteract(PlayerInteractEvent event) { + if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR || event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + if(held != null) { + String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + if(internal != null && internal.equals("ASPECT_OF_THE_END")) { + aoteTeleportationTicks += 5; + + if(aoteTeleportationCurr == null) { + aoteTeleportationCurr = new Vector3f(); + aoteTeleportationCurr.x = (float) Minecraft.getMinecraft().thePlayer.posX; + aoteTeleportationCurr.y = (float) Minecraft.getMinecraft().thePlayer.posY; + aoteTeleportationCurr.z = (float) Minecraft.getMinecraft().thePlayer.posZ; + } + + } + } + } + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index fc7db07b..af23787a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; +import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; @@ -33,6 +34,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import javax.swing.*; @@ -131,6 +133,7 @@ public class NEUEventListener { } if(longUpdate) { neu.updateSkyblockScoreboard(); + CapeManager.getInstance().tick(); if(neu.hasSkyblockScoreboard()) { lastSkyblockScoreboard = currentTime; if(!joinedSB) { @@ -657,6 +660,9 @@ public class NEUEventListener { */ @SubscribeEvent public void onGuiScreenMouse(GuiScreenEvent.MouseInputEvent.Pre event) { + if(!event.isCanceled()) { + Utils.scrollTooltip(Mouse.getEventDWheel()); + } if(event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView()) { event.setCanceled(true); neu.manager.auctionManager.customAH.handleMouseInput(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 2cfe9d91..2ae298e2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -464,8 +464,8 @@ public class NEUManager { } URL url = new URL(dlUrl+name); URLConnection urlConnection = url.openConnection(); - urlConnection.setConnectTimeout(3000); - urlConnection.setReadTimeout(3000); + urlConnection.setConnectTimeout(5000); + urlConnection.setReadTimeout(5000); try (BufferedInputStream inStream = new BufferedInputStream(urlConnection.getInputStream()); FileOutputStream fileOutputStream = new FileOutputStream(item)) { byte dataBuffer[] = new byte[1024]; @@ -503,8 +503,8 @@ public class NEUManager { } URL url = new URL(dlUrl); URLConnection urlConnection = url.openConnection(); - urlConnection.setConnectTimeout(3000); - urlConnection.setReadTimeout(3000); + urlConnection.setConnectTimeout(15000); + urlConnection.setReadTimeout(20000); try (BufferedInputStream inStream = new BufferedInputStream(urlConnection.getInputStream()); FileOutputStream fileOutputStream = new FileOutputStream(itemsZip)) { byte dataBuffer[] = new byte[1024]; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 6e01e409..aa604854 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -9,10 +9,10 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; +import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics; import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.infopanes.CollectionLogInfoPane; -import io.github.moulberry.notenoughupdates.infopanes.CosmeticsInfoPane; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; @@ -40,8 +40,6 @@ import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.StringUtils; import javax.swing.*; @@ -128,6 +126,37 @@ public class NotEnoughUpdates { } }); + SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + profileViewer.getProfileByName(args[0], profile -> { + if (profile != null) { + profile.resetCache(); + + float overallScore = 0; + + JsonObject profileInfo = profile.getProfileInformation(null); + + JsonObject skill = profile.getSkillInfo(null); + } + }); + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; + List<String> playerMatches = new ArrayList<>(); + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + public static ProfileViewer profileViewer; SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { @@ -252,10 +281,7 @@ public class NotEnoughUpdates { SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) { - openGui = new GuiInventory(Minecraft.getMinecraft().thePlayer); - } - overlay.displayInformationPane(new CosmeticsInfoPane(overlay, manager)); + openGui = new GuiCosmetics(); } }); @@ -288,6 +314,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(new NEUEventListener(this)); MinecraftForge.EVENT_BUS.register(CapeManager.getInstance()); MinecraftForge.EVENT_BUS.register(new SBGamemodes()); + MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE); File f = new File(event.getModConfigurationDirectory(), "notenoughupdates"); f.mkdirs(); @@ -425,6 +452,7 @@ public class NotEnoughUpdates { long currentTime = System.currentTimeMillis(); if (openGui != null) { + Minecraft.getMinecraft().thePlayer.closeScreen(); Minecraft.getMinecraft().displayGuiScreen(openGui); openGui = null; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index de03baa9..457c06d0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -309,7 +309,7 @@ public class APIManager { getPageFromAPI(0); } - manager.hypixelApi.getApiGZIPAsync("http://moulberry.codes/auction.json.gz", jsonObject -> { + manager.hypixelApi.getMyApiGZIPAsync("auction.json.gz", jsonObject -> { if(jsonObject.get("success").getAsBoolean()) { long apiUpdate = (long)jsonObject.get("time").getAsFloat(); if(lastApiUpdate == apiUpdate) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index 3780db3d..817c9e96 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.auction; import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -405,13 +406,12 @@ public class CustomAH extends Gui { return -1; } - public String findEndsInStr(ItemStack stack) { + public String findStrStart(ItemStack stack, String toFind) { if(stack.hasTagCompound()) { //ยง7Ends in: - String endsIn = EnumChatFormatting.GRAY+"Ends in: "; for(String line : manager.getLoreFromNBT(stack.getTagCompound())) { - if(line.trim().startsWith(endsIn)) { - return line.substring(endsIn.length()); + if(line.trim().startsWith(toFind)) { + return line.substring(toFind.length()); } } } @@ -419,6 +419,10 @@ public class CustomAH extends Gui { return null; } + public String findEndsInStr(ItemStack stack) { + return findStrStart(stack, EnumChatFormatting.GRAY+"Ends in: "); + } + public void drawScreen(int mouseX, int mouseY) { if(System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false); @@ -522,7 +526,11 @@ public class CustomAH extends Gui { if(mouseX > auctionViewLeft+31 && mouseX <auctionViewLeft+31+16) { if(mouseY > guiTop+35 && mouseY < guiTop+35+16) { - if(topStack != null) tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if(topStack != null) { + tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + tooltipToRender.add(""); + tooltipToRender.add(EnumChatFormatting.YELLOW+"Click to copy seller name!"); + } } else if(mouseY > guiTop+100 && mouseY < guiTop+100+16) { if(leftStack != null) tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); } else if(mouseY > guiTop+61 && mouseY < guiTop+61+16) { @@ -916,11 +924,13 @@ public class CustomAH extends Gui { mouseClickMove(mouseX, mouseY, this.eventButton, l); } - int dWheel = Mouse.getEventDWheel(); - dWheel = Math.max(-1, Math.min(1, dWheel)); + if(!manager.config.disableAhScroll.value) { + int dWheel = Mouse.getEventDWheel(); + dWheel = Math.max(-1, Math.min(1, dWheel)); - scrollAmount = scrollAmount - dWheel/(float)(auctionIds.size()/9-(5+splits)); - scrollAmount = Math.max(0, Math.min(1, scrollAmount)); + scrollAmount = scrollAmount - dWheel/(float)(auctionIds.size()/9-(5+splits)); + scrollAmount = Math.max(0, Math.min(1, scrollAmount)); + } } private String niceAucId(String aucId) { @@ -1362,7 +1372,16 @@ public class CustomAH extends Gui { if(containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) { if(mouseX > guiLeft+getXSize()+4+31 && mouseX < guiLeft+getXSize()+4+31+16) { boolean leftFiller = isGuiFiller(auctionView.inventorySlots.getSlot(29).getStack());//isBin - if(mouseY > guiTop+100 && mouseY < guiTop+100+16) { + if(mouseY > guiTop+35 && mouseY < guiTop+35+16) { + ItemStack topStack = auctionView.inventorySlots.getSlot(13).getStack(); + if(topStack != null) { + String line = findStrStart(topStack, EnumChatFormatting.GRAY+"Seller: "); + String[] split = line.split(" "); + String seller = split[split.length-1]; + StringSelection selection = new StringSelection(seller); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); + } + } else if(mouseY > guiTop+100 && mouseY < guiTop+100+16) { int slotClick = leftFiller ? 31 : 29; Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId, slotClick, 2, 3, Minecraft.getMinecraft().thePlayer); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index e78d078c..906ccda4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -1,7 +1,10 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.HypixelApi; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderPlayerEvent; @@ -11,6 +14,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -18,28 +22,94 @@ import java.util.Set; public class CapeManager { public static final CapeManager INSTANCE = new CapeManager(); + public long lastCapeUpdate = 0; + public long lastCapeSynced = 0; + public Pair<NEUCape, String> localCape = null; private HashMap<String, Pair<NEUCape, String>> capeMap = new HashMap<>(); - private String[] capes = new String[]{"patreon1", "patreon2", "gravy", "fade", "contrib"}; + + private boolean allAvailable = false; + private HashSet<String> availableCapes = new HashSet<>(); + + private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", "gravy" }; + public Boolean[] specialCapes = |
