From cf903cf649f7983f6b8c3b9be687c607335c25ba Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sun, 28 Feb 2021 20:17:13 +0900 Subject: breh --- src/main/java/kr/syeyoung/dungeonsguide/e.java | 1 + .../dungeonsguide/features/FeatureRegistry.java | 2 + .../features/impl/dungeon/FeaturePlayerESP.java | 53 ++++++++++++++++-- .../impl/etc/FeatureAutoAcceptReparty.java | 63 ++++++++++++++++++++++ 4 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java (limited to 'src/main') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index ba02b8ad..323e73e1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -105,6 +105,7 @@ public class e implements c { configDir.mkdirs(); } Config.f = configFile; + Minecraft.getMinecraft().getFramebuffer().enableStencil(); } private void copy(InputStream inputStream, File f) throws IOException { FileOutputStream fos = new FileOutputStream(f); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 0a205880..adbf15c4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -65,6 +65,8 @@ public class FeatureRegistry { public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); public static final FeatureRepartyCommand ETC_REPARTY = register(new FeatureRepartyCommand()); public static final FeatureDecreaseExplosionSound ETC_EXPLOSION_SOUND = register(new FeatureDecreaseExplosionSound()); + public static final FeatureAutoAcceptReparty ETC_AUTO_ACCEPT_REPARTY = register(new FeatureAutoAcceptReparty()); + public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("Fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java index 14d62437..490f4c18 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java @@ -12,10 +12,16 @@ import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.RenderPlayerEvent; import org.jetbrains.annotations.Nullable; @@ -36,29 +42,68 @@ public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListe private boolean preCalled = false; @Override public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { + + if (preCalled) return; if (!isEnabled()) return; + DungeonContext dungeonContext = skyblockStatus.getContext(); if (dungeonContext == null) return; if (!dungeonContext.getPlayers().contains(renderPlayerEvent.entityPlayer.getName())) { return; } + preCalled = true; + GL11.glEnable(GL11.GL_STENCIL_TEST); + GL11.glClearStencil(0); + GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); + + GL11.glStencilMask(0xFF); + GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF); + GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_REPLACE, GL11.GL_REPLACE); + + EntityPlayer entity = renderPlayerEvent.entityPlayer; + InventoryPlayer inv = entity.inventory; + ItemStack[] armor = inv.armorInventory; + inv.armorInventory = new ItemStack[4]; + ItemStack[] hand = inv.mainInventory; + inv.mainInventory = new ItemStack[36]; - preCalled = true; - GlStateManager.depthFunc(GL11.GL_GEQUAL); - Entity entity = renderPlayerEvent.entityPlayer; float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * renderPlayerEvent.partialRenderTick; try { renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z, f, renderPlayerEvent.partialRenderTick); } catch (Throwable t) {} + + GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); + GL11.glStencilFunc(GL11.GL_NOTEQUAL, 1, 0xff); + GL11.glDepthMask(false); + GL11.glDepthFunc(GL11.GL_GEQUAL); + + GlStateManager.pushMatrix(); + GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y + 0.9, renderPlayerEvent.z); + GlStateManager.scale(1.2f, 1.1f, 1.2f); + renderPlayerEvent.renderer.setRenderOutlines(true); + try { + renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, 0,-0.9,0, f, renderPlayerEvent.partialRenderTick); + } catch (Throwable t) {} + + renderPlayerEvent.renderer.setRenderOutlines(false); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GlStateManager.popMatrix(); + + GL11.glDisable(GL11.GL_STENCIL_TEST); // Turn this shit off! + + inv.armorInventory = armor; + inv.mainInventory = hand; + preCalled = false; - GlStateManager.depthFunc(GL11.GL_LEQUAL); + } @Override public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { } + } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java new file mode 100644 index 00000000..081beb19 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java @@ -0,0 +1,63 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; +import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiOpenEvent; + +import java.awt.*; + +public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListener { + public FeatureAutoAcceptReparty() { + super("ETC", "Auto accept reparty", "Automatically accept reparty", "qol.autoacceptreparty", true); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + private String lastDisband; + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.message.getFormattedText().endsWith("§ehas disbanded the party!§r")) { + lastDisband = null; + String[] texts = TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()).split(" "); + for (String s : texts) { + if (s.isEmpty()) continue; + if (s.startsWith("[")) continue; + if (s.equalsIgnoreCase("has")) break; + lastDisband = s; + break; + } + System.out.println(lastDisband); + } else if (clientChatReceivedEvent.message.getFormattedText().contains("§ehas invited you to join their party!")) { + String[] texts = TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()).split(" "); + boolean equals = false; + for (String s : texts) { + System.out.println(s); + if (s.isEmpty()) continue; + if (s.startsWith("[")) continue; + if (s.equalsIgnoreCase("has")) continue; + if (s.equalsIgnoreCase(lastDisband)) { + equals = true; + break; + } + } + System.out.println(lastDisband + " - "+equals); + + if (equals) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/p join "+lastDisband); + } + } + } +} -- cgit