forked from RepoMirrors/kami-blue
Merge branch 'master' into autofeetplace
This commit is contained in:
commit
6546cf9fe0
|
@ -63,15 +63,19 @@ public class SettingsPanel extends OrganisedContainer {
|
||||||
NumberSetting numberSetting = (NumberSetting) setting;
|
NumberSetting numberSetting = (NumberSetting) setting;
|
||||||
boolean isBound = numberSetting.isBound();
|
boolean isBound = numberSetting.isBound();
|
||||||
|
|
||||||
|
// 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());
|
||||||
if (!isBound) {
|
if (!isBound) {
|
||||||
UnboundSlider slider = new UnboundSlider(numberSetting.getValue().doubleValue(), name, setting instanceof IntegerSetting);
|
UnboundSlider slider = new UnboundSlider(value, name, setting instanceof IntegerSetting);
|
||||||
slider.addPoof(new Slider.SliderPoof<UnboundSlider, Slider.SliderPoof.SliderPoofInfo>() {
|
slider.addPoof(new Slider.SliderPoof<UnboundSlider, Slider.SliderPoof.SliderPoofInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(UnboundSlider component, SliderPoofInfo info) {
|
public void execute(UnboundSlider component, SliderPoofInfo info) {
|
||||||
if (setting instanceof IntegerSetting)
|
if (setting instanceof IntegerSetting)
|
||||||
setting.setValue(new Integer((int) info.getNewValue()));
|
setting.setValue((int) info.getNewValue());
|
||||||
else if (setting instanceof FloatSetting)
|
else if (setting instanceof FloatSetting)
|
||||||
setting.setValue(new Float(info.getNewValue()));
|
setting.setValue((float) info.getNewValue());
|
||||||
else if (setting instanceof DoubleSetting)
|
else if (setting instanceof DoubleSetting)
|
||||||
setting.setValue(info.getNewValue());
|
setting.setValue(info.getNewValue());
|
||||||
setModule(module);
|
setModule(module);
|
||||||
|
@ -81,10 +85,6 @@ public class SettingsPanel extends OrganisedContainer {
|
||||||
if (numberSetting.getMin() != null) slider.setMin(numberSetting.getMin().doubleValue());
|
if (numberSetting.getMin() != null) slider.setMin(numberSetting.getMin().doubleValue());
|
||||||
addChild(slider);
|
addChild(slider);
|
||||||
} else {
|
} else {
|
||||||
// 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 min = Double.parseDouble(numberSetting.getMin().toString());
|
||||||
double max = Double.parseDouble(numberSetting.getMax().toString());
|
double max = Double.parseDouble(numberSetting.getMax().toString());
|
||||||
Slider slider = new Slider(
|
Slider slider = new Slider(
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package me.zeroeightsix.kami.module.modules.movement;
|
||||||
|
|
||||||
|
import me.zeroeightsix.kami.module.Module;
|
||||||
|
import me.zeroeightsix.kami.setting.Setting;
|
||||||
|
import me.zeroeightsix.kami.setting.Settings;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created on 26 October 2019 by hub
|
||||||
|
* Updated 24 November 2019 by hub
|
||||||
|
*/
|
||||||
|
@Module.Info(name = "IceSpeed", description = "Ice Speed", category = Module.Category.MOVEMENT)
|
||||||
|
public class IceSpeed extends Module {
|
||||||
|
|
||||||
|
private Setting<Float> slipperiness = register(Settings.floatBuilder("Slipperiness").withMinimum(0.2f).withValue(0.4f).withMaximum(1.0f).build());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
Blocks.ICE.slipperiness = slipperiness.getValue();
|
||||||
|
Blocks.PACKED_ICE.slipperiness = slipperiness.getValue();
|
||||||
|
Blocks.FROSTED_ICE.slipperiness = slipperiness.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
Blocks.ICE.slipperiness = 0.98f;
|
||||||
|
Blocks.PACKED_ICE.slipperiness = 0.98f;
|
||||||
|
Blocks.FROSTED_ICE.slipperiness = 0.98f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue