Created ReplayAsset interface and AssetRepository class which can contain such ReplayAssets. ReplayAssets allow users to add custom Files (so far only images, might be extended by .obj files) to the Replay which will later be used for CustomImageObjects.
Created GuiReplayManager to allow users to manage their assets. Created BoundingUtils class to provide a simple method to fit an image into given bounds. This implementation fixes https://trello.com/c/WTnicWkJ/
This commit is contained in:
@@ -22,7 +22,7 @@ public class KeybindRegistry {
|
||||
public static final String KEY_PLAY_PAUSE = "replaymod.input.playpause";
|
||||
public static final String KEY_ADD_MARKER = "replaymod.input.marker";
|
||||
public static final String KEY_PATH_PREVIEW = "replaymod.input.pathpreview";
|
||||
public static final String KEY_ADD_ASSETS = "replaymod.input.addassets";
|
||||
public static final String KEY_ASSET_MANAGER = "replaymod.input.assetmanager";
|
||||
private static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public static void initialize() {
|
||||
@@ -40,7 +40,7 @@ public class KeybindRegistry {
|
||||
bindings.add(new KeyBinding(KEY_ROLL_COUNTERCLOCKWISE, Keyboard.KEY_J, "replaymod.title"));
|
||||
bindings.add(new KeyBinding(KEY_PLAY_PAUSE, Keyboard.KEY_P, "replaymod.title"));
|
||||
bindings.add(new KeyBinding(KEY_PATH_PREVIEW, Keyboard.KEY_H, "replaymod.title"));
|
||||
bindings.add(new KeyBinding(KEY_ADD_ASSETS, Keyboard.KEY_G, "replaymod.title"));
|
||||
bindings.add(new KeyBinding(KEY_ASSET_MANAGER, Keyboard.KEY_G, "replaymod.title"));
|
||||
|
||||
mc.gameSettings.keyBindings = bindings.toArray(new KeyBinding[bindings.size()]);
|
||||
|
||||
|
||||
@@ -30,9 +30,14 @@ public class ResourceHelper {
|
||||
return openResources.contains(loc);
|
||||
}
|
||||
|
||||
public static void freeResource(ResourceLocation loc) {
|
||||
Minecraft.getMinecraft().getTextureManager().deleteTexture(loc);
|
||||
openResources.remove(loc);
|
||||
public static void freeResource(final ResourceLocation loc) {
|
||||
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Minecraft.getMinecraft().getTextureManager().deleteTexture(loc);
|
||||
openResources.remove(loc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void freeAllResources() {
|
||||
|
||||
Reference in New Issue
Block a user