Update to latest remote

This commit is contained in:
Alex 2020-05-08 19:01:04 +02:00
commit fce2c8421f
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
13 changed files with 165 additions and 19 deletions

View File

@ -1,6 +1,6 @@
# ![Seppuku](res/seppuku_full.png)
Seppuku is a free, lightweight, open-source Minecraft Forge client-side mod for Minecraft 1.12.2. Oriented towards 9B9T, this is a full-featured anarchy mod with an external plugin API, unique exploits, and a solid community.
Seppuku is a free, lightweight, open-source [_Minecraft Forge_](https://files.minecraftforge.net/) mod for Minecraft 1.12.2. Oriented towards the 9B9T anarchy server, this is a fully featured client-side mod with an external plugin API, unique exploits, and a [solid community](https://discord.gg/UzWBZPe).
# Requirements
- **JDK 8** (https://adoptopenjdk.net/, https://aws.amazon.com/corretto/)

View File

@ -107,7 +107,15 @@ public final class Seppuku {
this.getEventManager().dispatchEvent(new EventLoad());
this.logger.info("Loaded");
// Add runtime hook to listen for shutdown to save configs
Runtime.getRuntime().addShutdownHook(new Thread("Seppuku Shutdown Hook") {
@Override
public void run() {
getConfigManager().saveAll();
}
});
this.logger.info("Seppuku Loaded Successfully");
}
public void errorChat(String message) {

View File

@ -41,6 +41,10 @@ public class HudComponent {
}
public void keyTyped(char typedChar, int keyCode) {
}
public boolean collidesWith(HudComponent other) {
// Collision x-axis?
boolean collisionX = this.x + this.w > other.x &&

View File

@ -35,6 +35,12 @@ public final class GuiHudEditor extends GuiScreen {
}
}
}
for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) {
if (component.isVisible()) {
component.keyTyped(typedChar, keyCode);
}
}
}
@Override

View File

@ -0,0 +1,73 @@
package me.rigamortis.seppuku.impl.gui.hud.component;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import me.rigamortis.seppuku.impl.module.render.HudModule;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
import java.security.Key;
/**
* created by noil on 5/7/2020
*/
public final class FirstLaunchComponent extends DraggableHudComponent {
private Module hudModule;
private String textData;
public FirstLaunchComponent() {
super("FirstLaunch");
final String textData = "Welcome to Seppuku Client!\n\n" +
"Press ~ (tilda/grave) to open the GUI / hud-editor.";
this.setTextData(textData);
this.setVisible(true);
this.setSnappable(false);
this.setW(200);
this.setH(38);
this.setX(2);
this.setY(2);
this.hudModule = Seppuku.INSTANCE.getModuleManager().find(HudModule.class);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
final Minecraft mc = Minecraft.getMinecraft();
// Background
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xFF202020);
// Render text data
mc.fontRenderer.drawSplitString(this.textData, (int) this.getX() + 2, (int) this.getY() + 2, 200, 0xFFFFFFFF);
}
public void onClose() {
if (this.hudModule != null) {
if(this.hudModule.isEnabled()) {
this.hudModule.onEnable();
}else {
this.hudModule.toggle();
}
this.hudModule.setEnabled(true);
}
this.setVisible(false);
}
public String getTextData() {
return textData;
}
public void setTextData(String textData) {
this.textData = textData;
}
}

View File

@ -30,9 +30,6 @@ public class PopupComponent extends DraggableHudComponent {
final Minecraft mc = Minecraft.getMinecraft();
if (!(mc.currentScreen instanceof GuiHudEditor)) // ensure we are in the hud editor screen only
return;
// background
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xFF202020);
@ -54,7 +51,7 @@ public class PopupComponent extends DraggableHudComponent {
mouseY <= this.getY() + CLOSE_BUTTON_SIZE;
if (insideCloseButton && button == 0) {
this.setVisible(false);
this.onCloseButton();
}
}
@ -65,4 +62,8 @@ public class PopupComponent extends DraggableHudComponent {
public void setTextData(String textData) {
this.textData = textData;
}
public void onCloseButton() {
this.setVisible(false);
}
}

View File

@ -33,13 +33,13 @@ public final class TutorialComponent extends PopupComponent {
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
final Minecraft mc = Minecraft.getMinecraft();
if (!(mc.currentScreen instanceof GuiHudEditor)) // ensure we are in the hud editor screen only
return;
super.render(mouseX, mouseY, partialTicks);
// drag me!
mc.fontRenderer.drawStringWithShadow("(drag me!)", this.getX() + this.getW() - 80, this.getY() + 10, 0xFFAAAAAA);
}

View File

