General warning cleanup

This commit is contained in:
johni0702
2015-07-19 16:18:34 +02:00
parent 4f718ab302
commit 6422558028
31 changed files with 88 additions and 281 deletions

View File

@@ -2,8 +2,6 @@ package eu.crushedpixel.replaymod.gui;
public class GuiConstants {
public static final int MAIN_MENU_UPDATE_BUTTON = 8765;
public static final int CENTER_DOWNLOADED_REPLAYS_BUTTON = 2001;
public static final int CENTER_SEARCH_BUTTON = 2002;
public static final int CENTER_BACK_BUTTON = 2003;
@@ -61,17 +59,8 @@ public class GuiConstants {
public static final int PLAYER_OVERVIEW_SHOW_ALL = 101;
public static final int PLAYER_OVERVIEW_REMEMBER = -10;
public static final int RENDER_SETTINGS_RENDER_BUTTON = 9002;
public static final int RENDER_SETTINGS_CANCEL_BUTTON = 9003;
public static final int RENDER_SETTINGS_INTERPOLATION_BUTTON = 9007;
public static final int RENDER_SETTINGS_FORCECHUNKS_BUTTON = 9008;
public static final int RENDER_SETTINGS_FRAMERATE_SLIDER = 9009;
public static final int RENDER_SETTINGS_STATIC_CAMERA = 9012;
public static final int RENDER_SETTINGS_ADVANCED_BUTTON = 9013;
public static final int RENDER_SETTINGS_COLOR_PICKER = 9014;
public static final int RENDER_SETTINGS_ENABLE_GREENSCREEN = 9015;
public static final int RENDER_SETTINGS_OUTPUT_CHOOSER = 9016;
public static final int RENDER_SETTINGS_RENDER_NAMETAGS = 9017;
public static final int REPLAY_SETTINGS_RECORDSERVER_ID = 9004;
public static final int REPLAY_SETTINGS_RECORDSP_ID = 9005;
@@ -83,5 +72,4 @@ public class GuiConstants {
public static final int REPLAY_SETTINGS_CLEARCALLBACK_ID = 9014;
public static final int REPLAY_EDITING_CANCEL_BUTTON = 1234;
public static final int REPLAY_DOWNLOADING_CANCEL_BUTTON = 2345;
}

View File

@@ -11,6 +11,7 @@ import eu.crushedpixel.replaymod.gui.elements.timelines.GuiTimeline;
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
import eu.crushedpixel.replaymod.holders.*;
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.utils.MouseUtils;
import eu.crushedpixel.replaymod.utils.ReplayFile;
@@ -30,6 +31,8 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
import org.lwjgl.util.Point;
public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOverlay {
private boolean initialized = false;
@@ -50,16 +53,12 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
private GuiDraggingNumberInput scaleXInput, scaleYInput, scaleZInput;
private GuiDraggingNumberInput opacityInput;
private NumberInputGroup anchorNumberInputs, positionNumberInputs, orientationNumberInputs, scaleNumberInputs, opacityNumberInputs;
private NumberPositionInputGroup anchorNumberInputs, positionNumberInputs, orientationNumberInputs, scaleNumberInputs;
private NumberValueInputGroup opacityNumberInputs;
@Getter
private GuiObjectKeyframeTimeline objectKeyframeTimeline;
private GuiScrollbar timelineScrollbar;
private GuiTexturedButton zoomInButton, zoomOutButton;
private ComposedElement anchorInputs, positionInputs, scaleInputs, orientationInputs, opacityInputs, numberInputs;
private ComposedElement disableElements, allElements;
private static final int KEYFRAME_BUTTON_X = 80;
@@ -257,19 +256,19 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
int inputWidth = 40;
anchorInputs = new ComposedElement(anchorXInput, anchorYInput, anchorZInput);
positionInputs = new ComposedElement(positionXInput, positionYInput, positionZInput);
orientationInputs = new ComposedElement(orientationXInput, orientationYInput, orientationZInput);
scaleInputs = new ComposedElement(scaleXInput, scaleYInput, scaleZInput);
opacityInputs = new ComposedElement(opacityInput);
numberInputs = new ComposedElement(anchorInputs, positionInputs, orientationInputs, scaleInputs, opacityInputs);
ComposedElement anchorInputs = new ComposedElement(anchorXInput, anchorYInput, anchorZInput);
ComposedElement positionInputs = new ComposedElement(positionXInput, positionYInput, positionZInput);
ComposedElement orientationInputs = new ComposedElement(orientationXInput, orientationYInput, orientationZInput);
ComposedElement scaleInputs = new ComposedElement(scaleXInput, scaleYInput, scaleZInput);
ComposedElement opacityInputs = new ComposedElement(opacityInput);
ComposedElement numberInputs = new ComposedElement(anchorInputs, positionInputs, orientationInputs, scaleInputs, opacityInputs);
for(int i = numberInputs.getParts().size()-1; i >= 0; i--) {
int yPos = this.height-5-10-(25*(numberInputs.getParts().size()-i));
DelegatingElement button = keyframeButton(10, yPos, i);
GuiString label = new GuiString(35, yPos + 6, Color.WHITE, labelStrings[i]);
ComposedElement child = (ComposedElement)numberInputs.getParts().get(i);
ComposedElement child = (ComposedElement) numberInputs.getParts().get(i);
int x = 0;
for(GuiElement el : child.getParts()) {
GuiDraggingNumberInput dni = (GuiDraggingNumberInput)el;
@@ -294,10 +293,10 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
objectKeyframeTimeline = new GuiObjectKeyframeTimeline(timelineX, timelineY, timelineWidth, timelineHeight);
disableElements.addPart(objectKeyframeTimeline);
timelineScrollbar = new GuiScrollbar(timelineX, this.height-15, timelineWidth-21) {
GuiScrollbar timelineScrollbar = new GuiScrollbar(timelineX, this.height - 15, timelineWidth - 21) {
@Override
public void dragged() {
objectKeyframeTimeline.timeStart = (float)sliderPosition;
objectKeyframeTimeline.timeStart = (float) sliderPosition;
}
};
@@ -306,14 +305,14 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
disableElements.addPart(timelineScrollbar);
zoomInButton = GuiReplayOverlay.texturedButton(width - 28, this.height-15, 40, 20, 9, new Runnable() {
GuiTexturedButton zoomInButton = GuiReplayOverlay.texturedButton(width - 28, this.height - 15, 40, 20, 9, new Runnable() {
@Override
public void run() {
objectKeyframeTimeline.zoom = Math.max(0.025f, objectKeyframeTimeline.zoom - ZOOM_STEPS);
}
}, "replaymod.gui.ingame.menu.zoomin");
zoomOutButton = GuiReplayOverlay.texturedButton(width - 18, this.height-15, 40, 30, 9, new Runnable() {
GuiTexturedButton zoomOutButton = GuiReplayOverlay.texturedButton(width - 18, this.height - 15, 40, 30, 9, new Runnable() {
@Override
public void run() {
@@ -467,17 +466,17 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
saveOnQuit();
}
public abstract class NumberInputGroup implements NumberValueChangeListener {
public abstract class NumberInputGroup<T extends KeyframeValue> implements NumberValueChangeListener {
KeyframeList toModify;
KeyframeList<T> toModify;
public void setUnderlyingKeyframeList(KeyframeList toModify) {
public void setUnderlyingKeyframeList(KeyframeList<T> toModify) {
this.toModify = toModify;
}
}
public class NumberValueInputGroup extends NumberInputGroup {
public class NumberValueInputGroup extends NumberInputGroup<NumberValue> {
public NumberValueInputGroup(KeyframeList<NumberValue> toModify, GuiNumberInput input) {
this.toModify = toModify;
@@ -486,6 +485,7 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
}
@Override
@SuppressWarnings("unchecked")
public void onValueChange(double value) {
NumberValue numberValue = new NumberValue(value);
@@ -498,7 +498,7 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
}
}
public class NumberPositionInputGroup extends NumberInputGroup {
public class NumberPositionInputGroup extends NumberInputGroup<Position> {
public NumberPositionInputGroup(KeyframeList<Position> toModify, GuiNumberInput xInput, GuiNumberInput yInput, GuiNumberInput zInput) {
this.toModify = toModify;
@@ -514,6 +514,7 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
private GuiNumberInput xInput, yInput, zInput;
@Override
@SuppressWarnings("unchecked")
public void onValueChange(double value) {
Position position = new Position(xInput.getPreciseValue(), yInput.getPreciseValue(), zInput.getPreciseValue());
@@ -561,10 +562,10 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
if(transformations != null) {
for(int i = 0; i < 5; i++) {
KeyframeList keyframes = transformations.getKeyframeListByID(i);
KeyframeList<?> keyframes = transformations.getKeyframeListByID(i);
//Draw Keyframe logos
for(Keyframe kf : (List<Keyframe>) keyframes) {
for(Keyframe kf : keyframes) {
drawKeyframe(kf, (int)(i * (height / 5f)) + 10, bodyWidth, leftTime, rightTime, segmentLength);
}
}
@@ -609,9 +610,8 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
int lower = upper + KEYFRAME_SIZE;
if(mouseY >= upper && mouseY <= lower) {
KeyframeList keyframes = transformations.getKeyframeListByID(i);
Keyframe closest = keyframes.getClosestKeyframeForTimestamp(time, tolerance);
selectedKeyframe = closest;
selectedKeyframe = keyframes.getClosestKeyframeForTimestamp(time, tolerance);
if(selectedKeyframe != null) {
selectedKeyframeRow = i;
@@ -662,6 +662,7 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
this.dragging = false;
}
@SuppressWarnings("unchecked")
public void addKeyframe(int line) {
CustomImageObject currentObject = objectList.getElement(objectList.getSelectionIndex());
if(currentObject != null) {
@@ -672,32 +673,32 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
switch(line) {
case 0:
kf = new Keyframe(timestamp, new Position(
kf = new Keyframe<Position>(timestamp, new Position(
anchorXInput.getPreciseValue(),
anchorYInput.getPreciseValue(),
anchorZInput.getPreciseValue()));
break;
case 1:
kf = new Keyframe(timestamp, new Position(
kf = new Keyframe<Position>(timestamp, new Position(
positionXInput.getPreciseValue(),
positionYInput.getPreciseValue(),
positionZInput.getPreciseValue()));
break;
case 2:
kf = new Keyframe(timestamp, new Position(
kf = new Keyframe<Position>(timestamp, new Position(
orientationXInput.getPreciseValue(),
orientationYInput.getPreciseValue(),
orientationZInput.getPreciseValue()));
break;
case 3:
kf = new Keyframe(timestamp, new Position(
kf = new Keyframe<Position>(timestamp, new Position(
scaleXInput.getPreciseValue(),
scaleYInput.getPreciseValue(),
scaleZInput.getPreciseValue()));
break;
case 4:
kf = new Keyframe(timestamp, new NumberValue(
kf = new Keyframe<NumberValue>(timestamp, new NumberValue(
opacityInput.getPreciseValue()
));
break;

View File

@@ -1,91 +0,0 @@
package eu.crushedpixel.replaymod.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.MathHelper;
public class GuiVideoQualitySlider extends GuiButton {
public boolean dragging;
private String displayKey;
private float sliderValue;
public GuiVideoQualitySlider(int buttonId, int p_i45017_2_, int p_i45017_3_, float d, String displayKey) {
super(buttonId, p_i45017_2_, p_i45017_3_, 150, 20, "");
this.sliderValue = normalizeValue(d);
this.displayString = displayKey + ": " + translate(d);
this.displayKey = displayKey;
}
private final String DRAFT = I18n.format("replaymod.gui.settings.videoquality.draft");
private final String NORMAL = I18n.format("replaymod.gui.settings.videoquality.normal");
private final String GOOD= I18n.format("replaymod.gui.settings.videoquality.good");
private final String BEST = I18n.format("replaymod.gui.settings.videoquality.best");
private String translate(float value) {
if(value <= 0.3) {
return DRAFT;
} else if(value <= 0.5) {
return NORMAL;
} else if(value <= 0.7) {
return GOOD;
}
return BEST;
}
protected int getHoverState(boolean mouseOver) {
return 0;
}
@Override
protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) {
if(this.visible) {
if(this.dragging) {
sliderValue = (float) (mouseX - (this.xPosition + 4)) / (float) (this.width - 8);
sliderValue = MathHelper.clamp_float(sliderValue, 0.0F, 1.0F);
float f = denormalizeValue(sliderValue);
f = snapValue(f);
sliderValue = normalizeValue(f);
this.displayString = displayKey + ": " + translate(f);
}
mc.getTextureManager().bindTexture(buttonTextures);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(this.xPosition + (int)Math.ceil(sliderValue * (float) (this.width - 8)), this.yPosition, 0, 66, 4, 20);
this.drawTexturedModalRect(this.xPosition + (int)Math.ceil(sliderValue * (float) (this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20);
}
}
public float getQuality() {
return snapValue(denormalizeValue(sliderValue));
}
private float snapValue(float val) {
int i = Math.round(val * 10);
return i / 10f;
}
private float normalizeValue(float val) {
return (val - 0.1f) / 0.8f;
}
private float denormalizeValue(float val) {
//Transfers the value ranging from 0.0 to 1.0 to the scale of 0.1 to 0.9
float r = 0.8f * val;
return 0.1f + r;
}
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if(super.mousePressed(mc, mouseX, mouseY)) {
this.dragging = true;
return true;
} else {
return false;
}
}
public void mouseReleased(int mouseX, int mouseY) {
this.dragging = false;
}
}

View File

@@ -1,29 +0,0 @@
package eu.crushedpixel.replaymod.gui;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
public class PasswordTextField extends GuiTextField {
public PasswordTextField(int p_i45542_1_, FontRenderer p_i45542_2_,
int p_i45542_3_, int p_i45542_4_, int p_i45542_5_, int p_i45542_6_) {
super(p_i45542_1_, p_i45542_2_, p_i45542_3_, p_i45542_4_, p_i45542_5_,
p_i45542_6_);
}
@Override
public void drawTextBox() {
String prev = getText();
String pw = "";
for(int i = 0; i < prev.length(); i++) {
pw += "*";
}
text = pw;
super.drawTextBox();
text = prev;
}
}

View File

@@ -138,8 +138,8 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
}
public boolean mouseClickedResult(int xPos, int yPos) {
if(!isEnabled) return false;
boolean success = false;
if(!isEnabled) return success;
if(xPos > xPosition + width - height && xPos < xPosition + width && yPos > yPosition && yPos < yPosition + height) {
open = !open;
} else {

View File

@@ -1,12 +1,9 @@
package eu.crushedpixel.replaymod.gui.elements;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
public class GuiNumberInputWithText extends GuiNumberInput {
private final Minecraft mc = Minecraft.getMinecraft();
private String suffix;
public GuiNumberInputWithText(FontRenderer fontRenderer,

View File

@@ -136,14 +136,13 @@ public class GuiKeyframeTimeline extends GuiTimeline {
int i = iterator.nextIndex();
int nextSpectatorKeyframeRealTime = -1;
while(iterator.hasNext()) {
if (iterator.hasNext()) {
Keyframe<AdvancedPosition> kf2 = iterator.next();
if(kf.getValue().getSpectatedEntityID()
.equals(kf2.getValue().getSpectatedEntityID())) {
nextSpectatorKeyframeRealTime = kf2.getRealTimestamp();
}
break;
}
int i2 = iterator.previousIndex();
@@ -172,12 +171,11 @@ public class GuiKeyframeTimeline extends GuiTimeline {
int i = iterator.nextIndex();
int nextTimeKeyframeRealTime = -1;
while(iterator.hasNext()) {
if (iterator.hasNext()) {
Keyframe<TimestampValue> kf2 = iterator.next();
if(kf.getValue().asInt() > kf2.getValue().asInt()) {
nextTimeKeyframeRealTime = kf2.getRealTimestamp();
}
break;
}
int i2 = iterator.previousIndex();
@@ -232,7 +230,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
y += 0;
//If Spectator Keyframe, use different texture
if(((Keyframe<AdvancedPosition>) kf).getValue().getSpectatedEntityID() != null) {
if(((AdvancedPosition) kf.getValue()).getSpectatedEntityID() != null) {
textureX = KEYFRAME_SPEC_X;
textureY = KEYFRAME_SPEC_Y;
}

View File

@@ -36,7 +36,7 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.util.Point;
import java.awt.*;
import java.awt.Color;
import java.io.IOException;
import java.util.List;
@@ -191,7 +191,7 @@ public class GuiReplayOverlay extends Gui {
boolean selected = ReplayHandler.getSelectedKeyframe() != null && ReplayHandler.getSelectedKeyframe().getValue() instanceof AdvancedPosition;
boolean camera;
if(selected) {
camera = ((Keyframe<AdvancedPosition>)ReplayHandler.getSelectedKeyframe()).getValue().getSpectatedEntityID() == null;
camera = ((AdvancedPosition)ReplayHandler.getSelectedKeyframe().getValue()).getSpectatedEntityID() == null;
} else {
camera = ReplayHandler.isCamera();
}
@@ -616,9 +616,10 @@ public class GuiReplayOverlay extends Gui {
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableAlpha();
GlStateManager.disableLighting();
Gui.drawModalRectWithCustomSizedTexture(xPos-width, HEIGHT - 10 - 13,
Gui.drawModalRectWithCustomSizedTexture(xPos - width, HEIGHT - 10 - 13,
100, 0, 20, 13, TEXTURE_SIZE, TEXTURE_SIZE);
//noinspection UnusedAssignment
xPos -= width + 5;
}

View File

@@ -9,6 +9,7 @@ import net.minecraft.client.resources.I18n;
import java.awt.*;
import java.io.IOException;
import java.util.List;
public class GuiReplayEditingProcess extends GuiScreen {
@@ -48,6 +49,8 @@ public class GuiReplayEditingProcess extends GuiScreen {
cancelButton.width = 150;
cancelButton.yPosition = this.height - 5 - 20;
@SuppressWarnings("unchecked")
List<GuiButton> buttonList = this.buttonList;
buttonList.add(cancelButton);
initialized = true;