mirror of
https://github.com/seppukudevelopment/seppuku
synced 2024-12-27 17:12:09 +00:00
New Events, Changed name API, NotificationsComponent text centers on anchors properly, Lagger NBT mode fixed, Added VisualRange, Updated LogoutSpots, Added fade option to Holes, Added WorldPatch(untested mappings)
This commit is contained in:
parent
1c07097367
commit
557b3f967a
@ -0,0 +1,24 @@
|
||||
package me.rigamortis.seppuku.api.event.world;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 11/10/2019 @ 3:30 PM.
|
||||
*/
|
||||
public class EventAddEntity {
|
||||
|
||||
private Entity entity;
|
||||
|
||||
public EventAddEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package me.rigamortis.seppuku.api.event.world;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 11/10/2019 @ 3:31 PM.
|
||||
*/
|
||||
public class EventRemoveEntity {
|
||||
|
||||
private Entity entity;
|
||||
|
||||
public EventRemoveEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package me.rigamortis.seppuku.api.util;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
import org.json.simple.parser.ParseException;
|
||||
@ -16,18 +15,15 @@ import java.util.UUID;
|
||||
public final class NetworkUtil {
|
||||
|
||||
public static String resolveUsername(UUID id) {
|
||||
final String url = "https://api.mojang.com/user/profiles/" + id.toString().replace("-", "") + "/names";
|
||||
final String url = "https://api.minetools.eu/uuid/" + id.toString().replace("-", "");
|
||||
try {
|
||||
final String nameJson = IOUtils.toString(new URL(url));
|
||||
if (nameJson != null) {
|
||||
final JSONArray nameValue = (JSONArray) JSONValue.parseWithException(nameJson);
|
||||
if (nameValue != null) {
|
||||
final String playerSlot = nameValue.get(nameValue.size() - 1).toString();
|
||||
if (playerSlot != null) {
|
||||
final JSONObject nameObject = (JSONObject) JSONValue.parseWithException(playerSlot);
|
||||
if (nameObject != null) {
|
||||
return nameObject.get("name").toString();
|
||||
}
|
||||
if (nameJson != null && nameJson.length() > 0) {
|
||||
final JSONObject jsonObject = (JSONObject) JSONValue.parseWithException(nameJson);
|
||||
if (jsonObject != null) {
|
||||
final String nick = jsonObject.get("name").toString();
|
||||
if (nick != null) {
|
||||
return nick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,26 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
||||
float maxWidth = 0;
|
||||
|
||||
for (Notification notification : Seppuku.INSTANCE.getNotificationManager().getNotifications()) {
|
||||
notification.setX(this.getX());
|
||||
|
||||
float offsetX = 0;
|
||||
|
||||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
offsetX = (this.getW() - Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case BOTTOM_LEFT:
|
||||
offsetX = 0;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
case BOTTOM_RIGHT:
|
||||
offsetX = this.getW() - Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
notification.setX(this.getX() + offsetX);
|
||||
notification.setY(this.getY() + offsetY);
|
||||
notification.setWidth(Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText()) + 4);
|
||||
notification.setHeight(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 5);
|
||||
|
@ -142,6 +142,7 @@ public final class ModuleManager {
|
||||
add(new ShulkerPreviewModule());
|
||||
add(new LogoutSpotsModule());
|
||||
add(new ChatSuffixModule());
|
||||
add(new VisualRangeModule());
|
||||
|
||||
this.loadExternalModules();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import me.rigamortis.seppuku.api.value.OptionalValue;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@ -21,10 +20,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 5/3/2019 @ 8:49 PM.
|
||||
@ -37,12 +32,8 @@ public final class LaggerModule extends Module {
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private String rand;
|
||||
|
||||
public LaggerModule() {
|
||||
super("Lagger", new String[]{"Lag"}, "Spams unoptimized packets", "NONE", -1, ModuleType.MISC);
|
||||
final IntStream gen = new Random().ints(0x80, 0x10ffff - 0x800).map(i -> i < 0xd800 ? i : i + 0x800);
|
||||
this.rand = gen.limit(1024).mapToObj(i -> String.valueOf((char) i)).collect(Collectors.joining());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,7 +82,7 @@ public final class LaggerModule extends Module {
|
||||
final NBTTagList pages = new NBTTagList();
|
||||
|
||||
for (int page = 0; page < 50; page++) {
|
||||
pages.appendTag(new NBTTagString(this.rand));
|
||||
pages.appendTag(new NBTTagString("192i9i1jr1fj8fj893fj84ujv8924jv2j4c8j248vj2498u2-894u10fuj0jhv20j204uv902jv90j209vj204vj"));
|
||||
}
|
||||
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
@ -102,7 +93,7 @@ public final class LaggerModule extends Module {
|
||||
|
||||
for (int i = 0; i <= this.packets.getInt(); i++) {
|
||||
mc.player.connection.sendPacket(new CPacketCreativeInventoryAction(0, itemStack));
|
||||
// mc.player.connection.sendPacket(new CPacketClickWindow(0, 0, 0, ClickType.PICKUP, itemStack, (short)0));
|
||||
//mc.player.connection.sendPacket(new CPacketClickWindow(0, 0, 0, ClickType.PICKUP, itemStack, (short)0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package me.rigamortis.seppuku.impl.module.misc;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.world.EventAddEntity;
|
||||
import me.rigamortis.seppuku.api.event.world.EventRemoveEntity;
|
||||
import me.rigamortis.seppuku.api.friend.Friend;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 11/10/2019 @ 4:20 AM.
|
||||
*/
|
||||
public final class VisualRangeModule extends Module {
|
||||
|
||||
private int prevPlayer = -1;
|
||||
|
||||
public VisualRangeModule() {
|
||||
super("VisualRange", new String[]{"VisRange", "VRange", "VR"}, "Notifies you when players enter and leave your visual range", "NONE", -1, ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onEntityAdded(EventAddEntity event) {
|
||||
if (!Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
|
||||
final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has entered your visual range.";
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
|
||||
Seppuku.INSTANCE.logChat(msg);
|
||||
if (event.getEntity().getEntityId() == this.prevPlayer) {
|
||||
this.prevPlayer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onEntityRemove(EventRemoveEntity event) {
|
||||
if (!Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
if (this.prevPlayer != event.getEntity().getEntityId()) {
|
||||
this.prevPlayer = event.getEntity().getEntityId();
|
||||
final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
|
||||
final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has left your visual range.";
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
|
||||
Seppuku.INSTANCE.logChat(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package me.rigamortis.seppuku.impl.module.render;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
|
||||
import me.rigamortis.seppuku.api.event.render.EventRender3D;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.util.MathUtil;
|
||||
import me.rigamortis.seppuku.api.value.BooleanValue;
|
||||
import me.rigamortis.seppuku.api.value.NumberValue;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -28,6 +30,8 @@ public final class HolesModule extends Module {
|
||||
|
||||
public final NumberValue radius = new NumberValue("Radius", new String[]{"Radius", "Range", "Distance"}, 8, Integer.class, 0, 32, 1);
|
||||
|
||||
public final BooleanValue fade = new BooleanValue("Fade", new String[]{"f"}, true);
|
||||
|
||||
public final List<Hole> holes = new ArrayList<>();
|
||||
|
||||
private ICamera camera = new Frustum();
|
||||
@ -98,8 +102,13 @@ public final class HolesModule extends Module {
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glLineWidth(1.5f);
|
||||
RenderGlobal.renderFilledBox(bb, 0, 1, 0, 0.25f);
|
||||
RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 0, 1, 0, 0.25f);
|
||||
|
||||
final double dist = mc.player.getDistance(hole.getX() + 0.5f, hole.getY() + 0.5f, hole.getZ() + 0.5f) * 0.75f;
|
||||
|
||||
float alpha = MathUtil.clamp((float) (dist * 255.0f / (this.radius.getInt()) / 255.0f), 0.0f, 0.3f);
|
||||
|
||||
RenderGlobal.renderFilledBox(bb, 0, 1, 0, this.fade.getBoolean() ? alpha : 0.25f);
|
||||
RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 0, 1, 0, this.fade.getBoolean() ? alpha : 0.25f);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
|
@ -6,6 +6,7 @@ import me.rigamortis.seppuku.api.event.player.EventPlayerJoin;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerLeave;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
|
||||
import me.rigamortis.seppuku.api.event.render.EventRender2D;
|
||||
import me.rigamortis.seppuku.api.event.render.EventRender3D;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.texture.Texture;
|
||||
import me.rigamortis.seppuku.api.util.GLUProjection;
|
||||
@ -25,7 +26,7 @@ public final class LogoutSpotsModule extends Module {
|
||||
|
||||
public final NumberValue<Integer> removeDistance = new NumberValue<Integer>("RemoveDistance", new String[]{"RD", "RemoveRange"}, 200, Integer.class, 1, 2000, 1);
|
||||
|
||||
private final Map<String, PlayerData> playerCache = Maps.newConcurrentMap();
|
||||
private final Map<String, EntityPlayer> playerCache = Maps.newConcurrentMap();
|
||||
private final Map<String, PlayerData> logoutCache = Maps.newConcurrentMap();
|
||||
private final Texture playerIcon = new Texture("location.png");
|
||||
|
||||
@ -51,9 +52,39 @@ public final class LogoutSpotsModule extends Module {
|
||||
if (player == null || player.equals(mc.player))
|
||||
continue;
|
||||
|
||||
final GameProfile gameProfile = player.getGameProfile();
|
||||
final String uuid = gameProfile.getId().toString();
|
||||
this.updatePlayerCache(uuid, new PlayerData(gameProfile.getName(), player.getPosition()));
|
||||
//final PlayerData data = new PlayerData(player.getPosition(), player.getGameProfile(), (EntityOtherPlayerMP) player);
|
||||
|
||||
this.updatePlayerCache(player.getGameProfile().getId().toString(), player);
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onRenderWorld(EventRender3D event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
for (String uuid : this.logoutCache.keySet()) {
|
||||
final PlayerData data = this.logoutCache.get(uuid);
|
||||
|
||||
if (this.isOutOfRange(data)) {
|
||||
this.logoutCache.remove(uuid);
|
||||
continue;
|
||||
}
|
||||
|
||||
data.ghost.prevLimbSwingAmount = 0;
|
||||
data.ghost.limbSwing = 0;
|
||||
data.ghost.limbSwingAmount = 0;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
mc.getRenderManager().renderEntity(data.ghost, data.position.getX() - mc.getRenderManager().renderPosX, data.position.getY() - mc.getRenderManager().renderPosY, data.position.getZ() - mc.getRenderManager().renderPosZ, data.ghost.rotationYaw, mc.getRenderPartialTicks(), false);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,8 +104,8 @@ public final class LogoutSpotsModule extends Module {
|
||||
if (projection != null && projection.isType(GLUProjection.Projection.Type.INSIDE)) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(projection.getX(), projection.getY(), 0);
|
||||
playerIcon.render(-8, -16 - 2, 16, 16);
|
||||
String text = data.username + " logout";
|
||||
//playerIcon.render(-8, -16 - 2, 16, 16);
|
||||
String text = data.profile.getName() + " logout";
|
||||
float textWidth = mc.fontRenderer.getStringWidth(text);
|
||||
mc.fontRenderer.drawStringWithShadow(text, -(textWidth / 2), 0, -1);
|
||||
GlStateManager.translate(-projection.getX(), -projection.getY(), 0);
|
||||
@ -91,7 +122,9 @@ public final class LogoutSpotsModule extends Module {
|
||||
if (!uuid.equals(event.getUuid())) // not matching uuid
|
||||
continue;
|
||||
|
||||
final PlayerData data = this.playerCache.get(uuid);
|
||||
final EntityPlayer player = this.playerCache.get(uuid);
|
||||
|
||||
final PlayerData data = new PlayerData(player.getPosition(), player.getGameProfile(), player);
|
||||
|
||||
if (!this.hasPlayerLogged(uuid)) {
|
||||
this.logoutCache.put(uuid, data);
|
||||
@ -119,8 +152,8 @@ public final class LogoutSpotsModule extends Module {
|
||||
this.logoutCache.remove(uuid);
|
||||
}
|
||||
|
||||
private void updatePlayerCache(String uuid, PlayerData data) {
|
||||
this.playerCache.put(uuid, data);
|
||||
private void updatePlayerCache(String uuid, EntityPlayer player) {
|
||||
this.playerCache.put(uuid, player);
|
||||
}
|
||||
|
||||
private boolean hasPlayerLogged(String uuid) {
|
||||
@ -133,12 +166,14 @@ public final class LogoutSpotsModule extends Module {
|
||||
}
|
||||
|
||||
private class PlayerData {
|
||||
String username;
|
||||
BlockPos position;
|
||||
GameProfile profile;
|
||||
EntityPlayer ghost;
|
||||
|
||||
PlayerData(String username, BlockPos position) {
|
||||
this.username = username;
|
||||
public PlayerData(BlockPos position, GameProfile profile, EntityPlayer ghost) {
|
||||
this.position = position;
|
||||
this.profile = profile;
|
||||
this.ghost = ghost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package me.rigamortis.seppuku.impl.patch;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.world.EventAddEntity;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLightUpdate;
|
||||
import me.rigamortis.seppuku.api.event.world.EventRainStrength;
|
||||
import me.rigamortis.seppuku.api.event.world.EventRemoveEntity;
|
||||
import me.rigamortis.seppuku.api.patch.ClassPatch;
|
||||
import me.rigamortis.seppuku.api.patch.MethodPatch;
|
||||
import me.rigamortis.seppuku.impl.management.PatchManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
@ -83,4 +86,36 @@ public final class WorldPatch extends ClassPatch {
|
||||
return event.isCanceled();
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "onEntityAdded",
|
||||
notchName = "b",
|
||||
mcpDesc = "(Lnet/minecraft/entity/Entity;)V",
|
||||
notchDesc = "(Lvg;)V")
|
||||
public void onEntityAdded(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final InsnList list = new InsnList();
|
||||
list.add(new VarInsnNode(ALOAD, 1));
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "onEntityAddedHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/entity/Entity;)V" : "(Lvg;)V", false));
|
||||
methodNode.instructions.insert(list);
|
||||
}
|
||||
|
||||
public static void onEntityAddedHook(Entity entity) {
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventAddEntity(entity));
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "onEntityRemoved",
|
||||
notchName = "c",
|
||||
mcpDesc = "(Lnet/minecraft/entity/Entity;)V",
|
||||
notchDesc = "(Lvg;)V")
|
||||
public void onEntityRemoved(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final InsnList list = new InsnList();
|
||||
list.add(new VarInsnNode(ALOAD, 1));
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "onEntityRemovedHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/entity/Entity;)V" : "(Lvg;)V", false));
|
||||
methodNode.instructions.insert(list);
|
||||
}
|
||||
|
||||
public static void onEntityRemovedHook(Entity entity) {
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRemoveEntity(entity));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user