Compare commits
30 Commits
1.11-2.0.0
...
1.11.2-2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33cb1405d5 | ||
|
|
b6cf42c3be | ||
|
|
c6dec95a57 | ||
|
|
4fdfa9ec87 | ||
|
|
44d4a250eb | ||
|
|
01acbc6f1f | ||
|
|
1c606874ff | ||
|
|
d9b796db5e | ||
|
|
6bbff3bba7 | ||
|
|
6f3ac71a8b | ||
|
|
503b308043 | ||
|
|
b0a1cdfce2 | ||
|
|
d46589193e | ||
|
|
1b099f9ef6 | ||
|
|
03534c6515 | ||
|
|
4388d6977d | ||
|
|
7ad19aa025 | ||
|
|
655bea0b2d | ||
|
|
458dad6f9a | ||
|
|
eb5ccb2fd5 | ||
|
|
6498d625ad | ||
|
|
2c898a8192 | ||
|
|
5d520a5a3c | ||
|
|
c681742a69 | ||
|
|
7b491d188d | ||
|
|
fbf165e618 | ||
|
|
fb4140a123 | ||
|
|
905ae75330 | ||
|
|
72e1fe0d6c | ||
|
|
6163585fe5 |
@@ -3,8 +3,10 @@ pipeline:
|
|||||||
image: plugins/git
|
image: plugins/git
|
||||||
tags: true
|
tags: true
|
||||||
build:
|
build:
|
||||||
image: openjdk:8
|
image: maven:3.3.9-jdk-8
|
||||||
commands:
|
commands:
|
||||||
|
- curl --fail --create-dirs -o $HOME/.gradle/init.d/mirror.gradle https://maven.johni0702.de/config/gradle
|
||||||
|
- curl --fail --create-dirs -o $HOME/.m2/settings.xml https://maven.johni0702.de/config/maven
|
||||||
- JAVA_OPTS=-Xmx1516M ./gradlew setupDecompWorkspace
|
- JAVA_OPTS=-Xmx1516M ./gradlew setupDecompWorkspace
|
||||||
- ./gradlew :build
|
- ./gradlew :build
|
||||||
archive:
|
archive:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgY2xvbmU6CiAgICBpbWFnZTogcGx1Z2lucy9naXQKICAgIHRhZ3M6IHRydWUKICBidWlsZDoKICAgIGltYWdlOiBvcGVuamRrOjgKICAgIGNvbW1hbmRzOgogICAgICAtIEpBVkFfT1BUUz0tWG14MTUxNk0gLi9ncmFkbGV3IHNldHVwRGVjb21wV29ya3NwYWNlCiAgICAgIC0gLi9ncmFkbGV3IDpidWlsZAogIGFyY2hpdmU6CiAgICBpbWFnZTogcGx1Z2lucy9zMwogICAgYWNsOiBwdWJsaWMtcmVhZAogICAgcmVnaW9uOiAidXMtZWFzdC0xIgogICAgYnVja2V0OiAicmVwbGF5bW9kIgogICAgcGF0aF9zdHlsZTogdHJ1ZQogICAgc291cmNlOiBidWlsZC9saWJzLyoKICAgIHN0cmlwX3ByZWZpeDogYnVpbGQvbGlicy8KICAgIHRhcmdldDogLwo.Q_jQxd73CuNh8ZTGTw31yMmBIzWprIagmaddFYovDrc
|
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgY2xvbmU6CiAgICBpbWFnZTogcGx1Z2lucy9naXQKICAgIHRhZ3M6IHRydWUKICBidWlsZDoKICAgIGltYWdlOiBtYXZlbjozLjMuOS1qZGstOAogICAgY29tbWFuZHM6CiAgICAgIC0gY3VybCAtLWZhaWwgLS1jcmVhdGUtZGlycyAtbyAkSE9NRS8uZ3JhZGxlL2luaXQuZC9taXJyb3IuZ3JhZGxlIGh0dHBzOi8vbWF2ZW4uam9obmkwNzAyLmRlL2NvbmZpZy9ncmFkbGUKICAgICAgLSBjdXJsIC0tZmFpbCAtLWNyZWF0ZS1kaXJzIC1vICRIT01FLy5tMi9zZXR0aW5ncy54bWwgaHR0cHM6Ly9tYXZlbi5qb2huaTA3MDIuZGUvY29uZmlnL21hdmVuCiAgICAgIC0gSkFWQV9PUFRTPS1YbXgxNTE2TSAuL2dyYWRsZXcgc2V0dXBEZWNvbXBXb3Jrc3BhY2UKICAgICAgLSAuL2dyYWRsZXcgOmJ1aWxkCiAgYXJjaGl2ZToKICAgIGltYWdlOiBwbHVnaW5zL3MzCiAgICBhY2w6IHB1YmxpYy1yZWFkCiAgICByZWdpb246ICJ1cy1lYXN0LTEiCiAgICBidWNrZXQ6ICJyZXBsYXltb2QiCiAgICBwYXRoX3N0eWxlOiB0cnVlCiAgICBzb3VyY2U6IGJ1aWxkL2xpYnMvKgogICAgc3RyaXBfcHJlZml4OiBidWlsZC9saWJzLwogICAgdGFyZ2V0OiAvCg.nzPW0_TpMIjnFZZ5Ci439QDKlaDo1a3DCH-VCYUgpx8
|
||||||
@@ -36,9 +36,11 @@ archivesBaseName = "replaymod"
|
|||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
coreMod = 'com.replaymod.core.LoadingPlugin'
|
coreMod = 'com.replaymod.core.LoadingPlugin'
|
||||||
version = '1.11-13.19.1.2188'
|
version = '1.11.2-13.20.0.2216'
|
||||||
runDir = "eclipse"
|
runDir = "eclipse"
|
||||||
mappings = "snapshot_20161111"
|
mappings = "snapshot_20161220"
|
||||||
|
replace '@MOD_VERSION@', project.version
|
||||||
|
replace '@MC_VERSION@', project.minecraft.version
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -59,7 +61,7 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.projectlombok:lombok:1.16.4'
|
compile 'org.projectlombok:lombok:1.16.4'
|
||||||
|
|
||||||
compile 'org.spongepowered:mixin:0.5.9-SNAPSHOT'
|
compile 'org.spongepowered:mixin:0.6.4-SNAPSHOT'
|
||||||
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
|
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
|
||||||
shade 'org.apache.commons:commons-exec:1.3'
|
shade 'org.apache.commons:commons-exec:1.3'
|
||||||
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
|
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'
|
||||||
|
|||||||
@@ -2,7 +2,14 @@
|
|||||||
## Installing the Replay Mod [replaymod]
|
## Installing the Replay Mod [replaymod]
|
||||||
The **ReplayMod** requires **Minecraft Forge** to be installed.
|
The **ReplayMod** requires **Minecraft Forge** to be installed.
|
||||||
|
|
||||||
For the use with the **Replay Mod**, we recommend using Forge Version `1.8-11.14.3.1450`, which can be downloaded [here](http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.html)
|
Depending on your **Replay Mod** version we recommend the following **Forge** versions:
|
||||||
|
|
||||||
|
- Replay Mod 2.0.0 or later for Minecraft 1.11: Forge [1.11-13.19.1.2189](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.11.html)
|
||||||
|
- Replay Mod 2.0.0 or later for Minecraft 1.10.2: Forge [1.10.2-12.18.2.2099](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.10.2.html)
|
||||||
|
- Replay Mod 2.0.0 or later for Minecraft 1.9.4: Forge [1.9.4-12.17.0.1976](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.9.4.html)
|
||||||
|
- Replay Mod 2.0.0 or later for Minecraft 1.8: Forge [1.8-11.14.4.1563](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.html)
|
||||||
|
- Replay Mod 1.0.8 or older for Minecraft 1.8: Forge [1.8-11.14.3.1450](http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.html)
|
||||||
|
|
||||||
Other Forge Versions might, but don't necessarily work.
|
Other Forge Versions might, but don't necessarily work.
|
||||||
|
|
||||||
If you don't know how to install Forge, follow [this tutorial](https://www.youtube.com/watch?v=4i7-RystzC4).
|
If you don't know how to install Forge, follow [this tutorial](https://www.youtube.com/watch?v=4i7-RystzC4).
|
||||||
@@ -25,6 +32,10 @@ Next, download this **Batch Script** to quickly install FFmpeg: <https://replaym
|
|||||||
Put the downloaded script into the folder where you extracted FFmpeg and run itt by double-clicking it.
|
Put the downloaded script into the folder where you extracted FFmpeg and run itt by double-clicking it.
|
||||||
If you see a success message in the console, you've sucessfully installed **FFmpeg**!
|
If you see a success message in the console, you've sucessfully installed **FFmpeg**!
|
||||||
|
|
||||||
|
Alternatively, starting with ReplayMod 2.0.0-b5, you can also extract the downloaded `.7z` file into a `ffmpeg` folder
|
||||||
|
(you have to create it, it doesn't exist by default) in your `.minecraft` folder. No need to run any **Batch Script**.
|
||||||
|
The FFmpeg executable should end up at `.minecraft/ffmpeg/bin/ffmpeg.exe`.
|
||||||
|
|
||||||
### Mac OSX [mac]
|
### Mac OSX [mac]
|
||||||
On OSX, you can install **FFmpeg** with **[Homebrew](http://brew.sh/)** using `brew install ffmpeg`.
|
On OSX, you can install **FFmpeg** with **[Homebrew](http://brew.sh/)** using `brew install ffmpeg`.
|
||||||
|
|
||||||
@@ -37,26 +48,35 @@ If in doubt, consult the documentation of your distribution.
|
|||||||
## Compatibility with other Mods [compatibility]
|
## Compatibility with other Mods [compatibility]
|
||||||
### General information [general]
|
### General information [general]
|
||||||
In General, the Replay Mod _should_ be compatible with most Forge Mods.
|
In General, the Replay Mod _should_ be compatible with most Forge Mods.
|
||||||
However, due to the way that recording works, many Mods that add new Blocks, Mobs or Game Mechanics are not supported.
|
|
||||||
Mods that simply modify the client (like the [PixelCam Mod](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2327429-pixelcam-camera-studio-for-minecraft-1-8)
|
|
||||||
or the [CommandGroups Mod](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2443430-command-groups-mod-order-label-and-color-command)) usually work.
|
|
||||||
|
|
||||||
### Optifine [optifine]
|
|
||||||
The **Replay Mod** is compatible with `Optifine 1.8.0 HD U D5`, which can be downloaded at <https://optifine.net/downloads>.
|
|
||||||
Other Optifine versions for Minecraft 1.8.0 might, but don't have to be compatible as well.
|
|
||||||
|
|
||||||
> **Warning:** If you have Optifine installed, you **can not render videos** from within the Replay Mod.
|
|
||||||
This might change in future Replay Mod versions.
|
|
||||||
|
|
||||||
### Shaders Mod [shaders]
|
### Shaders Mod [shaders]
|
||||||
You can use the Replay Mod together with [karyonix' Shaders Mod](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1286604-shaders-mod-updated-by-karyonix),
|
[Karyonix' Shaders Mod](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1286604-shaders-mod-updated-by-karyonix)
|
||||||
but rendering videos results in **possible crashes** and **malformed videos**.
|
is no longer compatible with Minecraft Forge starting with 1.9.4. As such it is not compatible with the Replay Mod either.
|
||||||
Therefore, you have to **uninstall the Shaders Mod before rendering**.
|
Please use [Optifine](https://optifine.net/) instead.
|
||||||
|
|
||||||
|
### Custom Main Menu [custom-main-menu]
|
||||||
|
The [Custom Main Menu](https://mods.curse.com/mc-mods/minecraft/226406-custom-main-menu) mod is often used in mod packs to customize their Main Menu with a button layout fitting the background image, links to their website / bug tracker and similar.
|
||||||
|
If you are familiar with it, the button ids for the Replay Mod are: **17890234** (text: `replaymod.gui.replayviewer`), **17890235** (text: `replaymod.gui.replayviewer`) and **17890236** (text: `replaymod.gui.replaycenter`)
|
||||||
|
|
||||||
|
Due to the nature of this Custom Main Menu mod, buttons added to the Main Menu by 3rd party mods like the **Replay Mod** will not show up by default.
|
||||||
|
Thus, to access the Replay Viewer/Editor/Center, you need to manually configure the position for those buttons.
|
||||||
|
To do so, you need to modify the Custom Main Menu configuration file.
|
||||||
|
Usually, you can find it at `.minecraft/config/CustomMainMenu/mainmenu.json` (if you're using a mod pack launcher, it normally has its own .minecraft folder).
|
||||||
|
For an explanation of this config file, have a look at Custom Main Menu's page.
|
||||||
|
|
||||||
|
You can find a list of already modified config files [here](https://gist.github.com/Johni0702/3f3fab81dbf7ada83d045d9fe8f345aa).
|
||||||
|
|
||||||
## Troubleshooting [troubleshooting]
|
## Troubleshooting [troubleshooting]
|
||||||
If you need help installing the **Replay Mod** or **FFmpeg**, please read [this forum thread](https://www.replaymod.com/forum/thread/220)
|
If you need help installing the **Replay Mod** or **FFmpeg**, please read [this forum thread](https://www.replaymod.com/forum/thread/220)
|
||||||
by [bela333](https://www.replaymod.com/user/bela333) - it covers most of the problems that users encountered so far.
|
by [bela333](https://www.replaymod.com/user/bela333) - it covers most of the problems that users encountered so far.
|
||||||
|
|
||||||
|
## Settings [settings]
|
||||||
|
To access the **Replay Mod Settings** from the Main Menu click the **"Mods"** button, select the **Replay Mod** from the list and
|
||||||
|
the click the **"Config"** button.
|
||||||
|
|
||||||
|
When in a Replay, you can either bind a hotkey to the **Replay Mod Settings** in Minecraft's Control settings
|
||||||
|
or use the hotkey GUI by clicking on the arrow button in the lower left corner.
|
||||||
|
|
||||||
# Recording [recording]
|
# Recording [recording]
|
||||||

|

|
||||||
The **Recording Indicator** which is displayed while recording
|
The **Recording Indicator** which is displayed while recording
|
||||||
@@ -88,6 +108,8 @@ You can move through block similar to Spectator Mode.
|
|||||||
|
|
||||||
Using the **Mouse Wheel**, you can modify your flying speed. Scrolling **up** causes you to fly faster, while scrolling **down** slows you down.
|
Using the **Mouse Wheel**, you can modify your flying speed. Scrolling **up** causes you to fly faster, while scrolling **down** slows you down.
|
||||||
|
|
||||||
|
If you prefer the camera to be controlled similar to vanilla Creative Mode, you can change that in the **Replay Settings**.
|
||||||
|
|
||||||
### Camera Roll [roll]
|
### Camera Roll [roll]
|
||||||

|

|
||||||
A Screenshot taken with a **tilted camera**
|
A Screenshot taken with a **tilted camera**
|
||||||
@@ -251,13 +273,15 @@ The **Keyframe Repository** with two **Path Presets**
|
|||||||
|
|
||||||
Using the `X` key, you can open the **Keyframe Repository**. Every Replay File has a separate Keyframe Repository which can contain several **Keyframe Presets**.
|
Using the `X` key, you can open the **Keyframe Repository**. Every Replay File has a separate Keyframe Repository which can contain several **Keyframe Presets**.
|
||||||
|
|
||||||
To save the Keyframes currently on your Timeline, click the **"Save current Path"** button.
|
To save the Keyframes currently on your Timeline, click the **"Save as..."** button.
|
||||||
You can change the Preset's name using the Text Input Field in the upper right corner.
|
You can change a Preset's name, select it from the list and click the **"Rename"** button.
|
||||||
To load a Keyframe Preset, select a Preset from the list on the left side and click the **"Load"** button.
|
To load a Keyframe Preset, select a Preset from the list and click the **"Load"** button.
|
||||||
Using the **"Remove"** button, you can permanently delete a Keyframe Preset from the **Keyframe Repository**.
|
Using the **"Remove"** button, you can permanently delete a Keyframe Preset from the **Keyframe Repository**.
|
||||||
|
|
||||||
## Custom Objects [objects]
|
## Custom Objects [objects]
|
||||||
|
|
||||||
|
> Custom Objects are not available in the 2.0.0 versions. They are expected to return eventually.
|
||||||
|
|
||||||
[YouTube](_Xdpg828fbE)
|
[YouTube](_Xdpg828fbE)
|
||||||
|
|
||||||
### Introduction [introduction]
|
### Introduction [introduction]
|
||||||
@@ -416,12 +440,10 @@ There are **7 Encoding Presets** you can choose from:
|
|||||||
|
|
||||||
### Advanced Settings [advanced]
|
### Advanced Settings [advanced]
|
||||||

|

|
||||||
The **Advanced Render Settings** Screen
|
The **Advanced Render Settings**
|
||||||
|
|
||||||
By clicking the **"Advanced Settings" Button** in the lower right corner, you can access more settings.
|
#### Render Nametags [nametags]
|
||||||
|
If you don't want to see Entity's Nametags in the rendered video, simply un-tick the checkbox. Hidden Nametags also include Nametags of **Armor Stands** and **Mobs**, **not only Players**!
|
||||||
#### Hide Nametags [nametags]
|
|
||||||
If you don't want to see Entity's Nametags in the rendered video, simply tick the checkbox. Hidden Nametags also include Nametags of **Armor Stands** and **Mobs**, **not only Players**!
|
|
||||||
|
|
||||||
#### Stabilize Camera [stabilize]
|
#### Stabilize Camera [stabilize]
|
||||||
This setting is only applicable for **Cubic Rendering** and **Equirectangular Rendering**.
|
This setting is only applicable for **Cubic Rendering** and **Equirectangular Rendering**.
|
||||||
@@ -443,14 +465,14 @@ Using a **Video Editing Software** like **Adobe After Effects** or **Sony Vegas*
|
|||||||
|
|
||||||
### Command Line Settings [commandline]
|
### Command Line Settings [commandline]
|
||||||

|

|
||||||
The **Command Line Render Settings** Screen
|
The **Command Line Render Settings**
|
||||||
|
|
||||||
|
|
||||||
> **Note**: This is for advanced users only. If you do not know what your're doing, leave these settings as they are.
|
> **Note**: This is for advanced users only. If you do not know what your're doing, leave these settings as they are.
|
||||||
|
|
||||||
The **Replay Mod** runs [FFmpeg](http://ffmpeg.org/) via the **Command Line** to encode videos.
|
The **Replay Mod** runs [FFmpeg](http://ffmpeg.org/) via the **Command Line** to encode videos.
|
||||||
|
|
||||||
You can customize both the **executed Command** and the **Command Line Arguments** in the **Command Line Settings** Tag of the **Render Settings Screen**.
|
You can customize both the **executed Command** and the **Command Line Arguments** in the **Command Line Settings** part of the **Render Settings Screen**.
|
||||||
|
|
||||||
#### Custom Command [command]
|
#### Custom Command [command]
|
||||||
If you leave the left input field blank, `ffmpeg` will be used as **command**. If you haven't set your **PATH variable** to link to your FFmpeg distribution, simply enter the full path to your FFmpeg executable (e.g. `C:/ffmpeg/ffmpeg.exe` or `/usr/local/bin/ffmpeg`).
|
If you leave the left input field blank, `ffmpeg` will be used as **command**. If you haven't set your **PATH variable** to link to your FFmpeg distribution, simply enter the full path to your FFmpeg executable (e.g. `C:/ffmpeg/ffmpeg.exe` or `/usr/local/bin/ffmpeg`).
|
||||||
@@ -532,7 +554,7 @@ By clicking on a player's **Name or Head**, you can **spectate** this player.
|
|||||||
|
|
||||||
Next to each player, there's a **checkbox** using which you can toggle the player's **visibility**.
|
Next to each player, there's a **checkbox** using which you can toggle the player's **visibility**.
|
||||||
This way, you can hide certain players from the Replay.
|
This way, you can hide certain players from the Replay.
|
||||||
Above the individual checkboxes, there are two checkbox buttons - one to **hide all players** and one to **show all players**.
|
Below the individual checkboxes, there are two checkbox buttons - one to **hide all players** and one to **show all players**.
|
||||||
|
|
||||||
If you want to **save the player visibility settings**, check **"Remember Hidden Players" checkbox**.
|
If you want to **save the player visibility settings**, check **"Remember Hidden Players" checkbox**.
|
||||||
If checked, invisible players will stay invisible after closing the Replay (this can of course be reverted),
|
If checked, invisible players will stay invisible after closing the Replay (this can of course be reverted),
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 51 KiB |
BIN
docs/img/player-overview.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 85 KiB |
BIN
docs/img/rendersettings-advanced.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 108 KiB |
BIN
docs/img/rendersettings-commandline.png
Normal file
|
After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 110 KiB |
BIN
docs/img/rendersettings-video.png
Normal file
|
After Width: | Height: | Size: 140 KiB |
2
jGui
@@ -2,19 +2,18 @@ package com.replaymod.compat;
|
|||||||
|
|
||||||
import com.replaymod.compat.optifine.DisableFastRender;
|
import com.replaymod.compat.optifine.DisableFastRender;
|
||||||
import com.replaymod.compat.shaders.ShaderBeginRender;
|
import com.replaymod.compat.shaders.ShaderBeginRender;
|
||||||
import com.replaymod.core.ReplayMod;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventBus;
|
import net.minecraftforge.fml.common.eventhandler.EventBus;
|
||||||
|
|
||||||
@Mod(modid = ReplayModCompat.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModCompat.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModCompat {
|
public class ReplayModCompat {
|
||||||
public static final String MOD_ID = "replaymod-compat";
|
public static final String MOD_ID = "replaymod-compat";
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
EventBus bus = MinecraftForge.EVENT_BUS;
|
EventBus bus = MinecraftForge.EVENT_BUS;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.replaymod.compat.shaders.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Pseudo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Pseudo
|
||||||
|
@Mixin(targets = "shadersmod/client/ShadersRender", remap = false)
|
||||||
|
public abstract class MixinShadersRender {
|
||||||
|
|
||||||
|
@Inject(method = "renderHand0", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void replayModCompat_disableRenderHand0(EntityRenderer er, float partialTicks, int renderPass, CallbackInfo ci) {
|
||||||
|
if (ForgeHooksClient.renderFirstPersonHand(er.mc.renderGlobal, partialTicks, renderPass)) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,6 +34,8 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mod(modid = ReplayMod.MOD_ID,
|
@Mod(modid = ReplayMod.MOD_ID,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
updateJSON = "https://raw.githubusercontent.com/ReplayMod/ReplayMod/master/versions.json",
|
updateJSON = "https://raw.githubusercontent.com/ReplayMod/ReplayMod/master/versions.json",
|
||||||
guiFactory = "com.replaymod.core.gui.GuiFactory")
|
guiFactory = "com.replaymod.core.gui.GuiFactory")
|
||||||
public class ReplayMod {
|
public class ReplayMod {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Restrictions {
|
|||||||
public String handle(SPacketCustomPayload packet) {
|
public String handle(SPacketCustomPayload packet) {
|
||||||
PacketBuffer buffer = packet.getBufferData();
|
PacketBuffer buffer = packet.getBufferData();
|
||||||
while (buffer.isReadable()) {
|
while (buffer.isReadable()) {
|
||||||
String name = buffer.readStringFromBuffer(64);
|
String name = buffer.readString(64);
|
||||||
boolean active = buffer.readBoolean();
|
boolean active = buffer.readBoolean();
|
||||||
// if ("no_xray".equals(name)) {
|
// if ("no_xray".equals(name)) {
|
||||||
// noXray = active;
|
// noXray = active;
|
||||||
|
|||||||
@@ -1,17 +1,41 @@
|
|||||||
package com.replaymod.core.utils;
|
package com.replaymod.core.utils;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
|
import de.johni0702.minecraft.gui.container.AbstractGuiScrollable;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiContainer;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiScrollable;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiElement;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
|
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.VerticalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.popup.GuiInfoPopup;
|
||||||
|
import de.johni0702.minecraft.gui.utils.Colors;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.util.Dimension;
|
import org.lwjgl.util.Dimension;
|
||||||
import org.lwjgl.util.ReadableDimension;
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static net.minecraft.client.Minecraft.getMinecraft;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
public static final BufferedImage DEFAULT_THUMBNAIL;
|
public static final BufferedImage DEFAULT_THUMBNAIL;
|
||||||
@@ -63,7 +87,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ResourceLocation getResourceLocationForPlayerUUID(UUID uuid) {
|
public static ResourceLocation getResourceLocationForPlayerUUID(UUID uuid) {
|
||||||
NetworkPlayerInfo info = Minecraft.getMinecraft().getConnection().getPlayerInfo(uuid);
|
NetworkPlayerInfo info = getMinecraft().getConnection().getPlayerInfo(uuid);
|
||||||
ResourceLocation skinLocation;
|
ResourceLocation skinLocation;
|
||||||
if (info != null && info.hasLocationSkin()) {
|
if (info != null && info.hasLocationSkin()) {
|
||||||
skinLocation = info.getLocationSkin();
|
skinLocation = info.getLocationSkin();
|
||||||
@@ -76,4 +100,80 @@ public class Utils {
|
|||||||
public static boolean isCtrlDown() {
|
public static boolean isCtrlDown() {
|
||||||
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GuiInfoPopup error(Logger logger, GuiContainer container, CrashReport crashReport, Runnable onClose) {
|
||||||
|
// Convert crash report to string
|
||||||
|
String crashReportStr = crashReport.getCompleteReport();
|
||||||
|
|
||||||
|
// Log via logger
|
||||||
|
logger.error(crashReportStr);
|
||||||
|
|
||||||
|
// Try to save the crash report
|
||||||
|
if (crashReport.getFile() == null) {
|
||||||
|
try {
|
||||||
|
File folder = new File(getMinecraft().mcDataDir, "crash-reports");
|
||||||
|
File file = new File(folder, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
|
||||||
|
logger.debug("Saving crash report to file: {}", file);
|
||||||
|
crashReport.saveToFile(file);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
logger.error("Saving crash report file:", t);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("Not saving crash report as file already exists: {}", crashReport.getFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.trace("Opening crash report popup GUI");
|
||||||
|
GuiCrashReportPopup popup = new GuiCrashReportPopup(container, crashReportStr);
|
||||||
|
Futures.addCallback(popup.getFuture(), new FutureCallback<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nullable Void result) {
|
||||||
|
logger.trace("Crash report popup closed");
|
||||||
|
if (onClose != null) {
|
||||||
|
onClose.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
logger.error("During error popup:", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class GuiCrashReportPopup extends GuiInfoPopup {
|
||||||
|
private final GuiScrollable scrollable;
|
||||||
|
|
||||||
|
public GuiCrashReportPopup(GuiContainer container, String crashReport) {
|
||||||
|
super(container);
|
||||||
|
setBackgroundColor(Colors.DARK_TRANSPARENT);
|
||||||
|
|
||||||
|
// Add crash report to scrollable info
|
||||||
|
getInfo().addElements(new VerticalLayout.Data(0.5),
|
||||||
|
new GuiLabel().setColor(Colors.BLACK).setI18nText("replaymod.gui.unknownerror"),
|
||||||
|
scrollable = new GuiScrollable().setScrollDirection(AbstractGuiScrollable.Direction.VERTICAL)
|
||||||
|
.setLayout(new VerticalLayout().setSpacing(2))
|
||||||
|
.addElements(null,Arrays.stream(crashReport.replace("\t", " ").split("\n")).map(
|
||||||
|
l -> new GuiLabel().setText(l).setColor(Colors.BLACK)).toArray(GuiElement[]::new)));
|
||||||
|
|
||||||
|
// Replace close button with panel containing close and copy buttons
|
||||||
|
GuiButton copyToClipboardButton = new GuiButton().setI18nLabel("chat.copy").onClick(() ->
|
||||||
|
GuiScreen.setClipboardString(crashReport)).setSize(150, 20);
|
||||||
|
GuiButton closeButton = getCloseButton();
|
||||||
|
popup.removeElement(closeButton);
|
||||||
|
popup.addElements(new VerticalLayout.Data(1),
|
||||||
|
new GuiPanel().setLayout(new HorizontalLayout().setSpacing(5)).setSize(305, 20)
|
||||||
|
.addElements(null, copyToClipboardButton, closeButton));
|
||||||
|
|
||||||
|
// And open it
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||||
|
// Re-size the scrollable containing the crash report to 3/4 of the screen
|
||||||
|
scrollable.setSize(size.getWidth() * 3 / 4, size.getHeight() * 3 / 4);
|
||||||
|
super.draw(renderer, size, renderInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
41
src/main/java/com/replaymod/editor/ReplayModEditor.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package com.replaymod.editor;
|
||||||
|
|
||||||
|
import com.replaymod.core.ReplayMod;
|
||||||
|
import com.replaymod.editor.handler.GuiHandler;
|
||||||
|
import com.replaymod.online.Setting;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@Mod(modid = ReplayModEditor.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
|
public class ReplayModEditor {
|
||||||
|
public static final String MOD_ID = "replaymod-editor";
|
||||||
|
|
||||||
|
@Mod.Instance(MOD_ID)
|
||||||
|
public static ReplayModEditor instance;
|
||||||
|
|
||||||
|
private ReplayMod core;
|
||||||
|
|
||||||
|
public static Logger LOGGER;
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
ReplayModEditor.LOGGER = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
|
|
||||||
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void init(FMLInitializationEvent event) {
|
||||||
|
new GuiHandler(this).register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplayMod getCore() {
|
||||||
|
return core;
|
||||||
|
}
|
||||||
|
}
|
||||||
360
src/main/java/com/replaymod/editor/gui/GuiReplayEditor.java
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
package com.replaymod.editor.gui;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.replaymod.core.ReplayMod;
|
||||||
|
import com.replaymod.core.utils.Utils;
|
||||||
|
import com.replaymod.replaystudio.PacketData;
|
||||||
|
import com.replaymod.replaystudio.Studio;
|
||||||
|
import com.replaymod.replaystudio.filter.StreamFilter;
|
||||||
|
import com.replaymod.replaystudio.io.ReplayInputStream;
|
||||||
|
import com.replaymod.replaystudio.io.ReplayOutputStream;
|
||||||
|
import com.replaymod.replaystudio.replay.ReplayFile;
|
||||||
|
import com.replaymod.replaystudio.replay.ReplayMetaData;
|
||||||
|
import com.replaymod.replaystudio.replay.ZipReplayFile;
|
||||||
|
import com.replaymod.replaystudio.stream.PacketStream;
|
||||||
|
import com.replaymod.replaystudio.studio.ReplayStudio;
|
||||||
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiContainer;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiTextField;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
||||||
|
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
|
||||||
|
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.GridLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.VerticalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
|
||||||
|
import de.johni0702.minecraft.gui.popup.GuiInfoPopup;
|
||||||
|
import de.johni0702.minecraft.gui.popup.GuiYesNoPopup;
|
||||||
|
import de.johni0702.minecraft.gui.utils.Colors;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import static com.replaymod.editor.ReplayModEditor.LOGGER;
|
||||||
|
|
||||||
|
public class GuiReplayEditor extends GuiScreen {
|
||||||
|
private final ReplayMod mod;
|
||||||
|
|
||||||
|
private volatile ProcessingStage processingStage;
|
||||||
|
private volatile double progress;
|
||||||
|
private GuiProcessingProgressPopup popup;
|
||||||
|
|
||||||
|
public GuiButton currentTabButton;
|
||||||
|
public GuiPanel currentTabPanel;
|
||||||
|
|
||||||
|
public final GuiPanel tabButtons = new GuiPanel(this).setLayout(new GridLayout().setSpacingX(5));
|
||||||
|
public final List<GuiPanel> tabPanels = new ArrayList<>();
|
||||||
|
|
||||||
|
public final GuiButton saveButton = new GuiButton().setI18nLabel("replaymod.gui.save").setSize(100, 20);
|
||||||
|
public final GuiButton backButton = new GuiButton().setI18nLabel("replaymod.gui.back").setSize(100, 20);
|
||||||
|
|
||||||
|
public final GuiPanel buttonPanel = new GuiPanel(this).setLayout(new HorizontalLayout().setSpacing(5))
|
||||||
|
.addElements(null, saveButton, backButton);
|
||||||
|
|
||||||
|
public GuiReplayEditor(GuiScreen parent, ReplayMod mod) {
|
||||||
|
this.mod = mod;
|
||||||
|
backButton.onClick(parent::display);
|
||||||
|
|
||||||
|
setTitle(new GuiLabel().setI18nText("replaymod.gui.replayeditor"));
|
||||||
|
|
||||||
|
makeTab("trim", () -> new GuiTrimPanel(this));
|
||||||
|
makeTab("connect", GuiPanel::new).setDisabled(); // Not yet implemented
|
||||||
|
makeTab("modify", GuiPanel::new).setDisabled(); // Not yet implemented
|
||||||
|
|
||||||
|
setLayout(new CustomLayout<GuiScreen>() {
|
||||||
|
@Override
|
||||||
|
protected void layout(GuiScreen container, int width, int height) {
|
||||||
|
// Move all inactive panels aside
|
||||||
|
tabPanels.forEach(e -> pos(e, Integer.MIN_VALUE, Integer.MIN_VALUE));
|
||||||
|
|
||||||
|
pos(buttonPanel, width - 10 - width(buttonPanel), height - 10 - height(buttonPanel));
|
||||||
|
|
||||||
|
if (currentTabPanel != null) {
|
||||||
|
pos(currentTabPanel, 10, 50);
|
||||||
|
size(currentTabPanel, width - 20, y(buttonPanel) - 10 - y(currentTabPanel));
|
||||||
|
}
|
||||||
|
|
||||||
|
pos(tabButtons, 10, 20);
|
||||||
|
size(tabButtons, width - 20, 20);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiButton makeTab(String name, Supplier<GuiPanel> panel) {
|
||||||
|
GuiButton button = new GuiButton().setI18nLabel("replaymod.gui.editor." + name + ".title")
|
||||||
|
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.editor." + name + ".description"))
|
||||||
|
.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
|
button.onClick(() -> {
|
||||||
|
// Remove previous tab
|
||||||
|
if (currentTabButton != null) {
|
||||||
|
currentTabButton.setEnabled();
|
||||||
|
removeElement(currentTabPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate new tab
|
||||||
|
currentTabButton = button.setDisabled();
|
||||||
|
addElements(null, currentTabPanel = panel.get());
|
||||||
|
});
|
||||||
|
// Add new tab button to tabs panel
|
||||||
|
tabButtons.addElements(null, button);
|
||||||
|
((GridLayout) tabButtons.getLayout()).setColumns(tabButtons.getChildren().size());
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(File inputFile, PacketStream.FilterInfo...filters) {
|
||||||
|
save(FilenameUtils.getBaseName(inputFile.getName()), (outputFile) -> {
|
||||||
|
Studio studio = new ReplayStudio();
|
||||||
|
try (ReplayFile outputReplay = new ZipReplayFile(studio, inputFile, outputFile);
|
||||||
|
ReplayOutputStream out = outputReplay.writePacketData()) {
|
||||||
|
// The input replay file MUST be closed before saving the output file
|
||||||
|
try (ReplayFile inputReplay = new ZipReplayFile(studio, inputFile);
|
||||||
|
ReplayInputStream in = inputReplay.getPacketData()) {
|
||||||
|
ReplayMetaData metaData = inputReplay.getMetaData();
|
||||||
|
PacketStream stream = studio.createReplayStream(in, true);
|
||||||
|
|
||||||
|
stream.addFilter(new ProgressFilter(metaData.getDuration()));
|
||||||
|
for (PacketStream.FilterInfo info : filters) {
|
||||||
|
stream.addFilter(info.getFilter(), info.getFrom(), info.getTo());
|
||||||
|
LOGGER.debug("Added filter {}", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info("Built pipeline: {}", stream);
|
||||||
|
stream.start();
|
||||||
|
|
||||||
|
long lastTimestamp = 0;
|
||||||
|
|
||||||
|
PacketData data;
|
||||||
|
while ((data = stream.next()) != null) {
|
||||||
|
out.write(data);
|
||||||
|
lastTimestamp = data.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PacketData d : stream.end()) {
|
||||||
|
out.write(d);
|
||||||
|
lastTimestamp = d.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateProgress(ProcessingStage.FINALIZING, 0);
|
||||||
|
|
||||||
|
// Update duration of new replay
|
||||||
|
metaData.setDuration((int) lastTimestamp);
|
||||||
|
outputReplay.writeMetaData(metaData);
|
||||||
|
}
|
||||||
|
out.close();
|
||||||
|
outputReplay.save();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(String sourceName, Consumer<File> runnable) {
|
||||||
|
GuiTextField nameField = new GuiTextField().setSize(200, 20).setFocused(true).setText(sourceName);
|
||||||
|
GuiYesNoPopup popup = GuiYesNoPopup.open(this,
|
||||||
|
nameField
|
||||||
|
).setYesI18nLabel("replaymod.gui.editor.savemode.override").setNoI18nLabel("replaymod.gui.cancel");
|
||||||
|
nameField.onEnter(() -> {
|
||||||
|
if (popup.getYesButton().isEnabled()) {
|
||||||
|
popup.getYesButton().onClick();
|
||||||
|
}
|
||||||
|
}).onTextChanged(obj -> {
|
||||||
|
popup.getYesButton().setEnabled(!nameField.getText().isEmpty());
|
||||||
|
popup.setYesI18nLabel("replaymod.gui.editor.savemode." +
|
||||||
|
(nameField.getText().equals(sourceName) ? "override" : "newfile"));
|
||||||
|
});
|
||||||
|
Futures.addCallback(popup.getFuture(), new FutureCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nullable Boolean result) {
|
||||||
|
if (result == Boolean.TRUE) {
|
||||||
|
// Sanitize their input
|
||||||
|
String name = nameField.getText().trim().replace("[^a-zA-Z0-9\\.\\- ]", "_");
|
||||||
|
// This file is what they want
|
||||||
|
File replayFolder;
|
||||||
|
try {
|
||||||
|
replayFolder = mod.getReplayFolder();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Utils.error(LOGGER, GuiReplayEditor.this, CrashReport.makeCrashReport(e, "Getting replay folder"), null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File targetFile = new File(replayFolder, name + ".mcpr");
|
||||||
|
if (targetFile.exists()) {
|
||||||
|
LOGGER.trace("Selected file already exists, asking for confirmation");
|
||||||
|
Futures.addCallback(GuiYesNoPopup.open(GuiReplayEditor.this,
|
||||||
|
new GuiLabel().setColor(Colors.BLACK)
|
||||||
|
.setI18nText("replaymod.gui.replaymodified.warning1", name),
|
||||||
|
new GuiLabel().setColor(Colors.BLACK)
|
||||||
|
.setI18nText("replaymod.gui.replaymodified.warning2"))
|
||||||
|
.setYesI18nLabel("gui.yes").setNoI18nLabel("gui.no")
|
||||||
|
.getFuture(), new FutureCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nullable Boolean result) {
|
||||||
|
if (result == Boolean.TRUE) {
|
||||||
|
LOGGER.trace("Saving output in {}", targetFile);
|
||||||
|
runEdit(() -> runnable.accept(targetFile));
|
||||||
|
} else {
|
||||||
|
LOGGER.trace("Not overwriting file {}, reopening naming dialog", targetFile);
|
||||||
|
save(sourceName, runnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
LOGGER.error("During save file confirmation dialog:", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
LOGGER.trace("Saving output in {}", targetFile);
|
||||||
|
runEdit(() -> runnable.accept(targetFile));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOGGER.trace("Saving cancelled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
LOGGER.error("During save file dialog:", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runEdit(Runnable runnable) {
|
||||||
|
popup = new GuiProcessingProgressPopup(this);
|
||||||
|
processingStage = ProcessingStage.INITIALIZING;
|
||||||
|
progress = 0;
|
||||||
|
new Thread(() -> {
|
||||||
|
LOGGER.info("Starting editing of replay");
|
||||||
|
try {
|
||||||
|
runnable.run();
|
||||||
|
} catch (Throwable t) {
|
||||||
|
CrashReport crashReport = CrashReport.makeCrashReport(t, "Editing replay file");
|
||||||
|
mod.runLater(() -> Utils.error(LOGGER, this, crashReport, popup::close));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOGGER.info("Successfully finished editing");
|
||||||
|
mod.runLater(() -> {
|
||||||
|
popup.close();
|
||||||
|
GuiInfoPopup.open(this, "replaymod.gui.editor.progress.status.finished");
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateProgress(ProcessingStage stage, double progress) {
|
||||||
|
if (this.processingStage != stage) {
|
||||||
|
LOGGER.trace("Changing state from {} to {}", this.processingStage, stage);
|
||||||
|
}
|
||||||
|
this.processingStage = stage;
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplayMod getMod() {
|
||||||
|
return mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ProcessingStage {
|
||||||
|
INITIALIZING("initializing", 0.01),
|
||||||
|
WORKING("writing.raw", 0.89),
|
||||||
|
FINALIZING("writing.final", 0.1),
|
||||||
|
DONE("finished", 0);
|
||||||
|
|
||||||
|
private final String i18nKey;
|
||||||
|
private final double progressFraction;
|
||||||
|
|
||||||
|
ProcessingStage(String i18nKey, double progressFraction) {
|
||||||
|
this.i18nKey = "replaymod.gui.editor.progress.status." + i18nKey;
|
||||||
|
this.progressFraction = progressFraction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getOverallProgress(double progress) {
|
||||||
|
progress *= progressFraction;
|
||||||
|
for (ProcessingStage processingStage : values()) {
|
||||||
|
if (processingStage == this) break;
|
||||||
|
progress += processingStage.progressFraction;
|
||||||
|
}
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ProgressFilter implements StreamFilter {
|
||||||
|
private final long total;
|
||||||
|
|
||||||
|
public ProgressFilter(long total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "progress";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Studio studio, JsonObject config) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(PacketStream stream) {
|
||||||
|
updateProgress(ProcessingStage.WORKING, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPacket(PacketStream stream, PacketData data) {
|
||||||
|
updateProgress(ProcessingStage.WORKING, (double) data.getTime() / total);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnd(PacketStream stream, long timestamp) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GuiProcessingProgressPopup extends AbstractGuiPopup<GuiProcessingProgressPopup> {
|
||||||
|
private final GuiProgressBar progressBar = new GuiProgressBar().setSize(300, 20);
|
||||||
|
|
||||||
|
{
|
||||||
|
popup.setLayout(new VerticalLayout().setSpacing(10));
|
||||||
|
popup.addElements(new VerticalLayout.Data(0.5),
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.editor.progress.title").setColor(Colors.BLACK),
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.editor.progress.pleasewait").setColor(Colors.BLACK),
|
||||||
|
progressBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiProcessingProgressPopup(GuiContainer container) {
|
||||||
|
super(container);
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||||
|
// Update progress bar
|
||||||
|
progressBar.setI18nLabel(processingStage.i18nKey);
|
||||||
|
progressBar.setProgress((float) processingStage.getOverallProgress(progress));
|
||||||
|
|
||||||
|
super.draw(renderer, size, renderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiProcessingProgressPopup getThis() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
198
src/main/java/com/replaymod/editor/gui/GuiTrimPanel.java
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
package com.replaymod.editor.gui;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.replaymod.core.utils.Utils;
|
||||||
|
import com.replaymod.replaystudio.data.Marker;
|
||||||
|
import com.replaymod.replaystudio.filter.ChangeTimestampFilter;
|
||||||
|
import com.replaymod.replaystudio.filter.RemoveFilter;
|
||||||
|
import com.replaymod.replaystudio.filter.SquashFilter;
|
||||||
|
import com.replaymod.replaystudio.replay.ReplayFile;
|
||||||
|
import com.replaymod.replaystudio.replay.ReplayMetaData;
|
||||||
|
import com.replaymod.replaystudio.replay.ZipReplayFile;
|
||||||
|
import com.replaymod.replaystudio.stream.PacketStream;
|
||||||
|
import com.replaymod.replaystudio.studio.ReplayStudio;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiNumberField;
|
||||||
|
import de.johni0702.minecraft.gui.element.advanced.GuiDropdownMenu;
|
||||||
|
import de.johni0702.minecraft.gui.layout.GridLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.VerticalLayout;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.commons.io.IOCase;
|
||||||
|
import org.apache.commons.io.filefilter.SuffixFileFilter;
|
||||||
|
import org.lwjgl.util.Dimension;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileFilter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static com.replaymod.editor.ReplayModEditor.LOGGER;
|
||||||
|
import static java.util.Optional.ofNullable;
|
||||||
|
|
||||||
|
public class GuiTrimPanel extends GuiPanel {
|
||||||
|
// Special value indicating no replay files were found
|
||||||
|
private static final File NO_REPLAY = new File(".");
|
||||||
|
// Special value for the initial "Select Marker Keyframe" entry
|
||||||
|
private static final Marker NO_MARKER = new Marker(); static {NO_MARKER.setTime(-1);}
|
||||||
|
|
||||||
|
private final GuiReplayEditor gui;
|
||||||
|
|
||||||
|
public final GuiDropdownMenu<File> inputReplays = new GuiDropdownMenu<File>(this)
|
||||||
|
.setMinSize(new Dimension(200, 20)).onSelection(i -> updateSelectedReplay())
|
||||||
|
.setToString(f -> f == NO_REPLAY ? "" : FilenameUtils.getBaseName(f.getName()));
|
||||||
|
|
||||||
|
public final GuiNumberField startHour = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField startMin = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField startSec = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField startMilli = new GuiNumberField().setSize(40, 20).setMaxLength(4);
|
||||||
|
public final GuiDropdownMenu<Marker> startMarker = new GuiDropdownMenu<>();
|
||||||
|
|
||||||
|
public final GuiNumberField endHour = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField endMin = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField endSec = new GuiNumberField().setSize(20, 20).setMaxLength(2);
|
||||||
|
public final GuiNumberField endMilli = new GuiNumberField().setSize(40, 20).setMaxLength(4);
|
||||||
|
public final GuiDropdownMenu<Marker> endMarker = new GuiDropdownMenu<>();
|
||||||
|
|
||||||
|
public final GuiPanel timePanel = new GuiPanel(this)
|
||||||
|
.setLayout(new GridLayout().setCellsEqualSize(false).setSpacingX(20).setSpacingY(5).setColumns(3))
|
||||||
|
.addElements(new GridLayout.Data(0, 0.5),
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.start"),
|
||||||
|
new GuiPanel().setLayout(new HorizontalLayout().setSpacing(2)).addElements(
|
||||||
|
new HorizontalLayout.Data(0.5),
|
||||||
|
startHour, new GuiLabel().setI18nText("replaymod.gui.hours"),
|
||||||
|
startMin, new GuiLabel().setI18nText("replaymod.gui.minutes"),
|
||||||
|
startSec, new GuiLabel().setI18nText("replaymod.gui.seconds"),
|
||||||
|
startMilli, new GuiLabel().setI18nText("replaymod.gui.milliseconds")
|
||||||
|
), startMarker,
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.end"),
|
||||||
|
new GuiPanel().setLayout(new HorizontalLayout().setSpacing(2)).addElements(
|
||||||
|
new HorizontalLayout.Data(0.5),
|
||||||
|
endHour, new GuiLabel().setI18nText("replaymod.gui.hours"),
|
||||||
|
endMin, new GuiLabel().setI18nText("replaymod.gui.minutes"),
|
||||||
|
endSec, new GuiLabel().setI18nText("replaymod.gui.seconds"),
|
||||||
|
endMilli, new GuiLabel().setI18nText("replaymod.gui.milliseconds")
|
||||||
|
), endMarker);
|
||||||
|
|
||||||
|
public GuiTrimPanel(GuiReplayEditor gui) {
|
||||||
|
this.gui = gui;
|
||||||
|
|
||||||
|
setLayout(new VerticalLayout().setSpacing(10));
|
||||||
|
|
||||||
|
Function<Marker, String> toString = m -> {
|
||||||
|
if (m == NO_MARKER) {
|
||||||
|
return I18n.format("replaymod.gui.editor.trim.marker");
|
||||||
|
} else {
|
||||||
|
return ofNullable(m.getName()).orElse(I18n.format("replaymod.gui.ingame.unnamedmarker"))
|
||||||
|
+ " (" + Utils.convertSecondsToShortString(m.getTime() / 1000) + ")";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
startMarker.setToString(toString).setMinSize(new Dimension(100, 20)).onSelection(i ->
|
||||||
|
onSelectedMarkerChanged(startMarker, startHour, startMin, startSec, startMilli));
|
||||||
|
endMarker.setToString(toString).setMinSize(new Dimension(100, 20)).onSelection(i ->
|
||||||
|
onSelectedMarkerChanged(endMarker, endHour, endMin, endSec, endMilli));
|
||||||
|
|
||||||
|
File[] files = null;
|
||||||
|
try {
|
||||||
|
File folder = gui.getMod().getReplayFolder();
|
||||||
|
files = folder.listFiles((FileFilter) new SuffixFileFilter(".mcpr", IOCase.INSENSITIVE));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Utils.error(LOGGER, gui, CrashReport.makeCrashReport(e, "Listing available replays"), gui.backButton::onClick);
|
||||||
|
}
|
||||||
|
if (files == null) {
|
||||||
|
LOGGER.warn("Replay file list is null, has the replay folder been deleted?");
|
||||||
|
files = new File[0];
|
||||||
|
} else {
|
||||||
|
LOGGER.debug("Found {} replays in the replay folder", files.length);
|
||||||
|
}
|
||||||
|
if (files.length == 0) {
|
||||||
|
inputReplays.setValues(NO_REPLAY);
|
||||||
|
} else {
|
||||||
|
inputReplays.setValues(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSelectedReplay();
|
||||||
|
updateReadyState();
|
||||||
|
|
||||||
|
gui.saveButton.onClick(() -> {
|
||||||
|
// Read start and end times
|
||||||
|
int start = ((startHour.getInteger() * 60 + startMin.getInteger()) * 60 + startSec.getInteger()) * 1000 + startMilli.getInteger();
|
||||||
|
int end = ((endHour.getInteger() * 60 + endMin.getInteger()) * 60 + endSec.getInteger()) * 1000 + endMilli.getInteger();
|
||||||
|
// Configure offset of change timestamp filter
|
||||||
|
ChangeTimestampFilter ctf = new ChangeTimestampFilter();
|
||||||
|
JsonObject config = new JsonObject();
|
||||||
|
config.addProperty("offset", -start);
|
||||||
|
ctf.init(null, config);
|
||||||
|
// Pass filters to save dialog
|
||||||
|
gui.save(inputReplays.getSelectedValue(),
|
||||||
|
new PacketStream.FilterInfo(new SquashFilter(), -1, start),
|
||||||
|
new PacketStream.FilterInfo(ctf, start, end),
|
||||||
|
new PacketStream.FilterInfo(new RemoveFilter(), end, -1)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSelectedMarkerChanged(GuiDropdownMenu<Marker> dropdown, GuiNumberField hour, GuiNumberField min,
|
||||||
|
GuiNumberField sec, GuiNumberField milli) {
|
||||||
|
Marker marker = dropdown.getSelectedValue();
|
||||||
|
if (marker != NO_MARKER) {
|
||||||
|
int time = marker.getTime();
|
||||||
|
setTime(time, hour, min, sec, milli);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTime(int time, GuiNumberField hour, GuiNumberField min,
|
||||||
|
GuiNumberField sec, GuiNumberField milli) {
|
||||||
|
milli.setValue(time % 1000); time /= 1000;
|
||||||
|
sec.setValue(time % 60); time /= 60;
|
||||||
|
min.setValue(time % 60); time /= 60;
|
||||||
|
hour.setValue(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSelectedReplay() {
|
||||||
|
File file = inputReplays.getSelectedValue();
|
||||||
|
// Load markers and meta data from replay file
|
||||||
|
ReplayMetaData metaData;
|
||||||
|
Set<Marker> markers;
|
||||||
|
if (file == NO_REPLAY) {
|
||||||
|
metaData = new ReplayMetaData();
|
||||||
|
markers = Collections.emptySet();
|
||||||
|
} else {
|
||||||
|
try (ReplayFile replayFile = new ZipReplayFile(new ReplayStudio(), file)) {
|
||||||
|
metaData = replayFile.getMetaData();
|
||||||
|
markers = replayFile.getMarkers().or(Collections.emptySet());
|
||||||
|
LOGGER.debug("Loaded {} markers from replay {}", markers.size(), file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Utils.error(LOGGER, gui, CrashReport.makeCrashReport(e, "Reading markers from replay"), null);
|
||||||
|
metaData = new ReplayMetaData();
|
||||||
|
markers = Collections.emptySet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort and add initial "Select Event Marker" element
|
||||||
|
List<Marker> markerList = new ArrayList<>(markers);
|
||||||
|
markerList.sort(Comparator.comparing(Marker::getTime));
|
||||||
|
markerList.add(0, NO_MARKER);
|
||||||
|
|
||||||
|
// Set marker dropdown values
|
||||||
|
Marker[] markerArray = markerList.stream().toArray(Marker[]::new);
|
||||||
|
startMarker.setValues(markerArray).setSelected(0);
|
||||||
|
endMarker.setValues(markerArray).setSelected(0);
|
||||||
|
|
||||||
|
// Set start and end time values
|
||||||
|
setTime(0, startHour, startMin, startSec, startMilli);
|
||||||
|
setTime(metaData.getDuration(), endHour, endMin, endSec, endMilli);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateReadyState() {
|
||||||
|
gui.saveButton.setEnabled(inputReplays.getSelectedValue() != NO_REPLAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/main/java/com/replaymod/editor/handler/GuiHandler.java
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package com.replaymod.editor.handler;
|
||||||
|
|
||||||
|
import com.replaymod.editor.ReplayModEditor;
|
||||||
|
import com.replaymod.editor.gui.GuiReplayEditor;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
public class GuiHandler {
|
||||||
|
private static final int BUTTON_REPLAY_EDITOR = 17890237;
|
||||||
|
|
||||||
|
private final ReplayModEditor mod;
|
||||||
|
|
||||||
|
public GuiHandler(ReplayModEditor mod) {
|
||||||
|
this.mod = mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void injectIntoMainMenu(GuiScreenEvent.InitGuiEvent event) {
|
||||||
|
if (!(event.getGui() instanceof GuiMainMenu)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiButton button = new GuiButton(BUTTON_REPLAY_EDITOR, event.getGui().width / 2 + 2,
|
||||||
|
event.getGui().height / 4 + 10 + 3 * 24, I18n.format("replaymod.gui.replayeditor"));
|
||||||
|
button.width = button.width / 2 - 2;
|
||||||
|
event.getButtonList().add(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onButton(GuiScreenEvent.ActionPerformedEvent.Pre event) {
|
||||||
|
if(!event.getButton().enabled) return;
|
||||||
|
|
||||||
|
if (event.getGui() instanceof GuiMainMenu) {
|
||||||
|
if (event.getButton().id == BUTTON_REPLAY_EDITOR) {
|
||||||
|
new GuiReplayEditor(GuiScreen.wrap(event.getGui()), mod.getCore()).display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,14 +10,12 @@ import de.johni0702.minecraft.gui.element.IGuiImage;
|
|||||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||||
import net.minecraft.client.settings.GameSettings;
|
import net.minecraft.client.settings.GameSettings;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
public class FullBrightness implements Extra {
|
public class FullBrightness implements Extra {
|
||||||
@Mod.Instance(ReplayModReplay.MOD_ID)
|
private ReplayModReplay module;
|
||||||
private static ReplayModReplay module;
|
|
||||||
|
|
||||||
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 13).setSize(19, 13);
|
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 13).setSize(19, 13);
|
||||||
|
|
||||||
@@ -27,6 +25,7 @@ public class FullBrightness implements Extra {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final ReplayMod mod) throws Exception {
|
public void register(final ReplayMod mod) throws Exception {
|
||||||
|
this.module = ReplayModReplay.instance;
|
||||||
this.gameSettings = mod.getMinecraft().gameSettings;
|
this.gameSettings = mod.getMinecraft().gameSettings;
|
||||||
|
|
||||||
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.lighting", Keyboard.KEY_Z, new Runnable() {
|
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.lighting", Keyboard.KEY_Z, new Runnable() {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import net.minecraft.client.resources.IResourcePack;
|
|||||||
import net.minecraft.client.resources.data.IMetadataSection;
|
import net.minecraft.client.resources.data.IMetadataSection;
|
||||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -26,11 +25,12 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class LocalizationExtra implements Extra {
|
public class LocalizationExtra implements Extra {
|
||||||
@Mod.Instance(ReplayModOnline.MOD_ID)
|
private ReplayModOnline module;
|
||||||
private static ReplayModOnline module;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(ReplayMod mod) throws Exception {
|
public void register(ReplayMod mod) throws Exception {
|
||||||
|
this.module = ReplayModOnline.instance;
|
||||||
|
|
||||||
final Minecraft mc = mod.getMinecraft();
|
final Minecraft mc = mod.getMinecraft();
|
||||||
Thread localizedResourcePackLoader = new Thread(new Runnable() {
|
Thread localizedResourcePackLoader = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mod(modid = ReplayModExtras.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModExtras.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModExtras {
|
public class ReplayModExtras {
|
||||||
public static final String MOD_ID = "replaymod-extras";
|
public static final String MOD_ID = "replaymod-extras";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static ReplayModExtras instance;
|
public static ReplayModExtras instance;
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
private static final List<Class<? extends Extra>> builtin = Arrays.asList(
|
private static final List<Class<? extends Extra>> builtin = Arrays.asList(
|
||||||
PlayerOverview.class,
|
PlayerOverview.class,
|
||||||
UriSchemeExtra.class,
|
UriSchemeExtra.class,
|
||||||
@@ -44,7 +44,7 @@ public class ReplayModExtras {
|
|||||||
for (Class<? extends Extra> cls : builtin) {
|
for (Class<? extends Extra> cls : builtin) {
|
||||||
try {
|
try {
|
||||||
Extra extra = cls.newInstance();
|
Extra extra = cls.newInstance();
|
||||||
extra.register(core);
|
extra.register(ReplayMod.instance);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.warn("Failed to load extra " + cls.getName() + ": ", t);
|
logger.warn("Failed to load extra " + cls.getName() + ": ", t);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
|||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
@@ -21,20 +20,21 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class PlayerOverview implements Extra {
|
public class PlayerOverview implements Extra {
|
||||||
@Mod.Instance(ReplayModReplay.MOD_ID)
|
private ReplayModReplay module;
|
||||||
private static ReplayModReplay module;
|
|
||||||
|
|
||||||
private final Set<UUID> hiddenPlayers = new HashSet<>();
|
private final Set<UUID> hiddenPlayers = new HashSet<>();
|
||||||
private boolean savingEnabled;
|
private boolean savingEnabled;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final ReplayMod mod) throws Exception {
|
public void register(final ReplayMod mod) throws Exception {
|
||||||
|
this.module = ReplayModReplay.instance;
|
||||||
|
|
||||||
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.playeroverview", Keyboard.KEY_B, new Runnable() {
|
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.playeroverview", Keyboard.KEY_B, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (module.getReplayHandler() != null) {
|
if (module.getReplayHandler() != null) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<EntityPlayer> players = mod.getMinecraft().theWorld.getPlayers(EntityPlayer.class, new Predicate() {
|
List<EntityPlayer> players = mod.getMinecraft().world.getPlayers(EntityPlayer.class, new Predicate() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Object input) {
|
public boolean apply(Object input) {
|
||||||
return !(input instanceof CameraEntity); // Exclude the camera entity
|
return !(input instanceof CameraEntity); // Exclude the camera entity
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.replaymod.core.ReplayMod;
|
|||||||
import com.replaymod.extras.Extra;
|
import com.replaymod.extras.Extra;
|
||||||
import com.replaymod.online.ReplayModOnline;
|
import com.replaymod.online.ReplayModOnline;
|
||||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -13,14 +12,14 @@ import java.net.ServerSocket;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
public class UriSchemeExtra implements Extra {
|
public class UriSchemeExtra implements Extra {
|
||||||
@Mod.Instance(ReplayModOnline.MOD_ID)
|
private ReplayModOnline module;
|
||||||
private static ReplayModOnline module;
|
|
||||||
|
|
||||||
private ReplayMod mod;
|
private ReplayMod mod;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final ReplayMod mod) throws Exception {
|
public void register(final ReplayMod mod) throws Exception {
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
|
this.module = ReplayModOnline.instance;
|
||||||
|
|
||||||
UriScheme uriScheme = UriScheme.create();
|
UriScheme uriScheme = UriScheme.create();
|
||||||
if (uriScheme == null) {
|
if (uriScheme == null) {
|
||||||
|
|||||||
@@ -26,18 +26,19 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import static net.minecraft.client.Minecraft.getMinecraft;
|
import static net.minecraft.client.Minecraft.getMinecraft;
|
||||||
|
|
||||||
@Mod(modid = ReplayModOnline.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModOnline.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModOnline {
|
public class ReplayModOnline {
|
||||||
public static final String MOD_ID = "replaymod-online";
|
public static final String MOD_ID = "replaymod-online";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static ReplayModOnline instance;
|
public static ReplayModOnline instance;
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
private ReplayMod core;
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
@Mod.Instance(ReplayModReplay.MOD_ID)
|
private ReplayModReplay replayModule;
|
||||||
private static ReplayModReplay replayModule;
|
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@@ -53,6 +54,8 @@ public class ReplayModOnline {
|
|||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
logger = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
|
replayModule = ReplayModReplay.instance;
|
||||||
|
|
||||||
core.getSettingsRegistry().register(Setting.class);
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
|
|
||||||
@@ -64,9 +67,11 @@ public class ReplayModOnline {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
|
if (!getDownloadsFolder().exists()){
|
||||||
if (!getDownloadsFolder().mkdirs()) {
|
if (!getDownloadsFolder().mkdirs()) {
|
||||||
logger.warn("Failed to create downloads folder: " + getDownloadsFolder());
|
logger.warn("Failed to create downloads folder: " + getDownloadsFolder());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
new GuiHandler(this).register();
|
new GuiHandler(this).register();
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ public enum MinecraftVersion {
|
|||||||
MC_1_8("Minecraft 1.8", "1.8"),
|
MC_1_8("Minecraft 1.8", "1.8"),
|
||||||
MC_1_9_4("Minecraft 1.9.4", "1.9.4"),
|
MC_1_9_4("Minecraft 1.9.4", "1.9.4"),
|
||||||
MC_1_10_2("Minecraft 1.10.2", "1.10.2"),
|
MC_1_10_2("Minecraft 1.10.2", "1.10.2"),
|
||||||
MC_1_11("Minecraft 1.11", "1.11");
|
MC_1_11("Minecraft 1.11", "1.11"),
|
||||||
|
MC_1_11_2("Minecraft 1.11.2", "1.11.2");
|
||||||
|
|
||||||
private String niceName, apiName;
|
private String niceName, apiName;
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,17 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
@Mod(modid = ReplayModRecording.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModRecording.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModRecording {
|
public class ReplayModRecording {
|
||||||
public static final String MOD_ID = "replaymod-recording";
|
public static final String MOD_ID = "replaymod-recording";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static ReplayModRecording instance;
|
public static ReplayModRecording instance;
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
private ReplayMod core;
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ public class ReplayModRecording {
|
|||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
logger = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
|
|
||||||
core.getSettingsRegistry().register(Setting.class);
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ public class ConnectionEventHandler {
|
|||||||
worldName = mc.getIntegratedServer().getWorldName();
|
worldName = mc.getIntegratedServer().getWorldName();
|
||||||
} else if (Minecraft.getMinecraft().getCurrentServerData() != null) {
|
} else if (Minecraft.getMinecraft().getCurrentServerData() != null) {
|
||||||
worldName = Minecraft.getMinecraft().getCurrentServerData().serverIP;
|
worldName = Minecraft.getMinecraft().getCurrentServerData().serverIP;
|
||||||
|
} else if (Minecraft.getMinecraft().isConnectedToRealms()) {
|
||||||
|
// we can't access the server name without tapping too deep in the Realms Library
|
||||||
|
worldName = "A Realms Server";
|
||||||
} else {
|
} else {
|
||||||
logger.info("Recording not started as the world is neither local nor remote (probably a replay).");
|
logger.info("Recording not started as the world is neither local nor remote (probably a replay).");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.replaymod.recording.handler;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters out all handshake packets that were sent for recording but must
|
||||||
|
* not actually be handled.
|
||||||
|
* This handler is only present when connected to the integrated server as
|
||||||
|
* otherwise all packets must be handled.
|
||||||
|
*
|
||||||
|
* When in single player, the game state packets must never be handled
|
||||||
|
* otherwise wired bugs related to semi-singletons can occur.
|
||||||
|
* See https://bugs.replaymod.com/show_bug.cgi?id=44
|
||||||
|
*/
|
||||||
|
public class FMLHandshakeFilter extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
|
||||||
|
@Override
|
||||||
|
protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception {
|
||||||
|
if (!(msg instanceof FMLHandshakeMessage.RegistryData)) {
|
||||||
|
// Pass on everything but RegistryData messages
|
||||||
|
ctx.fireChannelRead(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,7 +57,7 @@ public class RecordingEventHandler {
|
|||||||
|
|
||||||
public void onPlayerJoin() {
|
public void onPlayerJoin() {
|
||||||
try {
|
try {
|
||||||
packetListener.save(new SPacketSpawnPlayer(mc.thePlayer));
|
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||||
} catch(Exception e1) {
|
} catch(Exception e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class RecordingEventHandler {
|
|||||||
|
|
||||||
public void onPlayerRespawn() {
|
public void onPlayerRespawn() {
|
||||||
try {
|
try {
|
||||||
packetListener.save(new SPacketSpawnPlayer(mc.thePlayer));
|
packetListener.save(new SPacketSpawnPlayer(mc.player));
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerTick(PlayerTickEvent e) {
|
public void onPlayerTick(PlayerTickEvent e) {
|
||||||
try {
|
try {
|
||||||
if(e.player != mc.thePlayer) return;
|
if(e.player != mc.player) return;
|
||||||
|
|
||||||
boolean force = false;
|
boolean force = false;
|
||||||
if(lastX == null || lastY == null || lastZ == null) {
|
if(lastX == null || lastY == null || lastZ == null) {
|
||||||
@@ -168,62 +168,62 @@ public class RecordingEventHandler {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Inventory Handling
|
//Inventory Handling
|
||||||
if (playerItems[0] != mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND)) {
|
if (playerItems[0] != mc.player.getHeldItem(EnumHand.MAIN_HAND)) {
|
||||||
playerItems[0] = mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND);
|
playerItems[0] = mc.player.getHeldItem(EnumHand.MAIN_HAND);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.MAINHAND, playerItems[0]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.MAINHAND, playerItems[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[1] != mc.thePlayer.getHeldItem(EnumHand.OFF_HAND)) {
|
if (playerItems[1] != mc.player.getHeldItem(EnumHand.OFF_HAND)) {
|
||||||
playerItems[1] = mc.thePlayer.getHeldItem(EnumHand.OFF_HAND);
|
playerItems[1] = mc.player.getHeldItem(EnumHand.OFF_HAND);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.OFFHAND, playerItems[1]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.OFFHAND, playerItems[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[2] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
if (playerItems[2] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET)) {
|
||||||
playerItems[2] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
playerItems[2] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.FEET, playerItems[2]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.FEET, playerItems[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[3] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
if (playerItems[3] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS)) {
|
||||||
playerItems[3] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
playerItems[3] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.LEGS, playerItems[3]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.LEGS, playerItems[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[4] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
if (playerItems[4] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST)) {
|
||||||
playerItems[4] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
playerItems[4] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.CHEST, playerItems[4]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.CHEST, playerItems[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerItems[5] != mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
if (playerItems[5] != mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD)) {
|
||||||
playerItems[5] = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
playerItems[5] = mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.HEAD, playerItems[5]));
|
packetListener.save(new SPacketEntityEquipment(e.player.getEntityId(), EntityEquipmentSlot.HEAD, playerItems[5]));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Leaving Ride
|
//Leaving Ride
|
||||||
|
|
||||||
if((!mc.thePlayer.isRiding() && lastRiding != -1) ||
|
if((!mc.player.isRiding() && lastRiding != -1) ||
|
||||||
(mc.thePlayer.isRiding() && lastRiding != mc.thePlayer.getRidingEntity().getEntityId())) {
|
(mc.player.isRiding() && lastRiding != mc.player.getRidingEntity().getEntityId())) {
|
||||||
if(!mc.thePlayer.isRiding()) {
|
if(!mc.player.isRiding()) {
|
||||||
lastRiding = -1;
|
lastRiding = -1;
|
||||||
} else {
|
} else {
|
||||||
lastRiding = mc.thePlayer.getRidingEntity().getEntityId();
|
lastRiding = mc.player.getRidingEntity().getEntityId();
|
||||||
}
|
}
|
||||||
packetListener.save(new SPacketEntityAttach(e.player, e.player.getRidingEntity()));
|
packetListener.save(new SPacketEntityAttach(e.player, e.player.getRidingEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sleeping
|
//Sleeping
|
||||||
if(!mc.thePlayer.isPlayerSleeping() && wasSleeping) {
|
if(!mc.player.isPlayerSleeping() && wasSleeping) {
|
||||||
packetListener.save(new SPacketAnimation(e.player, 2));
|
packetListener.save(new SPacketAnimation(e.player, 2));
|
||||||
wasSleeping = false;
|
wasSleeping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Active hand (e.g. eating, drinking, blocking)
|
// Active hand (e.g. eating, drinking, blocking)
|
||||||
if (mc.thePlayer.isHandActive() ^ wasHandActive || mc.thePlayer.getActiveHand() != lastActiveHand) {
|
if (mc.player.isHandActive() ^ wasHandActive || mc.player.getActiveHand() != lastActiveHand) {
|
||||||
wasHandActive = mc.thePlayer.isHandActive();
|
wasHandActive = mc.player.isHandActive();
|
||||||
lastActiveHand = mc.thePlayer.getActiveHand();
|
lastActiveHand = mc.player.getActiveHand();
|
||||||
EntityDataManager dataManager = new EntityDataManager(null);
|
EntityDataManager dataManager = new EntityDataManager(null);
|
||||||
int state = (wasHandActive ? 1 : 0) | (lastActiveHand == EnumHand.OFF_HAND ? 2 : 0);
|
int state = (wasHandActive ? 1 : 0) | (lastActiveHand == EnumHand.OFF_HAND ? 2 : 0);
|
||||||
dataManager.register(EntityLiving.HAND_STATES, (byte) state);
|
dataManager.register(EntityLiving.HAND_STATES, (byte) state);
|
||||||
packetListener.save(new SPacketEntityMetadata(mc.thePlayer.getEntityId(), dataManager, true));
|
packetListener.save(new SPacketEntityMetadata(mc.player.getEntityId(), dataManager, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception e1) {
|
} catch(Exception e1) {
|
||||||
@@ -244,7 +244,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onSleep(PlayerSleepInBedEvent event) {
|
public void onSleep(PlayerSleepInBedEvent event) {
|
||||||
try {
|
try {
|
||||||
if (event.getEntityPlayer() != mc.thePlayer) {
|
if (event.getEntityPlayer() != mc.player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ public class RecordingEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void enterMinecart(MinecartInteractEvent event) {
|
public void enterMinecart(MinecartInteractEvent event) {
|
||||||
try {
|
try {
|
||||||
if(event.getEntity() != mc.thePlayer) {
|
if(event.getEntity() != mc.player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ public class RecordingEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockBreakAnim(int breakerId, BlockPos pos, int progress) {
|
public void onBlockBreakAnim(int breakerId, BlockPos pos, int progress) {
|
||||||
EntityPlayer thePlayer = mc.thePlayer;
|
EntityPlayer thePlayer = mc.player;
|
||||||
if (thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
if (thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
||||||
packetListener.save(new SPacketBlockBreakAnim(breakerId, pos, progress));
|
packetListener.save(new SPacketBlockBreakAnim(breakerId, pos, progress));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ public abstract class MixinNetHandlerPlayClient {
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
@Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
||||||
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
public void recordOwnJoin(SPacketPlayerListItem packet, CallbackInfo ci) {
|
||||||
if (gameController.thePlayer == null) return;
|
if (gameController.player == null) return;
|
||||||
|
|
||||||
RecordingEventHandler handler = getRecordingEventHandler();
|
RecordingEventHandler handler = getRecordingEventHandler();
|
||||||
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
if (handler != null && packet.getAction() == SPacketPlayerListItem.Action.ADD_PLAYER) {
|
||||||
for (SPacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
for (SPacketPlayerListItem.AddPlayerData data : packet.getEntries()) {
|
||||||
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
if (data.getProfile() == null || data.getProfile().getId() == null) continue;
|
||||||
// Only add spawn packet for our own player and only if he isn't known yet
|
// Only add spawn packet for our own player and only if he isn't known yet
|
||||||
if (data.getProfile().getId().equals(Minecraft.getMinecraft().thePlayer.getGameProfile().getId())
|
if (data.getProfile().getId().equals(Minecraft.getMinecraft().player.getGameProfile().getId())
|
||||||
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
&& !playerInfoMap.containsKey(data.getProfile().getId())) {
|
||||||
handler.onPlayerJoin();
|
handler.onPlayerJoin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.replaymod.recording.mixin;
|
package com.replaymod.recording.mixin;
|
||||||
|
|
||||||
|
import com.replaymod.recording.handler.FMLHandshakeFilter;
|
||||||
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
|
import net.minecraftforge.fml.common.network.handshake.FMLHandshakeCodec;
|
||||||
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -11,17 +15,32 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(value = NetworkDispatcher.class, remap = false)
|
@Mixin(value = NetworkDispatcher.class, remap = false)
|
||||||
public abstract class MixinNetworkDispatcher {
|
public abstract class MixinNetworkDispatcher {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private Side side;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private EmbeddedChannel handshakeChannel;
|
private EmbeddedChannel handshakeChannel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always sets fml:isLocal to false.
|
* Always sets fml:isLocal to false on the server side.
|
||||||
* This effectively removes the difference in the FML handshake between SP and MP
|
* This effectively removes the difference in the FML handshake between SP and MP
|
||||||
* and forces the block/item ids, etc. to always be send.
|
* and forces the block/item ids, etc. to always be send.
|
||||||
* This might have undesired side effects but at least it works at all.
|
* Injects a {@link FMLHandshakeFilter} on the client side to filter out
|
||||||
|
* those extra, unexpected packets.
|
||||||
*/
|
*/
|
||||||
@Inject(method = "insertIntoChannel", at=@At("HEAD"))
|
@Inject(method = "insertIntoChannel", at=@At("HEAD"))
|
||||||
public void replayModRecording_forceIsLocalToFalse(CallbackInfo cb) {
|
public void replayModRecording_setupForLocalRecording(CallbackInfo cb) {
|
||||||
|
// If we're in multiplayer, everything is fine as is
|
||||||
|
if (!handshakeChannel.attr(NetworkDispatcher.IS_LOCAL).get()) return;
|
||||||
|
|
||||||
|
if (side == Side.SERVER) {
|
||||||
|
// On the server side, force all packets to be sent
|
||||||
handshakeChannel.attr(NetworkDispatcher.IS_LOCAL).set(false);
|
handshakeChannel.attr(NetworkDispatcher.IS_LOCAL).set(false);
|
||||||
|
} else {
|
||||||
|
// On the client side, discard additional packets
|
||||||
|
ChannelPipeline pipeline = handshakeChannel.pipeline();
|
||||||
|
pipeline.addAfter(pipeline.context(FMLHandshakeCodec.class).name(),
|
||||||
|
"replaymod_filter", new FMLHandshakeFilter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public abstract class MixinPlayerControllerMP implements RecordingEventHandler.R
|
|||||||
@Redirect(method = "onPlayerDestroyBlock", at = @At(value = "INVOKE",
|
@Redirect(method = "onPlayerDestroyBlock", at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
|
target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
|
||||||
public void replayModRecording_playEvent_fixed(World world, int type, BlockPos pos, int data) {
|
public void replayModRecording_playEvent_fixed(World world, int type, BlockPos pos, int data) {
|
||||||
world.playEvent(mc.thePlayer, type, pos, data);
|
world.playEvent(mc.player, type, pos, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
@Inject(method = "playSound", at = @At("HEAD"))
|
@Inject(method = "playSound", at = @At("HEAD"))
|
||||||
public void replayModRecording_recordClientSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category,
|
public void replayModRecording_recordClientSound(EntityPlayer player, double x, double y, double z, SoundEvent sound, SoundCategory category,
|
||||||
float volume, float pitch, CallbackInfo ci) {
|
float volume, float pitch, CallbackInfo ci) {
|
||||||
if (player == mc.thePlayer) {
|
if (player == mc.player) {
|
||||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.onClientSound(sound, category, x, y, z, volume, pitch);
|
handler.onClientSound(sound, category, x, y, z, volume, pitch);
|
||||||
@@ -50,7 +50,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
// These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
// These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
||||||
@Override
|
@Override
|
||||||
public void playEvent(EntityPlayer player, int type, BlockPos pos, int data) {
|
public void playEvent(EntityPlayer player, int type, BlockPos pos, int data) {
|
||||||
if (player == mc.thePlayer) {
|
if (player == mc.player) {
|
||||||
// We caused this event, the server won't send it to us
|
// We caused this event, the server won't send it to us
|
||||||
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
RecordingEventHandler handler = replayModRecording_getRecordingEventHandler();
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
|
|||||||
@@ -155,8 +155,8 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
|||||||
Packet packet = (Packet) msg;
|
Packet packet = (Packet) msg;
|
||||||
|
|
||||||
if(packet instanceof SPacketCollectItem) {
|
if(packet instanceof SPacketCollectItem) {
|
||||||
if(mc.thePlayer != null ||
|
if(mc.player != null ||
|
||||||
((SPacketCollectItem) packet).getEntityID() == mc.thePlayer.getEntityId()) {
|
((SPacketCollectItem) packet).getEntityID() == mc.player.getEntityId()) {
|
||||||
super.channelRead(ctx, msg);
|
super.channelRead(ctx, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
PacketBuffer packetBuffer = new PacketBuffer(byteBuf);
|
||||||
packetBuffer.writeVarIntToBuffer(packetId);
|
packetBuffer.writeVarInt(packetId);
|
||||||
packet.writePacketData(packetBuffer);
|
packet.writePacketData(packetBuffer);
|
||||||
|
|
||||||
byteBuf.readerIndex(0);
|
byteBuf.readerIndex(0);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.replaymod.render;
|
package com.replaymod.render;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import org.lwjgl.util.ReadableColor;
|
import org.lwjgl.util.ReadableColor;
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ public class RenderSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return "-y -f rawvideo -pix_fmt rgb24 -s %WIDTH%x%HEIGHT% -r %FPS% -i - " + preset;
|
return "-y -f rawvideo -pix_fmt rgb24 -s %WIDTH%x%HEIGHT% -r %FPS% -i - %FILTERS%" + preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileExtension() {
|
public String getFileExtension() {
|
||||||
@@ -64,6 +66,19 @@ public class RenderSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum AntiAliasing {
|
||||||
|
NONE(1), X2(2), X4(4), X8(8);
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final int factor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return I18n.format("replaymod.gui.rendersettings.antialiasing." + name().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final RenderMethod renderMethod;
|
private final RenderMethod renderMethod;
|
||||||
private final EncodingPreset encodingPreset;
|
private final EncodingPreset encodingPreset;
|
||||||
private final int videoWidth;
|
private final int videoWidth;
|
||||||
@@ -78,9 +93,48 @@ public class RenderSettings {
|
|||||||
private final boolean stabilizeRoll;
|
private final boolean stabilizeRoll;
|
||||||
private final ReadableColor chromaKeyingColor;
|
private final ReadableColor chromaKeyingColor;
|
||||||
private final boolean inject360Metadata;
|
private final boolean inject360Metadata;
|
||||||
|
private final AntiAliasing antiAliasing;
|
||||||
|
|
||||||
private final String exportCommand;
|
private final String exportCommand;
|
||||||
private final String exportArguments;
|
private final String exportArguments;
|
||||||
|
|
||||||
private final boolean highPerformance;
|
private final boolean highPerformance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the width of the output video during rendering, including the upscale for Anti-Aliasing.
|
||||||
|
*/
|
||||||
|
public int getVideoWidth() {
|
||||||
|
return videoWidth * antiAliasing.getFactor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the height of the output video during rendering, including the upscale for Anti-Aliasing.
|
||||||
|
*/
|
||||||
|
public int getVideoHeight() {
|
||||||
|
return videoHeight * antiAliasing.getFactor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the actual width of the output video.
|
||||||
|
*/
|
||||||
|
public int getTargetVideoWidth() {
|
||||||
|
return videoWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the actual height of the output video.
|
||||||
|
*/
|
||||||
|
public int getTargetVideoHeight() {
|
||||||
|
return videoHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideoFilters() {
|
||||||
|
if (antiAliasing == AntiAliasing.NONE) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
double factor = 1.0 / antiAliasing.getFactor();
|
||||||
|
return String.format("-vf scale=iw*%1$s:ih*%1$s ", factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,39 @@
|
|||||||
package com.replaymod.render;
|
package com.replaymod.render;
|
||||||
|
|
||||||
import com.replaymod.core.ReplayMod;
|
import com.replaymod.core.ReplayMod;
|
||||||
|
import com.replaymod.render.utils.RenderJob;
|
||||||
|
import com.replaymod.replay.events.ReplayCloseEvent;
|
||||||
import net.minecraft.crash.CrashReport;
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.util.ReportedException;
|
import net.minecraft.util.ReportedException;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mod(modid = ReplayModRender.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModRender.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModRender {
|
public class ReplayModRender {
|
||||||
public static final String MOD_ID = "replaymod-render";
|
public static final String MOD_ID = "replaymod-render";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static ReplayModRender instance;
|
public static ReplayModRender instance;
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
private ReplayMod core;
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
private Logger logger;
|
public static Logger LOGGER;
|
||||||
|
|
||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
|
private final List<RenderJob> renderQueue = new ArrayList<>();
|
||||||
|
|
||||||
public ReplayMod getCore() {
|
public ReplayMod getCore() {
|
||||||
return core;
|
return core;
|
||||||
@@ -32,12 +41,20 @@ public class ReplayModRender {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
LOGGER = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
configuration = new Configuration(event.getSuggestedConfigurationFile());
|
configuration = new Configuration(event.getSuggestedConfigurationFile());
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
core.getSettingsRegistry().register(Setting.class);
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onReplayClose(ReplayCloseEvent.Post event) {
|
||||||
|
renderQueue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public File getVideoFolder() {
|
public File getVideoFolder() {
|
||||||
String path = core.getSettingsRegistry().get(Setting.RENDER_PATH);
|
String path = core.getSettingsRegistry().get(Setting.RENDER_PATH);
|
||||||
File folder = new File(path.startsWith("./") ? core.getMinecraft().mcDataDir : null, path);
|
File folder = new File(path.startsWith("./") ? core.getMinecraft().mcDataDir : null, path);
|
||||||
@@ -52,4 +69,8 @@ public class ReplayModRender {
|
|||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RenderJob> getRenderQueue() {
|
||||||
|
return renderQueue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,27 @@ import com.replaymod.render.utils.StreamPipe;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.crash.CrashReport;
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.crash.CrashReportCategory;
|
import net.minecraft.crash.CrashReportCategory;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
|
import net.minecraftforge.fml.common.versioning.ComparableVersion;
|
||||||
import org.apache.commons.exec.CommandLine;
|
import org.apache.commons.exec.CommandLine;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.io.output.TeeOutputStream;
|
import org.apache.commons.io.output.TeeOutputStream;
|
||||||
import org.lwjgl.util.ReadableDimension;
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.WritableByteChannel;
|
import java.nio.channels.WritableByteChannel;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static com.replaymod.render.ReplayModRender.LOGGER;
|
||||||
import static org.apache.commons.lang3.Validate.isTrue;
|
import static org.apache.commons.lang3.Validate.isTrue;
|
||||||
|
|
||||||
public class VideoWriter implements FrameConsumer<RGBFrame> {
|
public class VideoWriter implements FrameConsumer<RGBFrame> {
|
||||||
@@ -43,10 +53,11 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
|
|||||||
.replace("%HEIGHT%", String.valueOf(settings.getVideoHeight()))
|
.replace("%HEIGHT%", String.valueOf(settings.getVideoHeight()))
|
||||||
.replace("%FPS%", String.valueOf(settings.getFramesPerSecond()))
|
.replace("%FPS%", String.valueOf(settings.getFramesPerSecond()))
|
||||||
.replace("%FILENAME%", fileName)
|
.replace("%FILENAME%", fileName)
|
||||||
.replace("%BITRATE%", String.valueOf(settings.getBitRate()));
|
.replace("%BITRATE%", String.valueOf(settings.getBitRate()))
|
||||||
|
.replace("%FILTERS%", settings.getVideoFilters());
|
||||||
|
|
||||||
String executable = settings.getExportCommand().isEmpty() ? "ffmpeg" : settings.getExportCommand();
|
String executable = settings.getExportCommand().isEmpty() ? findFFmpeg() : settings.getExportCommand();
|
||||||
System.out.println("Starting " + settings.getExportCommand() + " with args: " + commandArgs);
|
System.out.println("Starting " + executable + " with args: " + commandArgs);
|
||||||
String[] cmdline = new CommandLine(executable).addArguments(commandArgs).toStrings();
|
String[] cmdline = new CommandLine(executable).addArguments(commandArgs).toStrings();
|
||||||
process = new ProcessBuilder(cmdline).directory(outputFolder).start();
|
process = new ProcessBuilder(cmdline).directory(outputFolder).start();
|
||||||
File exportLogFile = new File(Minecraft.getMinecraft().mcDataDir, "export.log");
|
File exportLogFile = new File(Minecraft.getMinecraft().mcDataDir, "export.log");
|
||||||
@@ -57,6 +68,54 @@ public class VideoWriter implements FrameConsumer<RGBFrame> {
|
|||||||
channel = Channels.newChannel(outputStream);
|
channel = Channels.newChannel(outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String findFFmpeg() {
|
||||||
|
switch (Util.getOSType()) {
|
||||||
|
case WINDOWS:
|
||||||
|
// Allow windows users to unpack the ffmpeg archive into a sub-folder of their .minecraft folder
|
||||||
|
File inDotMinecraft = new File(Minecraft.getMinecraft().mcDataDir, "ffmpeg/bin/ffmpeg.exe");
|
||||||
|
if (inDotMinecraft.exists()) {
|
||||||
|
LOGGER.debug("FFmpeg found in .minecraft/ffmpeg");
|
||||||
|
return inDotMinecraft.getAbsolutePath();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OSX:
|
||||||
|
// The PATH doesn't seem to be set as expected on OSX, therefore we check some common locations ourselves
|
||||||
|
for (String path : new String[]{"/usr/local/bin/ffmpeg", "/usr/bin/ffmpeg"}) {
|
||||||
|
File file = new File(path);
|
||||||
|
if (file.exists()) {
|
||||||
|
LOGGER.debug("Found FFmpeg at {}", path);
|
||||||
|
return path;
|
||||||
|
} else {
|
||||||
|
LOGGER.debug("FFmpeg not located at {}", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Homebrew doesn't seem to reliably symlink its installed binaries either
|
||||||
|
File homebrewFolder = new File("/usr/local/Cellar/ffmpeg");
|
||||||
|
String[] homebrewVersions = homebrewFolder.list();
|
||||||
|
if (homebrewVersions != null) {
|
||||||
|
Optional<File> latestOpt = Arrays.stream(homebrewVersions)
|
||||||
|
.map(ComparableVersion::new) // Convert file name to comparable version
|
||||||
|
.sorted(Comparator.reverseOrder()) // Sort for latest version
|
||||||
|
.map(ComparableVersion::toString) // Convert back to file name
|
||||||
|
.map(v -> new File(new File(homebrewFolder, v), "bin/ffmpeg")) // Convert to binary files
|
||||||
|
.filter(File::exists) // Filter invalid installations (missing executable)
|
||||||
|
.findFirst(); // Take first one
|
||||||
|
if (latestOpt.isPresent()) {
|
||||||
|
File latest = latestOpt.get();
|
||||||
|
LOGGER.debug("Found {} versions of FFmpeg installed with homebrew, chose {}",
|
||||||
|
homebrewVersions.length, latest);
|
||||||
|
return latest.getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LINUX: // Linux users are entrusted to have their PATH configured correctly (most package manager do this)
|
||||||
|
case SOLARIS: // Never heard of anyone running this mod on Solaris having any problems
|
||||||
|
case UNKNOWN: // Unknown OS, just try to use "ffmpeg"
|
||||||
|
}
|
||||||
|
LOGGER.debug("Using default FFmpeg executable");
|
||||||
|
return "ffmpeg";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
IOUtils.closeQuietly(outputStream);
|
IOUtils.closeQuietly(outputStream);
|
||||||
|
|||||||
277
src/main/java/com/replaymod/render/gui/GuiRenderQueue.java
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
package com.replaymod.render.gui;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.replaymod.render.ReplayModRender;
|
||||||
|
import com.replaymod.render.rendering.VideoRenderer;
|
||||||
|
import com.replaymod.render.utils.RenderJob;
|
||||||
|
import com.replaymod.replay.ReplayHandler;
|
||||||
|
import com.replaymod.replaystudio.pathing.path.Timeline;
|
||||||
|
import com.replaymod.replaystudio.util.I18n;
|
||||||
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
|
import de.johni0702.minecraft.gui.RenderInfo;
|
||||||
|
import de.johni0702.minecraft.gui.container.AbstractGuiClickableContainer;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiContainer;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
|
import de.johni0702.minecraft.gui.container.GuiVerticalList;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiTextField;
|
||||||
|
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.GridLayout;
|
||||||
|
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||||
|
import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
|
||||||
|
import de.johni0702.minecraft.gui.popup.GuiYesNoPopup;
|
||||||
|
import de.johni0702.minecraft.gui.utils.Colors;
|
||||||
|
import net.minecraft.client.gui.GuiErrorScreen;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
|
import net.minecraft.util.ReportedException;
|
||||||
|
import org.lwjgl.util.Dimension;
|
||||||
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.replaymod.render.ReplayModRender.LOGGER;
|
||||||
|
|
||||||
|
public class GuiRenderQueue extends AbstractGuiPopup<GuiRenderQueue> {
|
||||||
|
private final GuiLabel title = new GuiLabel().setI18nText("replaymod.gui.renderqueue.title").setColor(Colors.BLACK);
|
||||||
|
private final GuiVerticalList list = new GuiVerticalList().setDrawShadow(true).setDrawSlider(true);
|
||||||
|
private final GuiButton addButton = new GuiButton().setI18nLabel("replaymod.gui.renderqueue.add").setSize(150, 20);
|
||||||
|
private final GuiButton renameButton = new GuiButton().setI18nLabel("replaymod.gui.rename").setSize(73, 20);
|
||||||
|
private final GuiButton removeButton = new GuiButton().setI18nLabel("replaymod.gui.remove").setSize(73, 20);
|
||||||
|
private final GuiButton renderButton = new GuiButton().setI18nLabel("replaymod.gui.render").setSize(150, 20);
|
||||||
|
private final GuiButton closeButton = new GuiButton().setI18nLabel("replaymod.gui.close").setSize(150, 20).onClick(this::close);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|---------------------------------|
|
||||||
|
| Add | Render |
|
||||||
|
|---------------------------------|
|
||||||
|
| Rename | Remove | Close |
|
||||||
|
|---------------------------------|
|
||||||
|
|
||||||
|
*/
|
||||||
|
private final GuiPanel buttonPanel = new GuiPanel()
|
||||||
|
.setLayout(new GridLayout().setSpacingX(5).setSpacingY(5).setColumns(2))
|
||||||
|
.addElements(null,
|
||||||
|
addButton,
|
||||||
|
renderButton,
|
||||||
|
new GuiPanel().setLayout(new HorizontalLayout().setSpacing(4)).addElements(null,
|
||||||
|
renameButton, removeButton),
|
||||||
|
closeButton);
|
||||||
|
|
||||||
|
private final GuiContainer container;
|
||||||
|
private Entry selectedEntry;
|
||||||
|
|
||||||
|
{
|
||||||
|
popup.setLayout(new CustomLayout<GuiPanel>() {
|
||||||
|
@Override
|
||||||
|
protected void layout(GuiPanel container, int width, int height) {
|
||||||
|
pos(title, width / 2 - width(title) / 2, 0);
|
||||||
|
pos(list, 0, y(title) + height(title) + 5);
|
||||||
|
pos(buttonPanel, width / 2 - width(buttonPanel) / 2, height - height(buttonPanel));
|
||||||
|
size(list, width, y(buttonPanel) - y(list) - 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReadableDimension calcMinSize(GuiContainer<?> container) {
|
||||||
|
ReadableDimension screenSize = GuiRenderQueue.this.container.getMinSize();
|
||||||
|
return new Dimension(screenSize.getWidth() - 40,
|
||||||
|
screenSize.getHeight() - 20 - buttonPanel.getMinSize().getHeight() - title.getMinSize().getHeight());
|
||||||
|
}
|
||||||
|
}).addElements(null, title, list, buttonPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiRenderQueue(GuiContainer container, GuiRenderSettings guiRenderSettings, ReplayHandler replayHandler, Timeline timeline) {
|
||||||
|
super(container);
|
||||||
|
this.container = container;
|
||||||
|
LOGGER.trace("Opening render queue popup");
|
||||||
|
|
||||||
|
setBackgroundColor(Colors.DARK_TRANSPARENT);
|
||||||
|
|
||||||
|
List<RenderJob> queue = ReplayModRender.instance.getRenderQueue();
|
||||||
|
|
||||||
|
for (RenderJob renderJob : queue) {
|
||||||
|
LOGGER.trace("Adding {} to job queue list", renderJob);
|
||||||
|
list.getListPanel().addElements(null, new Entry(renderJob));
|
||||||
|
}
|
||||||
|
|
||||||
|
addButton.onClick(() -> {
|
||||||
|
LOGGER.trace("Add button clicked");
|
||||||
|
// Open popup
|
||||||
|
GuiYesNoPopup popup = GuiYesNoPopup.open(container)
|
||||||
|
.setYesI18nLabel("replaymod.gui.add").setNoI18nLabel("replaymod.gui.cancel");
|
||||||
|
popup.getInfo().setLayout(new HorizontalLayout(HorizontalLayout.Alignment.CENTER).setSpacing(5));
|
||||||
|
// Add content
|
||||||
|
GuiLabel label = new GuiLabel().setI18nText("replaymod.gui.renderqueue.jobname").setColor(Colors.BLACK);
|
||||||
|
GuiTextField nameField = new GuiTextField().setSize(150, 20).setFocused(true);
|
||||||
|
popup.getInfo().addElements(new HorizontalLayout.Data(0.5), label, nameField);
|
||||||
|
// Disable "Yes" button while name is empty
|
||||||
|
nameField.onTextChanged(old -> popup.getYesButton().setEnabled(!nameField.getText().isEmpty())).onEnter(() -> {
|
||||||
|
if (popup.getYesButton().isEnabled()) {
|
||||||
|
popup.getYesButton().onClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.getYesButton().setDisabled();
|
||||||
|
// Register callback
|
||||||
|
Futures.addCallback(popup.getFuture(), new FutureCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nullable Boolean result) {
|
||||||
|
if (result == Boolean.TRUE) {
|
||||||
|
RenderJob newJob = new RenderJob();
|
||||||
|
newJob.setName(nameField.getText());
|
||||||
|
newJob.setSettings(guiRenderSettings.save(false));
|
||||||
|
newJob.setTimeline(timeline);
|
||||||
|
LOGGER.trace("Adding new job: {}", newJob);
|
||||||
|
queue.add(newJob);
|
||||||
|
list.getListPanel().addElements(null, new Entry(newJob));
|
||||||
|
} else {
|
||||||
|
LOGGER.trace("Adding cancelled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
LOGGER.error("Add Job popup:", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (guiRenderSettings != null) {
|
||||||
|
addButton.setEnabled(guiRenderSettings.renderButton.isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
renameButton.onClick(() -> {
|
||||||
|
LOGGER.trace("Rename button clicked for {}", selectedEntry.job);
|
||||||
|
// Open popup
|
||||||
|
GuiYesNoPopup popup = GuiYesNoPopup.open(container)
|
||||||
|
.setYesI18nLabel("replaymod.gui.rename").setNoI18nLabel("replaymod.gui.cancel");
|
||||||
|
popup.getInfo().setLayout(new HorizontalLayout(HorizontalLayout.Alignment.CENTER).setSpacing(5));
|
||||||
|
// Add content
|
||||||
|
GuiLabel label = new GuiLabel().setI18nText("replaymod.gui.renderqueue.jobname").setColor(Colors.BLACK);
|
||||||
|
GuiTextField nameField = new GuiTextField().setSize(150, 20).setFocused(true)
|
||||||
|
.setText(selectedEntry.job.getName());
|
||||||
|
popup.getInfo().addElements(new HorizontalLayout.Data(0.5), label, nameField);
|
||||||
|
// Disable "Yes" button while name is empty
|
||||||
|
nameField.onTextChanged(old -> popup.getYesButton().setEnabled(!nameField.getText().isEmpty())).onEnter(() -> {
|
||||||
|
if (popup.getYesButton().isEnabled()) {
|
||||||
|
popup.getYesButton().onClick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Register callback
|
||||||
|
Futures.addCallback(popup.getFuture(), new FutureCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(@Nullable Boolean result) {
|
||||||
|
if (result == Boolean.TRUE) {
|
||||||
|
LOGGER.trace("Renaming {} to \"{}\"", selectedEntry.job, nameField.getText());
|
||||||
|
selectedEntry.setName(nameField.getText());
|
||||||
|
} else {
|
||||||
|
LOGGER.trace("Renaming cancelled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
LOGGER.error("Rename Job popup:", t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
removeButton.onClick(() -> {
|
||||||
|
LOGGER.trace("Remove button clicked for {}", selectedEntry.job);
|
||||||
|
list.getListPanel().removeElement(selectedEntry);
|
||||||
|
queue.remove(selectedEntry.job);
|
||||||
|
selectedEntry = null;
|
||||||
|
updateButtons();
|
||||||
|
});
|
||||||
|
|
||||||
|
renderButton.onClick(() -> {
|
||||||
|
LOGGER.trace("Render button clicked");
|
||||||
|
// Close all GUIs (so settings in GuiRenderSettings are saved)
|
||||||
|
getMinecraft().displayGuiScreen(null);
|
||||||
|
// Start rendering
|
||||||
|
for (RenderJob renderJob : queue) {
|
||||||
|
LOGGER.info("Starting render job {}", renderJob);
|
||||||
|
try {
|
||||||
|
VideoRenderer videoRenderer = new VideoRenderer(renderJob.getSettings(), replayHandler, renderJob.getTimeline());
|
||||||
|
videoRenderer.renderVideo();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("Rendering video:", e);
|
||||||
|
GuiErrorScreen errorScreen = new GuiErrorScreen(I18n.format("replaymod.gui.rendering.error.title"),
|
||||||
|
I18n.format("replaymod.gui.rendering.error.message"));
|
||||||
|
getMinecraft().displayGuiScreen(errorScreen);
|
||||||
|
return;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
CrashReport crashReport = CrashReport.makeCrashReport(t, "Rendering video");
|
||||||
|
throw new ReportedException(crashReport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void open() {
|
||||||
|
super.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiRenderQueue getThis() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateButtons() {
|
||||||
|
renameButton.setEnabled(selectedEntry != null);
|
||||||
|
removeButton.setEnabled(selectedEntry != null);
|
||||||
|
renderButton.setEnabled(!list.getListPanel().getChildren().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Entry extends AbstractGuiClickableContainer<Entry> {
|
||||||
|
public final GuiLabel label = new GuiLabel(this);
|
||||||
|
public final RenderJob job;
|
||||||
|
|
||||||
|
public Entry(RenderJob job) {
|
||||||
|
this.job = job;
|
||||||
|
|
||||||
|
setLayout(new CustomLayout<Entry>() {
|
||||||
|
@Override
|
||||||
|
protected void layout(Entry container, int width, int height) {
|
||||||
|
pos(label, 5, height / 2 - height(label) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReadableDimension calcMinSize(GuiContainer<?> container) {
|
||||||
|
return new Dimension(buttonPanel.calcMinSize().getWidth(), 16);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
label.setText(job.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
selectedEntry = this;
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||||
|
if (selectedEntry == this) {
|
||||||
|
renderer.drawRect(0, 0, size.getWidth(), size.getHeight(), Colors.BLACK);
|
||||||
|
renderer.drawRect(0, 0, 2, size.getHeight(), Colors.WHITE);
|
||||||
|
}
|
||||||
|
super.draw(renderer, size, renderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
job.setName(name);
|
||||||
|
label.setText(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Entry getThis() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,13 +32,14 @@ import net.minecraft.crash.CrashReport;
|
|||||||
import net.minecraft.util.ReportedException;
|
import net.minecraft.util.ReportedException;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.common.config.Property;
|
import net.minecraftforge.common.config.Property;
|
||||||
|
import org.lwjgl.util.Color;
|
||||||
import org.lwjgl.util.Dimension;
|
import org.lwjgl.util.Dimension;
|
||||||
|
import org.lwjgl.util.ReadableColor;
|
||||||
import org.lwjgl.util.ReadableDimension;
|
import org.lwjgl.util.ReadableDimension;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -149,13 +150,18 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
public final GuiCheckbox inject360Metadata = new GuiCheckbox()
|
public final GuiCheckbox inject360Metadata = new GuiCheckbox()
|
||||||
.setI18nLabel("replaymod.gui.rendersettings.360metadata");
|
.setI18nLabel("replaymod.gui.rendersettings.360metadata");
|
||||||
|
|
||||||
|
public final GuiDropdownMenu<RenderSettings.AntiAliasing> antiAliasingDropdown = new GuiDropdownMenu<RenderSettings.AntiAliasing>()
|
||||||
|
.setSize(200, 20).setValues(RenderSettings.AntiAliasing.values()).setSelected(RenderSettings.AntiAliasing.NONE);
|
||||||
|
|
||||||
public final GuiPanel advancedPanel = new GuiPanel().setLayout(new VerticalLayout().setSpacing(15))
|
public final GuiPanel advancedPanel = new GuiPanel().setLayout(new VerticalLayout().setSpacing(15))
|
||||||
.addElements(null, nametagCheckbox, new GuiPanel().setLayout(
|
.addElements(null, nametagCheckbox, new GuiPanel().setLayout(
|
||||||
new GridLayout().setCellsEqualSize(false).setColumns(2).setSpacingX(5).setSpacingY(15))
|
new GridLayout().setCellsEqualSize(false).setColumns(2).setSpacingX(5).setSpacingY(15))
|
||||||
.addElements(new GridLayout.Data(0, 0.5),
|
.addElements(new GridLayout.Data(0, 0.5),
|
||||||
new GuiLabel().setI18nText("replaymod.gui.rendersettings.stabilizecamera"), stabilizePanel,
|
new GuiLabel().setI18nText("replaymod.gui.rendersettings.stabilizecamera"), stabilizePanel,
|
||||||
chromaKeyingCheckbox, chromaKeyingColor,
|
chromaKeyingCheckbox, chromaKeyingColor,
|
||||||
inject360Metadata));
|
inject360Metadata,
|
||||||
|
new GuiLabel(), // to show the anti-aliasing options in a new line
|
||||||
|
new GuiLabel().setI18nText("replaymod.gui.rendersettings.antialiasing"), antiAliasingDropdown));
|
||||||
|
|
||||||
public final GuiTextField exportCommand = new GuiTextField().setI18nHint("replaymod.gui.rendersettings.command")
|
public final GuiTextField exportCommand = new GuiTextField().setI18nHint("replaymod.gui.rendersettings.command")
|
||||||
.setSize(55, 20).setMaxLength(100);
|
.setSize(55, 20).setMaxLength(100);
|
||||||
@@ -179,6 +185,12 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
|
|
||||||
|
|
||||||
public final GuiPanel buttonPanel = new GuiPanel(contentPanel).setLayout(new HorizontalLayout().setSpacing(4));
|
public final GuiPanel buttonPanel = new GuiPanel(contentPanel).setLayout(new HorizontalLayout().setSpacing(4));
|
||||||
|
public final GuiButton queueButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
new GuiRenderQueue(GuiRenderSettings.this, GuiRenderSettings.this, replayHandler, timeline).open();
|
||||||
|
}
|
||||||
|
}).setSize(100, 20).setI18nLabel("replaymod.gui.renderqueue.open");
|
||||||
public final GuiButton renderButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton renderButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -198,13 +210,13 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
throw new ReportedException(crashReport);
|
throw new ReportedException(crashReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setSize(148, 20).setI18nLabel("replaymod.gui.render");
|
}).setSize(100, 20).setI18nLabel("replaymod.gui.render");
|
||||||
public final GuiButton cancelButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton cancelButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
getMinecraft().displayGuiScreen(null);
|
getMinecraft().displayGuiScreen(null);
|
||||||
}
|
}
|
||||||
}).setSize(148, 20).setI18nLabel("replaymod.gui.cancel");
|
}).setSize(100, 20).setI18nLabel("replaymod.gui.cancel");
|
||||||
|
|
||||||
{
|
{
|
||||||
setBackground(Background.NONE);
|
setBackground(Background.NONE);
|
||||||
@@ -261,12 +273,10 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
this.timeline = timeline;
|
this.timeline = timeline;
|
||||||
|
|
||||||
String json = getConfigProperty(ReplayModRender.instance.getConfiguration()).getString();
|
String json = getConfigProperty(ReplayModRender.instance.getConfiguration()).getString();
|
||||||
RenderSettings settings = new GsonBuilder().registerTypeAdapter(RenderSettings.class, new InstanceCreator<RenderSettings>() {
|
RenderSettings settings = new GsonBuilder()
|
||||||
@Override
|
.registerTypeAdapter(RenderSettings.class, (InstanceCreator<RenderSettings>) type -> getDefaultRenderSettings())
|
||||||
public RenderSettings createInstance(Type type) {
|
.registerTypeAdapter(ReadableColor.class, new Gson().getAdapter(Color.class))
|
||||||
return getDefaultRenderSettings();
|
.create().fromJson(json, RenderSettings.class);
|
||||||
}
|
|
||||||
}).create().fromJson(json, RenderSettings.class);
|
|
||||||
load(settings);
|
load(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,8 +357,8 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
public void load(RenderSettings settings) {
|
public void load(RenderSettings settings) {
|
||||||
renderMethodDropdown.setSelected(settings.getRenderMethod());
|
renderMethodDropdown.setSelected(settings.getRenderMethod());
|
||||||
encodingPresetDropdown.setSelected(settings.getEncodingPreset());
|
encodingPresetDropdown.setSelected(settings.getEncodingPreset());
|
||||||
videoWidth.setValue(settings.getVideoWidth());
|
videoWidth.setValue(settings.getTargetVideoWidth());
|
||||||
videoHeight.setValue(settings.getVideoHeight());
|
videoHeight.setValue(settings.getTargetVideoHeight());
|
||||||
frameRateSlider.setValue(settings.getFramesPerSecond() - 10);
|
frameRateSlider.setValue(settings.getFramesPerSecond() - 10);
|
||||||
if (settings.getBitRate() % (1 << 20) == 0) {
|
if (settings.getBitRate() % (1 << 20) == 0) {
|
||||||
bitRateField.setValue(settings.getBitRate() >> 20);
|
bitRateField.setValue(settings.getBitRate() >> 20);
|
||||||
@@ -380,6 +390,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
chromaKeyingColor.setColor(settings.getChromaKeyingColor());
|
chromaKeyingColor.setColor(settings.getChromaKeyingColor());
|
||||||
}
|
}
|
||||||
inject360Metadata.setChecked(settings.isInject360Metadata());
|
inject360Metadata.setChecked(settings.isInject360Metadata());
|
||||||
|
antiAliasingDropdown.setSelected(settings.getAntiAliasing());
|
||||||
exportCommand.setText(settings.getExportCommand());
|
exportCommand.setText(settings.getExportCommand());
|
||||||
exportArguments.setText(settings.getExportArguments());
|
exportArguments.setText(settings.getExportArguments());
|
||||||
|
|
||||||
@@ -401,6 +412,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
stabilizeRoll.isChecked() && (serialize || stabilizeRoll.isEnabled()),
|
stabilizeRoll.isChecked() && (serialize || stabilizeRoll.isEnabled()),
|
||||||
chromaKeyingCheckbox.isChecked() ? chromaKeyingColor.getColor() : null,
|
chromaKeyingCheckbox.isChecked() ? chromaKeyingColor.getColor() : null,
|
||||||
inject360Metadata.isChecked() && (serialize || inject360Metadata.isEnabled()),
|
inject360Metadata.isChecked() && (serialize || inject360Metadata.isEnabled()),
|
||||||
|
antiAliasingDropdown.getSelectedValue(),
|
||||||
exportCommand.getText(),
|
exportCommand.getText(),
|
||||||
exportArguments.getText(),
|
exportArguments.getText(),
|
||||||
net.minecraft.client.gui.GuiScreen.isCtrlKeyDown()
|
net.minecraft.client.gui.GuiScreen.isCtrlKeyDown()
|
||||||
@@ -415,7 +427,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
|
|
||||||
private RenderSettings getDefaultRenderSettings() {
|
private RenderSettings getDefaultRenderSettings() {
|
||||||
return new RenderSettings(RenderSettings.RenderMethod.DEFAULT, RenderSettings.EncodingPreset.MP4_DEFAULT, 1920, 1080, 60, 10 << 20, null,
|
return new RenderSettings(RenderSettings.RenderMethod.DEFAULT, RenderSettings.EncodingPreset.MP4_DEFAULT, 1920, 1080, 60, 10 << 20, null,
|
||||||
true, false, false, false, null, false, "", RenderSettings.EncodingPreset.MP4_DEFAULT.getValue(), false);
|
true, false, false, false, null, false, RenderSettings.AntiAliasing.NONE, "", RenderSettings.EncodingPreset.MP4_DEFAULT.getValue(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -431,4 +443,8 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
return configuration.get("rendersettings", "settings", "{}",
|
return configuration.get("rendersettings", "settings", "{}",
|
||||||
"Last state of the render settings GUI. Internal use only.");
|
"Last state of the render settings GUI. Internal use only.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReplayHandler getReplayHandler() {
|
||||||
|
return replayHandler;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.replaymod.render.rendering;
|
package com.replaymod.render.rendering;
|
||||||
|
|
||||||
import com.replaymod.pathing.player.AbstractTimelinePlayer;
|
import com.replaymod.pathing.player.AbstractTimelinePlayer;
|
||||||
|
import com.replaymod.pathing.player.ReplayTimer;
|
||||||
import com.replaymod.pathing.properties.TimestampProperty;
|
import com.replaymod.pathing.properties.TimestampProperty;
|
||||||
import com.replaymod.render.RenderSettings;
|
import com.replaymod.render.RenderSettings;
|
||||||
import com.replaymod.render.ReplayModRender;
|
import com.replaymod.render.ReplayModRender;
|
||||||
@@ -55,6 +56,7 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
private boolean debugInfoWasShown;
|
private boolean debugInfoWasShown;
|
||||||
private Map<SoundCategory, Float> originalSoundLevels;
|
private Map<SoundCategory, Float> originalSoundLevels;
|
||||||
|
|
||||||
|
private TimelinePlayer timelinePlayer;
|
||||||
private Future<Void> timelinePlayerFuture;
|
private Future<Void> timelinePlayerFuture;
|
||||||
private ChunkLoadingRenderGlobal chunkLoadingRenderGlobal;
|
private ChunkLoadingRenderGlobal chunkLoadingRenderGlobal;
|
||||||
|
|
||||||
@@ -174,7 +176,8 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setup() {
|
private void setup() {
|
||||||
timelinePlayerFuture = new TimelinePlayer(replayHandler).start(timeline);
|
timelinePlayer = new TimelinePlayer(replayHandler);
|
||||||
|
timelinePlayerFuture = timelinePlayer.start(timeline);
|
||||||
|
|
||||||
if (!OpenGlHelper.isFramebufferEnabled()) {
|
if (!OpenGlHelper.isFramebufferEnabled()) {
|
||||||
Display.setResizable(false);
|
Display.setResizable(false);
|
||||||
@@ -226,6 +229,8 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
if (!timelinePlayerFuture.isDone()) {
|
if (!timelinePlayerFuture.isDone()) {
|
||||||
timelinePlayerFuture.cancel(false);
|
timelinePlayerFuture.cancel(false);
|
||||||
}
|
}
|
||||||
|
// Tear down of the timeline player might only happen the next tick after it was cancelled
|
||||||
|
timelinePlayer.onTick(new ReplayTimer.UpdatedEvent());
|
||||||
|
|
||||||
if (!OpenGlHelper.isFramebufferEnabled()) {
|
if (!OpenGlHelper.isFramebufferEnabled()) {
|
||||||
Display.setResizable(true);
|
Display.setResizable(true);
|
||||||
|
|||||||
12
src/main/java/com/replaymod/render/utils/RenderJob.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.replaymod.render.utils;
|
||||||
|
|
||||||
|
import com.replaymod.render.RenderSettings;
|
||||||
|
import com.replaymod.replaystudio.pathing.path.Timeline;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RenderJob {
|
||||||
|
private String name;
|
||||||
|
private Timeline timeline;
|
||||||
|
private RenderSettings settings;
|
||||||
|
}
|
||||||
@@ -110,12 +110,12 @@ public class ReplayHandler {
|
|||||||
|
|
||||||
channel.close().awaitUninterruptibly();
|
channel.close().awaitUninterruptibly();
|
||||||
|
|
||||||
if (mc.thePlayer instanceof CameraEntity) {
|
if (mc.player instanceof CameraEntity) {
|
||||||
mc.thePlayer.setDead();
|
mc.player.setDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
mc.theWorld.sendQuittingDisconnectingPacket();
|
mc.world.sendQuittingDisconnectingPacket();
|
||||||
mc.loadWorld(null);
|
mc.loadWorld(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public class ReplayHandler {
|
|||||||
* @return {@code true} if the camera is the view entity, {@code false} otherwise
|
* @return {@code true} if the camera is the view entity, {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isCameraView() {
|
public boolean isCameraView() {
|
||||||
return mc.thePlayer instanceof CameraEntity && mc.thePlayer == mc.getRenderViewEntity();
|
return mc.player instanceof CameraEntity && mc.player == mc.getRenderViewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,7 +249,7 @@ public class ReplayHandler {
|
|||||||
* @return The camera entity or {@code null} if it does not yet exist
|
* @return The camera entity or {@code null} if it does not yet exist
|
||||||
*/
|
*/
|
||||||
public CameraEntity getCameraEntity() {
|
public CameraEntity getCameraEntity() {
|
||||||
return mc.thePlayer instanceof CameraEntity ? (CameraEntity) mc.thePlayer : null;
|
return mc.player instanceof CameraEntity ? (CameraEntity) mc.player : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getSpectatedUUID() {
|
public UUID getSpectatedUUID() {
|
||||||
@@ -329,7 +329,7 @@ public class ReplayHandler {
|
|||||||
replaySender.setReplaySpeed(0);
|
replaySender.setReplaySpeed(0);
|
||||||
|
|
||||||
mc.getConnection().getNetworkManager().processReceivedPackets();
|
mc.getConnection().getNetworkManager().processReceivedPackets();
|
||||||
for (Entity entity : mc.theWorld.loadedEntityList) {
|
for (Entity entity : mc.world.loadedEntityList) {
|
||||||
if (entity instanceof EntityOtherPlayerMP) {
|
if (entity instanceof EntityOtherPlayerMP) {
|
||||||
EntityOtherPlayerMP e = (EntityOtherPlayerMP) entity;
|
EntityOtherPlayerMP e = (EntityOtherPlayerMP) entity;
|
||||||
e.setPosition(e.otherPlayerMPX, e.otherPlayerMPY, e.otherPlayerMPZ);
|
e.setPosition(e.otherPlayerMPX, e.otherPlayerMPY, e.otherPlayerMPZ);
|
||||||
|
|||||||
@@ -28,15 +28,17 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Mod(modid = ReplayModReplay.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModReplay.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModReplay {
|
public class ReplayModReplay {
|
||||||
public static final String MOD_ID = "replaymod-replay";
|
public static final String MOD_ID = "replaymod-replay";
|
||||||
|
|
||||||
@Mod.Instance(MOD_ID)
|
@Mod.Instance(MOD_ID)
|
||||||
public static ReplayModReplay instance;
|
public static ReplayModReplay instance;
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
private ReplayMod core;
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
private final CameraControllerRegistry cameraControllerRegistry = new CameraControllerRegistry();
|
private final CameraControllerRegistry cameraControllerRegistry = new CameraControllerRegistry();
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ public class ReplayModReplay {
|
|||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
logger = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
|
|
||||||
core.getSettingsRegistry().register(Setting.class);
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
|
|
||||||
|
|||||||
@@ -257,8 +257,8 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
// Entity#addedToChunk is not set and it is therefore not updated every tick.
|
// Entity#addedToChunk is not set and it is therefore not updated every tick.
|
||||||
// To counteract this, we need to manually update it's position if it hasn't been added
|
// To counteract this, we need to manually update it's position if it hasn't been added
|
||||||
// to any chunk yet.
|
// to any chunk yet.
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
for (EntityPlayer playerEntity : mc.theWorld.playerEntities) {
|
for (EntityPlayer playerEntity : mc.world.playerEntities) {
|
||||||
if (!playerEntity.addedToChunk && playerEntity instanceof EntityOtherPlayerMP) {
|
if (!playerEntity.addedToChunk && playerEntity instanceof EntityOtherPlayerMP) {
|
||||||
playerEntity.onLivingUpdate();
|
playerEntity.onLivingUpdate();
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
// If we do not give minecraft time to tick, there will be dead entity artifacts left in the world
|
// If we do not give minecraft time to tick, there will be dead entity artifacts left in the world
|
||||||
// Therefore we have to remove all loaded, dead entities manually if we are in sync mode.
|
// Therefore we have to remove all loaded, dead entities manually if we are in sync mode.
|
||||||
// We do this after every SpawnX packet and after the destroy entities packet.
|
// We do this after every SpawnX packet and after the destroy entities packet.
|
||||||
if (!asyncMode && mc.theWorld != null) {
|
if (!asyncMode && mc.world != null) {
|
||||||
if (p instanceof SPacketSpawnPlayer
|
if (p instanceof SPacketSpawnPlayer
|
||||||
|| p instanceof SPacketSpawnObject
|
|| p instanceof SPacketSpawnObject
|
||||||
|| p instanceof SPacketSpawnMob
|
|| p instanceof SPacketSpawnMob
|
||||||
@@ -300,7 +300,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
|| p instanceof SPacketSpawnPainting
|
|| p instanceof SPacketSpawnPainting
|
||||||
|| p instanceof SPacketSpawnExperienceOrb
|
|| p instanceof SPacketSpawnExperienceOrb
|
||||||
|| p instanceof SPacketDestroyEntities) {
|
|| p instanceof SPacketDestroyEntities) {
|
||||||
World world = mc.theWorld;
|
World world = mc.world;
|
||||||
for (int i = 0; i < world.loadedEntityList.size(); ++i) {
|
for (int i = 0; i < world.loadedEntityList.size(); ++i) {
|
||||||
Entity entity = world.loadedEntityList.get(i);
|
Entity entity = world.loadedEntityList.get(i);
|
||||||
if (entity.isDead) {
|
if (entity.isDead) {
|
||||||
@@ -331,7 +331,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
ByteBuf bb = Unpooled.wrappedBuffer(bytes);
|
ByteBuf bb = Unpooled.wrappedBuffer(bytes);
|
||||||
PacketBuffer pb = new PacketBuffer(bb);
|
PacketBuffer pb = new PacketBuffer(bb);
|
||||||
|
|
||||||
int i = pb.readVarIntFromBuffer();
|
int i = pb.readVarInt();
|
||||||
|
|
||||||
Packet p = EnumConnectionState.PLAY.getPacket(EnumPacketDirection.CLIENTBOUND, i);
|
Packet p = EnumConnectionState.PLAY.getPacket(EnumPacketDirection.CLIENTBOUND, i);
|
||||||
p.readPacketData(pb);
|
p.readPacketData(pb);
|
||||||
@@ -460,7 +460,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Void call() {
|
public Void call() {
|
||||||
if (mc.theWorld == null || !mc.isCallingFromMinecraftThread()) {
|
if (mc.world == null || !mc.isCallingFromMinecraftThread()) {
|
||||||
synchronized(mc.scheduledTasks) {
|
synchronized(mc.scheduledTasks) {
|
||||||
mc.scheduledTasks.add(ListenableFutureTask.create(this));
|
mc.scheduledTasks.add(ListenableFutureTask.create(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The camera entity used as the main player entity during replay viewing.
|
* The camera entity used as the main player entity during replay viewing.
|
||||||
* During a replay {@link Minecraft#thePlayer} should be an instance of this class.
|
* During a replay {@link Minecraft#player} should be an instance of this class.
|
||||||
* Camera movement is controlled by a separate {@link CameraController}.
|
* Camera movement is controlled by a separate {@link CameraController}.
|
||||||
*/
|
*/
|
||||||
public class CameraEntity extends EntityPlayerSP {
|
public class CameraEntity extends EntityPlayerSP {
|
||||||
@@ -156,9 +156,9 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
// entity is recreated and we have to spectate a new entity
|
// entity is recreated and we have to spectate a new entity
|
||||||
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
||||||
if (spectating != null && (view.getUniqueID() != spectating
|
if (spectating != null && (view.getUniqueID() != spectating
|
||||||
|| view.worldObj != worldObj)
|
|| view.world != world)
|
||||||
|| worldObj.getEntityByID(view.getEntityId()) != view) {
|
|| world.getEntityByID(view.getEntityId()) != view) {
|
||||||
view = worldObj.getPlayerEntityByUUID(spectating);
|
view = world.getPlayerEntityByUUID(spectating);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
mc.setRenderViewEntity(view);
|
mc.setRenderViewEntity(view);
|
||||||
} else {
|
} else {
|
||||||
@@ -177,17 +177,17 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
@Override
|
@Override
|
||||||
public void preparePlayerToSpawn() {
|
public void preparePlayerToSpawn() {
|
||||||
// Make sure our world is up-to-date in case of world changes
|
// Make sure our world is up-to-date in case of world changes
|
||||||
if (mc.theWorld != null) {
|
if (mc.world != null) {
|
||||||
worldObj = mc.theWorld;
|
world = mc.world;
|
||||||
}
|
}
|
||||||
super.preparePlayerToSpawn();
|
super.preparePlayerToSpawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(float yaw, float pitch) {
|
public void setRotation(float yaw, float pitch) {
|
||||||
if (mc.getRenderViewEntity() == this) {
|
if (mc.getRenderViewEntity() == this) {
|
||||||
// Only update camera rotation when the camera is the view
|
// Only update camera rotation when the camera is the view
|
||||||
super.setAngles(yaw, pitch);
|
super.setRotation(yaw, pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,8 +439,8 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
mc.entityRenderer.itemRenderer.itemStackOffHand = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
mc.entityRenderer.itemRenderer.itemStackOffHand = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||||
|
|
||||||
|
|
||||||
mc.thePlayer.renderArmYaw = mc.thePlayer.prevRenderArmYaw = player.rotationYaw;
|
mc.player.renderArmYaw = mc.player.prevRenderArmYaw = player.rotationYaw;
|
||||||
mc.thePlayer.renderArmPitch = mc.thePlayer.prevRenderArmPitch = player.rotationPitch;
|
mc.player.renderArmPitch = mc.player.prevRenderArmPitch = player.rotationPitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class GuiMarkerTimeline extends AbstractGuiTimeline<GuiMarkerTimeline> im
|
|||||||
|
|
||||||
protected void drawMarker(GuiRenderer renderer, ReadableDimension size, Marker marker) {
|
protected void drawMarker(GuiRenderer renderer, ReadableDimension size, Marker marker) {
|
||||||
int visibleLength = (int) (getLength() * getZoom());
|
int visibleLength = (int) (getLength() * getZoom());
|
||||||
int markerPos = MathHelper.clamp_int(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
int markerPos = MathHelper.clamp(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
||||||
double positionInVisible = markerPos - getOffset();
|
double positionInVisible = markerPos - getOffset();
|
||||||
double fractionOfVisible = positionInVisible / visibleLength;
|
double fractionOfVisible = positionInVisible / visibleLength;
|
||||||
int markerX = (int) (BORDER_LEFT + fractionOfVisible * (size.getWidth() - BORDER_LEFT - BORDER_RIGHT));
|
int markerX = (int) (BORDER_LEFT + fractionOfVisible * (size.getWidth() - BORDER_LEFT - BORDER_RIGHT));
|
||||||
@@ -99,7 +99,7 @@ public class GuiMarkerTimeline extends AbstractGuiTimeline<GuiMarkerTimeline> im
|
|||||||
int visibleLength = (int) (getLength() * getZoom());
|
int visibleLength = (int) (getLength() * getZoom());
|
||||||
int contentWidth = lastSize.getWidth() - BORDER_LEFT - BORDER_RIGHT;
|
int contentWidth = lastSize.getWidth() - BORDER_LEFT - BORDER_RIGHT;
|
||||||
for (Marker marker : replayHandler.getMarkers()) {
|
for (Marker marker : replayHandler.getMarkers()) {
|
||||||
int markerPos = MathHelper.clamp_int(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
int markerPos = MathHelper.clamp(marker.getTime(), getOffset(), getOffset() + visibleLength);
|
||||||
double positionInVisible = markerPos - getOffset();
|
double positionInVisible = markerPos - getOffset();
|
||||||
double fractionOfVisible = positionInVisible / visibleLength;
|
double fractionOfVisible = positionInVisible / visibleLength;
|
||||||
int markerX = (int) (BORDER_LEFT + fractionOfVisible * contentWidth);
|
int markerX = (int) (BORDER_LEFT + fractionOfVisible * contentWidth);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class MixinGuiSpectator {
|
|||||||
@Inject(method = "onHotbarSelected", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onHotbarSelected", at = @At("HEAD"), cancellable = true)
|
||||||
public void isInReplay(int i, CallbackInfo ci) {
|
public void isInReplay(int i, CallbackInfo ci) {
|
||||||
// Prevent spectator gui from opening while in a replay
|
// Prevent spectator gui from opening while in a replay
|
||||||
if (mc.thePlayer instanceof CameraEntity) {
|
if (mc.player instanceof CameraEntity) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public abstract class MixinPlayerControllerMP {
|
|||||||
|
|
||||||
@Inject(method = "isSpectator", at=@At("HEAD"), cancellable = true)
|
@Inject(method = "isSpectator", at=@At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_isSpectator(CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_isSpectator(CallbackInfoReturnable<Boolean> ci) {
|
||||||
if (mc.thePlayer instanceof CameraEntity) { // this check should in theory not be required
|
if (mc.player instanceof CameraEntity) { // this check should in theory not be required
|
||||||
ci.setReturnValue(mc.thePlayer.isSpectator());
|
ci.setReturnValue(mc.player.isSpectator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class MixinRenderArmorStand {
|
public abstract class MixinRenderArmorStand {
|
||||||
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_canRenderInvisibleName(EntityArmorStand entity, CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_canRenderInvisibleName(EntityArmorStand entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer thePlayer = Minecraft.getMinecraft().player;
|
||||||
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
ci.setReturnValue(false);
|
ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public abstract class MixinRenderLivingBase {
|
public abstract class MixinRenderLivingBase {
|
||||||
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||||
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer thePlayer = Minecraft.getMinecraft().player;
|
||||||
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
ci.setReturnValue(false);
|
ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public abstract class MixinViewFrustum {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = MathHelper.floor_double(viewEntityX) - 8;
|
int i = MathHelper.floor(viewEntityX) - 8;
|
||||||
int j = MathHelper.floor_double(viewEntityZ) - 8;
|
int j = MathHelper.floor(viewEntityZ) - 8;
|
||||||
int k = this.countChunksX * 16;
|
int k = this.countChunksX * 16;
|
||||||
|
|
||||||
for (int l = 0; l < this.countChunksX; ++l) {
|
for (int l = 0; l < this.countChunksX; ++l) {
|
||||||
|
|||||||
@@ -26,20 +26,23 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Mod(modid = ReplayModSimplePathing.MOD_ID, useMetadata = true)
|
@Mod(modid = ReplayModSimplePathing.MOD_ID,
|
||||||
|
version = "@MOD_VERSION@",
|
||||||
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
||||||
|
useMetadata = true)
|
||||||
public class ReplayModSimplePathing implements PathingRegistry {
|
public class ReplayModSimplePathing implements PathingRegistry {
|
||||||
public static final String MOD_ID = "replaymod-simplepathing";
|
public static final String MOD_ID = "replaymod-simplepathing";
|
||||||
|
|
||||||
@Mod.Instance(ReplayMod.MOD_ID)
|
private ReplayMod core;
|
||||||
private static ReplayMod core;
|
|
||||||
|
|
||||||
private Logger logger;
|
public static Logger LOGGER;
|
||||||
|
|
||||||
private GuiPathing guiPathing;
|
private GuiPathing guiPathing;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
LOGGER = event.getModLog();
|
||||||
|
core = ReplayMod.instance;
|
||||||
|
|
||||||
core.getSettingsRegistry().register(Setting.class);
|
core.getSettingsRegistry().register(Setting.class);
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
setBackgroundColor(Colors.DARK_TRANSPARENT);
|
setBackgroundColor(Colors.DARK_TRANSPARENT);
|
||||||
|
|
||||||
popup.setLayout(new VerticalLayout().setSpacing(10))
|
popup.setLayout(new VerticalLayout().setSpacing(10))
|
||||||
.addElements(new VerticalLayout.Data(0.5), title, inputs, timePanel, buttons);
|
.addElements(new VerticalLayout.Data(0.5, false), title, inputs, timePanel, buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiEditKeyframe(GuiPathing gui, Path path, Keyframe keyframe, String type) {
|
public GuiEditKeyframe(GuiPathing gui, Path path, Keyframe keyframe, String type) {
|
||||||
@@ -179,13 +179,13 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Position extends GuiEditKeyframe<Position> {
|
public static class Position extends GuiEditKeyframe<Position> {
|
||||||
public final GuiNumberField xField = newGuiNumberField().setSize(150, 20).setPrecision(10);
|
public final GuiNumberField xField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
public final GuiNumberField yField = newGuiNumberField().setSize(150, 20).setPrecision(10);
|
public final GuiNumberField yField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
public final GuiNumberField zField = newGuiNumberField().setSize(150, 20).setPrecision(10);
|
public final GuiNumberField zField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
|
|
||||||
public final GuiNumberField yawField = newGuiNumberField().setSize(150, 20).setPrecision(5);
|
public final GuiNumberField yawField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
public final GuiNumberField pitchField = newGuiNumberField().setSize(150, 20).setPrecision(5);
|
public final GuiNumberField pitchField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
public final GuiNumberField rollField = newGuiNumberField().setSize(150, 20).setPrecision(5);
|
public final GuiNumberField rollField = newGuiNumberField().setSize(60, 20).setPrecision(5);
|
||||||
|
|
||||||
{
|
{
|
||||||
inputs.setLayout(new GridLayout().setCellsEqualSize(false).setColumns(4).setSpacingX(3).setSpacingY(5))
|
inputs.setLayout(new GridLayout().setCellsEqualSize(false).setColumns(4).setSpacingX(3).setSpacingY(5))
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.replaymod.replaystudio.pathing.path.Path;
|
|||||||
import com.replaymod.replaystudio.pathing.path.PathSegment;
|
import com.replaymod.replaystudio.pathing.path.PathSegment;
|
||||||
import com.replaymod.replaystudio.pathing.path.Timeline;
|
import com.replaymod.replaystudio.pathing.path.Timeline;
|
||||||
import com.replaymod.replaystudio.pathing.property.Property;
|
import com.replaymod.replaystudio.pathing.property.Property;
|
||||||
|
import com.replaymod.replaystudio.pathing.serialize.TimelineSerialization;
|
||||||
import com.replaymod.replaystudio.util.EntityPositionTracker;
|
import com.replaymod.replaystudio.util.EntityPositionTracker;
|
||||||
import com.replaymod.replaystudio.util.Location;
|
import com.replaymod.replaystudio.util.Location;
|
||||||
import com.replaymod.simplepathing.ReplayModSimplePathing;
|
import com.replaymod.simplepathing.ReplayModSimplePathing;
|
||||||
@@ -41,6 +42,7 @@ import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
|
|||||||
import de.johni0702.minecraft.gui.popup.GuiInfoPopup;
|
import de.johni0702.minecraft.gui.popup.GuiInfoPopup;
|
||||||
import de.johni0702.minecraft.gui.popup.GuiYesNoPopup;
|
import de.johni0702.minecraft.gui.popup.GuiYesNoPopup;
|
||||||
import de.johni0702.minecraft.gui.utils.Colors;
|
import de.johni0702.minecraft.gui.utils.Colors;
|
||||||
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import org.apache.commons.lang3.tuple.Triple;
|
import org.apache.commons.lang3.tuple.Triple;
|
||||||
@@ -56,10 +58,14 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static com.replaymod.core.utils.Utils.error;
|
||||||
|
import static com.replaymod.simplepathing.ReplayModSimplePathing.LOGGER;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gui plug-in to the GuiReplayOverlay for simple pathing.
|
* Gui plug-in to the GuiReplayOverlay for simple pathing.
|
||||||
@@ -91,7 +97,19 @@ public class GuiPathing {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!preparePathsForPlayback()) return;
|
if (!preparePathsForPlayback()) return;
|
||||||
new GuiRenderSettings(replayHandler, mod.getCurrentTimeline()).display();
|
|
||||||
|
// Clone the timeline passed to the settings gui as it may be stored for later rendering in a queue
|
||||||
|
Timeline timeline = mod.getCurrentTimeline();
|
||||||
|
try {
|
||||||
|
TimelineSerialization serialization = new TimelineSerialization(mod, null);
|
||||||
|
String serialized = serialization.serialize(Collections.singletonMap("", timeline));
|
||||||
|
timeline = serialization.deserialize(serialized).get("");
|
||||||
|
} catch (Throwable t) {
|
||||||
|
error(LOGGER, replayHandler.getOverlay(), CrashReport.makeCrashReport(t, "Cloning timeline"), () -> {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new GuiRenderSettings(replayHandler, timeline).display();
|
||||||
}
|
}
|
||||||
}).setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 0)
|
}).setSize(20, 20).setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(40, 0)
|
||||||
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.ingame.menu.renderpath"));
|
.setTooltip(new GuiTooltip().setI18nText("replaymod.gui.ingame.menu.renderpath"));
|
||||||
@@ -512,6 +530,13 @@ public class GuiPathing {
|
|||||||
lastTime = time;
|
lastTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure there are at least two position- and two time-keyframes
|
||||||
|
if (timeline.getPaths().get(POSITION_PATH).getSegments().isEmpty()
|
||||||
|
|| timeline.getPaths().get(TIME_PATH).getSegments().isEmpty()) {
|
||||||
|
GuiInfoPopup.open(replayHandler.getOverlay(), "replaymod.chat.morekeyframes");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,8 @@ replaymod.gui.editor.trim.description=Removes the beginning and end of a Replay
|
|||||||
replaymod.gui.editor.connect.description=Connects multiple Replays in the specified order
|
replaymod.gui.editor.connect.description=Connects multiple Replays in the specified order
|
||||||
replaymod.gui.editor.modify.description=Provides several filters to modify Replay Files
|
replaymod.gui.editor.modify.description=Provides several filters to modify Replay Files
|
||||||
|
|
||||||
|
replaymod.gui.editor.trim.marker=Select Event Marker
|
||||||
|
|
||||||
replaymod.gui.editor.progress.title=Editing Replay File...
|
replaymod.gui.editor.progress.title=Editing Replay File...
|
||||||
replaymod.gui.editor.progress.pleasewait=Please wait while the Replay is being edited.
|
replaymod.gui.editor.progress.pleasewait=Please wait while the Replay is being edited.
|
||||||
|
|
||||||
@@ -424,6 +426,18 @@ replaymod.gui.rendersettings.presets.webm.custom=WEBM - Custom Bitrate
|
|||||||
replaymod.gui.rendersettings.presets.mkv.lossless=MKV - Lossless
|
replaymod.gui.rendersettings.presets.mkv.lossless=MKV - Lossless
|
||||||
replaymod.gui.rendersettings.presets.png=PNG Sequence
|
replaymod.gui.rendersettings.presets.png=PNG Sequence
|
||||||
|
|
||||||
|
replaymod.gui.rendersettings.antialiasing=Anti-Aliasing
|
||||||
|
replaymod.gui.rendersettings.antialiasing.none=None
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x2=2x
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x4=4x
|
||||||
|
replaymod.gui.rendersettings.antialiasing.x8=8x
|
||||||
|
|
||||||
|
#Render Queue GUI
|
||||||
|
replaymod.gui.renderqueue.title=Render Queue
|
||||||
|
replaymod.gui.renderqueue.open=Open Queue
|
||||||
|
replaymod.gui.renderqueue.jobname=Job Name:
|
||||||
|
replaymod.gui.renderqueue.add=Add current configuration
|
||||||
|
|
||||||
#Rendering GUI
|
#Rendering GUI
|
||||||
replaymod.gui.rendering.title=Rendering Video
|
replaymod.gui.rendering.title=Rendering Video
|
||||||
replaymod.gui.rendering.pause=Pause Rendering
|
replaymod.gui.rendering.pause=Pause Rendering
|
||||||
|
|||||||
@@ -100,6 +100,23 @@
|
|||||||
"screenshots": [],
|
"screenshots": [],
|
||||||
"dependencies": ["required-after:replaymod-replay"]
|
"dependencies": ["required-after:replaymod-replay"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"modid": "replaymod-editor",
|
||||||
|
"name": "Replay Mod - Replay Editor",
|
||||||
|
"description": "Replay Editor Module of the ReplayMod",
|
||||||
|
"version": "${version}",
|
||||||
|
"mcversion": "${mcversion}",
|
||||||
|
"url": "https://replaymod.com",
|
||||||
|
"updateUrl": "https://replaymod.com/download",
|
||||||
|
"authorList": [
|
||||||
|
"CrushedPixel",
|
||||||
|
"johni0702"
|
||||||
|
],
|
||||||
|
"logoFile": "replaymod_logo.png",
|
||||||
|
"parent": "replaymod",
|
||||||
|
"screenshots": [],
|
||||||
|
"dependencies": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"modid": "replaymod-extras",
|
"modid": "replaymod-extras",
|
||||||
"name": "Replay Mod - Extras",
|
"name": "Replay Mod - Extras",
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
"client": [
|
"client": [
|
||||||
"MixinShaderEntityRenderer",
|
"MixinShaderEntityRenderer",
|
||||||
"MixinShaderRenderChunk",
|
"MixinShaderRenderChunk",
|
||||||
"MixinShaderRenderGlobal"
|
"MixinShaderRenderGlobal",
|
||||||
|
"MixinShadersRender"
|
||||||
],
|
],
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
"refmap": "mixins.replaymod.refmap.json"
|
"refmap": "mixins.replaymod.refmap.json"
|
||||||
}
|
}
|
||||||