forked from RepoMirrors/kami-blue
Merge branch 'master' into autofeetplace
This commit is contained in:
commit
7628417a97
|
@ -5,7 +5,7 @@
|
|||
|
||||
## A minecraft utility mod for anarchy servers.
|
||||
|
||||
Development has slowed down considerably. KAMI will likely no longer be updated. Pull requests are still welcome.
|
||||
Development has slowed down considerably.
|
||||
|
||||
See [forgehax](https://github.com/fr1kin/forgehax) for a more polished equivalent. Some features in KAMI may be based on those of forgehax, as I sometimes used it as reference.
|
||||
|
||||
|
|
|
@ -81,17 +81,26 @@ public class SettingsPanel extends OrganisedContainer {
|
|||
if (numberSetting.getMin() != null) slider.setMin(numberSetting.getMin().doubleValue());
|
||||
addChild(slider);
|
||||
} else {
|
||||
Slider slider = new Slider(numberSetting.getValue().doubleValue(), numberSetting.getMin().doubleValue(), numberSetting.getMax().doubleValue(), Slider.getDefaultStep(numberSetting.getMin().doubleValue(), numberSetting.getMax().doubleValue()), name, setting instanceof IntegerSetting);
|
||||
// Terrible terrible bug fix.
|
||||
// I know, these parseDoubles look awful, but any conversions I tried here would end up with weird floating point conversion errors.
|
||||
// This is really the easiest solution..
|
||||
double value = Double.parseDouble(numberSetting.getValue().toString());
|
||||
double min = Double.parseDouble(numberSetting.getMin().toString());
|
||||
double max = Double.parseDouble(numberSetting.getMax().toString());
|
||||
Slider slider = new Slider(
|
||||
value, min, max,
|
||||
Slider.getDefaultStep(min, max),
|
||||
name,
|
||||
setting instanceof IntegerSetting);
|
||||
slider.addPoof(new Slider.SliderPoof<Slider, Slider.SliderPoof.SliderPoofInfo>() {
|
||||
@Override
|
||||
public void execute(Slider component, SliderPoofInfo info) {
|
||||
if (setting instanceof IntegerSetting)
|
||||
setting.setValue(new Integer((int) info.getNewValue()));
|
||||
setting.setValue((int) info.getNewValue());
|
||||
else if (setting instanceof FloatSetting)
|
||||
setting.setValue(new Float(info.getNewValue()));
|
||||
setting.setValue((float) info.getNewValue());
|
||||
else if (setting instanceof DoubleSetting)
|
||||
setting.setValue(info.getNewValue());
|
||||
setModule(module);
|
||||
}
|
||||
});
|
||||
addChild(slider);
|
||||
|
|
|
@ -21,7 +21,8 @@ public class RootSliderUI extends AbstractComponentUI<Slider> {
|
|||
glColor4f(1,0.33f,0.33f,component.getOpacity());
|
||||
glLineWidth(2.5f);
|
||||
int height = component.getHeight();
|
||||
double w = component.getWidth() * (component.getValue() / component.getMaximum());
|
||||
double value = component.getValue();
|
||||
double w = component.getWidth() * ((value - component.getMinimum()) / (component.getMaximum() - component.getMinimum()));
|
||||
float downscale = 1.1f;
|
||||
glBegin(GL_LINES);
|
||||
{
|
||||
|
@ -37,11 +38,7 @@ public class RootSliderUI extends AbstractComponentUI<Slider> {
|
|||
glColor3f(1,0.33f,0.33f);
|
||||
RenderHelper.drawCircle((int)w,height/downscale,2f);
|
||||
|
||||
String s = "";
|
||||
if (Math.floor(component.getValue())==component.getValue())
|
||||
s += (int) component.getValue();
|
||||
else
|
||||
s += component.getValue();
|
||||
String s = value + "";
|
||||
if (component.isPressed()){
|
||||
w -= smallFontRenderer.getStringWidth(s)/2;
|
||||
w = Math.max(0,Math.min(w, component.getWidth()-smallFontRenderer.getStringWidth(s)));
|
||||
|
|
|
@ -102,7 +102,8 @@ public class Slider extends AbstractComponent {
|
|||
public void setValue(double value) {
|
||||
SliderPoof.SliderPoofInfo info = new SliderPoof.SliderPoofInfo(this.value, value);
|
||||
callPoof(SliderPoof.class, info);
|
||||
this.value = integer ? (int) info.getNewValue() : info.getNewValue();
|
||||
double newValue = info.getNewValue();
|
||||
this.value = integer ? (int) newValue : newValue;
|
||||
}
|
||||
|
||||
public static abstract class SliderPoof<T extends Component, S extends SliderPoof.SliderPoofInfo> extends Poof<T,S> {
|
||||
|
|
|
@ -11,24 +11,31 @@ import net.minecraft.client.gui.GuiGameOver;
|
|||
|
||||
/**
|
||||
* Created by 086 on 9/04/2018.
|
||||
* Updated 16 November 2019 by hub
|
||||
*/
|
||||
@Module.Info(name = "AutoRespawn", description = "Automatically respawns upon death and tells you where you died", category = Module.Category.MISC)
|
||||
@Module.Info(name = "AutoRespawn", description = "Respawn utility", category = Module.Category.MISC)
|
||||
public class AutoRespawn extends Module {
|
||||
|
||||
private Setting<Boolean> deathCoords = register(Settings.b("DeathCoords", false));
|
||||
private Setting<Boolean> respawn = register(Settings.b("Respawn", true));
|
||||
private Setting<Boolean> deathCoords = register(Settings.b("DeathCoords", false));
|
||||
private Setting<Boolean> antiGlitchScreen = register(Settings.b("Anti Glitch Screen", true));
|
||||
|
||||
@EventHandler
|
||||
public Listener<GuiScreenEvent.Displayed> listener = new Listener<>(event -> {
|
||||
if (event.getScreen() instanceof GuiGameOver) {
|
||||
if (deathCoords.getValue())
|
||||
Command.sendChatMessage(String.format("You died at x %d y %d z %d", (int)mc.player.posX, (int)mc.player.posY, (int)mc.player.posZ));
|
||||
|
||||
if (respawn.getValue()) {
|
||||
mc.player.respawnPlayer();
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
if (!(event.getScreen() instanceof GuiGameOver)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deathCoords.getValue() && mc.player.getHealth() <= 0) {
|
||||
Command.sendChatMessage(String.format("You died at x %d y %d z %d", (int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ));
|
||||
}
|
||||
|
||||
if (respawn.getValue() || (antiGlitchScreen.getValue() && mc.player.getHealth() > 0)) {
|
||||
mc.player.respawnPlayer();
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class AntiForceLook extends Module {
|
|||
|
||||
@EventHandler
|
||||
Listener<PacketEvent.Receive> receiveListener = new Listener<>(event -> {
|
||||
if (mc.player == null) return;
|
||||
if (event.getPacket() instanceof SPacketPlayerPosLook) {
|
||||
SPacketPlayerPosLook packet = (SPacketPlayerPosLook) event.getPacket();
|
||||
packet.yaw = mc.player.rotationYaw;
|
||||
|
|
Loading…
Reference in New Issue