This commit is contained in:
creeper123123321 2019-03-20 17:23:48 -03:00
parent e25b39e3f3
commit 1fee4cc779
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
8 changed files with 45 additions and 10 deletions

View File

@ -38,14 +38,14 @@ configurations {
dependencies {
// transitive = false, viabackwards-core because Guava is conflicting on runClient
shade("us.myles:viaversion:2.0.0-19w11b") { transitive = false }
shade("us.myles:viaversion:2.0.0-19w12a") { transitive = false }
shade("de.gerrygames:viarewind-core:1.4.0") { transitive = false }
shade("nl.matsv:viabackwards-core:3.0.0-19w11b") { transitive = false }
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
minecraft "com.mojang:minecraft:19w11b"
mappings "net.fabricmc:yarn:19w11b.4"
minecraft "com.mojang:minecraft:19w12a"
mappings "net.fabricmc:yarn:19w12a.1"
modCompile "net.fabricmc:fabric-loader:0.3.7.109"
modCompile "net.fabricmc:fabric:0.2.3.111"
@ -65,6 +65,7 @@ jar {
exclude 'mcmod.info'
exclude 'plugin.yml'
exclude 'bungee.yml'
exclude 'velocity-plugin.json'
}
}
}

View File

@ -38,7 +38,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
@Mixin(targets = "net.minecraft.server.ServerNetworkIO$1")
public class MixinClientConnectionServerChInit {
public class MixinServerNetworkIOChInit {
@Inject(method = "initChannel(Lio/netty/channel/Channel;)V", at = @At(value = "TAIL"), remap = false)
private void onInitChannel(Channel channel, CallbackInfo ci) {
if (channel instanceof SocketChannel) {

View File

@ -44,7 +44,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
@Mixin(MultiplayerScreen.class)
public abstract class MixinMultiplayerGui extends Screen {
public abstract class MixinMultiplayerScreen extends Screen {
private TextFieldWidget protocolVersion;
private boolean validProtocol = true;
private boolean supportedProtocol;

View File

@ -24,8 +24,15 @@
package com.github.creeper123123321.viafabric.platform;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.SharedConstants;
import us.myles.ViaVersion.api.platform.ViaInjector;
import us.myles.ViaVersion.util.GsonUtil;
import us.myles.viaversion.libs.gson.JsonObject;
import java.lang.reflect.Method;
import java.util.Arrays;
public class VRInjector implements ViaInjector {
@Override
@ -52,4 +59,26 @@ public class VRInjector implements ViaInjector {
public String getDecoderName() {
return "decoder";
}
@Override
public JsonObject getDump() {
JsonObject obj = new JsonObject();
try {
obj.add("serverNetworkIOChInit", GsonUtil.getGson().toJsonTree(
Arrays.stream(Class.forName("net.minecraft.class_3242$1").getDeclaredMethods())
.map(Method::toString)
.toArray(String[]::new)));
} catch (ClassNotFoundException ignored) {
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
try {
obj.add("clientConnectionChInit", GsonUtil.getGson().toJsonTree(
Arrays.stream(Class.forName("net.minecraft.class_2535$1").getDeclaredMethods())
.map(Method::toString)
.toArray(String[]::new)));
} catch (ClassNotFoundException ignored) {
}
}
return obj;
}
}

View File

@ -180,7 +180,7 @@ public class VRPlatform implements ViaPlatform {
@Override
public ViaCommandSender[] getOnlinePlayers() {
MinecraftServer server = getServer();
if (server != null && server.method_18854()) {
if (server != null && server.isOnThread()) {
// Not thread safe
return server.getPlayerManager().getPlayerList().stream()
.map(Entity::getCommandSource)
@ -231,7 +231,7 @@ public class VRPlatform implements ViaPlatform {
}
} else {
MinecraftServer server = getServer();
if (server != null && server.method_18854()) {
if (server != null && server.isOnThread()) {
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
if (player == null) return false;
player.networkHandler.disconnect(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)));

View File

@ -275,7 +275,12 @@ public class VRViaConfig extends Config implements ViaVersionConfig {
}
@Override
public boolean truncate1_14Books() {
public boolean isTruncate1_14Books() {
return this.getBoolean("truncate-1_14-books", false);
}
@Override
public boolean isLeftHandedHandling() {
return this.getBoolean("left-handed-handling", true);
}
}

View File

@ -6,7 +6,7 @@
],
"client": [
"client.MixinClientConnectionChInit",
"client.MixinMultiplayerGui"
"client.MixinMultiplayerScreen"
],
"injectors": {
"defaultRequire": 1

View File

@ -3,7 +3,7 @@
"compatibilityLevel": "JAVA_8",
"package": "com.github.creeper123123321.viafabric.mixin",
"mixins": [
"MixinClientConnectionServerChInit"
"MixinServerNetworkIOChInit"
],
"injectors": {
"defaultRequire": 1