0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add TacoCmd

This commit is contained in:
Alexander01998 2019-09-21 12:40:11 +02:00
parent b24eeda327
commit e6f137ec7b
8 changed files with 130 additions and 2 deletions

View File

@ -51,6 +51,7 @@ public enum WurstClient
private KeybindList keybinds;
private ClickGui gui;
private Navigator navigator;
private CmdProcessor cmdProcessor;
private IngameHUD hud;
private RotationFaker rotationFaker;
@ -91,7 +92,7 @@ public enum WurstClient
Path preferencesFile = wurstFolder.resolve("preferences.json");
navigator = new Navigator(preferencesFile, hax, cmds, otfs);
CmdProcessor cmdProcessor = new CmdProcessor(cmds);
cmdProcessor = new CmdProcessor(cmds);
eventManager.add(ChatOutputListener.class, cmdProcessor);
KeybindProcessor keybindProcessor =
@ -181,6 +182,11 @@ public enum WurstClient
return navigator;
}
public CmdProcessor getCmdProcessor()
{
return cmdProcessor;
}
public IngameHUD getHud()
{
return hud;

View File

@ -57,7 +57,7 @@ public final class CmdList
// public final SetModeCmd setModeCmd = new SetModeCmd();
// public final SetSliderCmd setSliderCmd = new SetSliderCmd();
// public final SpammerCmd spammerCmd = new SpammerCmd();
// public final TacoCmd tacoCmd = new TacoCmd();
public final TacoCmd tacoCmd = new TacoCmd();
// public final TCmd tCmd = new TCmd();
// public final ThrowCmd throwCmd = new ThrowCmd();
// public final TpCmd tpCmd = new TpCmd();

View File

@ -9,6 +9,7 @@ package net.wurstclient.command;
import java.util.Objects;
import net.wurstclient.Category;
import net.wurstclient.Feature;
import net.wurstclient.util.ChatUtils;
@ -17,6 +18,7 @@ public abstract class Command extends Feature
private final String name;
private final String description;
private final String[] syntax;
private Category category;
public Command(String name, String description, String... syntax)
{
@ -70,4 +72,15 @@ public abstract class Command extends Feature
for(String line : syntax)
ChatUtils.message(line);
}
@Override
public final Category getCategory()
{
return category;
}
protected final void setCategory(Category category)
{
this.category = category;
}
}

View File

@ -0,0 +1,109 @@
/*
* Copyright (C) 2014 - 2019 | Wurst-Imperium | All rights reserved.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.commands;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.Window;
import net.minecraft.util.Identifier;
import net.wurstclient.Category;
import net.wurstclient.command.CmdException;
import net.wurstclient.command.CmdSyntaxError;
import net.wurstclient.command.Command;
import net.wurstclient.events.GUIRenderListener;
import net.wurstclient.events.UpdateListener;
public final class TacoCmd extends Command
implements GUIRenderListener, UpdateListener
{
private final Identifier[] tacos =
{new Identifier("wurst", "dancingtaco1.png"),
new Identifier("wurst", "dancingtaco2.png"),
new Identifier("wurst", "dancingtaco3.png"),
new Identifier("wurst", "dancingtaco4.png")};
private boolean enabled;
private int ticks = 0;
public TacoCmd()
{
super("taco", "Spawns a dancing taco on your hotbar.\n"
+ "\"I love that little guy. So cute!\" -WiZARD");
setCategory(Category.FUN);
}
@Override
public void call(String[] args) throws CmdException
{
if(args.length != 0)
throw new CmdSyntaxError("Tacos don't need arguments!");
enabled = !enabled;
if(enabled)
{
WURST.getEventManager().add(GUIRenderListener.class, this);
WURST.getEventManager().add(UpdateListener.class, this);
}else
{
WURST.getEventManager().remove(GUIRenderListener.class, this);
WURST.getEventManager().remove(UpdateListener.class, this);
}
}
@Override
public String getPrimaryAction()
{
return "Be a BOSS!";
}
@Override
public void doPrimaryAction()
{
WURST.getCmdProcessor().process("taco");
}
@Override
public void onUpdate()
{
if(ticks >= 31)
ticks = 0;
else
ticks++;
}
@Override
public void onRenderGUI(float partialTicks)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// TODO: RainbowUI
// if(WurstClient.INSTANCE.getHax().rainbowUiHack.isActive())
// {
// float[] acColor = WurstClient.INSTANCE.getGui().getAcColor();
// GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1);
// }else
GL11.glColor4f(1, 1, 1, 1);
MC.getTextureManager().bindTexture(tacos[ticks / 8]);
Window sr = MC.window;
int x = sr.getScaledWidth() / 2 - 32 + 76;
int y = sr.getScaledHeight() - 32 - 19;
int w = 64;
int h = 32;
DrawableHelper.blit(x, y, 0, 0, w, h, w, h);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB