diff options
author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-20 03:15:09 +1000 |
---|---|---|
committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-20 03:15:09 +1000 |
commit | 65ae0aa5a0319b6ead2dd6ed07c53a7e7291a23d (patch) | |
tree | a9f03b6b94f9d613c552303c4ee764fea3526baa /src/main/java/io | |
parent | ea1391e0c6f0db863bbb61511eb6e9acb57a5968 (diff) | |
download | NotEnoughUpdates-65ae0aa5a0319b6ead2dd6ed07c53a7e7291a23d.tar.gz NotEnoughUpdates-65ae0aa5a0319b6ead2dd6ed07c53a7e7291a23d.tar.bz2 NotEnoughUpdates-65ae0aa5a0319b6ead2dd6ed07c53a7e7291a23d.zip |
1.1.5-2
Diffstat (limited to 'src/main/java/io')
6 files changed, 261 insertions, 69 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java index 500587f5..f4fcc41d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java @@ -31,28 +31,38 @@ public class CustomItemEffects { public static final CustomItemEffects INSTANCE = new CustomItemEffects(); - public int aoteUseTicks = 0; - public int aoteTeleportationTicks = 0; - public Vector3f aoteTeleportationLast = null; + public long aoteUseMillis = 0; + public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; - public boolean teleported = false; - public float partialTicks; + + public long lastMillis = 0; + + public Vector3f getCurrentPosition() { + if(aoteTeleportationMillis <= 0) return null; + return aoteTeleportationCurr; + } @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if(aoteTeleportationTicks > 7) aoteTeleportationTicks = 7; + public void onTick(TickEvent.RenderTickEvent event) { + //if(aoteTeleportationTicks > 7) aoteTeleportationTicks = 7; + long currentTime = System.currentTimeMillis(); + int delta = (int)(currentTime - lastMillis); + lastMillis = currentTime; + + if(delta <= 0) return; + + if(aoteTeleportationMillis > 300) aoteTeleportationMillis = 300; + if(aoteTeleportationMillis < 0) aoteTeleportationMillis = 0; - if(aoteUseTicks > 20 && aoteTeleportationCurr != null && !teleported) { + if(currentTime - aoteUseMillis > 1000 && aoteTeleportationMillis <= 0) { aoteTeleportationCurr = null; - aoteTeleportationTicks = 0; } - if(aoteTeleportationCurr != null && aoteTeleportationTicks > 0) { - aoteUseTicks++; - if(teleported) { - float factor = 1f/aoteTeleportationTicks; + if(aoteTeleportationCurr != null) { + if(aoteTeleportationMillis > 0) { + int deltaMin = Math.min(delta, aoteTeleportationMillis); - aoteTeleportationLast = new Vector3f(aoteTeleportationCurr); + float factor = deltaMin/(float)aoteTeleportationMillis; float dX = aoteTeleportationCurr.x - (float)Minecraft.getMinecraft().thePlayer.posX; float dY = aoteTeleportationCurr.y - (float)Minecraft.getMinecraft().thePlayer.posY; @@ -62,30 +72,45 @@ public class CustomItemEffects { aoteTeleportationCurr.y -= dY*factor; aoteTeleportationCurr.z -= dZ*factor; - aoteTeleportationTicks--; + if(Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(aoteTeleportationCurr.x, + aoteTeleportationCurr.y, aoteTeleportationCurr.z)).getBlock().getMaterial() != Material.air) { + aoteTeleportationCurr.y = (float)Math.ceil(aoteTeleportationCurr.y); + } + + aoteTeleportationMillis -= deltaMin; } 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; + aoteUseMillis = 0; + aoteTeleportationMillis = 0; } } - 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 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")) { + aoteUseMillis = System.currentTimeMillis(); + 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; + } + } + } + } } @SubscribeEvent public void renderBlockOverlay(DrawBlockHighlightEvent event) { - if(aoteTeleportationCurr != null && aoteTeleportationTicks > 0 && teleported) { + if(aoteTeleportationCurr != null && aoteTeleportationMillis > 0) { event.setCanceled(true); } ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); @@ -99,12 +124,8 @@ public class CustomItemEffects { 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) { @@ -152,9 +173,9 @@ public class CustomItemEffects { } 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; + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; + double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)event.partialTicks; drawSelectionBoundingBox(block.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate) .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), @@ -220,25 +241,4 @@ public class CustomItemEffects { } - @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/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index aa604854..69d4a038 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates; import com.google.common.collect.Sets; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mojang.authlib.Agent; import com.mojang.authlib.exceptions.AuthenticationException; @@ -14,6 +15,7 @@ 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.profileviewer.GuiProfileViewer; +import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; import io.github.moulberry.notenoughupdates.util.Utils; @@ -41,6 +43,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; import javax.swing.*; import java.io.File; @@ -48,10 +51,12 @@ import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.net.Proxy; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.UUID; +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true) public class NotEnoughUpdates { @@ -126,17 +131,189 @@ public class NotEnoughUpdates { } }); + private static HashMap<String, String> petRarityToColourMap = new HashMap<>(); + static { + petRarityToColourMap.put("UNKNOWN", EnumChatFormatting.RED.toString()); + + petRarityToColourMap.put("COMMON", EnumChatFormatting.WHITE.toString()); + petRarityToColourMap.put("UNCOMMON", EnumChatFormatting.GREEN.toString()); + petRarityToColourMap.put("RARE", EnumChatFormatting.BLUE.toString()); + petRarityToColourMap.put("EPIC", EnumChatFormatting.DARK_PURPLE.toString()); + petRarityToColourMap.put("LEGENDARY", EnumChatFormatting.GOLD.toString()); + } + ScheduledExecutorService peekCommandExecutorService = null; SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { + int id = new Random().nextInt(Integer.MAX_VALUE/2)+Integer.MAX_VALUE/2; + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.YELLOW+"[PEEK] Getting player information..."), id); profileViewer.getProfileByName(args[0], profile -> { if (profile != null) { profile.resetCache(); - float overallScore = 0; - JsonObject profileInfo = profile.getProfileInformation(null); + if(peekCommandExecutorService == null || peekCommandExecutorService.isShutdown()) { + peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.RED+"[PEEK] New peek command run, cancelling old one.")); + peekCommandExecutorService.shutdownNow(); + peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); + } - JsonObject skill = profile.getSkillInfo(null); + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.YELLOW+"[PEEK] Getting player skyblock profiles..."), id); + + long startTime = System.currentTimeMillis(); + peekCommandExecutorService.schedule(new Runnable() { + public void run() { + if(System.currentTimeMillis() - startTime > 10*1000) { + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.RED+"[PEEK] Getting profile info took too long, aborting."), id); + return; + } + + String g = EnumChatFormatting.GRAY.toString(); + + JsonObject profileInfo = profile.getProfileInformation(null); + if(profileInfo != null) { + float overallScore = 0; + + boolean isMe = args[0].equalsIgnoreCase("moulberry"); + + PlayerStats.Stats stats = profile.getStats(null); + JsonObject skill = profile.getSkillInfo(null); + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(EnumChatFormatting.GREEN+" "+ + EnumChatFormatting.STRIKETHROUGH+"-=-" +EnumChatFormatting.RESET+EnumChatFormatting.GREEN+" "+ + Utils.getElementAsString(profile.getHypixelProfile().get("displayname"), args[0]) + "'s Info " + + EnumChatFormatting.STRIKETHROUGH+"-=-"), id); + + if(skill == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+"Skills api disabled!")); + } else { + float totalSkillLVL = 0; + float totalSkillCount = 0; + + for(Map.Entry<String, JsonElement> entry : skill.entrySet()) { + if(entry.getKey().startsWith("level_skill")) { + if(entry.getKey().contains("runecrafting")) continue; + if(entry.getKey().contains("carpentry")) continue; + totalSkillLVL += entry.getValue().getAsFloat(); + totalSkillCount++; + } + } + + float combat = Utils.getElementAsFloat(skill.get("level_skill_combat"), 0); + float zombie = Utils.getElementAsFloat(skill.get("level_slayer_zombie"), 0); + float spider = Utils.getElementAsFloat(skill.get("level_slayer_spider"), 0); + float wolf = Utils.getElementAsFloat(skill.get("level_slayer_wolf"), 0); + + float avgSkillLVL = totalSkillLVL/totalSkillCount; + + if(isMe) { + avgSkillLVL = 6; + combat = 4; + zombie = 2; + spider = 1; + wolf = 2; + } + + EnumChatFormatting combatPrefix = combat>20?(combat>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting zombiePrefix = zombie>3?(zombie>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting spiderPrefix = spider>3?(spider>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting wolfPrefix = wolf>3?(wolf>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting avgPrefix = avgSkillLVL>20?(avgSkillLVL>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + + overallScore += combat*combat/2000f; + overallScore += zombie*zombie/81f; + overallScore += spider*spider/81f; + overallScore += wolf*wolf/81f; + overallScore += avgSkillLVL/20f; + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Combat: "+combatPrefix+(int)Math.floor(combat) +g+" - AVG Skill: " + avgPrefix+(int)Math.floor(avgSkillLVL))); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Slayer: "+zombiePrefix+(int)Math.floor(zombie)+g+"-"+ + spiderPrefix+(int)Math.floor(spider)+g+"-"+wolfPrefix+(int)Math.floor(wolf))); + } + if(stats == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.YELLOW+"Skills, collection and/or inventory apis disabled!")); + } else { + int health = (int)stats.get("health"); + int defence = (int)stats.get("defence"); + int strength = (int)stats.get("strength"); + int intelligence = (int)stats.get("intelligence"); + + EnumChatFormatting healthPrefix = health>800?(health>1600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting defencePrefix = defence>200?(defence>600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting strengthPrefix = strength>100?(strength>300?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting intelligencePrefix = intelligence>300?(intelligence>900?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Stats : "+healthPrefix+health+EnumChatFormatting.RED+"\u2764 "+ + defencePrefix+defence+EnumChatFormatting.GREEN+"\u2748 "+ + strengthPrefix+strength+EnumChatFormatting.RED+"\u2741 "+ + intelligencePrefix+intelligence+EnumChatFormatting.AQUA+"\u270e ")); + } + float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1); + float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); + + + EnumChatFormatting moneyPrefix = (bankBalance+purseBalance)>10*1000*1000? + ((bankBalance+purseBalance)>50*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Purse : "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " + + (bankBalance == -1 ? EnumChatFormatting.YELLOW+"Disabled" : moneyPrefix+ + (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))))); + + overallScore += Math.min(2, (bankBalance+purseBalance)/(50f*1000*1000)); + + String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"), + "None Active"); + String activePetTier = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.tier"), "UNKNOWN"); + + String col = petRarityToColourMap.get(activePetTier); + if(col == null) col = EnumChatFormatting.LIGHT_PURPLE.toString(); + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Pet : " + + col + WordUtils.capitalizeFully(activePet.replace("_", " ")))); + + String overall = "Skywars Main"; + if(isMe) { + overall = Utils.chromaString("Literally the best player to exist"); + } else if(overallScore < 5 && (bankBalance+purseBalance) > 500*1000*1000) { + overall = EnumChatFormatting.GOLD+"Bill Gates"; + } else if(overallScore > 9) { + overall = Utils.chromaString("Didn't even think this score was possible"); + } else if(overallScore > 8) { + overall = Utils.chromaString("Mentally unstable"); + } else if(overallScore > 7) { + overall = EnumChatFormatting.GOLD+"Why though 0.0"; + } else if(overallScore > 5.5) { + overall = EnumChatFormatting.GOLD+"Bro stop playing"; + } else if(overallScore > 4) { + overall = EnumChatFormatting.GREEN+"Kinda sweaty"; + } else if(overallScore > 3) { + overall = EnumChatFormatting.YELLOW+"Alright I guess"; + } else if(overallScore > 2) { + overall = EnumChatFormatting.YELLOW+"Ender Non"; + } else if(overallScore > 1) { + overall = EnumChatFormatting.RED+"Played Skyblock"; + } + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Overall score: " + + overall + g + " (" + Math.round(overallScore*10)/10f + ")")); + + peekCommandExecutorService.shutdownNow(); + } else { + peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS); + } + } + }, 200, TimeUnit.MILLISECONDS); } }); } @@ -326,6 +503,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(viewProfileCommand); ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); ClientCommandHandler.instance.registerCommand(viewProfileShort2Command); + ClientCommandHandler.instance.registerCommand(peekCommand); ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java index de8fe562..7dc5daa1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java @@ -315,12 +315,18 @@ public class SBGamemodes { @SubscribeEvent public void onChatMessage(ClientChatReceivedEvent event) { + if(event.type != 0) return; + /*if(Keyboard.isKeyDown(Keyboard.KEY_K)) { - System.out.println("-----START"); + boolean has = false; for(char c : event.message.getFormattedText().toCharArray()) { - System.out.println((int)c); + if((int)c > 200) { + if(!has) System.out.println("-----START"); + has = true; + System.out.println((int)c); + } } - System.out.println("-----END"); + if(has) System.out.println("-----END"); }*/ if(getGamemode() == null || !NotEnoughUpdates.INSTANCE.isOnSkyblock()) return; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java index de86198e..22cf38d1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java @@ -42,11 +42,6 @@ public class MixinEntityRenderer { } //renderWorldPass - @Inject(method="renderWorldPass", at=@At("HEAD")) - public void renderWorldPass(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) { - CustomItemEffects.INSTANCE.partialTicks = partialTicks; - } - @ModifyVariable(method="renderWorldPass", at=@At(value="STORE"), ordinal = 0) public double renderWorldPass_d0(double d0) { Vector3f currentPosition = CustomItemEffects.INSTANCE.getCurrentPosition(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java index 2337aa8b..5d8697b4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java @@ -19,7 +19,9 @@ public class MixinNetHandlerPlayClient { "setPositionAndRotation(DDDFF)V"; @Redirect(method="handlePlayerPosLook", at=@At(value="INVOKE", target=TARGET)) public void handlePlayerPosLook_setPositionAndRotation(EntityPlayer player, double x, double y, double z, float yaw, float pitch) { - CustomItemEffects.INSTANCE.teleported = true; + if(CustomItemEffects.INSTANCE.aoteTeleportationCurr != null) { + CustomItemEffects.INSTANCE.aoteTeleportationMillis += 175; + } player.setPositionAndRotation(x, y, z, yaw, pitch); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 428a43b2..9445514f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -125,6 +125,17 @@ public class Utils { return rainbowText.toString(); } + private static char[] c = new char[]{'k', 'm', 'b', 't'}; + public static String shortNumberFormat(double n, int iteration) { + double d = ((long) n / 100) / 10.0; + boolean isRound = (d * 10) %10 == 0; + return (d < 1000? + ((d > 99.9 || isRound || (!isRound && d > 9.99)? + (int) d * 10 / 10 : d + "" + ) + "" + c[iteration]) + : shortNumberFormat(d, iteration+1)); + } + public static void drawItemStackLinear(ItemStack stack, int x, int y) { if(stack == null)return; |