diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-24 20:02:25 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-24 20:02:25 +0200 |
commit | f86196a74db27d5492020e514b6c0d819b82fdc2 (patch) | |
tree | 3f56ae644df187cd7b2cbe3f441df3c6219f2530 | |
parent | 019f3630776c6f4b4eedd41c25aa4f36b99ccf5b (diff) | |
download | NotEnoughUpdates-f86196a74db27d5492020e514b6c0d819b82fdc2.tar.gz NotEnoughUpdates-f86196a74db27d5492020e514b6c0d819b82fdc2.tar.bz2 NotEnoughUpdates-f86196a74db27d5492020e514b6c0d819b82fdc2.zip |
fixes
3 files changed, 83 insertions, 50 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 6aa292eb..08ef97a9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -838,7 +838,6 @@ public class NEUEventListener { if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") || unformatted.equals(" You've earned a Crystal Loot Bundle!")) OverlayManager.crystalHollowOverlay.message(unformatted); - System.out.println(unformatted); } public static boolean drawingGuiScreen = false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index 3ca05dea..0f4e2f4d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -45,6 +45,8 @@ import java.awt.*; import java.io.ByteArrayInputStream; import java.util.*; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CustomItemEffects { @@ -59,7 +61,7 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; - + private final Pattern etherwarpDistancePattern = Pattern.compile("up to (?<distance>\\d{2}) blocks away\\."); public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -262,7 +264,10 @@ public class CustomItemEffects { denyTpReason = "Not solid!"; } else { WorldClient world = Minecraft.getMinecraft().theWorld; - if(world.getBlockState(pos.add(0, 1, 0)).getBlock() != Blocks.air || + Block above = world.getBlockState(pos.add(0, 1, 0)).getBlock(); + if(above != Blocks.air && above.isCollidable() && + above.getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, pos.add(0, 1, 0), + world.getBlockState(pos.add(0, 1, 0))) != null || world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { denyTpReason = "No air above!"; } @@ -543,34 +548,45 @@ public class CustomItemEffects { } if(usingEtherwarp) { - etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, 60, 0.1f); + int dist = 0; + for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(held.getTagCompound())) { + String cleaned = Utils.cleanColour(line); + Matcher matcher = etherwarpDistancePattern.matcher(cleaned); + if (matcher.matches()) { + dist = Integer.parseInt(matcher.group("distance")); + break; + } + } + if (dist != 0) { + etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, dist, 0.1f); - if(etherwarpRaycast != null) { - AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) - .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); - drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + if (etherwarpRaycast != null) { + AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) + .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); + drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.disableDepth(); - drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.enableDepth(); + GlStateManager.disableDepth(); + drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - float distFactor = 1 - (float)Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))/60; + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + float distFactor = 1 - (float) Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())) / 60; - targetFOVMult = distFactor*distFactor*distFactor*0.75f + 0.25f; - if(targetFOVMult < 0.25f) targetFOVMult = 0.25f; + targetFOVMult = distFactor * distFactor * distFactor * 0.75f + 0.25f; + if (targetFOVMult < 0.25f) targetFOVMult = 0.25f; - targetSensMult = distFactor*0.76f + 0.25f; + targetSensMult = distFactor * 0.76f + 0.25f; + } + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + targetFOVMult = lastFOVMult; } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - targetFOVMult = lastFOVMult; - } - return; + return; + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index 51810c2d..11a5574d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -11,15 +11,17 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; -import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager; @@ -32,7 +34,9 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; -import net.minecraft.util.*; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -49,8 +53,8 @@ import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.util.*; import java.util.List; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; @@ -1340,6 +1344,8 @@ public class GuiProfileViewer extends GuiScreen { String petname = pet.get("type").getAsString(); String tier = pet.get("tier").getAsString(); String heldItem = Utils.getElementAsString(pet.get("heldItem"), null); + String skin = Utils.getElementAsString(pet.get("skin"), null); + int candy = pet.get("candyUsed").getAsInt(); JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem); String tierNum = MINION_RARITY_TO_NUM.get(tier); float exp = pet.get("exp").getAsFloat(); @@ -1407,6 +1413,22 @@ public class GuiProfileViewer extends GuiScreen { newLore.appendTag(new NBTTagString(line)); } Integer secondLastBlank = blankLocations.get(blankLocations.size()-2); + if(skin != null){ + JsonObject petSkin = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PET_SKIN_" + skin); + if(petSkin != null){ + try { + NBTTagCompound nbt = JsonToNBT.getTagFromJson(petSkin.get("nbttag").getAsString()); + tag.setTag("SkullOwner", nbt.getTag("SkullOwner")); + String name = petSkin.get("displayname").getAsString(); + if(name != null){ + name = Utils.cleanColour(name); + newLore.set(0, new NBTTagString(newLore.get(0).toString().replace("\"" , "") + ", " + name)); + } + } catch (NBTException e) { + e.printStackTrace(); + } + } + } if(heldItemJson != null && secondLastBlank != null) { for(int j=0; j<newLore.tagCount(); j++) { String line = newLore.getStringTagAt(j); @@ -1434,6 +1456,10 @@ public class GuiProfileViewer extends GuiScreen { } else { display.setTag("Lore", newLore); } + if(candy != 0){ + newLore.appendTag(new NBTTagString()); + newLore.appendTag(new NBTTagString(EnumChatFormatting.GREEN + "(" + candy + "/10) Pet Candy Used")); + } } if(display.hasKey("Name", 8)) { String displayName = display.getString("Name"); @@ -1535,33 +1561,25 @@ public class GuiProfileViewer extends GuiScreen { ItemStack petStack = sortedPetsStack.get(selectedPet); String display = petStack.getDisplayName(); JsonObject pet = sortedPets.get(selectedPet); - String type = pet.get("type").getAsString(); - for(int i=0; i<4; i++) { - JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i); - if(item != null) { - int x = guiLeft+280; - float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); + int x = guiLeft+280; + float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); - int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display); - int halfDisplayLen = displayLen/2; + int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display); + int halfDisplayLen = displayLen/2; - GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, 0); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, 0); - drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB()); + drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB()); - Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); + Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item); - GlStateManager.enableDepth(); - GlStateManager.translate(-55, 0, 0); - GlStateManager.scale(3.5f, 3.5f, 1); - Utils.drawItemStack(stack, 0, 0); - GlStateManager.popMatrix(); - break; - } - } + GlStateManager.enableDepth(); + GlStateManager.translate(-55, 0, 0); + GlStateManager.scale(3.5f, 3.5f, 1); + Utils.drawItemStack(petStack, 0, 0); + GlStateManager.popMatrix(); float level = pet.get("level").getAsFloat(); float currentLevelRequirement = pet.get("currentLevelRequirement").getAsFloat(); @@ -1711,7 +1729,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Minions", Minecraft.getMinecraft().fontRendererObj, guiLeft+326, guiTop+14, true, 4210752); - + List<String> minions = ProfileViewer.getCollectionCatToMinionMap().get(selectedCollectionCategory); if(minions != null) { for(int i=0; i<minions.size(); i++) { @@ -2414,7 +2432,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76); - + Utils.renderAlignedString(EnumChatFormatting.RED + "Total Slayer XP", EnumChatFormatting.WHITE.toString() + shortNumberFormat(totalSlayerXP, 0), guiLeft + xStart, guiTop + yStartBottom + yOffset * 4, 76); } |