Created GuiEntryListEntry interface for GuiEntryList contained classes to avoid toString() methods from having to be abused

Created GuiFileChooser and according Listeners
Added (non-functional) GuiAssetAdder for CustomImageObjects
This commit is contained in:
CrushedPixel
2015-07-06 13:44:50 +02:00
parent 013d5963ff
commit a5eadd2d01
16 changed files with 278 additions and 25 deletions

View File

@@ -2,6 +2,7 @@ package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.registry.ResourceHelper;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation;
@@ -11,9 +12,9 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class CustomImageObject {
public class CustomImageObject implements GuiEntryListEntry {
public CustomImageObject(Position position, String name, File imageSource) throws IOException {
public CustomImageObject(Position position, String name, File imageSource, boolean backVisible) throws IOException {
BufferedImage bufferedImage = ImageIO.read(imageSource);
this.textureWidth = bufferedImage.getWidth();
@@ -35,10 +36,13 @@ public class CustomImageObject {
this.resourceLocation = new ResourceLocation("customImages/"+imageSource.getAbsolutePath());
this.dynamicTexture = new DynamicTexture(bufferedImage);
this.backVisible = backVisible;
}
@Getter private ExtendedPosition position;
@Getter private String name;
@Getter @Setter private ExtendedPosition position;
@Getter @Setter private String name;
@Getter @Setter private boolean backVisible;
private ResourceLocation resourceLocation;
private DynamicTexture dynamicTexture;
@@ -54,4 +58,9 @@ public class CustomImageObject {
return resourceLocation;
}
@Override
public String getDisplayString() {
return name;
}
}

View File

@@ -0,0 +1,8 @@
package eu.crushedpixel.replaymod.holders;
public interface GuiEntryListEntry {
public String getDisplayString();
}

View File

@@ -0,0 +1,19 @@
package eu.crushedpixel.replaymod.holders;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class GuiEntryListStringEntry implements GuiEntryListEntry {
private String displayName;
@Override
public String getDisplayString() {
return displayName;
}
@Override
public String toString() {
return displayName;
}
}

View File

@@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class KeyframeSet {
public class KeyframeSet implements GuiEntryListEntry {
private String name;
private PositionKeyframe[] positionKeyframes;
private TimeKeyframe[] timeKeyframes;
@@ -70,7 +70,7 @@ public class KeyframeSet {
}
@Override
public String toString() {
public String getDisplayString() {
return name;
}