Merge remote-tracking branch 'origin/master'

This commit is contained in:
cannabidiol 2021-01-21 02:34:54 -09:00
commit d66594e296
9 changed files with 220 additions and 21 deletions

View File

@ -58,7 +58,7 @@ public class ResizableHudComponent extends DraggableHudComponent {
}
if (Minecraft.getMinecraft().currentScreen instanceof GuiHudEditor) {
RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, 0x90202020);
RenderUtil.drawRect(this.getX() + this.getW() - CLICK_ZONE, this.getY() + this.getH() - CLICK_ZONE, this.getX() + this.getW() + CLICK_ZONE, this.getY() + this.getH() + CLICK_ZONE, this.isMouseInside(mouseX, mouseY) ? 0x90909090 : 0x90202020);
}
final boolean insideClickZone = mouseX >= this.getX() + this.getW() - CLICK_ZONE && mouseX <= this.getX() + this.getW() + CLICK_ZONE && mouseY >= this.getY() + this.getH() - CLICK_ZONE && mouseY <= this.getY() + this.getH() + CLICK_ZONE;

View File

@ -0,0 +1,112 @@
package me.rigamortis.seppuku.api.gui.hud.particle;
import me.rigamortis.seppuku.api.util.ColorUtil;
import me.rigamortis.seppuku.api.util.RenderUtil;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Mouse;
import javax.vecmath.Vector2f;
import java.util.concurrent.ThreadLocalRandom;
public class Particle {
private Vector2f pos;
private Vector2f velocity;
private Vector2f acceleration;
private int alpha;
private final int maxAlpha;
private float size;
public Particle(Vector2f pos) {
this.pos = pos;
int lowVel = -1;
int highVel = 1;
float resultXVel = lowVel + ThreadLocalRandom.current().nextFloat() * (highVel - lowVel);
float resultYVel = lowVel + ThreadLocalRandom.current().nextFloat() * (highVel - lowVel);
this.velocity = new Vector2f(resultXVel, resultYVel);
this.acceleration = new Vector2f(0, 0.35f);
this.alpha = 0;
this.maxAlpha = ThreadLocalRandom.current().nextInt(32, 192);
this.size = 0.5f + ThreadLocalRandom.current().nextFloat() * (2.0f - 0.5f);
}
public void respawn(ScaledResolution scaledResolution) {
this.pos = new Vector2f((float) (Math.random() * scaledResolution.getScaledWidth()), (float) (Math.random() * scaledResolution.getScaledHeight()));
}
public void update() {
if (this.alpha < this.maxAlpha) {
this.alpha += 8;
}
if (this.acceleration.getX() > 0.35f) {
this.acceleration.setX(this.acceleration.getX() * 0.975f);
} else if (this.acceleration.getX() < -0.35f) {
this.acceleration.setX(this.acceleration.getX() * 0.975f);
}
if (this.acceleration.getY() > 0.35f) {
this.acceleration.setY(this.acceleration.getY() * 0.975f);
} else if (this.acceleration.getY() < -0.35f) {
this.acceleration.setY(this.acceleration.getY() * 0.975f);
}
this.pos.add(acceleration);
this.pos.add(velocity);
}
public void render(int mouseX, int mouseY) {
if (Mouse.isButtonDown(0)) {
float deltaXToMouse = mouseX - this.pos.getX();
float deltaYToMouse = mouseY - this.pos.getY();
if (Math.abs(deltaXToMouse) < 50 && Math.abs(deltaYToMouse) < 50) {
this.acceleration.setX(this.acceleration.getX() + (deltaXToMouse * 0.0025f));
this.acceleration.setY(this.acceleration.getY() + (deltaYToMouse * 0.0025f));
}
}
RenderUtil.drawRect(this.pos.x, this.pos.y, this.pos.x + this.size, this.pos.y + this.size, ColorUtil.changeAlpha(0xFF9900EE, this.alpha));
}
public Vector2f getPos() {
return pos;
}
public void setPos(Vector2f pos) {
this.pos = pos;
}
public Vector2f getVelocity() {
return velocity;
}
public void setVelocity(Vector2f velocity) {
this.velocity = velocity;
}
public Vector2f getAcceleration() {
return acceleration;
}
public void setAcceleration(Vector2f acceleration) {
this.acceleration = acceleration;
}
public int getAlpha() {
return alpha;
}
public void setAlpha(int alpha) {
this.alpha = alpha;
}
public float getSize() {
return size;
}
public void setSize(float size) {
this.size = size;
}
}

View File

