Compare commits

...

5 Commits

Author SHA1 Message Date
Jonas Herzig
6109960d4a Fix integration test failing because of conflicting keybindings 2017-06-15 20:44:10 +02:00
Jonas Herzig
4dcecc5697 Do not show OpenEye offer gui if there's no OpenEye for the current MC version 2017-06-15 16:28:44 +02:00
Jonas Herzig
bef5e41a8d Update mappings 2017-06-15 16:15:01 +02:00
Jonas Herzig
6ecb87e8dd Add workaround for race condition preventing us from joining SP (see MinecraftForge/MinecraftForge#3974)
This is done by preventing all calls to ChannelConfig.setAutoRead(false) during
the call to FMLNetworkHandler.fmlClientHandshake (the two @Redirects in
MixinNetworkDispatcher) and manually issuing the call before handleLoginSuccess
returns (at which point the NetHandlerPlayClient has been set).

This commit should be reverted once the issue mentioned above has been fixed.
2017-06-15 16:15:01 +02:00
Jonas Herzig
921c9e0098 Update to 1.12 2017-06-15 16:15:01 +02:00
36 changed files with 144 additions and 93 deletions

View File

@@ -17,7 +17,7 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
}
}
@@ -34,9 +34,9 @@ archivesBaseName = "replaymod"
minecraft {
coreMod = 'com.replaymod.core.LoadingPlugin'
version = '1.11.2-13.20.0.2216'
version = '1.12-14.21.0.2327'
runDir = "eclipse"
mappings = "snapshot_20161220"
mappings = "snapshot_20170615"
replace '@MOD_VERSION@', project.version
replace '@MC_VERSION@', project.minecraft.version
}
@@ -46,9 +46,6 @@ repositories {
name = "SpongePowered Repo"
url = "http://repo.spongepowered.org/maven/"
}
maven {
url 'https://repo.spacehq.org/content/repositories/snapshots/'
}
}
configurations {
@@ -59,7 +56,9 @@ configurations {
dependencies {
compile 'org.projectlombok:lombok:1.16.4'
compile 'org.spongepowered:mixin:0.6.8-SNAPSHOT'
compile('org.spongepowered:mixin:0.6.11-SNAPSHOT') {
exclude group: 'org.apache.logging.log4j'
}
shade 'com.googlecode.mp4parser:isoparser:1.1.7'
shade 'org.apache.commons:commons-exec:1.3'
shade 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0'

2
jGui

Submodule jGui updated: bd3fa93d7d...e5fcc65032

View File

@@ -299,7 +299,7 @@ public abstract class AbstractTask implements Task {
return;
}
clickNow(button.xPosition + 5, button.yPosition + 5);
clickNow(button.x + 5, button.y + 5);
} catch (IllegalAccessException | NoSuchFieldException e) {
future.setException(e);
}

View File

@@ -36,6 +36,11 @@ public class ReplayModIntegrationTest {
// Make sure the game window doesn't have to remain in focus during the test
mc.gameSettings.pauseOnLostFocus = false;
// Vanilla uses our keys
mc.gameSettings.keyBindAdvancements.setKeyCode(0);
mc.gameSettings.keyBindLoadToolbar.setKeyCode(0);
mc.gameSettings.keyBindSaveToolbar.setKeyCode(0);
runTasks(
new SkipLogin(),
new DownloadOpenEye(),

View File

@@ -10,6 +10,10 @@ import java.nio.file.NoSuchFileException;
public class DownloadOpenEye extends AbstractTask {
@Override
protected void init() {
if ("1".equals(System.getenv("RM_INTEGRATION_TEST_NO_OPENEYE"))) {
runLater(() -> future.set(null));
return;
}
expectGui(OpenEyeExtra.OfferGui.class, offerGui -> {
click(offerGui.yesButton);
expectGuiClosed(20 * 1000, () -> {

View File

@@ -30,7 +30,7 @@ public class ShaderBeginRender {
// check if Shaders are enabled
if (!(boolean) (ShaderReflection.config_isShaders.invoke(null))) return;
ShaderReflection.shaders_beginRender.invoke(null, mc, mc.timer.elapsedPartialTicks, 0);
ShaderReflection.shaders_beginRender.invoke(null, mc, mc.timer.renderPartialTicks, 0);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}

View File

@@ -20,6 +20,7 @@ public abstract class MixinShaderRenderChunk {
*/
@Inject(method = "isPlayerUpdate", at = @At("HEAD"), cancellable = true)
private void replayModCompat_disableIsPlayerUpdate(CallbackInfoReturnable<Boolean> ci) {
// TODO: Update to 1.12 once optifine is available
if (((EntityRendererHandler.IEntityRenderer) mc.entityRenderer).replayModRender_getHandler() == null) return;
ci.setReturnValue(true);
}

View File

@@ -85,7 +85,7 @@ public class KeyBindingRegistry {
CrashReport crashReport = CrashReport.makeCrashReport(cause, "Handling Key Binding");
CrashReportCategory category = crashReport.makeCategory("Key Binding");
category.addCrashSection("Key Binding", keyBinding);
category.setDetail("Handler", runnable::toString);
category.addDetail("Handler", runnable::toString);
throw new ReportedException(crashReport);
}
}
@@ -100,7 +100,7 @@ public class KeyBindingRegistry {
CrashReport crashReport = CrashReport.makeCrashReport(cause, "Handling Raw Key Binding");
CrashReportCategory category = crashReport.makeCategory("Key Binding");
category.addCrashSection("Key Code", keyCode);
category.setDetail("Handler", runnable::toString);
category.addDetail("Handler", runnable::toString);
throw new ReportedException(crashReport);
}
}

View File

@@ -14,9 +14,19 @@ public class GuiFactory implements IModGuiFactory {
}
@Override
public boolean hasConfigGui() {
return true;
}
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
return new GuiReplaySettings(parentScreen, ReplayMod.instance.getSettingsRegistry()).toMinecraft();
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ConfigGuiWrapper.class;
return null;
}
@Override
@@ -28,17 +38,4 @@ public class GuiFactory implements IModGuiFactory {
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
public static class ConfigGuiWrapper extends GuiScreen {
private final GuiScreen parent;
public ConfigGuiWrapper(GuiScreen parent) {
this.parent = parent;
}
@Override
public void initGui() {
new GuiReplaySettings(parent, ReplayMod.instance.getSettingsRegistry()).display();
}
}
}

View File

@@ -19,12 +19,12 @@ public class MainMenuHandler {
if (event.getGui() instanceof GuiMainMenu) {
for (GuiButton button : event.getButtonList()) {
// Buttons that aren't in a rectangle directly above our space don't need moving
if (button.xPosition + button.width < event.getGui().width / 2 - 100
|| button.xPosition > event.getGui().width / 2 + 100
|| button.yPosition > event.getGui().height / 4 + 10 + 4 * 24) continue;
if (button.x + button.width < event.getGui().width / 2 - 100
|| button.x > event.getGui().width / 2 + 100
|| button.y > event.getGui().height / 4 + 10 + 4 * 24) continue;
// Move button up to make space for two rows of buttons
// and then move back down by 10 to compensate for the space to the exit button that was already there
button.yPosition -= 2 * 24 - 10;
button.y -= 2 * 24 - 10;
}
}
}

View File

@@ -1,8 +1,8 @@
package com.replaymod.core.utils;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
@@ -35,7 +35,7 @@ public class OpenGLUtils {
float f5 = 1.0F / textureHeight;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
BufferBuilder vertexBuffer = tessellator.getBuffer();
GlStateManager.translate(x+(width/2), y+(width/2), 0);
GlStateManager.rotate(rotation, 0, 0, 1);
vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

View File

@@ -3,6 +3,8 @@ package com.replaymod.core.utils;
import net.minecraft.util.Timer;
public class WrappedTimer extends Timer {
public static final float DEFAULT_MS_PER_TICK = 1000 / 20;
protected final Timer wrapped;
public WrappedTimer(Timer wrapped) {
@@ -19,15 +21,10 @@ public class WrappedTimer extends Timer {
}
protected void copy(Timer from, Timer to) {
to.ticksPerSecond = from.ticksPerSecond;
to.lastHRTime = from.lastHRTime;
to.elapsedTicks = from.elapsedTicks;
to.renderPartialTicks = from.renderPartialTicks;
to.timerSpeed = from.timerSpeed;
to.elapsedPartialTicks = from.elapsedPartialTicks;
to.lastSyncSysClock = from.lastSyncSysClock;
to.lastSyncHRClock = from.lastSyncHRClock;
to.counter = from.counter;
to.timeSyncAdjustment = from.timeSyncAdjustment;
to.elapsedPartialTicks = from.elapsedPartialTicks;
to.tickLength = from.tickLength;
}
}

View File

@@ -26,6 +26,7 @@ import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import static com.replaymod.core.utils.Utils.SSL_SOCKET_FACTORY;
import static com.replaymod.extras.ReplayModExtras.LOGGER;
public class OpenEyeExtra implements Extra {
private static final String DOWNLOAD_URL = "https://www.replaymod.com/dl/openeye/" + Loader.MC_VERSION;
@@ -39,7 +40,25 @@ public class OpenEyeExtra implements Extra {
mod.getSettingsRegistry().register(ASK_FOR_OPEN_EYE);
if (!Loader.isModLoaded("OpenEye") && mod.getSettingsRegistry().get(ASK_FOR_OPEN_EYE)) {
mod.runLater(() -> new OfferGui(GuiScreen.wrap(mod.getMinecraft().currentScreen)).display());
new Thread(() -> {
try {
LOGGER.trace("Checking for OpenEye availability");
HttpsURLConnection connection = (HttpsURLConnection) new URL(DOWNLOAD_URL).openConnection();
connection.setSSLSocketFactory(SSL_SOCKET_FACTORY);
connection.setRequestMethod("HEAD");
connection.connect();
LOGGER.trace("Got response code: {}", connection.getResponseCode());
if (connection.getResponseCode() == 200) {
mod.runLater(() -> new OfferGui(GuiScreen.wrap(mod.getMinecraft().currentScreen)).display());
} else {
LOGGER.info("Cannot offer OpenEye, server returned: {} {}",
connection.getResponseCode(), connection.getResponseMessage());
}
connection.disconnect();
} catch (Throwable e) {
LOGGER.error("Failed to check for OpenEye availability:", e);
}
}).start();
}
}

View File

@@ -6,7 +6,8 @@ public enum MinecraftVersion {
MC_1_9_4("Minecraft 1.9.4", "1.9.4"),
MC_1_10_2("Minecraft 1.10.2", "1.10.2"),
MC_1_11("Minecraft 1.11", "1.11"),
MC_1_11_2("Minecraft 1.11.2", "1.11.2");
MC_1_11_2("Minecraft 1.11.2", "1.11.2"),
MC_1_12("Minecraft 1.12", "1.12");
private String niceName, apiName;

View File

@@ -55,7 +55,7 @@ public class GuiRegister extends AbstractGuiScreen<GuiRegister> {
pos(cancelButton, width / 2 + 2, 170);
pos(statusLabel, width / 2 - statusLabel.getMinSize().getWidth() / 2, 152);
FontRenderer font = getMinecraft().fontRendererObj;
FontRenderer font = getMinecraft().fontRenderer;
int lineCount = font.listFormattedStringToWidth(disclaimerLabel.getText(), width - 10).size();
Dimension dim = new Dimension(width - 10, font.FONT_HEIGHT * lineCount);
disclaimerLabel.setSize(dim);

View File

@@ -39,7 +39,7 @@ import de.johni0702.minecraft.gui.utils.Colors;
import de.johni0702.minecraft.gui.utils.Consumer;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.io.FilenameUtils;
import org.apache.logging.log4j.core.helpers.Strings;
import org.apache.logging.log4j.util.Strings;
import org.lwjgl.util.Dimension;
import org.lwjgl.util.ReadableDimension;

View File

@@ -6,6 +6,7 @@ import com.google.common.collect.Ordering;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.replaymod.core.utils.WrappedTimer;
import com.replaymod.replay.ReplayHandler;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import com.replaymod.replaystudio.pathing.path.Path;
@@ -68,8 +69,8 @@ public abstract class AbstractTimelinePlayer {
MinecraftForge.EVENT_BUS.register(this);
lastTime = 0;
mc.timer = new ReplayTimer(mc.timer);
mc.timer.timerSpeed = 1;
mc.timer.elapsedPartialTicks = mc.timer.elapsedTicks = 0;
mc.timer.tickLength = WrappedTimer.DEFAULT_MS_PER_TICK;
mc.timer.renderPartialTicks = mc.timer.elapsedTicks = 0;
return future = settableFuture = SettableFuture.create();
}
@@ -107,10 +108,9 @@ public abstract class AbstractTimelinePlayer {
float timeInTicks = replayTime / 50f;
float previousTimeInTicks = lastTime / 50f;
float passedTicks = timeInTicks - previousTimeInTicks;
mc.timer.elapsedPartialTicks += passedTicks;
mc.timer.elapsedTicks = (int) mc.timer.elapsedPartialTicks;
mc.timer.elapsedPartialTicks -= mc.timer.elapsedTicks;
mc.timer.renderPartialTicks = mc.timer.elapsedPartialTicks;
mc.timer.renderPartialTicks += passedTicks;
mc.timer.elapsedTicks = (int) mc.timer.renderPartialTicks;
mc.timer.renderPartialTicks -= mc.timer.elapsedTicks;
lastTime = replayTime;

View File

@@ -42,7 +42,7 @@ public class GuiRecordingOverlay {
public void renderRecordingIndicator(RenderGameOverlayEvent.Post event) {
if (event.getType() != RenderGameOverlayEvent.ElementType.ALL) return;
if (settingsRegistry.get(Setting.INDICATOR)) {
FontRenderer fontRenderer = mc.fontRendererObj;
FontRenderer fontRenderer = mc.fontRenderer;
fontRenderer.drawString(I18n.format("replaymod.gui.recording").toUpperCase(), 30, 18 - (fontRenderer.FONT_HEIGHT / 2), 0xffffffff);
mc.renderEngine.bindTexture(TEXTURE);
GlStateManager.resetColor();

View File

@@ -46,7 +46,7 @@ public class ConnectionEventHandler {
try {
boolean local = networkManager.isLocalChannel();
if (local) {
if (mc.getIntegratedServer().getEntityWorld().getWorldType() == WorldType.DEBUG_WORLD) {
if (mc.getIntegratedServer().getEntityWorld().getWorldType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
logger.info("Debug World recording is not supported.");
return;
}

View File

@@ -235,7 +235,7 @@ public class RecordingEventHandler {
public void onPickupItem(ItemPickupEvent event) {
try {
packetListener.save(new SPacketCollectItem(event.pickedUp.getEntityId(), event.player.getEntityId(),
event.pickedUp.getEntityItem().getMaxStackSize()));
event.pickedUp.getItem().getMaxStackSize()));
} catch(Exception e) {
e.printStackTrace();
}

View File

@@ -24,4 +24,9 @@ public abstract class MixinNetHandlerLoginClient {
public void replayModRecording_initiateRecording(CallbackInfo cb) {
ReplayModRecording.instance.initiateRecording(networkManager);
}
@Inject(method = "handleLoginSuccess", at=@At("RETURN"))
public void replayModRecording_raceConditionWorkAround(CallbackInfo cb) {
networkManager.channel().config().setAutoRead(true);
}
}

View File

@@ -1,8 +1,11 @@
package com.replaymod.recording.mixin;
import com.replaymod.recording.handler.FMLHandshakeFilter;
import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.embedded.EmbeddedChannel;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.NetworkManager;
import net.minecraftforge.fml.common.network.handshake.FMLHandshakeCodec;
import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
import net.minecraftforge.fml.relauncher.Side;
@@ -10,6 +13,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = NetworkDispatcher.class, remap = false)
@@ -43,4 +47,17 @@ public abstract class MixinNetworkDispatcher {
"replaymod_filter", new FMLHandshakeFilter());
}
}
@Redirect(method = "clientListenForServerHandshake", at = @At(value = "INVOKE", remap = true, target =
"Lnet/minecraft/network/NetworkManager;setConnectionState(Lnet/minecraft/network/EnumConnectionState;)V"))
public void replayModRecording_raceConditionWorkAround1(NetworkManager self, EnumConnectionState ignored) { }
@Redirect(method = "insertIntoChannel", at = @At(value = "INVOKE", target =
"Lio/netty/channel/ChannelConfig;setAutoRead(Z)Lio/netty/channel/ChannelConfig;"))
public ChannelConfig replayModRecording_raceConditionWorkAround2(ChannelConfig self, boolean autoRead) {
if (side == Side.CLIENT) {
autoRead = false;
}
return self.setAutoRead(autoRead);
}
}

View File

@@ -197,7 +197,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
}
@SuppressWarnings("unchecked")
private byte[] getPacketData(Packet packet) throws IOException {
private byte[] getPacketData(Packet packet) throws Exception {
if (packet instanceof SPacketSpawnMob) {
SPacketSpawnMob p = (SPacketSpawnMob) packet;
if (p.dataManager == null) {

View File

@@ -88,7 +88,7 @@ public class ResourcePackRecorder {
if (levelDir.isFile()) {
netManager.sendPacket(new CPacketResourcePackStatus(CPacketResourcePackStatus.Action.ACCEPTED));
Futures.addCallback(mc.getResourcePackRepository().setResourcePackInstance(levelDir), new FutureCallback<Object>() {
Futures.addCallback(mc.getResourcePackRepository().setServerResourcePack(levelDir), new FutureCallback<Object>() {
@Override
public void onSuccess(Object result) {
recordResourcePack(levelDir, requestId);
@@ -174,7 +174,7 @@ public class ResourcePackRecorder {
String fileHash = Hashing.sha1().hashBytes(Files.toByteArray(file)).toString();
if (fileHash.equals(hash)) {
recordResourcePack(file, requestId);
return repo.setResourcePackInstance(file);
return repo.setServerResourcePack(file);
}
logger.warn("File " + file + " had wrong hash (expected " + hash + ", found " + fileHash + "). Deleting it.");
@@ -196,7 +196,7 @@ public class ResourcePackRecorder {
@Override
public void onSuccess(Object value) {
recordResourcePack(file, requestId);
repo.setResourcePackInstance(file);
repo.setServerResourcePack(file);
}
@Override

View File

@@ -4,7 +4,7 @@ import com.replaymod.render.hooks.EntityRendererHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -12,19 +12,19 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ParticleManager.class)
public abstract class MixinParticleManager {
@Redirect(method = "renderParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/Particle;renderParticle(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/entity/Entity;FFFFFF)V"))
private void renderNormalParticle(Particle particle, VertexBuffer vertexBuffer, Entity view, float partialTicks,
@Redirect(method = "renderParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/Particle;renderParticle(Lnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/entity/Entity;FFFFFF)V"))
private void renderNormalParticle(Particle particle, BufferBuilder vertexBuffer, Entity view, float partialTicks,
float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
renderParticle(particle, vertexBuffer, view, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY);
}
@Redirect(method = "renderLitParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/Particle;renderParticle(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/entity/Entity;FFFFFF)V"))
private void renderLitParticle(Particle particle, VertexBuffer vertexBuffer, Entity view, float partialTicks,
@Redirect(method = "renderLitParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/Particle;renderParticle(Lnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/entity/Entity;FFFFFF)V"))
private void renderLitParticle(Particle particle, BufferBuilder vertexBuffer, Entity view, float partialTicks,
float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
renderParticle(particle, vertexBuffer, view, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY);
}
private void renderParticle(Particle particle, VertexBuffer vertexBuffer, Entity view, float partialTicks,
private void renderParticle(Particle particle, BufferBuilder vertexBuffer, Entity view, float partialTicks,
float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
EntityRendererHandler handler = ((EntityRendererHandler.IEntityRenderer) Minecraft.getMinecraft().entityRenderer).replayModRender_getHandler();
if (handler != null && handler.omnidirectional) {

View File

@@ -1,5 +1,6 @@
package com.replaymod.render.rendering;
import com.replaymod.core.utils.WrappedTimer;
import com.replaymod.pathing.player.AbstractTimelinePlayer;
import com.replaymod.pathing.player.ReplayTimer;
import com.replaymod.pathing.properties.TimestampProperty;
@@ -111,8 +112,8 @@ public class VideoRenderer implements RenderInfo {
if (videoStart > 1000) {
int replayTime = videoStart - 1000;
timer.elapsedPartialTicks = timer.renderPartialTicks = 0;
timer.timerSpeed = 1;
timer.renderPartialTicks = 0;
timer.tickLength = WrappedTimer.DEFAULT_MS_PER_TICK;
while (replayTime < videoStart) {
timer.elapsedTicks = 1;
replayTime += 50;

View File

@@ -3,6 +3,7 @@ package com.replaymod.replay;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import com.replaymod.core.utils.Restrictions;
import com.replaymod.core.utils.WrappedTimer;
import com.replaymod.replay.camera.CameraEntity;
import com.replaymod.replay.camera.SpectatorCameraController;
import com.replaymod.replay.events.ReplayCloseEvent;
@@ -119,7 +120,7 @@ public class ReplayHandler {
mc.loadWorld(null);
}
mc.timer.timerSpeed = 1;
mc.timer.tickLength = WrappedTimer.DEFAULT_MS_PER_TICK;
overlay.setVisible(false);
ReplayModReplay.instance.replayHandler = null;
@@ -141,13 +142,14 @@ public class ReplayHandler {
networkManager.setNetHandler(netHandlerPlayClient);
FMLClientHandler.instance().setPlayClient(netHandlerPlayClient);
channel = new EmbeddedChannel(networkManager);
channel = new EmbeddedChannel();
NetworkDispatcher networkDispatcher = new NetworkDispatcher(networkManager);
channel.attr(NetworkDispatcher.FML_DISPATCHER).set(networkDispatcher);
channel.pipeline().addFirst("ReplayModReplay_replaySender", replaySender);
channel.pipeline().addAfter("ReplayModReplay_replaySender", "fml:packet_handler", networkDispatcher);
channel.pipeline().addLast("packet_handler", networkManager);
channel.pipeline().fireChannelActive();
networkDispatcher.clientToServerHandshake();
}
public ReplayFile getReplayFile() {
@@ -299,7 +301,7 @@ public class ReplayHandler {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawBackground(0);
drawCenteredString(fontRendererObj, I18n.format("replaymod.gui.pleasewait"),
drawCenteredString(fontRenderer, I18n.format("replaymod.gui.pleasewait"),
width / 2, height / 2, 0xffffffff);
}
};

View File

@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import com.google.common.io.Files;
import com.google.common.util.concurrent.ListenableFutureTask;
import com.replaymod.core.utils.Restrictions;
import com.replaymod.core.utils.WrappedTimer;
import com.replaymod.replay.camera.CameraEntity;
import com.replaymod.replaystudio.replay.ReplayFile;
import io.netty.buffer.ByteBuf;
@@ -396,7 +397,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
if (!file.exists()) {
IOUtils.copy(replayFile.getResourcePack(hash).get(), new FileOutputStream(file));
}
mc.getResourcePackRepository().setResourcePackInstance(file);
mc.getResourcePackRepository().setServerResourcePack(file);
}
}
return null;
@@ -518,7 +519,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
* @return {@code true} if it is paused, {@code false} otherwise
*/
public boolean paused() {
return mc.timer.timerSpeed == 0;
return mc.timer.tickLength == Float.POSITIVE_INFINITY;
}
/**
@@ -538,7 +539,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
*/
public void setReplaySpeed(final double d) {
if(d != 0) this.replaySpeed = d;
mc.timer.timerSpeed = (float) d;
mc.timer.tickLength = WrappedTimer.DEFAULT_MS_PER_TICK / (float) d;
}
/////////////////////////////////////////////////////////

View File

@@ -19,6 +19,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.stats.RecipeBook;
import net.minecraft.stats.StatisticsManager;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
@@ -66,8 +67,8 @@ public class CameraEntity extends EntityPlayerSP {
*/
private final EventHandler eventHandler = new EventHandler();
public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager) {
super(mcIn, worldIn, netHandlerPlayClient, statisticsManager);
public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager, RecipeBook recipeBook) {
super(mcIn, worldIn, netHandlerPlayClient, statisticsManager, recipeBook);
MinecraftForge.EVENT_BUS.register(eventHandler);
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {
cameraController = ReplayModReplay.instance.createCameraController(this);

View File

@@ -132,7 +132,7 @@ public class ClassicCameraController implements CameraController {
Vec3d movement = direction.normalize();
double factor = motion * (frac / 1000D);
camera.moveCamera(movement.xCoord * factor, movement.yCoord * factor, movement.zCoord * factor);
camera.moveCamera(movement.x * factor, movement.y * factor, movement.z * factor);
}
private void setMovement(MoveDirection dir) {

View File

@@ -34,7 +34,7 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOCase;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.helpers.Strings;
import org.apache.logging.log4j.util.Strings;
import org.lwjgl.Sys;
import org.lwjgl.util.Dimension;
import org.lwjgl.util.ReadableDimension;

View File

@@ -17,7 +17,7 @@ import java.util.List;
public class GuiHandler {
private static final int BUTTON_EXIT_SERVER = 1;
private static final int BUTTON_ACHIEVEMENTS = 5;
private static final int BUTTON_ADVANCEMENTS = 5;
private static final int BUTTON_STATS = 6;
private static final int BUTTON_OPEN_TO_LAN = 7;
@@ -55,8 +55,8 @@ public class GuiHandler {
b.displayString = I18n.format("replaymod.gui.exit");
b.id = BUTTON_EXIT_REPLAY;
break;
// Remove "Achievements", "Stats" and "Open to LAN" buttons
case BUTTON_ACHIEVEMENTS:
// Remove "Advancements", "Stats" and "Open to LAN" buttons
case BUTTON_ADVANCEMENTS:
buttonList.remove(achievements = b);
break;
case BUTTON_STATS:
@@ -68,12 +68,12 @@ public class GuiHandler {
}
}
if (achievements != null && stats != null) {
moveAllButtonsDirectlyBelowUpwards(buttonList, achievements.yPosition,
achievements.xPosition, stats.xPosition + stats.width);
moveAllButtonsDirectlyBelowUpwards(buttonList, achievements.y,
achievements.x, stats.x + stats.width);
}
if (openToLan != null) {
moveAllButtonsDirectlyBelowUpwards(buttonList, openToLan.yPosition,
openToLan.xPosition, openToLan.xPosition + openToLan.width);
moveAllButtonsDirectlyBelowUpwards(buttonList, openToLan.y,
openToLan.x, openToLan.x + openToLan.width);
}
}
}
@@ -87,8 +87,8 @@ public class GuiHandler {
*/
private void moveAllButtonsDirectlyBelowUpwards(List<GuiButton> buttons, int belowY, int xStart, int xEnd) {
for (GuiButton button : buttons) {
if (button.yPosition >= belowY && button.xPosition <= xEnd && button.xPosition + button.width >= xStart) {
button.yPosition -= 24;
if (button.y >= belowY && button.x <= xEnd && button.x + button.width >= xStart) {
button.y -= 24;
}
}
}

View File

@@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.stats.RecipeBook;
import net.minecraft.stats.StatisticsManager;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -23,10 +24,10 @@ public abstract class MixinPlayerControllerMP {
@Shadow
private NetHandlerPlayClient connection;
@Inject(method = "createClientPlayer", at=@At("HEAD"), cancellable = true)
private void replayModReplay_createReplayCamera(World worldIn, StatisticsManager statisticsManager, CallbackInfoReturnable<EntityPlayerSP> ci) {
@Inject(method = "func_192830_a", at=@At("HEAD"), cancellable = true)
private void replayModReplay_createReplayCamera(World worldIn, StatisticsManager statisticsManager, RecipeBook recipeBook, CallbackInfoReturnable<EntityPlayerSP> ci) {
if (ReplayModReplay.instance.getReplayHandler() != null) {
ci.setReturnValue(new CameraEntity(mc, worldIn, connection, statisticsManager));
ci.setReturnValue(new CameraEntity(mc, worldIn, connection, statisticsManager, recipeBook));
ci.cancel();
}
}

View File

@@ -658,7 +658,7 @@ public class SPTimeline implements PathingRegistry {
} catch (IOException e) {
CrashReport crash = CrashReport.makeCrashReport(e, "Serializing interpolator");
CrashReportCategory category = crash.makeCategory("Serializing interpolator");
category.setDetail("Interpolator", interpolator::toString);
category.addDetail("Interpolator", interpolator::toString);
throw new ReportedException(crash);
}

View File

@@ -15,9 +15,9 @@ import com.replaymod.simplepathing.ReplayModSimplePathing;
import com.replaymod.simplepathing.SPTimeline;
import com.replaymod.simplepathing.gui.GuiPathing;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
@@ -204,7 +204,7 @@ public class PathPreviewRenderer {
if (distanceSquared(view, pos2) > renderDistanceSquared) return;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
BufferBuilder vertexBuffer = tessellator.getBuffer();
vertexBuffer.setTranslation(-view.getLeft(), -view.getMiddle(), -view.getRight());
vertexBuffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
@@ -231,7 +231,7 @@ public class PathPreviewRenderer {
Triple<Double, Double, Double> pos,
Keyframe keyframe) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
BufferBuilder vertexBuffer = tessellator.getBuffer();
vertexBuffer.setTranslation(0, 0, 0);
mc.renderEngine.bindTexture(TEXTURE);
@@ -280,7 +280,7 @@ public class PathPreviewRenderer {
Triple<Double, Double, Double> pos,
Triple<Float, Float, Float> rot) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
BufferBuilder vertexBuffer = tessellator.getBuffer();
vertexBuffer.setTranslation(0, 0, 0);
mc.renderEngine.bindTexture(CAMERA_HEAD);