Skip to content

Commit

Permalink
Sponge compatibility, disable F3+C delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Runemoro committed May 5, 2018
1 parent 5f61446 commit 5785fd5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ String jarVersion = fullVersion.replace("+", "-") // Github/Travis doesn't seem
// Minecraft, MCP, Forge, and Java versions
sourceCompatibility = targetCompatibility = "1.8"
ext.mcversion = "1.12.2"
ext.forgeversion = "14.23.2.2623"
ext.forgeversion = "14.23.3.2655"
String mcpversion = "snapshot_20180227"

// Configuration
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dimdev/vanillafix/VanillaFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import net.minecraftforge.fml.common.Mod;

@Mod(modid = "vanillafix", name = "VanillaFix", version = "${version}", acceptedMinecraftVersions = "(,1.13)")
@Mod(modid = "vanillafix", name = "VanillaFix", version = "${version}", acceptableRemoteVersions = "*")
public class VanillaFix {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@SuppressWarnings({"unused", "NonConstantFieldWithUpperCaseName"}) // Shadow
@Mixin(NetHandlerPlayServer.class)
@Mixin(value = NetHandlerPlayServer.class, priority = 500) // After sponge
public abstract class MixinNetHandlerPlayServer implements INetHandlerPlayServer {

@Shadow public EntityPlayerMP player;
Expand Down Expand Up @@ -86,6 +86,7 @@ public void processPlayer(CPacketPlayer packet) {
if (player.queuedEndExit) return;

WorldServer world = server.getWorld(player.dimension);
// TODO: Sponge

if (networkTickCount == 0) {
captureCurrentPosition();
Expand All @@ -98,15 +99,16 @@ public void processPlayer(CPacketPlayer packet) {
// a position change, the server will have sent it another one, repeatedly causing the player to jump
// back until they stop moving for whatever the ping time is.

/*if (networkTickCount - lastPositionUpdate > 20) {
if (networkTickCount - lastPositionUpdate > 200) {
LOGGER.error("VanillaFix: 10 seconds passed without client confirming teleport!");
lastPositionUpdate = networkTickCount;

// Fix: Vanilla code was: setPlayerLocation(targetPos.x, targetPos.y, targetPos.z,
// player.rotationYaw, player.rotationPitch); Why would the server revert movements
// after a teleport just because the client didn't confirm it? I'm assuming that they
// intended to send another updated move packet:
setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
}*/
}

// Instead, we will send another packet both here and in processConfirmTeleport if the position the client
// was sent is no longer good (exceeds tolerance):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.dimdev.vanillafix.IPatchedMinecraft;
import org.lwjgl.LWJGLException;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.*;

import javax.annotation.Nullable;
import java.io.File;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void run() {
} catch (Throwable throwable) {
CrashReport report = CrashReport.makeCrashReport(throwable, "Initializing game");
report.makeCategory("Initialization");
displayCrashReport(addGraphicsAndWorldToCrashReport(report)); // TODO: GUI for this too
displayCrashScreen(addGraphicsAndWorldToCrashReport(report)); // TODO: GUI for this too
return;
}

Expand Down Expand Up @@ -186,4 +187,10 @@ public void freeMemory() {
public void clearCurrentReport() {
currentReport = null;
}


@ModifyConstant(method = "runTickKeyboard", constant = @Constant(longValue = 6000L, ordinal = 0))
public long getDebugCrashKeyPressTime(long value) {
return 0; // TODO: config
}
}

0 comments on commit 5785fd5

Please sign in to comment.