@ -18,7 +18,7 @@ public final class ConfigManager {
private File moduleConfigDir;
private File hudComponentConfigDir;
private boolean firstLaunch;
private boolean firstLaunch = false;
private List<Configurable> configurableList = new ArrayList<>();
@ -31,7 +31,7 @@ public final class ConfigManager {
private void generateDirectories() {
this.configDir = new File(CONFIG_PATH);
if (!this.configDir.exists()) {
this.firstLaunch = true;
this.setFirstLaunch(true);
this.configDir.mkdirs();
}

View File

@ -5,11 +5,14 @@ import me.rigamortis.seppuku.api.event.render.EventRender2D;
import me.rigamortis.seppuku.api.gui.hud.component.HudComponent;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.ReflectionUtil;
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
import me.rigamortis.seppuku.impl.gui.hud.component.*;
import me.rigamortis.seppuku.impl.gui.hud.component.module.ModuleListComponent;
import me.rigamortis.seppuku.impl.module.render.HudModule;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
@ -29,6 +32,8 @@ public final class HudManager {
private List<HudComponent> componentList = new CopyOnWriteArrayList<>();
private List<AnchorPoint> anchorPoints = new ArrayList<>();
private final FirstLaunchComponent firstLaunchComponent;
public HudManager() {
final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
@ -86,6 +91,9 @@ public final class HudManager {
// Organize alphabetically
this.componentList = this.componentList.stream().sorted((obj1, obj2) -> obj1.getName().compareTo(obj2.getName())).collect(Collectors.toList());
// Create first launch component
this.firstLaunchComponent = new FirstLaunchComponent();
Seppuku.INSTANCE.getEventManager().addEventListener(this);
}
@ -98,6 +106,16 @@ public final class HudManager {
public void onRender(EventRender2D event) {
final Minecraft mc = Minecraft.getMinecraft();
if (this.firstLaunchComponent != null && mc.world != null) {
if (Seppuku.INSTANCE.getConfigManager().isFirstLaunch()) {
if (mc.currentScreen instanceof GuiHudEditor) {
firstLaunchComponent.onClose();
} else if (firstLaunchComponent.isVisible()) {
firstLaunchComponent.render(0, 0, event.getPartialTicks());
}
}
}
final int chatHeight = (mc.currentScreen instanceof GuiChat) ? 14 : 0;
for (AnchorPoint point : this.anchorPoints) {

View File

@ -17,7 +17,7 @@ import me.rigamortis.seppuku.impl.module.misc.*;
import me.rigamortis.seppuku.impl.module.movement.*;
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.ui.HudEditorModule;
import me.rigamortis.seppuku.impl.module.world.*;
import java.io.File;
@ -148,6 +148,7 @@ public final class ModuleManager {
add(new ChatSuffixModule());
add(new VisualRangeModule());
add(new HotBarRefillModule());
add(new QuickCraftModule());
//p2w experience
if (Seppuku.INSTANCE.getCapeManager().hasCape())

View File

@ -24,7 +24,6 @@ public final class KeybindsModule extends Module {
if(mod != null) {
if(mod.getType() != ModuleType.HIDDEN && event.getKey() == Keyboard.getKeyIndex(mod.getKey()) && Keyboard.getKeyIndex(mod.getKey()) != Keyboard.KEY_NONE) {
mod.toggle();
Seppuku.INSTANCE.getConfigManager().saveAll();
}
}
}

View File

@ -0,0 +1,41 @@
package me.rigamortis.seppuku.impl.module.misc;
import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
import me.rigamortis.seppuku.api.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.init.Items;
import net.minecraft.inventory.ClickType;
import net.minecraft.network.play.server.SPacketSetSlot;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
/**
* Shift clicks the crafting result into the inventory.
*
* @author Old Chum
* @since 10/18/20
*/
public final class QuickCraftModule extends Module {
public QuickCraftModule () {
super("QuickCraft", new String[]{"FastCraft", "qcraft"}, "Automatically collects the result when crafting.", "NONE", -1, Module.ModuleType.MISC);
}
@Listener
public void onReceivePacket (EventReceivePacket event) {
if (event.getStage() == EventStageable.EventStage.PRE) {
if (event.getPacket() instanceof SPacketSetSlot) {
// Check if this packet updates the recipe result and if the result is not empty
if (((SPacketSetSlot) event.getPacket()).getSlot() == 0 && ((SPacketSetSlot) event.getPacket()).getStack().getItem() != Items.AIR) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiCrafting) {
mc.playerController.windowClick(mc.player.openContainer.windowId, 0, 0, ClickType.QUICK_MOVE, mc.player);
mc.playerController.updateController();
}
}
}
}
}
}

View File

@ -22,7 +22,7 @@ public final class HudModule extends Module {
public final Value<Boolean> hidePotions = new Value<Boolean>("HidePotions", new String[]{"HidePotions", "HidePots", "Hide_Potions"}, "Hides the Vanilla potion hud (at the top right of the screen).", true);
public HudModule() {
super("Hud", new String[]{"Overlay"}, "Shows lots of useful info", "NONE", -1, ModuleType.RENDER);
super("Hud", new String[]{"Overlay"}, "Renders hud components on the screen.", "NONE", -1, ModuleType.RENDER);
this.setHidden(true);
}
@ -30,11 +30,7 @@ public final class HudModule extends Module {
public void render(EventRender2D event) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.showDebugInfo) {
return;
}
if (mc.currentScreen instanceof GuiHudEditor) {
if (mc.gameSettings.showDebugInfo || mc.currentScreen instanceof GuiHudEditor || mc.player == null) {
return;
}
@ -42,7 +38,6 @@ public final class HudModule extends Module {
GlStateManager.enableBlend();
for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) {
if (component.isVisible()) {
//dont render components with the TOP_CENTER anchor if we are looking at the tab list
if (component instanceof DraggableHudComponent) {
final DraggableHudComponent draggableComponent = (DraggableHudComponent) component;