GuiAssetAdder now allows to add/remove/edit Assets in a Replay. These Assets are not being saved yet.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import eu.crushedpixel.replaymod.registry.ResourceHelper;
|
||||
import eu.crushedpixel.replaymod.utils.RoundUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -14,8 +15,25 @@ import java.io.IOException;
|
||||
|
||||
public class CustomImageObject implements GuiEntryListEntry {
|
||||
|
||||
public CustomImageObject(Position position, String name, File imageSource, boolean backVisible) throws IOException {
|
||||
BufferedImage bufferedImage = ImageIO.read(imageSource);
|
||||
public CustomImageObject(Position position, String name, final File imageSource, boolean backVisible) throws IOException {
|
||||
|
||||
this.position = new ExtendedPosition(RoundUtils.round(position.getX()), RoundUtils.round(position.getY()), RoundUtils.round(position.getZ()), 0, 0);
|
||||
|
||||
this.name = name;
|
||||
this.backVisible = backVisible;
|
||||
|
||||
setImageFile(imageSource);
|
||||
}
|
||||
|
||||
@Getter @Setter private ExtendedPosition position;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private boolean backVisible;
|
||||
@Getter private File imageFile;
|
||||
|
||||
public void setImageFile(final File imageSource) throws IOException {
|
||||
this.imageFile = imageSource;
|
||||
|
||||
final BufferedImage bufferedImage = ImageIO.read(imageSource);
|
||||
|
||||
this.textureWidth = bufferedImage.getWidth();
|
||||
this.textureHeight = bufferedImage.getHeight();
|
||||
@@ -31,19 +49,18 @@ public class CustomImageObject implements GuiEntryListEntry {
|
||||
h = 1;
|
||||
}
|
||||
|
||||
this.position = new ExtendedPosition(position.getX(), position.getY(), position.getZ(), w, h);
|
||||
this.name = name;
|
||||
this.position.setWidth(w);
|
||||
this.position.setHeight(h);
|
||||
|
||||
this.resourceLocation = new ResourceLocation("customImages/"+imageSource.getAbsolutePath());
|
||||
this.dynamicTexture = new DynamicTexture(bufferedImage);
|
||||
|
||||
this.backVisible = backVisible;
|
||||
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
resourceLocation = new ResourceLocation("customImages/"+imageSource.getAbsolutePath());
|
||||
dynamicTexture = new DynamicTexture(bufferedImage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Getter @Setter private ExtendedPosition position;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private boolean backVisible;
|
||||
|
||||
private ResourceLocation resourceLocation;
|
||||
private DynamicTexture dynamicTexture;
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@ package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
public interface GuiEntryListEntry {
|
||||
|
||||
public String getDisplayString();
|
||||
String getDisplayString();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user