Reworked the cape patch, Added cape module, Added hud components, Added Camera manager, Fixed bugs, Added quality additions to a few mods

This commit is contained in:
Rigamortis 2019-12-10 03:09:38 -09:00
parent ee8687e952
commit e4b7525a28
17 changed files with 786 additions and 10 deletions

View File

@ -70,6 +70,8 @@ public final class Seppuku {
private GuiSeppukuMainMenu seppukuMainMenu;
private CameraManager cameraManager;
/**
* The initialization point of the client
* this is called post launch
@ -94,6 +96,7 @@ public final class Seppuku {
this.notificationManager = new NotificationManager();
this.moduleManager = new ModuleManager();
this.commandManager = new CommandManager();
this.cameraManager = new CameraManager();
this.hudManager = new HudManager();
//this.seppukuMainMenu = new GuiSeppukuMainMenu();
@ -143,6 +146,7 @@ public final class Seppuku {
this.animationManager.unload();
this.notificationManager.unload();
this.seppukuMainMenu.unload();
this.cameraManager.unload();
this.getEventManager().dispatchEvent(new EventUnload());
@ -327,10 +331,17 @@ public final class Seppuku {
}
public GuiSeppukuMainMenu getSeppukuMainMenu() {
if(this.seppukuMainMenu == null) {
if (this.seppukuMainMenu == null) {
this.seppukuMainMenu = new GuiSeppukuMainMenu();
}
return this.seppukuMainMenu;
}
public CameraManager getCameraManager() {
if (this.cameraManager == null) {
this.cameraManager = new CameraManager();
}
return this.cameraManager;
}
}

View File

@ -0,0 +1,239 @@
package me.rigamortis.seppuku.api.camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.input.Mouse;
import static org.lwjgl.opengl.GL11.GL_QUADS;
/**
* Author Seth
* 12/9/2019 @ 6:11 AM.
*/
public class Camera {
private Vec3d pos;
private float yaw;
private float pitch;
private boolean recording;
private boolean valid;
private boolean rendering;
private Framebuffer frameBuffer;
private final int WIDTH_RESOLUTION = 800;
private final int HEIGHT_RESOLUTION = 600;
private final Minecraft mc = Minecraft.getMinecraft();
public Camera() {
this.pos = new Vec3d(0, 0, 0);
this.yaw = 0;
this.pitch = 0;
this.frameBuffer = new Framebuffer(WIDTH_RESOLUTION, HEIGHT_RESOLUTION, true);
this.frameBuffer.createFramebuffer(WIDTH_RESOLUTION, HEIGHT_RESOLUTION);
}
public void render(float x, float y, float w, float h) {
if (OpenGlHelper.isFramebufferEnabled()) {
GlStateManager.pushMatrix();
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.enableColorMaterial();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
frameBuffer.bindFramebufferTexture();
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
bufferbuilder.pos(x, h, 0).tex(0, 0).endVertex();
bufferbuilder.pos(w, h, 0).tex(1, 0).endVertex();
bufferbuilder.pos(w, y, 0).tex(1, 1).endVertex();
bufferbuilder.pos(x, y, 0).tex(0, 1).endVertex();
tessellator.draw();
frameBuffer.unbindFramebufferTexture();
GlStateManager.popMatrix();
}
}
public void updateFbo() {
if (mc.player != null && !Mouse.isButtonDown(2)) {
double posX = mc.player.posX;
double posY = mc.player.posY;
double posZ = mc.player.posZ;
double prevPosX = mc.player.prevPosX;
double prevPosY = mc.player.prevPosY;
double prevPosZ = mc.player.prevPosZ;
double lastTickPosX = mc.player.lastTickPosX;
double lastTickPosY = mc.player.lastTickPosY;
double lastTickPosZ = mc.player.lastTickPosZ;
float rotationYaw = mc.player.rotationYaw;
float prevRotationYaw = mc.player.prevRotationYaw;
float rotationPitch = mc.player.rotationPitch;
float prevRotationPitch = mc.player.prevRotationPitch;
boolean sprinting = mc.player.isSprinting();
boolean hideGUI = mc.gameSettings.hideGUI;
int clouds = mc.gameSettings.clouds;
int thirdPersonView = mc.gameSettings.thirdPersonView;
float gamma = mc.gameSettings.gammaSetting;
int ambientOcclusion = mc.gameSettings.ambientOcclusion;
boolean viewBobbing = mc.gameSettings.viewBobbing;
int particles = mc.gameSettings.particleSetting;
boolean shadows = mc.gameSettings.entityShadows;
int displayWidth = mc.displayWidth;
int displayHeight = mc.displayHeight;
int frameLimit = mc.gameSettings.limitFramerate;
float fovSetting = mc.gameSettings.fovSetting;
mc.player.posX = this.getPos().x;
mc.player.posY = this.getPos().y;
mc.player.posZ = this.getPos().z;
mc.player.prevPosX = this.getPos().x;
mc.player.prevPosY = this.getPos().y;
mc.player.prevPosZ = this.getPos().z;
mc.player.lastTickPosX = this.getPos().x;
mc.player.lastTickPosY = this.getPos().y;
mc.player.lastTickPosZ = this.getPos().z;
mc.player.rotationYaw = this.yaw;
mc.player.prevRotationYaw = this.yaw;
mc.player.rotationPitch = this.pitch;
mc.player.prevRotationPitch = this.pitch;
mc.player.setSprinting(false);
mc.gameSettings.hideGUI = true;
mc.gameSettings.clouds = 0;
mc.gameSettings.thirdPersonView = 0;
mc.gameSettings.gammaSetting = 100;
mc.gameSettings.ambientOcclusion = 0;
mc.gameSettings.viewBobbing = false;
mc.gameSettings.particleSetting = 0;
mc.gameSettings.entityShadows = false;
mc.displayWidth = WIDTH_RESOLUTION;
mc.displayHeight = HEIGHT_RESOLUTION;
mc.gameSettings.limitFramerate = 10;
mc.gameSettings.fovSetting = 110;
//TODO backup fire overlay, and effects(blindness), fog
this.setRecording(true);
frameBuffer.bindFramebuffer(true);
mc.entityRenderer.updateCameraAndRender(mc.timer.renderPartialTicks, System.nanoTime());
frameBuffer.unbindFramebuffer();
this.setRecording(false);
mc.player.posX = posX;
mc.player.posY = posY;
mc.player.posZ = posZ;
mc.player.prevPosX = prevPosX;
mc.player.prevPosY = prevPosY;
mc.player.prevPosZ = prevPosZ;
mc.player.lastTickPosX = lastTickPosX;
mc.player.lastTickPosY = lastTickPosY;
mc.player.lastTickPosZ = lastTickPosZ;
mc.player.rotationYaw = rotationYaw;
mc.player.prevRotationYaw = prevRotationYaw;
mc.player.rotationPitch = rotationPitch;
mc.player.prevRotationPitch = prevRotationPitch;
mc.player.setSprinting(sprinting);
mc.gameSettings.hideGUI = hideGUI;
mc.gameSettings.clouds = clouds;
mc.gameSettings.thirdPersonView = thirdPersonView;
mc.gameSettings.gammaSetting = gamma;
mc.gameSettings.ambientOcclusion = ambientOcclusion;
mc.gameSettings.viewBobbing = viewBobbing;
mc.gameSettings.particleSetting = particles;
mc.gameSettings.entityShadows = shadows;
mc.displayWidth = displayWidth;
mc.displayHeight = displayHeight;
mc.gameSettings.limitFramerate = frameLimit;
mc.gameSettings.fovSetting = fovSetting;
this.setValid(true);
this.setRendering(false);
}
}
public void resize() {
this.frameBuffer.createFramebuffer(WIDTH_RESOLUTION, HEIGHT_RESOLUTION);
if (!isRecording() && isRendering()) {
this.updateFbo();
}
}
public Vec3d getPos() {
return pos;
}
public void setPos(Vec3d pos) {
this.pos = pos;
}
public float getYaw() {
return yaw;
}
public void setYaw(float yaw) {
this.yaw = yaw;
}
public float getPitch() {
return pitch;
}
public void setPitch(float pitch) {
this.pitch = pitch;
}
public boolean isRecording() {
return recording;
}
public void setRecording(boolean recording) {
this.recording = recording;
}
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public boolean isRendering() {
return rendering;
}
public void setRendering(boolean rendering) {
this.rendering = rendering;
}
}

View File

@ -0,0 +1,35 @@
package me.rigamortis.seppuku.api.event.player;
import me.rigamortis.seppuku.api.event.EventCancellable;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.util.ResourceLocation;
/**
* Author Seth
* 12/9/2019 @ 2:48 AM.
*/
public class EventCapeLocation extends EventCancellable {
private AbstractClientPlayer player;
private ResourceLocation location;
public EventCapeLocation(AbstractClientPlayer player) {
this.player = player;
}
public AbstractClientPlayer getPlayer() {
return player;
}
public void setPlayer(AbstractClientPlayer player) {
this.player = player;
}
public ResourceLocation getLocation() {
return location;
}
public void setLocation(ResourceLocation location) {
this.location = location;
}
}

View File

@ -0,0 +1,130 @@
package me.rigamortis.seppuku.api.gui.hud.component;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
/**
* Author Seth
* 12/10/2019 @ 1:26 AM.
*/
public class ResizableHudComponent extends DraggableHudComponent {
private boolean resizeDragging;
private float resizeDeltaX;
private float resizeDeltaY;
private float initialWidth;
private float initialHeight;
private final float CLICK_ZONE = 2;
public ResizableHudComponent(String name, float initialWidth, float initialHeight) {
super(name);
this.initialWidth = initialWidth;
this.initialHeight = initialHeight;
}
@Override
public void mouseClick(int mouseX, int mouseY, int button) {
super.mouseClick(mouseX, mouseY, button);
final boolean inside = mouseX >= this.getX() + this.getW() - CLICK_ZONE && mouseX <= this.getX() + this.getW() + CLICK_ZONE && mouseY >= this.getY() + this.getH() - CLICK_ZONE && mouseY <= this.getY() + this.getH() + CLICK_ZONE;
if (inside) {
if (button == 0) {
this.setResizeDragging(true);
this.setDragging(false);
this.setResizeDeltaX(mouseX - this.getW());
this.setResizeDeltaY(mouseY - this.getH());
Seppuku.INSTANCE.getHudManager().moveToTop(this);
}
}
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
if (this.isResizeDragging()) {
this.setW(mouseX - this.getResizeDeltaX());
this.setH(mouseY - this.getResizeDeltaY());
this.clampMaxs();
}
final boolean inside = mouseX >= this.getX() + this.getW() - CLICK_ZONE && mouseX <= this.getX() + this.getW() + CLICK_ZONE && mouseY >= this.getY() + this.getH() - CLICK_ZONE && mouseY <= this.getY() + this.getH() + CLICK_ZONE;
if (inside) {
RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, 0x45FFFFFF);
}
if (Minecraft.getMinecraft().currentScreen instanceof GuiHudEditor) {
RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, 0x75101010);
}
this.clampMaxs();
}
@Override
public void mouseRelease(int mouseX, int mouseY, int button) {
super.mouseRelease(mouseX, mouseY, button);
if (button == 0) {
if (this.isResizeDragging()) {
this.setResizeDragging(false);
}
}
}
public void clampMaxs() {
if (this.getW() <= this.getInitialWidth()) {
this.setW(this.getInitialWidth());
}
if (this.getH() <= this.getInitialHeight()) {
this.setH(this.getInitialHeight());
}
}
public boolean isResizeDragging() {
return resizeDragging;
}
public void setResizeDragging(boolean resizeDragging) {
this.resizeDragging = resizeDragging;
}
public float getResizeDeltaX() {
return resizeDeltaX;
}
public void setResizeDeltaX(float resizeDeltaX) {
this.resizeDeltaX = resizeDeltaX;
}
public float getResizeDeltaY() {
return resizeDeltaY;
}
public void setResizeDeltaY(float resizeDeltaY) {
this.resizeDeltaY = resizeDeltaY;
}
public float getInitialWidth() {
return initialWidth;
}
public void setInitialWidth(float initialWidth) {
this.initialWidth = initialWidth;
}
public float getInitialHeight() {
return initialHeight;
}
public void setInitialHeight(float initialHeight) {
this.initialHeight = initialHeight;
}
}

View File

@ -0,0 +1,101 @@
package me.rigamortis.seppuku.impl.gui.hud.component;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.camera.Camera;
import me.rigamortis.seppuku.api.gui.hud.component.ResizableHudComponent;
import me.rigamortis.seppuku.api.util.RenderUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.input.Mouse;
/**
* Author Seth
* 12/9/2019 @ 3:16 AM.
*/
public final class OverViewComponent extends ResizableHudComponent {
private final Camera overviewCamera = new Camera();
private float scroll;
private float lastScroll;
private float distance = 35.0f;
public OverViewComponent() {
super("OverView", 120, 120);
Seppuku.INSTANCE.getCameraManager().addCamera(overviewCamera);
this.setW(120);
this.setH(120);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
RenderUtil.drawRect(this.getX() - 1, this.getY() - 1, this.getX() + this.getW() + 1, this.getY() + this.getH() + 1, 0x99101010);
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xFF202020);
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.getName(), this.getX() + 2, this.getY() + 2, 0xFFFFFFFF);
this.handleScrolling(mouseX, mouseY);
this.overviewCamera.setRendering(true);
if (this.overviewCamera.isValid()) {
final Vec3d ground = this.getGround(partialTicks);
if (ground != null) {
this.overviewCamera.setPos(ground.add(0, this.getDist(partialTicks), 0));
this.overviewCamera.setYaw(Minecraft.getMinecraft().player.rotationYaw);
this.overviewCamera.setPitch(90.0f);
this.overviewCamera.render(this.getX() + 2, this.getY() + 12, this.getX() + this.getW() - 2, this.getY() + this.getH() - 2);
}
}
}
private Vec3d getGround(float partialTicks) {
final Minecraft mc = Minecraft.getMinecraft();
final Vec3d eyes = mc.player.getPositionEyes(partialTicks);
final RayTraceResult ray = mc.world.rayTraceBlocks(eyes, eyes.subtract(0, 3, 0), false);
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK) {
return ray.hitVec;
}
return eyes;
}
private double getDist(float partialTicks) {
final Minecraft mc = Minecraft.getMinecraft();
final Vec3d eyes = mc.player.getPositionEyes(partialTicks);
final RayTraceResult ray = mc.world.rayTraceBlocks(eyes, eyes.add(0, this.distance, 0), false);
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK) {
return mc.player.getDistance(ray.hitVec.x, ray.hitVec.y, ray.hitVec.z) - 4;
}
return this.distance;
}
private void handleScrolling(int mouseX, int mouseY) {
final boolean inside = mouseX >= this.getX() && mouseX <= this.getX() + this.getW() && mouseY >= this.getY() && mouseY <= this.getY() + this.getH();
if (inside && Mouse.hasWheel()) {
this.scroll += -(Mouse.getDWheel() / 100);
if(this.scroll <= 0) {
this.scroll = 0;
}
if(this.scroll >= 8) {
this.scroll = 8;
}
if(this.lastScroll != this.scroll) {
this.lastScroll = this.scroll;
this.distance = this.scroll * 10;
//TODO update fbo
}
}
}
}

