Get core, recording and replay modules compiling on 1.13.2
This commit is contained in:
@@ -36,6 +36,7 @@ import org.apache.commons.io.IOUtils;
|
||||
|
||||
//#if MC>=11300
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11200
|
||||
@@ -377,10 +378,14 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
int chunkX = entity.chunkCoordX;
|
||||
int chunkY = entity.chunkCoordZ;
|
||||
|
||||
//#if MC>=11300
|
||||
if (entity.addedToChunk && world.getChunkProvider().provideChunk(chunkX, chunkY, false, false) != null) {
|
||||
//#else
|
||||
//#if MC>=10904
|
||||
if (entity.addedToChunk && world.getChunkProvider().getLoadedChunk(chunkX, chunkY) != null) {
|
||||
//$$ if (entity.addedToChunk && world.getChunkProvider().getLoadedChunk(chunkX, chunkY) != null) {
|
||||
//#else
|
||||
//$$ if (entity.addedToChunk && world.getChunkProvider().chunkExists(chunkX, chunkY)) {
|
||||
//#endif
|
||||
//#endif
|
||||
//#if MC>=11300
|
||||
world.getChunk(chunkX, chunkY).removeEntity(entity);
|
||||
@@ -566,7 +571,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
actualID = entId;
|
||||
entId = -1789435; // Camera entity id should be negative which is an invalid id and can't be used by servers
|
||||
//#if MC>=10800
|
||||
int dimension = packet.getDimension();
|
||||
//#if MC>=11300
|
||||
DimensionType dimension = packet.func_212642_e();
|
||||
//#else
|
||||
//$$ int dimension = packet.getDimension();
|
||||
//#endif
|
||||
EnumDifficulty difficulty = packet.getDifficulty();
|
||||
//#if MC>=11300
|
||||
int maxPlayers = 0;// FIXME needs AT packet.maxPlayers;
|
||||
@@ -596,7 +605,12 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#if MC>=10904
|
||||
if(p instanceof SPacketRespawn) {
|
||||
SPacketRespawn respawn = (SPacketRespawn) p;
|
||||
p = new SPacketRespawn(respawn.getDimensionID(),
|
||||
p = new SPacketRespawn(
|
||||
//#if MC>=11300
|
||||
respawn.func_212643_b(),
|
||||
//#else
|
||||
//$$ respawn.getDimensionID(),
|
||||
//#endif
|
||||
respawn.getDifficulty(), respawn.getWorldType(), GameType.SPECTATOR);
|
||||
//#else
|
||||
//$$ if(p instanceof S07PacketRespawn) {
|
||||
@@ -1083,7 +1097,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
World world = world(mc);
|
||||
IChunkProvider chunkProvider = world.getChunkProvider();
|
||||
// Get the chunk that will be unloaded
|
||||
Chunk chunk = chunkProvider.provideChunk(x, z);
|
||||
//#if MC>=11300
|
||||
Chunk chunk = chunkProvider.provideChunk(x, z, false, false);
|
||||
//#else
|
||||
//$$ Chunk chunk = chunkProvider.provideChunk(x, z);
|
||||
//#endif
|
||||
if (!chunk.isEmpty()) {
|
||||
List<Entity> entitiesInChunk = new ArrayList<>();
|
||||
// Gather all entities in that chunk
|
||||
@@ -1109,12 +1127,16 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
if (entity.chunkCoordX != chunkX || entity.chunkCoordZ != chunkZ) {
|
||||
// Entity has left the chunk
|
||||
chunk.removeEntityAtIndex(entity, entity.chunkCoordY);
|
||||
//#if MC>=11300
|
||||
Chunk newChunk = chunkProvider.provideChunk(chunkX, chunkZ, false, false);
|
||||
//#else
|
||||
//#if MC>=10904
|
||||
Chunk newChunk = chunkProvider.getLoadedChunk(chunkX, chunkZ);
|
||||
//$$ Chunk newChunk = chunkProvider.getLoadedChunk(chunkX, chunkZ);
|
||||
//#else
|
||||
//$$ Chunk newChunk = chunkProvider.chunkExists(chunkX, chunkZ)
|
||||
//$$ ? chunkProvider.provideChunk(chunkX, chunkZ) : null;
|
||||
//#endif
|
||||
//#endif
|
||||
if (newChunk != null) {
|
||||
newChunk.addEntity(entity);
|
||||
} else {
|
||||
|
||||
@@ -54,11 +54,15 @@ public class NoGuiScreenshot {
|
||||
mc.getFramebuffer().bindFramebuffer(true);
|
||||
GlStateManager.enableTexture2D();
|
||||
|
||||
//#if MC>=11300
|
||||
mc.entityRenderer.renderWorld(mc.timer.renderPartialTicks, System.nanoTime());
|
||||
//#else
|
||||
//#if MC>=10809
|
||||
mc.entityRenderer.updateCameraAndRender(mc.timer.renderPartialTicks, System.nanoTime());
|
||||
//$$ mc.entityRenderer.updateCameraAndRender(mc.timer.renderPartialTicks, System.nanoTime());
|
||||
//#else
|
||||
//$$ mc.entityRenderer.updateCameraAndRender(mc.timer.renderPartialTicks);
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
mc.getFramebuffer().unbindFramebuffer();
|
||||
GlStateManager.popMatrix();
|
||||
@@ -79,7 +83,12 @@ public class NoGuiScreenshot {
|
||||
// disk for better maintainability
|
||||
File tmpFolder = Files.createTempDir();
|
||||
try {
|
||||
ScreenShotHelper.saveScreenshot(tmpFolder, "tmp", frameWidth, frameHeight, mc.getFramebuffer());
|
||||
//#if MC>=11300
|
||||
ScreenShotHelper.saveScreenshot(tmpFolder, "tmp", frameWidth, frameHeight, mc.getFramebuffer(), (msg) ->
|
||||
mc.addScheduledTask(() -> mc.ingameGUI.getChatGUI().printChatMessage(msg)));
|
||||
//#else
|
||||
//$$ ScreenShotHelper.saveScreenshot(tmpFolder, "tmp", frameWidth, frameHeight, mc.getFramebuffer());
|
||||
//#endif
|
||||
File screenshotFile = new File(tmpFolder, "screenshots/tmp");
|
||||
BufferedImage image = ImageIO.read(screenshotFile);
|
||||
int imageWidth = image.getWidth();
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.replaymod.core.KeyBindingRegistry;
|
||||
import com.replaymod.core.Module;
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.utils.ModCompat;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
@@ -29,23 +31,12 @@ import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
//$$ import org.lwjgl.input.Keyboard;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
//$$ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
//$$ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
//#endif
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ReplayModReplay extends ReplayMod.Module {
|
||||
public class ReplayModReplay implements Module {
|
||||
|
||||
{ instance = this; }
|
||||
public static ReplayModReplay instance;
|
||||
@@ -64,13 +55,13 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
|
||||
public ReplayModReplay(ReplayMod core) {
|
||||
this.core = core;
|
||||
|
||||
core.getSettingsRegistry().register(Setting.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
core.getSettingsRegistry().register(Setting.class);
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.marker", MCVer.Keyboard.KEY_M, new Runnable() {
|
||||
public void registerKeyBindings(KeyBindingRegistry registry) {
|
||||
registry.registerKeyBinding("replaymod.input.marker", MCVer.Keyboard.KEY_M, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (replayHandler != null ) {
|
||||
@@ -91,7 +82,7 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
}
|
||||
});
|
||||
|
||||
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
|
||||
registry.registerRaw(Keyboard.KEY_DELETE, () -> {
|
||||
if (replayHandler != null) {
|
||||
GuiMarkerTimeline timeline = replayHandler.getOverlay().timeline;
|
||||
if (timeline.getSelectedMarker() != null) {
|
||||
@@ -102,7 +93,7 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
}
|
||||
});
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.thumbnail", Keyboard.KEY_N, new Runnable() {
|
||||
registry.registerKeyBinding("replaymod.input.thumbnail", Keyboard.KEY_N, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (replayHandler != null) {
|
||||
@@ -130,7 +121,7 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
}
|
||||
});
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.playpause", Keyboard.KEY_P, new Runnable() {
|
||||
registry.registerKeyBinding("replaymod.input.playpause", Keyboard.KEY_P, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (replayHandler != null) {
|
||||
@@ -139,7 +130,7 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
}
|
||||
});
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, () -> {
|
||||
registry.registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, () -> {
|
||||
if (replayHandler != null) {
|
||||
replayHandler.getReplaySender().setSyncModeAndWait();
|
||||
core.runLater(() ->
|
||||
@@ -161,7 +152,10 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.resettilt", Keyboard.KEY_K, () -> {
|
||||
Optional.ofNullable(replayHandler).map(ReplayHandler::getCameraEntity).ifPresent(c -> c.roll = 0);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initClient() {
|
||||
cameraControllerRegistry.register("replaymod.camera.classic", new Function<CameraEntity, CameraController>() {
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -176,21 +170,13 @@ public class ReplayModReplay extends ReplayMod.Module {
|
||||
return new VanillaCameraController(core.getMinecraft(), cameraEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
Minecraft mc = core.getMinecraft();
|
||||
// FIXME mc.timer = new InputReplayTimer(mc.timer, this);
|
||||
|
||||
new GuiHandler(this).register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
Setting.CAMERA.setChoices(new ArrayList<>(cameraControllerRegistry.getControllers()));
|
||||
}
|
||||
|
||||
public void startReplay(File file) throws IOException {
|
||||
startReplay(new ZipReplayFile(new ReplayStudio(), file));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.replaymod.replay.camera;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.replaymod.replay.Setting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -14,6 +16,7 @@ public class CameraControllerRegistry {
|
||||
public void register(String name, Function<CameraEntity, CameraController> constructor) {
|
||||
Preconditions.checkState(!constructors.containsKey(name), "Controller " + name + " is already registered.");
|
||||
constructors.put(name, constructor);
|
||||
Setting.CAMERA.setChoices(new ArrayList<>(getControllers()));
|
||||
}
|
||||
|
||||
public Set<String> getControllers() {
|
||||
|
||||
Reference in New Issue
Block a user