@ -0,0 +1,41 @@
package me.rigamortis.seppuku.api.gui.hud.particle;
import net.minecraft.client.gui.ScaledResolution;
import javax.vecmath.Vector2f;
public final class ParticleSystem {
private final int PARTS = 100;
private final Particle[] particles = new Particle[PARTS];
private final ScaledResolution scaledResolution;
public ParticleSystem(ScaledResolution scaledResolution) {
this.scaledResolution = scaledResolution;
for (int i = 0; i < PARTS; i++) {
this.particles[i] = new Particle(new Vector2f((float) (Math.random() * scaledResolution.getScaledWidth()), (float) (Math.random() * scaledResolution.getScaledHeight())));
}
}
public void update() {
for (int i = 0; i < PARTS; i++) {
final Particle particle = this.particles[i];
if (this.scaledResolution != null) {
final boolean isOffScreenX = particle.getPos().x > this.scaledResolution.getScaledWidth() || particle.getPos().x < 0;
final boolean isOffScreenY = particle.getPos().y > this.scaledResolution.getScaledHeight() || particle.getPos().y < 0;
if (isOffScreenX || isOffScreenY) {
particle.respawn(this.scaledResolution);
}
}
particle.update();
}
}
public void render(int mouseX, int mouseY) {
for (int i = 0; i < PARTS; i++) {
final Particle particle = this.particles[i];
particle.render(mouseX, mouseY);
}
}
}

View File

@ -3,6 +3,7 @@ package me.rigamortis.seppuku.impl.gui.hud;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent;
import me.rigamortis.seppuku.api.gui.hud.component.HudComponent;
import me.rigamortis.seppuku.api.gui.hud.particle.ParticleSystem;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.impl.gui.hud.anchor.AnchorPoint;
import me.rigamortis.seppuku.impl.module.ui.HudEditorModule;
@ -20,6 +21,15 @@ import java.io.IOException;
*/
public final class GuiHudEditor extends GuiScreen {
private ParticleSystem particleSystem;
@Override
public void initGui() {
super.initGui();
this.particleSystem = new ParticleSystem(new ScaledResolution(mc));
}
@Override
public void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
@ -47,6 +57,8 @@ public final class GuiHudEditor extends GuiScreen {
public void onResize(Minecraft mcIn, int w, int h) {
super.onResize(mcIn, w, h);
this.particleSystem = new ParticleSystem(new ScaledResolution(mcIn));
final ScaledResolution sr = new ScaledResolution(mcIn);
for (AnchorPoint anchorPoint : Seppuku.INSTANCE.getHudManager().getAnchorPoints()) {
anchorPoint.updatePosition(sr);
@ -60,6 +72,9 @@ public final class GuiHudEditor extends GuiScreen {
final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
if (this.particleSystem != null)
this.particleSystem.render(mouseX, mouseY);
final float halfWidth = res.getScaledWidth() / 2.0f;
final float halfHeight = res.getScaledHeight() / 2.0f;
RenderUtil.drawLine(halfWidth, 0, halfWidth, res.getScaledHeight(), 1, 0x75909090);
@ -189,6 +204,14 @@ public final class GuiHudEditor extends GuiScreen {
super.onGuiClosed();
}
@Override
public void updateScreen() {
super.updateScreen();
if (this.particleSystem != null)
this.particleSystem.update();
}
public void unload() {
// empty
}

View File

@ -3,6 +3,7 @@ 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.gui.hud.particle.ParticleSystem;
import me.rigamortis.seppuku.api.gui.menu.MainMenuButton;
import me.rigamortis.seppuku.api.texture.Texture;
import me.rigamortis.seppuku.impl.fml.SeppukuMod;
@ -37,6 +38,8 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
private Texture seppukuLogo;
private ParticleSystem particleSystem;
private boolean inactive = false;
public GuiSeppukuMainMenu() {
@ -47,13 +50,15 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
public void initGui() {
super.initGui();
final GuiSeppukuMainMenu menu = this;
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution res = new ScaledResolution(mc);
if (this.seppukuLogo == null)
this.seppukuLogo = new Texture("seppuku-logo.png");
final GuiSeppukuMainMenu menu = this;
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution res = new ScaledResolution(mc);
if (this.particleSystem == null)
this.particleSystem = new ParticleSystem(res);
// resize the seppuku hud editor with the size of the main menu
Seppuku.INSTANCE.getHudEditor().onResize(mc, res.getScaledWidth(), res.getScaledHeight());
@ -178,12 +183,24 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
}
}
@Override
public void updateScreen() {
super.updateScreen();
if (this.particleSystem != null)
this.particleSystem.update();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
this.drawDefaultBackground();
final ScaledResolution res = new ScaledResolution(mc);
// draw particle system
if (this.particleSystem != null)
this.particleSystem.render(mouseX, mouseY);
// begin gl states
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
@ -260,6 +277,8 @@ public final class GuiSeppukuMainMenu extends GuiScreen {
public void onResize(Minecraft mcIn, int w, int h) {
super.onResize(mcIn, w, h);
this.particleSystem = new ParticleSystem(new ScaledResolution(mcIn));
// resize the seppuku hud editor with the size of the main menu
Seppuku.INSTANCE.getHudEditor().onResize(mcIn, w, h);
}

View File

@ -45,7 +45,7 @@ public final class PatchManager {
this.patchList.add(new BlockSoulSandPatch());
this.patchList.add(new KeyBindingPatch());
this.patchList.add(new BlockModelRendererPatch());
//this.patchList.add(new BlockFluidRendererPatch());
this.patchList.add(new BlockFluidRendererPatch());
this.patchList.add(new ActiveRenderInfoPatch());
this.patchList.add(new BlockSlimePatch());
this.patchList.add(new BlockLiquidPatch());

View File

@ -17,7 +17,7 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
public final class BrightnessModule extends Module {
public final Value<Mode> mode = new Value<Mode>("Mode", new String[]{"Mode", "M"}, "The brightness mode to use.", Mode.GAMMA);
public final Value<Boolean> disablePotion = new Value<Boolean>("DisablePotion", new String[]{"AutoDisablePotion", "dp", "adp"}, "Automatically remove the night vision effect if using a different mode.", false);
public final Value<Boolean> disablePotion = new Value<Boolean>("DisablePotion", new String[]{"AutoDisablePotion", "dp", "adp"}, "Automatically remove the night vision effect if using a different mode.", true);
private enum Mode {
GAMMA, POTION, TABLE

View File

@ -35,6 +35,7 @@ public final class NoLagModule extends Module {
public final Value<Boolean> light = new Value<Boolean>("Light", new String[]{"Lit", "l"}, "Choose to enable the lighting lag fix. Disables lighting updates.", true);
public final Value<Boolean> signs = new Value<Boolean>("Signs", new String[]{"Sign", "si"}, "Choose to enable the sign lag fix. Disables the rendering of sign text.", false);
public final Value<Boolean> sounds = new Value<Boolean>("Sounds", new String[]{"Sound", "s"}, "Choose to enable the sound lag fix. Disable entity swap-item/equip sound.", true);
public final Value<Boolean> fluids = new Value<Boolean>("Fluids", new String[]{"Fluid", "f", "Liquids", "liq", "Water", "Lava"}, "Disables the rendering of all fluids.", false);
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);
@ -42,7 +43,7 @@ public final class NoLagModule extends Module {
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);
public final Value<Boolean> witherSkulls = new Value<Boolean>("WitherSkulls", new String[]{"WitherSkull", "skulls", "skull", "ws"}, "Disables the rendering of flying wither skulls.", false);
public final Value<Boolean> skulls = new Value<Boolean>("Skulls", new String[]{"WitherSkull", "skulls", "skull", "ws"}, "Disables the rendering of flying wither skulls.", false);
public final Value<Boolean> crystals = new Value<Boolean>("Crystals", new String[]{"Wither", "w"}, "Disables the rendering of crystals.", false);
public final Value<Boolean> tnt = new Value<Boolean>("TNT", new String[]{"Wither", "w"}, "Disables the rendering of (primed) TNT.", false);
@ -51,7 +52,7 @@ public final class NoLagModule extends Module {
}
@Listener
public void recievePacket(EventReceivePacket event) {
public void onReceivePacket(EventReceivePacket event) {
if (event.getStage() == EventStageable.EventStage.PRE) {
if (this.slimes.getValue()) {
if (event.getPacket() instanceof SPacketSpawnMob) {
@ -61,6 +62,15 @@ public final class NoLagModule extends Module {
}
}
}
if (this.sounds.getValue()) {
if (event.getPacket() instanceof SPacketSoundEffect) {
final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket();
if (packet.getCategory() == SoundCategory.PLAYERS && packet.getSound() == SoundEvents.ITEM_ARMOR_EQUIP_GENERIC) {
event.setCanceled(true);
}
}
}
}
}
@ -103,16 +113,10 @@ public final class NoLagModule extends Module {
}
@Listener
public void receivePacket(EventReceivePacket event) {
if (event.getStage() == EventStageable.EventStage.PRE) {
if (event.getPacket() instanceof SPacketSoundEffect) {
if (this.sounds.getValue()) {
final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket();
if (packet.getCategory() == SoundCategory.PLAYERS && packet.getSound() == SoundEvents.ITEM_ARMOR_EQUIP_GENERIC) {
event.setCanceled(true);
}
}
}
public void onRenderFluid(EventRenderFluid event) {
if (this.fluids.getValue()) {
event.setRenderable(false);
event.setCanceled(true);
}
}
@ -129,7 +133,7 @@ public final class NoLagModule extends Module {
event.setCanceled(true);
}
if (this.witherSkulls.getValue()) {
if (this.skulls.getValue()) {
if (event.getEntity() instanceof EntityWitherSkull)
event.setCanceled(true);
}

View File

@ -19,7 +19,7 @@ public final class HudEditorModule extends Module {
private boolean open;
public HudEditorModule() {
super("HudEditor", new String[]{"HudEdit", "HEdit"}, "Displays a menu to modify the hud", "GRAVE", -1, ModuleType.UI);
super("HudEditor", new String[]{"HudEdit", "HEdit", "GUI", "ClickGUI"}, "Displays a menu to modify the hud", "GRAVE", -1, ModuleType.UI);
this.setHidden(true);
}