Added PathPreviewRenderer to draw a Preview of the current Camera Path into the World

Added KeyframesModifyEvent to be dispatched whenever the ReplayHandler's Keyframe List is changed
Refactored Event package
Reworked Settings GUI
This commit is contained in:
CrushedPixel
2015-06-15 11:32:34 +02:00
committed by johni0702
parent 6d4512e74b
commit 3df1bdcfc8
23 changed files with 447 additions and 126 deletions

View File

@@ -0,0 +1,24 @@
package eu.crushedpixel.replaymod.gui.elements;
import net.minecraft.client.resources.I18n;
public class GuiOnOffButton extends GuiToggleButton {
private static final String[] values = new String[] {I18n.format("options.on"), I18n.format("options.off")};
public GuiOnOffButton(int buttonId, int x, int y, String buttonText) {
super(buttonId, x, y, buttonText, values);
}
public GuiOnOffButton(int buttonId, int x, int y, int width, int height, String buttonText) {
super(buttonId, x, y, width, height, buttonText, values);
}
public GuiOnOffButton(int buttonId, int x, int y, int width, int height, String buttonText, String onValue, String offValue) {
super(buttonId, x, y, width, height, buttonText, new String[] {onValue, offValue});
}
public boolean isOn() {
return getValue() == 0;
}
}

View File

@@ -0,0 +1,39 @@
package eu.crushedpixel.replaymod.gui.elements;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.settings.ReplaySettings;
public class GuiSettingsOnOffButton extends GuiOnOffButton {
private ReplaySettings.ValueEnum toChange;
public GuiSettingsOnOffButton(int buttonId, int x, int y, int width, int height, ReplaySettings.ValueEnum toChange) {
super(buttonId, x, y, width, height, toChange.getName()+": ");
this.toChange = toChange;
if(toChange.getValue() instanceof Boolean) {
this.setValue((Boolean) toChange.getValue() == true ? 0 : 1);
}
}
public GuiSettingsOnOffButton(int buttonId, int x, int y, int width, int height, ReplaySettings.ValueEnum toChange, String onValue, String offValue) {
super(buttonId, x, y, width, height, toChange.getName()+": ", onValue, offValue);
this.toChange = toChange;
if(toChange.getValue() instanceof Boolean) {
this.setValue((Boolean) toChange.getValue() == true ? 0 : 1);
}
}
@Override
public void toggle() {
super.toggle();
toChange.setValue(isOn());
ReplayMod.replaySettings.rewriteSettings();
}
@Override
public void setValue(int value) {
super.setValue(value);
toChange.setValue(isOn());
ReplayMod.replaySettings.rewriteSettings();
}
}

View File

@@ -20,6 +20,12 @@ public class GuiToggleButton extends GuiAdvancedButton {
this.displayString = baseText+values[value];
}
public GuiToggleButton(int buttonId, int x, int y, int width, int height, String buttonText, String[] values) {
this(buttonId, x, y, buttonText, values);
this.width = width;
this.height = height;
}
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
boolean success = super.mousePressed(mc, mouseX, mouseY);
@@ -41,6 +47,7 @@ public class GuiToggleButton extends GuiAdvancedButton {
public void setValue(int value) {
this.value = value;
this.displayString = baseText+values[value];
}