View File

@ -0,0 +1,27 @@
package me.rigamortis.seppuku.impl.gui.hud.component;
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
import net.minecraft.client.Minecraft;
/**
* Author Seth
* 12/5/2019 @ 3:00 PM.
*/
public final class PlayerCountComponent extends DraggableHudComponent {
public PlayerCountComponent() {
super("PlayerCount");
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
final String playerCount = "ONLINE: " + Minecraft.getMinecraft().player.connection.getPlayerInfoMap().size();
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(playerCount));
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(playerCount, this.getX(), this.getY(), -1);
}
}

View File

@ -0,0 +1,42 @@
package me.rigamortis.seppuku.impl.gui.hud.component;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.camera.Camera;
import me.rigamortis.seppuku.api.gui.hud.component.ResizableHudComponent;
import me.rigamortis.seppuku.api.util.RenderUtil;
import net.minecraft.client.Minecraft;
/**
* Author Seth
* 12/10/2019 @ 1:49 AM.
*/
public final class RearViewComponent extends ResizableHudComponent {
private final Camera rearviewCamera = new Camera();
public RearViewComponent() {
super("RearView", 120, 120);
Seppuku.INSTANCE.getCameraManager().addCamera(rearviewCamera);
this.setW(120);
this.setH(120);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
RenderUtil.drawRect(this.getX() - 1, this.getY() - 1, this.getX() + this.getW() + 1, this.getY() + this.getH() + 1, 0x99101010);
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xFF202020);
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.getName(), this.getX() + 2, this.getY() + 2, 0xFFFFFFFF);
this.rearviewCamera.setRendering(true);
if (this.rearviewCamera.isValid()) {
this.rearviewCamera.setPos(Minecraft.getMinecraft().player.getPositionEyes(partialTicks));
this.rearviewCamera.setYaw(Minecraft.getMinecraft().player.rotationYaw - 180.0f);
this.rearviewCamera.setPitch(0.0f);
this.rearviewCamera.render(this.getX() + 2, this.getY() + 12, this.getX() + this.getW() - 2, this.getY() + this.getH() - 2);
}
}
}

View File

@ -0,0 +1,60 @@
package me.rigamortis.seppuku.impl.management;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.camera.Camera;
import me.rigamortis.seppuku.api.event.minecraft.EventUpdateFramebufferSize;
import me.rigamortis.seppuku.api.event.render.EventRender2D;
import net.minecraft.client.Minecraft;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import java.util.ArrayList;
import java.util.List;
/**
* Author Seth
* 12/9/2019 @ 6:09 AM.
*/
public final class CameraManager {
private List<Camera> cameraList = new ArrayList();
public CameraManager() {
Seppuku.INSTANCE.getEventManager().addEventListener(this);
}
public void update() {
if (Minecraft.getMinecraft().inGameHasFocus) {
for (Camera cam : this.cameraList) {
if (cam != null && !cam.isRecording() && cam.isRendering()) {
cam.updateFbo();
}
}
}
}
@Listener
public void fboResize(EventUpdateFramebufferSize event) {
for (Camera cam : this.cameraList) {
if (cam != null) {
cam.resize();
}
}
}
public void addCamera(Camera cam) {
this.cameraList.add(cam);
}
public void unload() {
this.cameraList.clear();
Seppuku.INSTANCE.getEventManager().removeEventListener(this);
}
public List<Camera> getCameraList() {
return cameraList;
}
public void setCameraList(List<Camera> cameraList) {
this.cameraList = cameraList;
}
}

View File

@ -1,10 +1,13 @@
package me.rigamortis.seppuku.impl.management;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.cape.CapeUser;
import me.rigamortis.seppuku.api.event.player.EventCapeLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
import javax.imageio.ImageIO;
import java.io.BufferedReader;
@ -28,6 +31,18 @@ public final class CapeManager {
public CapeManager() {
this.downloadCapeUsers();
this.downloadCapes();
Seppuku.INSTANCE.getEventManager().addEventListener(this);
}
@Listener
public void displayCape(EventCapeLocation event) {
if (Minecraft.getMinecraft().player != null && event.getPlayer() != Minecraft.getMinecraft().player) {
final ResourceLocation cape = this.getCape(event.getPlayer());
if (cape != null) {
event.setLocation(cape);
event.setCanceled(true);
}
}
}
/**
@ -92,6 +107,16 @@ public final class CapeManager {
}
}
public boolean hasCape() {
for (CapeUser capeUser : this.capeUserList) {
if (capeUser.getUuid().equals(Minecraft.getMinecraft().session.getProfile().getId().toString().replace("-", ""))) {
return true;
}
}
return false;
}
/**
* Returns a ResourceLocation for a player
*
@ -126,6 +151,7 @@ public final class CapeManager {
public void unload() {
this.capeUserList.clear();
Seppuku.INSTANCE.getEventManager().removeEventListener(this);
}
public List<CapeUser> getCapeUserList() {

View File

@ -65,6 +65,9 @@ public final class HudManager {
this.componentList.add(new TotemCountComponent());
this.componentList.add(new TutorialComponent());
this.componentList.add(new HoleOverlayComponent());
this.componentList.add(new PlayerCountComponent());
this.componentList.add(new OverViewComponent());
this.componentList.add(new RearViewComponent());
for (Module.ModuleType type : Module.ModuleType.values()) {
if (type.equals(Module.ModuleType.HIDDEN) || type.equals(Module.ModuleType.UI))

View File

@ -18,6 +18,7 @@ import me.rigamortis.seppuku.impl.module.player.*;
import me.rigamortis.seppuku.impl.module.render.*;
import me.rigamortis.seppuku.impl.module.ui.HudEditorModule;
import me.rigamortis.seppuku.impl.module.world.*;
import net.minecraft.client.Minecraft;
import java.io.File;
import java.lang.reflect.Field;
@ -145,6 +146,10 @@ public final class ModuleManager {
add(new ChatSuffixModule());
add(new VisualRangeModule());
//p2w experience
if (Seppuku.INSTANCE.getCapeManager().hasCape())
add(new CapeModule());
this.loadExternalModules();
for (final Module module : moduleList)

View File

@ -6,6 +6,11 @@ import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityFishHook;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.network.play.server.SPacketEntityMetadata;
import net.minecraft.network.play.server.SPacketEntityStatus;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.network.play.server.SPacketExplosion;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
@ -19,6 +24,7 @@ public final class VelocityModule extends Module {
public final Value<Integer> horizontal_vel = new Value("Horizontal_Velocity", new String[]{"Horizontal_Velocity", "HVel", "HV", "HorizontalVel", "Horizontal", "H"}, "The horizontal velocity you will take.", 0, 0, 100, 1);
public final Value<Integer> vertical_vel = new Value("Vertical_Velocity", new String[]{"Vertical_Velocity", "VVel", "VV", "VerticalVel", "Vertical", "Vert", "V"}, "The vertical velocity you will take.", 0, 0, 100, 1);
public final Value<Boolean> explosions = new Value("Explosions", new String[]{"Explosions", "Explosion", "EXP", "EX", "Expl"}, "Apply velocity modifier on explosion velocity.", true);
public final Value<Boolean> bobbers = new Value("Bobbers", new String[]{"Bobb", "Bob", "FishHook", "FishHooks"}, "Apply velocity modifier on fishing bobber velocity.", true);
public VelocityModule() {
super("Velocity", new String[]{"Vel", "AntiVelocity", "Knockback", "AntiKnockback"}, "Modify the velocity you take", "NONE", -1, ModuleType.COMBAT);
@ -32,6 +38,19 @@ public final class VelocityModule extends Module {
@Listener
public void receivePacket(EventReceivePacket event) {
if (event.getStage() == EventStageable.EventStage.PRE) {
if (event.getPacket() instanceof SPacketEntityStatus && this.bobbers.getValue()) {
event.setCanceled(true);
final SPacketEntityStatus packet = (SPacketEntityStatus) event.getPacket();
if (packet.getOpCode() == 31) {
final Entity entity = packet.getEntity(Minecraft.getMinecraft().world);
if (entity != null && entity instanceof EntityFishHook) {
final EntityFishHook fishHook = (EntityFishHook) entity;
if (fishHook.caughtEntity == Minecraft.getMinecraft().player) {
event.setCanceled(true);
}
}
}
}
if (event.getPacket() instanceof SPacketEntityVelocity) {
final SPacketEntityVelocity packet = (SPacketEntityVelocity) event.getPacket();
if (packet.getEntityID() == Minecraft.getMinecraft().player.getEntityId()) {

View File

@ -0,0 +1,31 @@
package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.player.EventCapeLocation;
import me.rigamortis.seppuku.api.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
/**
* Author Seth
* 12/8/2019 @ 3:04 PM.
*/
public final class CapeModule extends Module {
public CapeModule() {
super("Cape", new String[]{"Capes"}, "Displays your cape.", "NONE", -1, ModuleType.RENDER);
}
@Listener
public void displayCape(EventCapeLocation event) {
if (Minecraft.getMinecraft().player != null && event.getPlayer() == Minecraft.getMinecraft().player) {
final ResourceLocation cape = Seppuku.INSTANCE.getCapeManager().getCape(event.getPlayer());
if (cape != null) {
event.setLocation(cape);
event.setCanceled(true);
}
}
}
}

View File

@ -3,14 +3,20 @@ package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.api.event.gui.EventRenderTooltip;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.Block;
import net.minecraft.block.BlockShulkerBox;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiShulkerBox;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemShulkerBox;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityShulkerBox;
import net.minecraft.util.NonNullList;
import org.lwjgl.input.Mouse;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
/**
@ -18,6 +24,10 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
*/
public final class ShulkerPreviewModule extends Module {
public final Value<Boolean> middleClick = new Value("MiddleClick", new String[]{"MC", "Mid"}, "Allows you to middle click shulkers and view their contents.", true);
private boolean clicked;
public ShulkerPreviewModule() {
super("ShulkerPreview", new String[]{"SPreview", "ShulkerView"}, "Hover over a shulker box to the items inside.", "NONE", -1, ModuleType.RENDER);
}
@ -79,6 +89,27 @@ public final class ShulkerPreviewModule extends Module {
}
}
if(this.middleClick.getValue()) {
if (Mouse.isButtonDown(2)) {
if (!this.clicked) {
final BlockShulkerBox shulkerBox = (BlockShulkerBox) Block.getBlockFromItem(shulker.getItem());
if (shulkerBox != null) {
final NBTTagCompound tag = shulker.getTagCompound();
if (tag != null && tag.hasKey("BlockEntityTag", 10)) {
final NBTTagCompound entityTag = tag.getCompoundTag("BlockEntityTag");
final TileEntityShulkerBox te = new TileEntityShulkerBox();
te.setWorld(mc.world);
te.readFromNBT(entityTag);
mc.displayGuiScreen(new GuiShulkerBox(mc.player.inventory, te));
}
}
}
this.clicked = true;
} else {
this.clicked = false;
}
}
}
}
}

View File

@ -1,9 +1,13 @@
package me.rigamortis.seppuku.impl.patch;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.player.EventCapeLocation;
import me.rigamortis.seppuku.api.patch.ClassPatch;
import me.rigamortis.seppuku.api.patch.MethodPatch;
import me.rigamortis.seppuku.impl.management.PatchManager;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.*;
import team.stiff.pomelo.EventManager;
import static org.objectweb.asm.Opcodes.*;
@ -24,19 +28,28 @@ public final class AbstractClientPlayerPatch extends ClassPatch {
notchDesc = "()Lnf;")
public void getLocationCape(MethodNode methodNode, PatchManager.Environment env) {
final InsnList insnList = new InsnList();
insnList.add(new FieldInsnNode(GETSTATIC, "me/rigamortis/seppuku/Seppuku", "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;"));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, "me/rigamortis/seppuku/Seppuku", "getCapeManager", "()Lme/rigamortis/seppuku/impl/management/CapeManager;", false));
insnList.add(new TypeInsnNode(NEW, Type.getInternalName(EventCapeLocation.class)));
insnList.add(new InsnNode(DUP));
insnList.add(new VarInsnNode(ALOAD, 0));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, "me/rigamortis/seppuku/impl/management/CapeManager", "getCape", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/client/entity/AbstractClientPlayer;)Lnet/minecraft/util/ResourceLocation;" : "(Lbua;)Lnf;", false));
insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(EventCapeLocation.class), "<init>", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/client/entity/AbstractClientPlayer;)V" : "(Lbua;)V", false));
insnList.add(new VarInsnNode(ASTORE, 2));
insnList.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(Seppuku.class), "INSTANCE", "Lme/rigamortis/seppuku/Seppuku;"));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(Seppuku.class), "getEventManager", "()Lteam/stiff/pomelo/EventManager;", false));
insnList.add(new VarInsnNode(ALOAD, 2));
insnList.add(new MethodInsnNode(INVOKEINTERFACE, Type.getInternalName(EventManager.class), "dispatchEvent", "(Ljava/lang/Object;)Ljava/lang/Object;", true));
insnList.add(new InsnNode(POP));
insnList.add(new VarInsnNode(ALOAD, 2));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventCapeLocation.class), "isCanceled", "()Z", false));
final LabelNode labelNode = new LabelNode();
insnList.add(new JumpInsnNode(IFNULL, labelNode));
insnList.add(new JumpInsnNode(IFEQ, labelNode));
insnList.add(new VarInsnNode(ALOAD, 2));
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(EventCapeLocation.class), "getLocation", env == PatchManager.Environment.IDE ? "()Lnet/minecraft/util/ResourceLocation;" : "()Lnf;", false));
insnList.add(new InsnNode(ARETURN));
insnList.add(labelNode);
methodNode.instructions.insert(insnList);
}
}

View File

@ -62,6 +62,9 @@ public final class EntityRendererPatch extends ClassPatch {
public static void updateCameraAndRenderHook(float partialTicks) {
//dispatch our event so we can render stuff on our screen
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRender2D(partialTicks, new ScaledResolution(Minecraft.getMinecraft())));
//update all camera fbos after we render
Seppuku.INSTANCE.getCameraManager().update();
}
/**

View File

@ -21,15 +21,15 @@ public final class ItemRendererPatch extends ClassPatch {
}
@MethodPatch(
mcpName = "renderBlockInHand",
mcpName = "renderSuffocationOverlay",
notchName = "a",
mcpDesc = "(Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;)V",
notchDesc = "(Lcdq;)V")
public void renderBlockInHand(MethodNode methodNode, PatchManager.Environment env) {
public void renderSuffocationOverlay(MethodNode methodNode, PatchManager.Environment env) {
//create a list of instructions and add the needed instructions to call our hook function
final InsnList insnList = new InsnList();
//call our hook function
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "renderBlockInHandHook", "()Z", false));
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "renderSuffocationOverlayHook", "()Z", false));
//add a label to jump to
final LabelNode jmp = new LabelNode();
//add if equals and pass the label
@ -42,7 +42,7 @@ public final class ItemRendererPatch extends ClassPatch {
methodNode.instructions.insert(insnList);
}
public static boolean renderBlockInHandHook() {
public static boolean renderSuffocationOverlayHook() {
final EventRenderOverlay event = new EventRenderOverlay(EventRenderOverlay.OverlayType.BLOCK);
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);