Adds the new main menu, updates every hud component, new NoLag option Particles, various code optimizations
This commit is contained in:
parent
9644d1b0c9
commit
dc1617a4cd
|
@ -96,7 +96,7 @@ public final class Seppuku {
|
|||
this.commandManager = new CommandManager();
|
||||
this.cameraManager = new CameraManager();
|
||||
this.hudManager = new HudManager();
|
||||
//this.seppukuMainMenu = new GuiSeppukuMainMenu();
|
||||
this.seppukuMainMenu = new GuiSeppukuMainMenu();
|
||||
|
||||
this.configManager.init(); // Keep last, so we load configs after everything else inits
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package me.rigamortis.seppuku.api.event.world;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.EventCancellable;
|
||||
|
||||
/**
|
||||
* @author noil
|
||||
*/
|
||||
public class EventSpawnParticle extends EventCancellable {
|
||||
}
|
|
@ -29,6 +29,8 @@ public class DraggableHudComponent extends HudComponent {
|
|||
|
||||
private static final double ANCHOR_THRESHOLD = 80;
|
||||
|
||||
protected final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public DraggableHudComponent(String name) {
|
||||
this.setName(name);
|
||||
this.setVisible(false);
|
||||
|
|
|
@ -106,12 +106,6 @@ public class TextComponent extends HudComponent {
|
|||
this.displayValue += typedChar;
|
||||
}
|
||||
break;
|
||||
case Keyboard.KEY_UNDERLINE:
|
||||
case Keyboard.KEY_MINUS:
|
||||
if (!this.digitOnly) {
|
||||
this.displayValue += typedChar;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,16 @@ public final class GuiHudEditor extends GuiScreen {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResize(Minecraft mcIn, int w, int h) {
|
||||
super.onResize(mcIn, w, h);
|
||||
|
||||
final ScaledResolution sr = new ScaledResolution(mcIn);
|
||||
for (AnchorPoint anchorPoint : Seppuku.INSTANCE.getHudManager().getAnchorPoints()) {
|
||||
anchorPoint.updatePosition(sr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
@ -98,7 +108,6 @@ public final class GuiHudEditor extends GuiScreen {
|
|||
RenderUtil.drawRect(draggable.getX() + draggable.getW() - SIZE, draggable.getY(), draggable.getX() + draggable.getW(), draggable.getY() + SIZE, 0x90FFFFFF);
|
||||
RenderUtil.drawRect(draggable.getX(), (draggable.getY() + draggable.getH()) - SIZE, draggable.getX() + SIZE, draggable.getY() + draggable.getH(), 0x90FFFFFF);
|
||||
RenderUtil.drawRect(draggable.getX() + draggable.getW() - SIZE, (draggable.getY() + draggable.getH()) - SIZE, draggable.getX() + draggable.getW(), draggable.getY() + draggable.getH(), 0x90FFFFFF);
|
||||
continue;
|
||||
}
|
||||
|
||||
// dragging highlight
|
||||
|
@ -172,5 +181,8 @@ public final class GuiHudEditor extends GuiScreen {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// go back to previous screen
|
||||
super.onGuiClosed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.anchor;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 8/7/2019 @ 1:18 PM.
|
||||
|
@ -11,6 +13,10 @@ public class AnchorPoint {
|
|||
|
||||
private Point point;
|
||||
|
||||
public AnchorPoint(Point point) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public AnchorPoint(float x, float y, Point point) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
@ -45,4 +51,32 @@ public class AnchorPoint {
|
|||
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER, BOTTOM_CENTER
|
||||
}
|
||||
|
||||
public void updatePosition(final ScaledResolution sr) {
|
||||
switch (this.getPoint()) {
|
||||
case TOP_LEFT:
|
||||
this.x = 2;
|
||||
this.y = 2;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
this.x = sr.getScaledWidth() - 2;
|
||||
this.y = 2;
|
||||
break;
|
||||
case BOTTOM_LEFT:
|
||||
this.x = 2;
|
||||
this.y = sr.getScaledHeight() - 2;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
this.x = sr.getScaledWidth() - 2;
|
||||
this.y = sr.getScaledHeight() - 2;
|
||||
break;
|
||||
case TOP_CENTER:
|
||||
this.x = sr.getScaledWidth() / 2.0f;
|
||||
this.y = 2;
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
this.x = sr.getScaledWidth() / 2.0f;
|
||||
this.y = sr.getScaledHeight() - 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -23,22 +22,23 @@ public final class ArmorComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean isInHudEditor = mc.currentScreen instanceof GuiHudEditor;
|
||||
int itemSpacingWidth = 0;
|
||||
boolean playerHasArmor = false;
|
||||
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
final ItemStack stack = mc.player.inventoryContainer.getSlot(8 - i).getStack();
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, (int) this.getX() + itemSpacingWidth, (int) this.getY());
|
||||
mc.getRenderItem().renderItemOverlays(mc.fontRenderer, stack, (int) this.getX() + itemSpacingWidth, (int) this.getY());
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
itemSpacingWidth += ITEM_SIZE;
|
||||
playerHasArmor = true;
|
||||
if (mc.player != null) {
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
final ItemStack stack = mc.player.inventoryContainer.getSlot(8 - i).getStack();
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, (int) this.getX() + itemSpacingWidth, (int) this.getY());
|
||||
mc.getRenderItem().renderItemOverlays(mc.fontRenderer, stack, (int) this.getX() + itemSpacingWidth, (int) this.getY());
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
itemSpacingWidth += ITEM_SIZE;
|
||||
playerHasArmor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
@ -14,22 +13,24 @@ public final class BiomeComponent extends DraggableHudComponent {
|
|||
|
||||
public BiomeComponent() {
|
||||
super("Biome");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final BlockPos pos = mc.player.getPosition();
|
||||
final Chunk chunk = mc.world.getChunk(pos);
|
||||
final Biome biome = chunk.getBiome(pos, mc.world.getBiomeProvider());
|
||||
if (mc.world != null) {
|
||||
final BlockPos pos = mc.player.getPosition();
|
||||
final Chunk chunk = mc.world.getChunk(pos);
|
||||
final Biome biome = chunk.getBiome(pos, mc.world.getBiomeProvider());
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(biome.getBiomeName()));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(biome.getBiomeName(), this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(biome.getBiomeName()));
|
||||
mc.fontRenderer.drawStringWithShadow(biome.getBiomeName(), this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(biome)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(biome)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +6,6 @@ import me.rigamortis.seppuku.api.util.ColorUtil;
|
|||
import me.rigamortis.seppuku.api.util.MathUtil;
|
||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.impl.module.world.WaypointsModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -26,62 +25,65 @@ public final class CompassComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution sr = new ScaledResolution(mc);
|
||||
final String host = Minecraft.getMinecraft().getCurrentServerData() != null ? Minecraft.getMinecraft().getCurrentServerData().serverIP : "localhost";
|
||||
float playerYaw = mc.player.rotationYaw;
|
||||
float rotationYaw = MathUtil.wrap(playerYaw);
|
||||
|
||||
// Background
|
||||
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x75101010);
|
||||
|
||||
// Begin scissor area
|
||||
RenderUtil.glScissor(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), sr);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
if (mc.world != null) {
|
||||
final ScaledResolution sr = new ScaledResolution(mc);
|
||||
final String host = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "localhost";
|
||||
float playerYaw = mc.player.rotationYaw;
|
||||
float rotationYaw = MathUtil.wrap(playerYaw);
|
||||
|
||||
// 0, 0
|
||||
final float zeroZeroYaw = MathUtil.wrap((float) (Math.atan2(0 - mc.player.posZ, 0 - mc.player.posX) * 180.0d / Math.PI) - 90.0f);
|
||||
RenderUtil.drawLine(this.getX() - rotationYaw + (this.getW() / 2) + zeroZeroYaw, this.getY() + 2, this.getX() - rotationYaw + (this.getW() / 2) + zeroZeroYaw, this.getY() + this.getH() - 2, 2, 0xFFFF1010);
|
||||
// Begin scissor area
|
||||
RenderUtil.glScissor(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), sr);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
|
||||
// Waypoints
|
||||
if (!Seppuku.INSTANCE.getWaypointManager().getWaypointDataList().isEmpty()) {
|
||||
for (WaypointsModule.WaypointData waypointData : Seppuku.INSTANCE.getWaypointManager().getWaypointDataList()) {
|
||||
if (!waypointData.getHost().equals(host) || waypointData.getDimension() != mc.player.dimension)
|
||||
continue;
|
||||
// 0, 0
|
||||
final float zeroZeroYaw = MathUtil.wrap((float) (Math.atan2(0 - mc.player.posZ, 0 - mc.player.posX) * 180.0d / Math.PI) - 90.0f);
|
||||
RenderUtil.drawLine(this.getX() - rotationYaw + (this.getW() / 2) + zeroZeroYaw, this.getY() + 2, this.getX() - rotationYaw + (this.getW() / 2) + zeroZeroYaw, this.getY() + this.getH() - 2, 2, 0xFFFF1010);
|
||||
|
||||
final float waypointDataYaw = MathUtil.wrap((float) (Math.atan2(waypointData.getZ() - mc.player.posZ, waypointData.getX() - mc.player.posX) * 180.0d / Math.PI) - 90.0f);
|
||||
RenderUtil.drawTriangle(this.getX() - rotationYaw + (this.getW() / 2) + waypointDataYaw, this.getY() + (this.getH() / 2), 3, 180, ColorUtil.changeAlpha(waypointData.getColor(), 0xFF));
|
||||
// Waypoints
|
||||
if (!Seppuku.INSTANCE.getWaypointManager().getWaypointDataList().isEmpty()) {
|
||||
for (WaypointsModule.WaypointData waypointData : Seppuku.INSTANCE.getWaypointManager().getWaypointDataList()) {
|
||||
if (!waypointData.getHost().equals(host) || waypointData.getDimension() != mc.player.dimension)
|
||||
continue;
|
||||
|
||||
final float waypointDataYaw = MathUtil.wrap((float) (Math.atan2(waypointData.getZ() - mc.player.posZ, waypointData.getX() - mc.player.posX) * 180.0d / Math.PI) - 90.0f);
|
||||
RenderUtil.drawTriangle(this.getX() - rotationYaw + (this.getW() / 2) + waypointDataYaw, this.getY() + (this.getH() / 2), 3, 180, ColorUtil.changeAlpha(waypointData.getColor(), 0xFF));
|
||||
}
|
||||
}
|
||||
|
||||
// North
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 180, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) + 180, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 180, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) - 180, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// East
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 90, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) - 90, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// South
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)), this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)), this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// West
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 90, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) + 90, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// South west
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 45, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) + 45, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// South east
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 45, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) - 45, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// North west
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 135, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) + 135, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// North east
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 135, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) - 135, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
|
||||
// Text
|
||||
mc.fontRenderer.drawStringWithShadow("n", (this.getX() - rotationYaw + (this.getW() / 2)) + 180 - mc.fontRenderer.getStringWidth("n") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("n", (this.getX() - rotationYaw + (this.getW() / 2)) - 180 - mc.fontRenderer.getStringWidth("n") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("e", (this.getX() - rotationYaw + (this.getW() / 2)) - 90 - mc.fontRenderer.getStringWidth("e") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("s", (this.getX() - rotationYaw + (this.getW() / 2)) - mc.fontRenderer.getStringWidth("s") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("w", (this.getX() - rotationYaw + (this.getW() / 2)) + 90 - mc.fontRenderer.getStringWidth("w") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
|
||||
// Centered line
|
||||
RenderUtil.drawLine((this.getX() + this.getW() / 2), this.getY() + 1, (this.getX() + this.getW() / 2), this.getY() + this.getH() - 1, 2, 0xFF909090);
|
||||
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
} else {
|
||||
mc.fontRenderer.drawStringWithShadow("(compass)", (this.getX() + (this.getW() / 2.0f)) - mc.fontRenderer.getStringWidth("(compass)") / 2.0f, this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
|
||||
// North
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 180, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) + 180, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 180, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) - 180, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// East
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 90, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) - 90, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// South
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)), this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)), this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// West
|
||||
//RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 90, this.getY(), (this.getX() - rotationYaw + (this.getW() / 2)) + 90, this.getY() + this.getH(), 2, 0xFFFFFFFF);
|
||||
// South west
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 45, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) + 45, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// South east
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 45, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) - 45, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// North west
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) + 135, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) + 135, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
// North east
|
||||
RenderUtil.drawLine((this.getX() - rotationYaw + (this.getW() / 2)) - 135, this.getY() + 2, (this.getX() - rotationYaw + (this.getW() / 2)) - 135, this.getY() + this.getH() - 2, 2, 0xFFFFFFFF);
|
||||
|
||||
// Text
|
||||
mc.fontRenderer.drawStringWithShadow("n", (this.getX() - rotationYaw + (this.getW() / 2)) + 180 - mc.fontRenderer.getStringWidth("n") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("n", (this.getX() - rotationYaw + (this.getW() / 2)) - 180 - mc.fontRenderer.getStringWidth("n") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("e", (this.getX() - rotationYaw + (this.getW() / 2)) - 90 - mc.fontRenderer.getStringWidth("e") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("s", (this.getX() - rotationYaw + (this.getW() / 2)) - mc.fontRenderer.getStringWidth("s") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow("w", (this.getX() - rotationYaw + (this.getW() / 2)) + 90 - mc.fontRenderer.getStringWidth("w") / 2.0f, this.getY(), 0xFFFFFFFF);
|
||||
|
||||
// Centered line
|
||||
RenderUtil.drawLine((this.getX() + this.getW() / 2), this.getY() + 1, (this.getX() + this.getW() / 2), this.getY() + this.getH() - 1, 2, 0xFF909090);
|
||||
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,23 +14,28 @@ public final class CoordsComponent extends DraggableHudComponent {
|
|||
|
||||
public CoordsComponent() {
|
||||
super("Coords");
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.RESET +
|
||||
df.format(Minecraft.getMinecraft().player.posX) + ChatFormatting.RESET + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RESET + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posZ) + ChatFormatting.RESET;
|
||||
if (mc.player != null && mc.world != null) {
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(coords));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.RESET +
|
||||
df.format(Minecraft.getMinecraft().player.posX) + ChatFormatting.RESET + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RESET + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posZ) + ChatFormatting.RESET;
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xAA202020);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(coords, this.getX(), this.getY(), -1);
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(coords));
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(coords, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth("(coords)"));
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("(coords)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.api.util.Timer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
/**
|
||||
|
@ -17,25 +16,29 @@ public final class DirectionComponent extends DraggableHudComponent {
|
|||
|
||||
public DirectionComponent() {
|
||||
super("Direction");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
if (this.directionTimer.passed(250)) { // 250ms
|
||||
direction = String.format("%s" + " " + ChatFormatting.GRAY + "%s", this.getFacing(), this.getTowards());
|
||||
this.directionTimer.reset();
|
||||
}
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(direction));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(direction, this.getX(), this.getY(), -1);
|
||||
if (mc.world != null) {
|
||||
if (this.directionTimer.passed(250)) { // 250ms
|
||||
direction = String.format("%s" + " " + ChatFormatting.GRAY + "%s", this.getFacing(), this.getTowards());
|
||||
this.directionTimer.reset();
|
||||
}
|
||||
|
||||
this.setW(mc.fontRenderer.getStringWidth(direction));
|
||||
mc.fontRenderer.drawStringWithShadow(direction, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(direction)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(direction)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
private String getFacing() {
|
||||
switch (MathHelper.floor((double) (Minecraft.getMinecraft().player.rotationYaw * 8.0F / 360.0F) + 0.5D) & 7) {
|
||||
switch (MathHelper.floor((double) (mc.player.rotationYaw * 8.0F / 360.0F) + 0.5D) & 7) {
|
||||
case 0:
|
||||
return "South";
|
||||
case 1:
|
||||
|
@ -57,7 +60,7 @@ public final class DirectionComponent extends DraggableHudComponent {
|
|||
}
|
||||
|
||||
private String getTowards() {
|
||||
switch (MathHelper.floor((double) (Minecraft.getMinecraft().player.rotationYaw * 8.0F / 360.0F) + 0.5D) & 7) {
|
||||
switch (MathHelper.floor((double) (mc.player.rotationYaw * 8.0F / 360.0F) + 0.5D) & 7) {
|
||||
case 0:
|
||||
return "+Z";
|
||||
case 1:
|
||||
|
|
|
@ -10,7 +10,6 @@ import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
|||
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
|
||||
import me.rigamortis.seppuku.impl.module.hidden.ArrayListModule;
|
||||
import me.rigamortis.seppuku.impl.module.render.HudModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
|
@ -50,8 +49,7 @@ public final class EnabledModsComponent extends DraggableHudComponent {
|
|||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final List<Module> mods = new ArrayList<>();
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
|
||||
final ScaledResolution res = new ScaledResolution(mc);
|
||||
boolean isInHudEditor = mc.currentScreen instanceof GuiHudEditor;
|
||||
|
||||
for (Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
|
||||
|
@ -103,7 +101,7 @@ public final class EnabledModsComponent extends DraggableHudComponent {
|
|||
|
||||
int color = 0;
|
||||
|
||||
if (RAINBOW) {
|
||||
if (RAINBOW && mc.player != null) {
|
||||
Color rainbow = new Color(Color.HSBtoRGB((float) (mc.player.ticksExisted / (100.0D - RAINBOW_HUE_SPEED) + Math.sin(hueDifference / (100.0D - RAINBOW_HUE_SPEED * Math.PI / 2.0D))) % 1.0F, RAINBOW_SATURATION, RAINBOW_BRIGHTNESS));
|
||||
color = (new Color(rainbow.getRed(), rainbow.getGreen(), rainbow.getBlue(), 255)).getRGB();
|
||||
} else {
|
||||
|
|
|
@ -23,8 +23,6 @@ public final class EnemyPotionsComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int effectCount = 0;
|
||||
float xOffset = 0;
|
||||
float yOffset = 0;
|
||||
|
|
|
@ -5,7 +5,6 @@ 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.module.render.HudModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +12,7 @@ import net.minecraft.util.text.TextFormatting;
|
|||
*/
|
||||
public final class FirstLaunchComponent extends DraggableHudComponent {
|
||||
|
||||
private Module hudModule;
|
||||
private final Module hudModule;
|
||||
|
||||
private String textData;
|
||||
|
||||
|
@ -38,8 +37,6 @@ public final class FirstLaunchComponent extends DraggableHudComponent {
|
|||
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(), 0x99202020);
|
||||
|
||||
|
|
|
@ -11,18 +11,20 @@ public final class FpsComponent extends DraggableHudComponent {
|
|||
|
||||
public FpsComponent() {
|
||||
super("Fps");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
final String framerate = "FPS: " + Minecraft.getDebugFPS();
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(framerate));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(framerate, this.getX(), this.getY(), -1);
|
||||
if (mc.world != null) {
|
||||
final String fps = "FPS: " + Minecraft.getDebugFPS();
|
||||
this.setW(mc.fontRenderer.getStringWidth(fps));
|
||||
mc.fontRenderer.drawStringWithShadow(fps, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(fps)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(fps)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* created by noil on 10/6/2019 at 8:53 PM
|
||||
|
@ -11,15 +10,13 @@ public final class HelloComponent extends DraggableHudComponent {
|
|||
public HelloComponent() {
|
||||
// this will be the recognized name of our component
|
||||
super("Hello");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
// store the minecraft instance in a local variable
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
// this will be the string we display on screen
|
||||
final String helloString = String.format("Hello %s :)", mc.getSession().getUsername());
|
||||
final int stringWidth = mc.fontRenderer.getStringWidth(helloString);
|
||||
|
@ -28,6 +25,5 @@ public final class HelloComponent extends DraggableHudComponent {
|
|||
mc.fontRenderer.drawStringWithShadow(helloString, this.getX(), this.getY(), 0xFFFFFFFF);
|
||||
|
||||
this.setW(stringWidth); // set the width of the component to the width of the displayed string
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT); // same with the component's height, set it to the string height
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import me.rigamortis.seppuku.api.util.MathUtil;
|
|||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.DestroyBlockProgress;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
|
@ -31,71 +30,72 @@ public final class HoleOverlayComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean isInHudEditor = mc.currentScreen instanceof GuiHudEditor;
|
||||
boolean foundBlock = false;
|
||||
|
||||
this.setW(48);
|
||||
this.setH(48);
|
||||
|
||||
float yaw = 0;
|
||||
final int dir = (MathHelper.floor((double) (mc.player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3);
|
||||
boolean foundBlock = false;
|
||||
if (mc.player != null && mc.world != null) {
|
||||
float yaw = 0;
|
||||
final int dir = (MathHelper.floor((double) (mc.player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3);
|
||||
|
||||
switch (dir) {
|
||||
case 1:
|
||||
yaw = 90;
|
||||
break;
|
||||
case 2:
|
||||
yaw = -180;
|
||||
break;
|
||||
case 3:
|
||||
yaw = -90;
|
||||
break;
|
||||
}
|
||||
|
||||
final BlockPos northPos = this.traceToBlock(partialTicks, yaw);
|
||||
final Block north = this.getBlock(northPos);
|
||||
if (north != null && north != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(northPos);
|
||||
if (damage != 0) {
|
||||
int damageColor = (int) MathUtil.map(damage, 0, 8, 0, 255);
|
||||
RenderUtil.drawRect(this.getX() + 16, this.getY(), this.getX() + 32, this.getY() + 16, new Color(damageColor, 255 - damageColor, 0).getRGB());
|
||||
switch (dir) {
|
||||
case 1:
|
||||
yaw = 90;
|
||||
break;
|
||||
case 2:
|
||||
yaw = -180;
|
||||
break;
|
||||
case 3:
|
||||
yaw = -90;
|
||||
break;
|
||||
}
|
||||
this.drawBlock(north, this.getX() + 16, this.getY());
|
||||
foundBlock = true;
|
||||
}
|
||||
|
||||
final BlockPos southPos = this.traceToBlock(partialTicks, yaw - 180.0f);
|
||||
final Block south = this.getBlock(southPos);
|
||||
if (south != null && south != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(southPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX() + 16, this.getY() + 32, this.getX() + 32, this.getY() + 48, 0x60ff0000);
|
||||
final BlockPos northPos = this.traceToBlock(partialTicks, yaw);
|
||||
final Block north = this.getBlock(northPos);
|
||||
if (north != null && north != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(northPos);
|
||||
if (damage != 0) {
|
||||
int damageColor = (int) MathUtil.map(damage, 0, 8, 0, 255);
|
||||
RenderUtil.drawRect(this.getX() + 16, this.getY(), this.getX() + 32, this.getY() + 16, new Color(damageColor, 255 - damageColor, 0).getRGB());
|
||||
}
|
||||
this.drawBlock(north, this.getX() + 16, this.getY());
|
||||
foundBlock = true;
|
||||
}
|
||||
this.drawBlock(south, this.getX() + 16, this.getY() + 32);
|
||||
foundBlock = true;
|
||||
}
|
||||
|
||||
final BlockPos eastPos = this.traceToBlock(partialTicks, yaw + 90.0f);
|
||||
final Block east = this.getBlock(eastPos);
|
||||
if (east != null && east != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(eastPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX() + 32, this.getY() + 16, this.getX() + 48, this.getY() + 32, 0x60ff0000);
|
||||
final BlockPos southPos = this.traceToBlock(partialTicks, yaw - 180.0f);
|
||||
final Block south = this.getBlock(southPos);
|
||||
if (south != null && south != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(southPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX() + 16, this.getY() + 32, this.getX() + 32, this.getY() + 48, 0x60ff0000);
|
||||
}
|
||||
this.drawBlock(south, this.getX() + 16, this.getY() + 32);
|
||||
foundBlock = true;
|
||||
}
|
||||
this.drawBlock(east, this.getX() + 32, this.getY() + 16);
|
||||
foundBlock = true;
|
||||
}
|
||||
|
||||
final BlockPos westPos = this.traceToBlock(partialTicks, yaw - 90.0f);
|
||||
final Block west = this.getBlock(westPos);
|
||||
if (west != null && west != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(westPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX(), this.getY() + 16, this.getX() + 16, this.getY() + 32, 0x60ff0000);
|
||||
final BlockPos eastPos = this.traceToBlock(partialTicks, yaw + 90.0f);
|
||||
final Block east = this.getBlock(eastPos);
|
||||
if (east != null && east != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(eastPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX() + 32, this.getY() + 16, this.getX() + 48, this.getY() + 32, 0x60ff0000);
|
||||
}
|
||||
this.drawBlock(east, this.getX() + 32, this.getY() + 16);
|
||||
foundBlock = true;
|
||||
}
|
||||
|
||||
final BlockPos westPos = this.traceToBlock(partialTicks, yaw - 90.0f);
|
||||
final Block west = this.getBlock(westPos);
|
||||
if (west != null && west != Blocks.AIR) {
|
||||
final int damage = this.getBlockDamage(westPos);
|
||||
if (damage != 0) {
|
||||
RenderUtil.drawRect(this.getX(), this.getY() + 16, this.getX() + 16, this.getY() + 32, 0x60ff0000);
|
||||
}
|
||||
this.drawBlock(west, this.getX(), this.getY() + 16);
|
||||
foundBlock = true;
|
||||
}
|
||||
this.drawBlock(west, this.getX(), this.getY() + 16);
|
||||
foundBlock = true;
|
||||
}
|
||||
|
||||
if (!foundBlock) {
|
||||
|
@ -111,7 +111,7 @@ public final class HoleOverlayComponent extends DraggableHudComponent {
|
|||
}
|
||||
|
||||
private int getBlockDamage(BlockPos pos) {
|
||||
for (DestroyBlockProgress destBlockProgress : Minecraft.getMinecraft().renderGlobal.damagedBlocks.values()) {
|
||||
for (DestroyBlockProgress destBlockProgress : mc.renderGlobal.damagedBlocks.values()) {
|
||||
if (destBlockProgress.getPosition().getX() == pos.getX() && destBlockProgress.getPosition().getY() == pos.getY() && destBlockProgress.getPosition().getZ() == pos.getZ()) {
|
||||
return destBlockProgress.getPartialBlockDamage();
|
||||
}
|
||||
|
@ -120,14 +120,14 @@ public final class HoleOverlayComponent extends DraggableHudComponent {
|
|||
}
|
||||
|
||||
private BlockPos traceToBlock(float partialTicks, float yaw) {
|
||||
final Vec3d pos = MathUtil.interpolateEntity(Minecraft.getMinecraft().player, partialTicks);
|
||||
final Vec3d pos = MathUtil.interpolateEntity(mc.player, partialTicks);
|
||||
final Vec3d dir = MathUtil.direction(yaw);
|
||||
|
||||
return new BlockPos(pos.x + dir.x, pos.y, pos.z + dir.z);
|
||||
}
|
||||
|
||||
private Block getBlock(BlockPos pos) {
|
||||
final Block block = Minecraft.getMinecraft().world.getBlockState(pos).getBlock();
|
||||
final Block block = mc.world.getBlockState(pos).getBlock();
|
||||
|
||||
if ((block == Blocks.BEDROCK) || (block == Blocks.OBSIDIAN)) {
|
||||
return block;
|
||||
|
@ -144,7 +144,7 @@ public final class HoleOverlayComponent extends DraggableHudComponent {
|
|||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.translate(x, y, 0);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
|
|
|
@ -8,7 +8,6 @@ import me.rigamortis.seppuku.api.texture.Texture;
|
|||
import me.rigamortis.seppuku.api.util.ColorUtil;
|
||||
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;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
@ -28,7 +27,7 @@ public final class HubComponent extends ResizableHudComponent {
|
|||
private final int BORDER = 2;
|
||||
private final int TEXT_GAP = 1;
|
||||
private final int TEXTURE_SIZE = 8;
|
||||
private final int TITLE_BAR_HEIGHT = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1;
|
||||
private final int TITLE_BAR_HEIGHT = mc.fontRenderer.FONT_HEIGHT + 1;
|
||||
|
||||
private final Texture texture;
|
||||
|
||||
|
@ -40,16 +39,14 @@ public final class HubComponent extends ResizableHudComponent {
|
|||
this.setSnappable(false);
|
||||
this.setW(100);
|
||||
this.setH(120);
|
||||
this.setX((Minecraft.getMinecraft().displayWidth / 2.0f) - (this.getW() / 2));
|
||||
this.setY((Minecraft.getMinecraft().displayHeight / 2.0f) - (this.getH() / 2));
|
||||
this.setX((mc.displayWidth / 2.0f) - (this.getW() / 2));
|
||||
this.setY((mc.displayHeight / 2.0f) - (this.getH() / 2));
|
||||
}
|
||||
|
||||
@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))
|
||||
return;
|
||||
|
||||
|
@ -117,7 +114,7 @@ public final class HubComponent extends ResizableHudComponent {
|
|||
for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) {
|
||||
if (component != this) {
|
||||
RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, component.isVisible() ? 0x45002e00 : 0x452e0000);
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll);
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll);
|
||||
if (insideComponent) {
|
||||
RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010);
|
||||
}
|
||||
|
@ -146,12 +143,12 @@ public final class HubComponent extends ResizableHudComponent {
|
|||
|
||||
for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) {
|
||||
if (component != this) {
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll) && mouseY <= (this.getY() + BORDER + (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2) + 1 + offsetY - this.scroll);
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT * 2) + 1 + offsetY - this.scroll);
|
||||
if (insideComponent) {
|
||||
component.setVisible(!component.isVisible());
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventHubComponentClick(component.getName(), component.isVisible()));
|
||||
}
|
||||
offsetY += Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -20,14 +20,16 @@ public final class InventoryComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();// store the minecraft instance in a local variable
|
||||
|
||||
if (mc.player == null)
|
||||
return;
|
||||
|
||||
this.setW(16 * 9);
|
||||
this.setH(16 * 3);
|
||||
|
||||
if (mc.player == null) {
|
||||
if (mc.currentScreen instanceof GuiHudEditor) {
|
||||
mc.fontRenderer.drawStringWithShadow("(inventory)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x75101010); // background
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -14,28 +13,32 @@ public final class NetherCoordsComponent extends DraggableHudComponent {
|
|||
|
||||
public NetherCoordsComponent() {
|
||||
super("NetherCoords");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.DARK_GREEN +
|
||||
df.format(Minecraft.getMinecraft().player.posX * 8) + ChatFormatting.DARK_GREEN + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.DARK_GREEN + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.DARK_GREEN + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.DARK_GREEN + df.format(Minecraft.getMinecraft().player.posZ * 8) + ChatFormatting.RESET;
|
||||
if (mc.player != null && mc.world != null) {
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
final String nether = ChatFormatting.GRAY + "x " + ChatFormatting.RED +
|
||||
df.format(Minecraft.getMinecraft().player.posX / 8) + ChatFormatting.RED + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RED + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posZ / 8) + ChatFormatting.RESET;
|
||||
final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.DARK_GREEN +
|
||||
df.format(mc.player.posX * 8) + ChatFormatting.DARK_GREEN + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.DARK_GREEN + df.format(mc.player.posY) + ChatFormatting.DARK_GREEN + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.DARK_GREEN + df.format(mc.player.posZ * 8) + ChatFormatting.RESET;
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(Minecraft.getMinecraft().player.dimension == -1 ? coords : nether));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
final String nether = ChatFormatting.GRAY + "x " + ChatFormatting.RED +
|
||||
df.format(mc.player.posX / 8) + ChatFormatting.RED + "," +
|
||||
ChatFormatting.GRAY + " y " + ChatFormatting.RED + df.format(mc.player.posY) + ChatFormatting.RED + "," +
|
||||
ChatFormatting.GRAY + " z " + ChatFormatting.RED + df.format(mc.player.posZ / 8) + ChatFormatting.RESET;
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(Minecraft.getMinecraft().player.dimension == -1 ? coords : nether, this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(mc.player.dimension == -1 ? coords : nether));
|
||||
mc.fontRenderer.drawStringWithShadow(mc.player.dimension == -1 ? coords : nether, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(nether coords)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(nether coords)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +6,6 @@ import me.rigamortis.seppuku.api.notification.Notification;
|
|||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* created by noil on 8/17/2019 at 4:39 PM
|
||||
|
@ -39,7 +38,7 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
offsetX = (this.getW() - Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
offsetX = (this.getW() - mc.fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case BOTTOM_LEFT:
|
||||
|
@ -47,19 +46,19 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
break;
|
||||
case TOP_RIGHT:
|
||||
case BOTTOM_RIGHT:
|
||||
offsetX = this.getW() - Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText());
|
||||
offsetX = this.getW() - mc.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);
|
||||
notification.setWidth(mc.fontRenderer.getStringWidth(notification.getText()) + 4);
|
||||
notification.setHeight(mc.fontRenderer.FONT_HEIGHT + 5);
|
||||
|
||||
RenderUtil.drawRect(notification.getTransitionX(), notification.getTransitionY(), notification.getTransitionX() + notification.getWidth(), notification.getTransitionY() + notification.getHeight(), 0x75101010);
|
||||
RenderUtil.drawRect(notification.getTransitionX(), notification.getTransitionY(), notification.getTransitionX() + notification.getWidth(), (notification.getTransitionY() + 1), notification.getType().getColor());
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(notification.getText(), notification.getTransitionX() + 2.0F, notification.getTransitionY() + 4.0F, 0xFFFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(notification.getText(), notification.getTransitionX() + 2.0F, notification.getTransitionY() + 4.0F, 0xFFFFFFFF);
|
||||
|
||||
final float width = notification.getWidth();
|
||||
if (width >= maxWidth) {
|
||||
|
@ -70,15 +69,15 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
}
|
||||
|
||||
if (Seppuku.INSTANCE.getNotificationManager().getNotifications().isEmpty()) {
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiHudEditor) {
|
||||
if (mc.currentScreen instanceof GuiHudEditor) {
|
||||
final String placeholder = "(notifications)";
|
||||
maxWidth = Minecraft.getMinecraft().fontRenderer.getStringWidth(placeholder);
|
||||
offsetY = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT;
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(placeholder, this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
maxWidth = mc.fontRenderer.getStringWidth(placeholder);
|
||||
offsetY = mc.fontRenderer.FONT_HEIGHT;
|
||||
mc.fontRenderer.drawStringWithShadow(placeholder, this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
} else {
|
||||
maxWidth = 0;
|
||||
offsetY = 0;
|
||||
this.setEmptyH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
this.setEmptyH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ 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;
|
||||
|
@ -34,41 +33,42 @@ public final class OverViewComponent extends ResizableHudComponent {
|
|||
|
||||
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);
|
||||
mc.fontRenderer.drawStringWithShadow(this.getName(), this.getX() + 2, this.getY() + 2, 0xFFFFFFFF);
|
||||
|
||||
this.handleScrolling(mouseX, mouseY);
|
||||
if (mc.player != null && mc.world != null) {
|
||||
this.overviewCamera.setRendering(true);
|
||||
|
||||
this.overviewCamera.setRendering(true);
|
||||
if (this.overviewCamera.isValid()) {
|
||||
|
||||
if (this.overviewCamera.isValid()) {
|
||||
final Vec3d ground = this.getGround(partialTicks);
|
||||
|
||||
final Vec3d ground = this.getGround(partialTicks);
|
||||
|
||||
if (ground != null) {
|
||||
if (ground != null) {
|
||||
|
||||
/*
|
||||
"isometric" view
|
||||
final Vec3d forward = MathUtil.direction(Minecraft.getMinecraft().player.rotationYaw);
|
||||
final Vec3d forward = MathUtil.direction(mc.player.rotationYaw);
|
||||
final float factor = 30.0f;
|
||||
this.overviewCamera.setPos(ground.add(0, this.getDist(partialTicks), 0).subtract(forward.x * factor, forward.y * factor, forward.z * factor));
|
||||
this.overviewCamera.setYaw(Minecraft.getMinecraft().player.rotationYaw);
|
||||
this.overviewCamera.setYaw(mc.player.rotationYaw);
|
||||
this.overviewCamera.setPitch(65.0f);
|
||||
this.overviewCamera.render(this.getX() + 2, this.getY() + 12, this.getX() + this.getW() - 2, this.getY() + this.getH() - 2);
|
||||
*/
|
||||
|
||||
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);
|
||||
this.overviewCamera.setPos(ground.add(0, this.getDist(partialTicks), 0));
|
||||
this.overviewCamera.setYaw(mc.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isMouseInside(mouseX, mouseY))
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("Zoom: " + this.distance, this.getX() + 4, this.getY() + this.getH() - Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 2, 0xFFFFFFFF);
|
||||
if (this.isMouseInside(mouseX, mouseY)) {
|
||||
this.handleScrolling(mouseX, mouseY);
|
||||
mc.fontRenderer.drawStringWithShadow("Zoom: " + this.distance, this.getX() + 4, this.getY() + this.getH() - mc.fontRenderer.FONT_HEIGHT - 2, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -80,7 +80,6 @@ public final class OverViewComponent extends ResizableHudComponent {
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import me.rigamortis.seppuku.api.event.EventStageable;
|
|||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.api.util.Timer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
@ -16,15 +15,17 @@ import java.text.DecimalFormat;
|
|||
*/
|
||||
public final class PacketTimeComponent extends DraggableHudComponent {
|
||||
|
||||
private Timer timer = new Timer();
|
||||
private final Timer timer = new Timer();
|
||||
|
||||
public PacketTimeComponent() {
|
||||
super("PacketTime");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
|
||||
Seppuku.INSTANCE.getEventManager().addEventListener(this);
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void recievePacket(EventReceivePacket event) {
|
||||
public void onReceivePacket(EventReceivePacket event) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
if (event.getPacket() != null) {
|
||||
this.timer.reset();
|
||||
|
@ -36,13 +37,16 @@ public final class PacketTimeComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final float seconds = ((System.currentTimeMillis() - this.timer.getTime()) / 1000.0f) % 60.0f;
|
||||
final String delay = "PACKET: " + (seconds >= 3.0f ? "\2474" : "\247f") + new DecimalFormat("#.#").format(seconds);
|
||||
if (mc.player != null && mc.world != null) {
|
||||
final float seconds = ((System.currentTimeMillis() - this.timer.getTime()) / 1000.0f) % 60.0f;
|
||||
final String delay = "Packet: " + (seconds >= 3.0f ? "\2474" : "\247f") + new DecimalFormat("#.#").format(seconds);
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(delay));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(delay, this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(delay));
|
||||
mc.fontRenderer.drawStringWithShadow(delay, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(packet delay)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(packet delay)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
|
||||
/**
|
||||
|
@ -12,27 +11,26 @@ public final class PingComponent extends DraggableHudComponent {
|
|||
|
||||
public PingComponent() {
|
||||
super("Ping");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.world == null || mc.player == null) {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(ping)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(ping)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mc.world == null || mc.player == null || mc.player.getUniqueID() == null)
|
||||
if (mc.player.connection == null || mc.getCurrentServerData() == null)
|
||||
return;
|
||||
|
||||
final NetworkPlayerInfo playerInfo = mc.player.connection.getPlayerInfo(mc.player.getUniqueID());
|
||||
final String ping = "Ping: " + playerInfo.getResponseTime() + "ms";
|
||||
|
||||
if (playerInfo == null)
|
||||
return;
|
||||
|
||||
final String ping = "MS: " + playerInfo.getResponseTime();
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(ping));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(ping, this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(ping));
|
||||
mc.fontRenderer.drawStringWithShadow(ping, this.getX(), this.getY(), -1);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
|
@ -11,17 +10,21 @@ public final class PlayerCountComponent extends DraggableHudComponent {
|
|||
|
||||
public PlayerCountComponent() {
|
||||
super("PlayerCount");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@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();
|
||||
if (mc.player != null) {
|
||||
final String playerCount = "Online: " + mc.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);
|
||||
this.setW(mc.fontRenderer.getStringWidth(playerCount));
|
||||
mc.fontRenderer.drawStringWithShadow(playerCount, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(player count)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(player count)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* created by noil on 11/4/19 at 7:54 AM
|
||||
|
@ -19,19 +18,18 @@ public class PopupComponent extends DraggableHudComponent {
|
|||
this.textData = textData;
|
||||
this.setW(100);
|
||||
this.setH(50);
|
||||
this.setX((Minecraft.getMinecraft().displayWidth / 2) - (this.getW() / 2));
|
||||
this.setY((Minecraft.getMinecraft().displayHeight / 2) - (this.getH() / 2));
|
||||
this.setX((mc.displayWidth / 2.0f) - (this.getW() / 2));
|
||||
this.setY((mc.displayHeight / 2.0f) - (this.getH() / 2));
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
// text data
|
||||
mc.fontRenderer.drawSplitString(this.textData, (int) this.getX() + 2, (int) this.getY() + 2, 200, 0xFFFFFFFF);
|
||||
|
||||
// close button
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.mojang.realmsclient.gui.ChatFormatting;
|
|||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import me.rigamortis.seppuku.api.util.PotionUtil;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
|
@ -26,75 +25,75 @@ public final class PotionEffectsComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
final List<PotionEffect> effects =
|
||||
new ArrayList<>(mc.player.getActivePotionEffects());
|
||||
|
||||
final Comparator<PotionEffect> comparator = (first, second) -> {
|
||||
final String firstEffect = PotionUtil.getFriendlyPotionName(first) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(first, 1.0F);
|
||||
final String secondEffect = PotionUtil.getFriendlyPotionName(second) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(second, 1.0F);
|
||||
final float dif = mc.fontRenderer.getStringWidth(secondEffect) - mc.fontRenderer.getStringWidth(firstEffect);
|
||||
return dif != 0 ? (int) dif : secondEffect.compareTo(firstEffect);
|
||||
};
|
||||
|
||||
effects.sort(comparator);
|
||||
|
||||
float xOffset = 0;
|
||||
float yOffset = 0;
|
||||
float maxWidth = 0;
|
||||
List<PotionEffect> effects = new ArrayList<>();
|
||||
|
||||
for (PotionEffect potionEffect : effects) {
|
||||
if (potionEffect != null) {
|
||||
final String effect = PotionUtil.getFriendlyPotionName(potionEffect) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(potionEffect, 1.0F);
|
||||
if (mc.player != null && mc.world != null) {
|
||||
effects = new ArrayList<>(mc.player.getActivePotionEffects());
|
||||
|
||||
final float width = mc.fontRenderer.getStringWidth(effect);
|
||||
final Comparator<PotionEffect> comparator = (first, second) -> {
|
||||
final String firstEffect = PotionUtil.getFriendlyPotionName(first) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(first, 1.0F);
|
||||
final String secondEffect = PotionUtil.getFriendlyPotionName(second) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(second, 1.0F);
|
||||
final float dif = mc.fontRenderer.getStringWidth(secondEffect) - mc.fontRenderer.getStringWidth(firstEffect);
|
||||
return dif != 0 ? (int) dif : secondEffect.compareTo(firstEffect);
|
||||
};
|
||||
|
||||
if (width >= maxWidth) {
|
||||
maxWidth = width;
|
||||
}
|
||||
effects.sort(comparator);
|
||||
|
||||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
xOffset = (this.getW() - mc.fontRenderer.getStringWidth(effect)) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case BOTTOM_LEFT:
|
||||
xOffset = 0;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
case BOTTOM_RIGHT:
|
||||
xOffset = this.getW() - mc.fontRenderer.getStringWidth(effect);
|
||||
break;
|
||||
for (PotionEffect potionEffect : effects) {
|
||||
if (potionEffect != null) {
|
||||
final String effect = PotionUtil.getFriendlyPotionName(potionEffect) + " " + ChatFormatting.GRAY + Potion.getPotionDurationString(potionEffect, 1.0F);
|
||||
|
||||
final float width = mc.fontRenderer.getStringWidth(effect);
|
||||
|
||||
if (width >= maxWidth) {
|
||||
maxWidth = width;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case TOP_LEFT:
|
||||
case TOP_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + (this.getH() - mc.fontRenderer.FONT_HEIGHT) + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset -= (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
xOffset = (this.getW() - mc.fontRenderer.getStringWidth(effect)) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case BOTTOM_LEFT:
|
||||
xOffset = 0;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
case BOTTOM_RIGHT:
|
||||
xOffset = this.getW() - mc.fontRenderer.getStringWidth(effect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case TOP_LEFT:
|
||||
case TOP_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + (this.getH() - mc.fontRenderer.FONT_HEIGHT) + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset -= (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
}
|
||||
} else {
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (effects.size() <= 0) {
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiHudEditor) {
|
||||
if (mc.currentScreen instanceof GuiHudEditor) {
|
||||
final String placeholder = "(my potion effects)";
|
||||
maxWidth = mc.fontRenderer.getStringWidth(placeholder);
|
||||
yOffset = mc.fontRenderer.FONT_HEIGHT;
|
||||
|
|
|
@ -4,7 +4,6 @@ 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
|
||||
|
@ -27,15 +26,17 @@ public final class RearViewComponent extends ResizableHudComponent {
|
|||
|
||||
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);
|
||||
mc.fontRenderer.drawStringWithShadow(this.getName(), this.getX() + 2, this.getY() + 2, 0xFFFFFFFF);
|
||||
|
||||
this.rearviewCamera.setRendering(true);
|
||||
if (mc.player != null && mc.world != null) {
|
||||
this.rearviewCamera.setRendering(true);
|
||||
|
||||
if (this.rearviewCamera.isValid()) {
|
||||
this.rearviewCamera.setPos(Minecraft.getMinecraft().player.getPositionEyes(partialTicks).subtract(0, 1, 0));
|
||||
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);
|
||||
if (this.rearviewCamera.isValid()) {
|
||||
this.rearviewCamera.setPos(mc.player.getPositionEyes(partialTicks).subtract(0, 1, 0));
|
||||
this.rearviewCamera.setYaw(mc.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
|
@ -11,18 +10,22 @@ public final class ServerBrandComponent extends DraggableHudComponent {
|
|||
|
||||
public ServerBrandComponent() {
|
||||
super("ServerBrand");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
final String brand = Minecraft.getMinecraft().getCurrentServerData() == null ? "Vanilla" : Minecraft.getMinecraft().getCurrentServerData().gameVersion;
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(brand));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
if (mc.getCurrentServerData() != null) {
|
||||
final String brand = mc.getCurrentServerData() == null ? "Vanilla" : mc.getCurrentServerData().gameVersion;
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(brand, this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(brand));
|
||||
mc.fontRenderer.drawStringWithShadow(brand, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(server brand)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(server brand)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
@ -15,24 +14,28 @@ public final class SpeedComponent extends DraggableHudComponent {
|
|||
|
||||
public SpeedComponent() {
|
||||
super("Speed");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
final double deltaX = Minecraft.getMinecraft().player.posX - Minecraft.getMinecraft().player.prevPosX;
|
||||
final double deltaZ = Minecraft.getMinecraft().player.posZ - Minecraft.getMinecraft().player.prevPosZ;
|
||||
final float tickRate = (Minecraft.getMinecraft().timer.tickLength / 1000.0f);
|
||||
if (mc.player != null) {
|
||||
final DecimalFormat df = new DecimalFormat("#.#");
|
||||
|
||||
final String bps = "BPS: " + df.format((MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) / tickRate));
|
||||
final double deltaX = mc.player.posX - mc.player.prevPosX;
|
||||
final double deltaZ = mc.player.posZ - mc.player.prevPosZ;
|
||||
final float tickRate = (mc.timer.tickLength / 1000.0f);
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(bps));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
final String bps = "BPS: " + df.format((MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) / tickRate));
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(bps, this.getX(), this.getY(), -1);
|
||||
this.setW(mc.fontRenderer.getStringWidth(bps));
|
||||
mc.fontRenderer.drawStringWithShadow(bps, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(bps)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(bps)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
@ -13,19 +12,16 @@ public final class TimeComponent extends DraggableHudComponent {
|
|||
|
||||
public TimeComponent() {
|
||||
super("Time");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final String time = new SimpleDateFormat("h:mm a").format(new Date());
|
||||
|
||||
this.setW(mc.fontRenderer.getStringWidth(time));
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(time, this.getX(), this.getY(), -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.rigamortis.seppuku.impl.gui.hud.component;
|
||||
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -13,24 +12,27 @@ public final class TotemCountComponent extends DraggableHudComponent {
|
|||
|
||||
public TotemCountComponent() {
|
||||
super("TotemCount");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
// RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final String totemCount = "Totems: " + Integer.toString(getTotemCount());
|
||||
|
||||
this.setW(mc.fontRenderer.getStringWidth(totemCount));
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
mc.fontRenderer.drawStringWithShadow(totemCount, this.getX(), this.getY(), -1);
|
||||
if (mc.player != null) {
|
||||
final String totemCount = "Totems: " + this.getTotemCount();
|
||||
this.setW(mc.fontRenderer.getStringWidth(totemCount));
|
||||
mc.fontRenderer.drawStringWithShadow(totemCount, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(totem count)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(totem count)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
private int getTotemCount() {
|
||||
int totems = 0;
|
||||
for (int i = 0; i < 45; i++) {
|
||||
final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i);
|
||||
final ItemStack stack = mc.player.inventory.getStackInSlot(i);
|
||||
if (stack.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||
totems += stack.getCount();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
|
@ -13,19 +12,21 @@ public final class TpsComponent extends DraggableHudComponent {
|
|||
|
||||
public TpsComponent() {
|
||||
super("Tps");
|
||||
this.setH(mc.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final String tickrate = String.format(ChatFormatting.WHITE + "TPS: %.2f", Seppuku.INSTANCE.getTickRateManager().getTickRate());
|
||||
|
||||
this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(tickrate));
|
||||
this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);
|
||||
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(tickrate, this.getX(), this.getY(), -1);
|
||||
if (mc.world != null && mc.getCurrentServerData() != null) {
|
||||
final String tps = String.format(ChatFormatting.WHITE + "TPS: %.2f", Seppuku.INSTANCE.getTickRateManager().getTickRate());
|
||||
this.setW(mc.fontRenderer.getStringWidth(tps));
|
||||
mc.fontRenderer.drawStringWithShadow(tps, this.getX(), this.getY(), -1);
|
||||
} else {
|
||||
this.setW(mc.fontRenderer.getStringWidth("(tps)"));
|
||||
mc.fontRenderer.drawStringWithShadow("(tps)", this.getX(), this.getY(), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import me.rigamortis.seppuku.api.texture.Texture;
|
|||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import me.rigamortis.seppuku.impl.module.ui.HudEditorModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -54,9 +53,6 @@ public class TrayComponent extends DraggableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
// store the minecraft instance in a local variable
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
// ensure we are in the hud editor
|
||||
boolean isInHudEditor = mc.currentScreen instanceof GuiHudEditor;
|
||||
if (!isInHudEditor) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.rigamortis.seppuku.impl.gui.hud.component;
|
|||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* created by noil on 10/22/2019 at 10:06 AM
|
||||
|
@ -27,14 +26,12 @@ public final class TutorialComponent extends PopupComponent {
|
|||
this.setSnappable(false);
|
||||
this.setW(200);
|
||||
this.setH(173);
|
||||
this.setX((Minecraft.getMinecraft().displayWidth / 2) - (this.getW() / 2));
|
||||
this.setY((Minecraft.getMinecraft().displayHeight / 2) - (this.getH() / 2));
|
||||
this.setX((mc.displayWidth / 2.0f) - (this.getW() / 2.0f));
|
||||
this.setY((mc.displayHeight / 2.0f) - (this.getH() / 2.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (!(mc.currentScreen instanceof GuiHudEditor)) // ensure we are in the hud editor screen only
|
||||
return;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public final class WatermarkComponent extends DraggableHudComponent {
|
|||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
//RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(WATERMARK, this.getX(), this.getY(), -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
private final int BORDER = 2;
|
||||
private final int TEXT_GAP = 1;
|
||||
private final int TEXTURE_SIZE = 8;
|
||||
private final int TITLE_BAR_HEIGHT = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1;
|
||||
private final int TITLE_BAR_HEIGHT = mc.fontRenderer.FONT_HEIGHT + 1;
|
||||
|
||||
private String originalName = "";
|
||||
private String title = "";
|
||||
|
@ -68,8 +68,6 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (!(mc.currentScreen instanceof GuiHudEditor))
|
||||
return;
|
||||
|
||||
|
@ -152,7 +150,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
this.title = this.originalName;
|
||||
for (Module module : Seppuku.INSTANCE.getModuleManager().getModuleList(this.type)) {
|
||||
RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, module.isEnabled() ? 0x451b002a : 0x451F1C22);
|
||||
final boolean insideModule = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll);
|
||||
final boolean insideModule = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll);
|
||||
if (insideModule) {
|
||||
RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010);
|
||||
}
|
||||
|
@ -177,15 +175,15 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
if (valueComponent.isMouseInside(mouseX, mouseY)) {
|
||||
tooltipText = valueComponent.getTooltipText();
|
||||
}
|
||||
height += Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
height += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
}
|
||||
} else {
|
||||
for (Module module : Seppuku.INSTANCE.getModuleManager().getModuleList(this.type)) {
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1 + height - this.scroll) && mouseY <= (this.getY() + BORDER + (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2) + 1 + height - this.scroll);
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + height - this.scroll) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT * 2) + 1 + height - this.scroll);
|
||||
if (insideComponent) {
|
||||
tooltipText = module.getDesc();
|
||||
}
|
||||
height += Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
height += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +210,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
super.mouseRelease(mouseX, mouseY, button);
|
||||
|
||||
final boolean inside = this.isMouseInside(mouseX, mouseY);
|
||||
final int titleBarHeight = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1;
|
||||
final int titleBarHeight = mc.fontRenderer.FONT_HEIGHT + 1;
|
||||
final boolean insideTitlebar = mouseY <= this.getY() + BORDER + titleBarHeight;
|
||||
|
||||
if (inside && !insideTitlebar && !isResizeDragging()) {
|
||||
|
@ -221,7 +219,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
} else {
|
||||
int offsetY = BORDER;
|
||||
for (Module module : Seppuku.INSTANCE.getModuleManager().getModuleList(this.type)) {
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll) && mouseY <= (this.getY() + BORDER + (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT * 2) + 1 + offsetY - this.scroll);
|
||||
final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT * 2) + 1 + offsetY - this.scroll);
|
||||
if (insideComponent) {
|
||||
switch (button) {
|
||||
case 0:
|
||||
|
@ -235,7 +233,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
|
|||
break;
|
||||
}
|
||||
}
|
||||
offsetY += Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package me.rigamortis.seppuku.impl.gui.menu;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.minecraft.EventDisplayGui;
|
||||
import me.rigamortis.seppuku.api.texture.Texture;
|
||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.impl.fml.SeppukuMod;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
@ -12,6 +16,9 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
|||
import java.awt.*;
|
||||
import java.net.URL;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 9/4/2019 @ 7:18 PM.
|
||||
|
@ -22,10 +29,13 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
private MainMenuButton multiPlayer;
|
||||
private MainMenuButton options;
|
||||
private MainMenuButton donate;
|
||||
private MainMenuButton hudEditor;
|
||||
private MainMenuButton alts;
|
||||
private MainMenuButton mods;
|
||||
private MainMenuButton quit;
|
||||
|
||||
private Texture seppukuLogo;
|
||||
|
||||
public GuiSeppukuMainMenu() {
|
||||
Seppuku.INSTANCE.getEventManager().addEventListener(this);
|
||||
}
|
||||
|
@ -34,13 +44,16 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
if (this.seppukuLogo == null)
|
||||
this.seppukuLogo = new Texture("seppuku-logo.png");
|
||||
|
||||
final GuiSeppukuMainMenu menu = this;
|
||||
|
||||
final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
|
||||
|
||||
float height = (res.getScaledHeight() / 4) + mc.fontRenderer.FONT_HEIGHT / 2 + 18;
|
||||
float height = (res.getScaledHeight() / 4.0f) + mc.fontRenderer.FONT_HEIGHT / 2.0f + 18;
|
||||
|
||||
this.singlePlayer = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Singleplayer") {
|
||||
this.singlePlayer = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Singleplayer") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.displayGuiScreen(new GuiWorldSelection(menu));
|
||||
|
@ -49,7 +62,7 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
|
||||
height += 20;
|
||||
|
||||
this.multiPlayer = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Multiplayer") {
|
||||
this.multiPlayer = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Multiplayer") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.displayGuiScreen(new GuiMultiplayer(menu));
|
||||
|
@ -58,7 +71,7 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
|
||||
height += 20;
|
||||
|
||||
this.options = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Options") {
|
||||
this.options = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Options") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.displayGuiScreen(new GuiOptions(menu, mc.gameSettings));
|
||||
|
@ -67,7 +80,16 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
|
||||
height += 20;
|
||||
|
||||
this.donate = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Donate") {
|
||||
this.mods = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Mods") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.displayGuiScreen(new GuiModList(menu));
|
||||
}
|
||||
};
|
||||
|
||||
height += 20;
|
||||
|
||||
this.donate = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, 69, 18, ChatFormatting.GRAY + "Donate!") {
|
||||
@Override
|
||||
public void action() {
|
||||
try {
|
||||
|
@ -75,7 +97,7 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
|
||||
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||
try {
|
||||
desktop.browse(new URL("http://seppuku.pw/donate.html").toURI());
|
||||
desktop.browse(new URL("https://seppuku.pw/donate.html").toURI());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -86,27 +108,25 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
}
|
||||
};
|
||||
|
||||
height += 20;
|
||||
|
||||
this.mods = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Mods") {
|
||||
this.hudEditor = new MainMenuButton(res.getScaledWidth() / 2.0f + 1, height, 69, 18, ChatFormatting.GRAY + "Hud Editor") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.displayGuiScreen(new GuiModList(menu));
|
||||
mc.displayGuiScreen(new GuiHudEditor());
|
||||
}
|
||||
};
|
||||
|
||||
height += 20;
|
||||
|
||||
this.alts = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Alts") {
|
||||
/*this.alts = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Alts") {
|
||||
@Override
|
||||
public void action() {
|
||||
//TODO
|
||||
}
|
||||
};
|
||||
|
||||
height += 20;
|
||||
height += 20;*/
|
||||
|
||||
this.quit = new MainMenuButton(res.getScaledWidth() / 2 - 70, height, "Quit") {
|
||||
this.quit = new MainMenuButton(res.getScaledWidth() / 2.0f - 70, height, "Quit") {
|
||||
@Override
|
||||
public void action() {
|
||||
mc.shutdown();
|
||||
|
@ -117,6 +137,11 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
|
||||
@Listener
|
||||
public void displayScreen(EventDisplayGui event) {
|
||||
if (event.getScreen() == null && mc.world == null) {
|
||||
event.setCanceled(true);
|
||||
Minecraft.getMinecraft().displayGuiScreen(this);
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiSeppukuMainMenu && event.getScreen() == null) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
@ -138,23 +163,43 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
this.drawDefaultBackground();
|
||||
final ScaledResolution res = new ScaledResolution(mc);
|
||||
|
||||
// begin gl states
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
// draw logo
|
||||
this.seppukuLogo.bind();
|
||||
this.seppukuLogo.render((res.getScaledWidth() / 2.0f) - 120, (res.getScaledHeight() / 8.0f), 240, 38);
|
||||
//RenderUtil.drawLine(res.getScaledWidth() / 2, 0, res.getScaledWidth() / 2, res.getScaledHeight(), 1, 0x75909090);
|
||||
//RenderUtil.drawLine(0, res.getScaledHeight() / 2, res.getScaledWidth(), res.getScaledHeight() / 2, 1, 0x75909090);
|
||||
|
||||
/*
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(res.getScaledWidth() / 2 - (mc.fontRenderer.getStringWidth("Seppuku \2477" + SeppukuMod.VERSION) / 2 * 4), (res.getScaledHeight() / 4) - (mc.fontRenderer.FONT_HEIGHT * 4), 0);
|
||||
GlStateManager.translate(res.getScaledWidth() / 2.0f - (mc.fontRenderer.getStringWidth("Seppuku \2477" + SeppukuMod.VERSION) / 2.0f * 4), (res.getScaledHeight() / 4.0f) - (mc.fontRenderer.FONT_HEIGHT * 4), 0);
|
||||
GlStateManager.scale(4.0f, 4.0f, 4.0f);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("Seppuku \2477" + SeppukuMod.VERSION, 0, 0, -1);
|
||||
//GlStateManager.scale(1.0f, 1.0f, 1.0f);
|
||||
GlStateManager.popMatrix();
|
||||
*/
|
||||
|
||||
// draw text
|
||||
this.drawSplashText();
|
||||
|
||||
// draw buttons
|
||||
this.singlePlayer.render(mouseX, mouseY, partialTicks);
|
||||
this.multiPlayer.render(mouseX, mouseY, partialTicks);
|
||||
this.options.render(mouseX, mouseY, partialTicks);
|
||||
this.donate.render(mouseX, mouseY, partialTicks);
|
||||
this.mods.render(mouseX, mouseY, partialTicks);
|
||||
this.alts.render(mouseX, mouseY, partialTicks);
|
||||
this.donate.render(mouseX, mouseY, partialTicks);
|
||||
this.hudEditor.render(mouseX, mouseY, partialTicks);
|
||||
//this.alts.render(mouseX, mouseY, partialTicks);
|
||||
this.quit.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
// end gl states
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,9 +208,10 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
this.singlePlayer.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.multiPlayer.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.options.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.donate.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.mods.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.alts.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.donate.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.hudEditor.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
//this.alts.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
this.quit.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -177,19 +223,19 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
|
|||
this.singlePlayer.mouseRelease(mouseX, mouseY, state);
|
||||
this.multiPlayer.mouseRelease(mouseX, mouseY, state);
|
||||
this.options.mouseRelease(mouseX, mouseY, state);
|
||||
this.donate.mouseRelease(mouseX, mouseY, state);
|
||||
this.mods.mouseRelease(mouseX, mouseY, state);
|
||||
this.alts.mouseRelease(mouseX, mouseY, state);
|
||||
this.donate.mouseRelease(mouseX, mouseY, state);
|
||||
this.hudEditor.mouseRelease(mouseX, mouseY, state);
|
||||
//this.alts.mouseRelease(mouseX, mouseY, state);
|
||||
this.quit.mouseRelease(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
private void drawSplashText() {
|
||||
final String spash = "You don't know where my base is!";
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution res = new ScaledResolution(mc);
|
||||
|
||||
this.drawString(this.fontRenderer, spash, (res.getScaledWidth() / 2) - (mc.fontRenderer.getStringWidth(spash) / 2), (res.getScaledHeight() / 4) + mc.fontRenderer.FONT_HEIGHT / 2, -1);
|
||||
final String spash = "Welcome, " + mc.getSession().getUsername();
|
||||
this.drawString(this.fontRenderer, spash, 2, res.getScaledHeight() - mc.fontRenderer.FONT_HEIGHT, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,20 +28,28 @@ public abstract class MainMenuButton {
|
|||
this.h = 18;
|
||||
}
|
||||
|
||||
public MainMenuButton(float x, float y, float w, float h, String text) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void render(int x, int y, float partialTicks) {
|
||||
if (this.clicked) {
|
||||
RenderUtil.drawRect(this.x, this.y, this.x + this.w, this.y + this.h, 0x66111111);
|
||||
RenderUtil.drawGradientRect(this.x + 1, this.y + 1, this.x + this.w - 1, this.y + this.h - 1, 0xAA232323, 0xAA303030);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2), 0xFF9900EE);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2.0f), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2.0f), 0xFF9900EE);
|
||||
} else {
|
||||
if (this.inside(x, y)) {
|
||||
RenderUtil.drawRect(this.x, this.y, this.x + this.w, this.y + this.h, 0x66111111);
|
||||
RenderUtil.drawGradientRect(this.x + 1, this.y + 1, this.x + this.w - 1, this.y + this.h - 1, 0xAA303030, 0xAA232323);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2), -1);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2.0f), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2.0f), -1);
|
||||
} else {
|
||||
RenderUtil.drawRect(this.x, this.y, this.x + this.w, this.y + this.h, 0x66111111);
|
||||
RenderUtil.drawGradientRect(this.x + 1, this.y + 1, this.x + this.w - 1, this.y + this.h - 1, 0xAA303030, 0xAA232323);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2), 0xFFAAAAAA);
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(this.text, this.x + (this.w / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.text) / 2.0f), this.y + (this.h / 2) - (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2.0f), 0xFFAAAAAA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@ public final class HudManager {
|
|||
private final FirstLaunchComponent firstLaunchComponent;
|
||||
|
||||
public HudManager() {
|
||||
final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
|
||||
final ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
|
||||
|
||||
final AnchorPoint TOP_LEFT = new AnchorPoint(2, 2, AnchorPoint.Point.TOP_LEFT);
|
||||
final AnchorPoint TOP_RIGHT = new AnchorPoint(res.getScaledWidth() - 2, 2, AnchorPoint.Point.TOP_RIGHT);
|
||||
final AnchorPoint BOTTOM_LEFT = new AnchorPoint(2, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_LEFT);
|
||||
final AnchorPoint BOTTOM_RIGHT = new AnchorPoint(res.getScaledWidth() - 2, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_RIGHT);
|
||||
final AnchorPoint TOP_CENTER = new AnchorPoint(res.getScaledWidth() / 2.0f, 2, AnchorPoint.Point.TOP_CENTER);
|
||||
final AnchorPoint BOTTOM_CENTER = new AnchorPoint(res.getScaledWidth() / 2.0f, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_CENTER);
|
||||
final AnchorPoint TOP_LEFT = new AnchorPoint(AnchorPoint.Point.TOP_LEFT);
|
||||
final AnchorPoint TOP_RIGHT = new AnchorPoint(AnchorPoint.Point.TOP_RIGHT);
|
||||
final AnchorPoint BOTTOM_LEFT = new AnchorPoint(AnchorPoint.Point.BOTTOM_LEFT);
|
||||
final AnchorPoint BOTTOM_RIGHT = new AnchorPoint(AnchorPoint.Point.BOTTOM_RIGHT);
|
||||
final AnchorPoint TOP_CENTER = new AnchorPoint(AnchorPoint.Point.TOP_CENTER);
|
||||
final AnchorPoint BOTTOM_CENTER = new AnchorPoint(AnchorPoint.Point.BOTTOM_CENTER);
|
||||
this.anchorPoints.add(TOP_LEFT);
|
||||
this.anchorPoints.add(TOP_RIGHT);
|
||||
this.anchorPoints.add(BOTTOM_LEFT);
|
||||
|
@ -48,6 +48,9 @@ public final class HudManager {
|
|||
this.anchorPoints.add(TOP_CENTER);
|
||||
this.anchorPoints.add(BOTTOM_CENTER);
|
||||
|
||||
for (AnchorPoint anchorPoint : this.anchorPoints)
|
||||
anchorPoint.updatePosition(sr);
|
||||
|
||||
int moduleListXOffset = 0;
|
||||
int moduleListYOffset = 0;
|
||||
for (Module.ModuleType type : Module.ModuleType.values()) {
|
||||
|
@ -55,7 +58,7 @@ public final class HudManager {
|
|||
continue;
|
||||
|
||||
final ModuleListComponent moduleList = new ModuleListComponent(type);
|
||||
if ((moduleList.getX() + moduleListXOffset) > res.getScaledWidth()) {
|
||||
if ((moduleList.getX() + moduleListXOffset) > sr.getScaledWidth()) {
|
||||
moduleListXOffset = 0;
|
||||
moduleListYOffset += moduleList.getH() + 4 /* gap above and below each column */;
|
||||
}
|
||||
|
@ -176,11 +179,8 @@ public final class HudManager {
|
|||
if (clazz != null) {
|
||||
if (HudComponent.class.isAssignableFrom(clazz)) {
|
||||
final HudComponent component = (HudComponent) clazz.newInstance();
|
||||
|
||||
if (component != null) {
|
||||
this.componentList.add(component);
|
||||
Seppuku.INSTANCE.getLogger().log(Level.INFO, "Found external hud component " + component.getName());
|
||||
}
|
||||
this.componentList.add(component);
|
||||
Seppuku.INSTANCE.getLogger().log(Level.INFO, "Found external hud component " + component.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public final class AutoTotemModule extends Module {
|
|||
|
||||
@Override
|
||||
public String getMetaData() {
|
||||
return "" + this.getItemCount(Items.TOTEM_OF_UNDYING);
|
||||
return "" + this.getTotemCount();
|
||||
}
|
||||
|
||||
@Listener
|
||||
|
@ -42,7 +42,7 @@ public final class AutoTotemModule extends Module {
|
|||
return;
|
||||
}
|
||||
|
||||
final int slot = this.getItemSlot(Items.TOTEM_OF_UNDYING);
|
||||
final int slot = this.getTotemSlot();
|
||||
|
||||
if (slot != -1) {
|
||||
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player);
|
||||
|
@ -55,10 +55,10 @@ public final class AutoTotemModule extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
private int getItemSlot(Item input) {
|
||||
private int getTotemSlot() {
|
||||
for (int i = 0; i < 36; i++) {
|
||||
final Item item = Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getItem();
|
||||
if (item == input) {
|
||||
if (item == Items.TOTEM_OF_UNDYING) {
|
||||
if (i < 9) {
|
||||
i += 36;
|
||||
}
|
||||
|
@ -68,17 +68,20 @@ public final class AutoTotemModule extends Module {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private int getItemCount(Item input) {
|
||||
int items = 0;
|
||||
private int getTotemCount() {
|
||||
int totems = 0;
|
||||
|
||||
if (Minecraft.getMinecraft().player == null)
|
||||
return totems;
|
||||
|
||||
for (int i = 0; i < 45; i++) {
|
||||
final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i);
|
||||
if (stack.getItem() == input) {
|
||||
items += stack.getCount();
|
||||
if (stack.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||
totems += stack.getCount();
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
return totems;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
|||
*/
|
||||
public final class NoDesyncModule extends Module {
|
||||
|
||||
public final Value<Boolean> crystals = new Value<Boolean>("Crystals", new String[]{"Crystal", "c"}, "Attempts to fix crystal de-sync.", true);
|
||||
public final Value<Boolean> destroyedBlocks = new Value<Boolean>("Blocks", new String[]{"DestroyedBlocks", "b"}, "Attempts to fix server->client block de-sync.", false);
|
||||
public final Value<Boolean> crystals = new Value<Boolean>("Crystals", new String[]{"Crystal", "c"}, "Attempts to fix crystal de-sync (could be buggy).", false);
|
||||
public final Value<Boolean> destroyedBlocks = new Value<Boolean>("Blocks", new String[]{"DestroyedBlocks", "b"}, "Attempts to fix server->client block de-sync.", true);
|
||||
|
||||
private boolean destroy;
|
||||
private BlockPos pos;
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class StorageAlertModule extends Module {
|
|||
}
|
||||
|
||||
public StorageAlertModule() {
|
||||
super("StorageAlert", new String[]{"StorageAlerts"}, "Alerts you how many storage blocks are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC);
|
||||
super("StorageAlert", new String[]{"StorageAlerts", "ChestAlert"}, "Alerts you how many storage blocks are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Listener
|
||||
|
|
|
@ -123,6 +123,9 @@ public final class ScaffoldModule extends Module {
|
|||
private int getBlockCount() {
|
||||
int count = 0;
|
||||
|
||||
if (Minecraft.getMinecraft().player == null)
|
||||
return count;
|
||||
|
||||
for (int i = 0; i < 36; i++) {
|
||||
final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i);
|
||||
if (canPlace(stack) && stack.getItem() instanceof ItemBlock) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import me.rigamortis.seppuku.api.event.EventStageable;
|
|||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.event.render.*;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLightUpdate;
|
||||
import me.rigamortis.seppuku.api.event.world.EventSpawnParticle;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.projectile.EntityWitherSkull;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.network.play.server.SPacketParticles;
|
||||
import net.minecraft.network.play.server.SPacketSoundEffect;
|
||||
import net.minecraft.network.play.server.SPacketSpawnMob;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -37,6 +39,7 @@ public final class NoLagModule extends Module {
|
|||
public final Value<Boolean> pistons = new Value<Boolean>("Pistons", new String[]{"Piston", "p"}, "Choose to enable the piston lag fix. Disables pistons from rendering.", false);
|
||||
public final Value<Boolean> slimes = new Value<Boolean>("Slimes", new String[]{"Slime", "sl"}, "Choose to enable the slime lag fix. Disables slimes from spawning.", false);
|
||||
public final Value<Boolean> items = new Value<Boolean>("Items", new String[]{"Item", "i"}, "Disables the rendering of items.", false);
|
||||
public final Value<Boolean> particles = new Value<Boolean>("Particles", new String[]{"Part", "par"}, "Disables the spawning of all particles.", false);
|
||||
public final Value<Boolean> sky = new Value<Boolean>("Sky", new String[]{"Skies", "ski"}, "Disables the rendering of the sky.", false);
|
||||
public final Value<Boolean> names = new Value<Boolean>("Names", new String[]{"Name", "n"}, "Disables the rendering of vanilla name-tags.", false);
|
||||
public final Value<Boolean> withers = new Value<Boolean>("Withers", new String[]{"Wither", "w"}, "Disables the rendering of withers.", false);
|
||||
|
@ -80,7 +83,6 @@ public final class NoLagModule extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Listener
|
||||
public void renderWorld(EventRender3D event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
@ -94,6 +96,13 @@ public final class NoLagModule extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onSpawnParticle(EventSpawnParticle event) {
|
||||
if (this.particles.getValue()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void receivePacket(EventReceivePacket event) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
|
|
|
@ -39,11 +39,10 @@ public final class StorageESPModule extends Module {
|
|||
|
||||
@Listener
|
||||
public void render2D(EventRender2D event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (this.mode.getValue() == Mode.THREE_D && !this.nametag.getValue()) // if 3D and names are off, return
|
||||
return;
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
for (TileEntity te : mc.world.loadedTileEntityList) {
|
||||
if (te != null) {
|
||||
if (this.isTileStorage(te)) {
|
||||
|
@ -78,7 +77,9 @@ public final class StorageESPModule extends Module {
|
|||
if (this.isTileStorage(te)) {
|
||||
final AxisAlignedBB bb = this.boundingBoxForEnt(te);
|
||||
if (bb != null) {
|
||||
camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);
|
||||
RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
|
||||
RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
|
||||
/*camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);
|
||||
|
||||
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX,
|
||||
bb.minY + mc.getRenderManager().viewerPosY,
|
||||
|
@ -88,7 +89,7 @@ public final class StorageESPModule extends Module {
|
|||
bb.maxZ + mc.getRenderManager().viewerPosZ))) {
|
||||
RenderUtil.drawFilledBox(bb, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
|
||||
RenderUtil.drawBoundingBox(bb, 1.5f, ColorUtil.changeAlpha(this.getColor(te), this.opacity.getValue()));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,10 +101,10 @@ public final class StorageESPModule extends Module {
|
|||
if (te instanceof TileEntityChest) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof TileEntityDispenser) {
|
||||
if (te instanceof TileEntityDropper) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof TileEntityDropper) {
|
||||
if (te instanceof TileEntityDispenser) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof TileEntityFurnace) {
|
||||
|
@ -148,7 +149,7 @@ public final class StorageESPModule extends Module {
|
|||
te.getPos().getX() + 0.9375d - mc.getRenderManager().viewerPosX,
|
||||
te.getPos().getY() + 0.875d - mc.getRenderManager().viewerPosY,
|
||||
te.getPos().getZ() + 0.9375d + 1 - mc.getRenderManager().viewerPosZ);
|
||||
} else if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null && chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) {
|
||||
} else if (chest.adjacentChestXPos == null && chest.adjacentChestZNeg == null) {
|
||||
return new AxisAlignedBB(
|
||||
te.getPos().getX() + 0.0625d - mc.getRenderManager().viewerPosX,
|
||||
te.getPos().getY() - mc.getRenderManager().viewerPosY,
|
||||
|
@ -187,10 +188,10 @@ public final class StorageESPModule extends Module {
|
|||
if (te instanceof TileEntityChest) {
|
||||
return 0xFFFFC417;
|
||||
}
|
||||
if (te instanceof TileEntityDispenser) {
|
||||
if (te instanceof TileEntityDropper) {
|
||||
return 0xFF4E4E4E;
|
||||
}
|
||||
if (te instanceof TileEntityDropper) {
|
||||
if (te instanceof TileEntityDispenser) {
|
||||
return 0xFF4E4E4E;
|
||||
}
|
||||
if (te instanceof TileEntityHopper) {
|
||||
|
@ -207,7 +208,7 @@ public final class StorageESPModule extends Module {
|
|||
}
|
||||
if (te instanceof TileEntityShulkerBox) {
|
||||
final TileEntityShulkerBox shulkerBox = (TileEntityShulkerBox) te;
|
||||
return (255 << 24) | shulkerBox.getColor().getColorValue() & 0xFFFFFFFF;
|
||||
return (255 << 24) | shulkerBox.getColor().getColorValue();
|
||||
}
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
@ -243,10 +244,6 @@ public final class StorageESPModule extends Module {
|
|||
for (Vec3d vec : corners) {
|
||||
final GLUProjection.Projection projection = GLUProjection.getInstance().project(vec.x, vec.y, vec.z, GLUProjection.ClampMode.NONE, true);
|
||||
|
||||
if (projection == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
x = Math.max(x, (float) projection.getX());
|
||||
y = Math.max(y, (float) projection.getY());
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
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.event.world.*;
|
||||
import me.rigamortis.seppuku.api.patch.ClassPatch;
|
||||
import me.rigamortis.seppuku.api.patch.MethodPatch;
|
||||
import me.rigamortis.seppuku.impl.management.PatchManager;
|
||||
|
@ -87,7 +84,6 @@ public final class WorldPatch extends ClassPatch {
|
|||
public static boolean getRainStrengthHook() {
|
||||
final EventRainStrength event = new EventRainStrength();
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
|
||||
return event.isCanceled();
|
||||
}
|
||||
|
||||
|
@ -123,4 +119,24 @@ public final class WorldPatch extends ClassPatch {
|
|||
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventRemoveEntity(entity));
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "spawnParticle",
|
||||
notchName = "a",
|
||||
mcpDesc = "(IZDDDDDD[I)V",
|
||||
notchDesc = "(IZDDDDDD[I)V")
|
||||
public void spawnParticle(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final InsnList list = new InsnList();
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "spawnParticleHook", "()Z", false));
|
||||
final LabelNode jmp = new LabelNode();
|
||||
list.add(new JumpInsnNode(IFEQ, jmp));
|
||||
list.add(new InsnNode(RETURN));
|
||||
list.add(jmp);
|
||||
methodNode.instructions.insert(list);
|
||||
}
|
||||
|
||||
public static boolean spawnParticleHook() {
|
||||
final EventSpawnParticle event = new EventSpawnParticle();
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
return event.isCanceled();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue