Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
1.8.0 support, ViaRewind update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrygames committed Jan 31, 2018
1 parent b711268 commit 1e8410a
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>de.gerrygames</groupId>
<artifactId>viarewind-all</artifactId>
<version>1.0.14</version>
<version>1.1.0</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.gerrygames.the5zig.clientviaversion.classnames;

import java.util.HashMap;
import java.util.Map;

public class ClassNames1_8 {
static Map<String, String> CLASS_NAMES = new HashMap<>();

static {
CLASS_NAMES.put("c_GuiDisconnected", "bwo");
CLASS_NAMES.put("c_GuiMultiplayer", "bzp");
CLASS_NAMES.put("c_Item", "alq");
CLASS_NAMES.put("c_NetHandlerLoginClient", "cec");
CLASS_NAMES.put("c_NettyCompressionDecoder", "gp");
CLASS_NAMES.put("c_NettyCompressionEncoder", "gq");

CLASS_NAMES.put("f_Entity_entityId", "c");
CLASS_NAMES.put("f_EntityPlayer_itemStackMainHand", "g");
CLASS_NAMES.put("f_GuiDisconnected_message", "f");
CLASS_NAMES.put("f_GuiDisconnected_textHeight", "i");
CLASS_NAMES.put("f_GuiScreen_buttons", "n");
CLASS_NAMES.put("f_GuiScreen_height", "m");
CLASS_NAMES.put("f_GuiScreen_width", "l");
CLASS_NAMES.put("f_ItemStack_item", "d");
CLASS_NAMES.put("f_Minecraft_displayHeight", "e");
CLASS_NAMES.put("f_Minecraft_displayWidth", "d");
CLASS_NAMES.put("f_NetworkManager_channel", "i");
CLASS_NAMES.put("f_NetworkManager_connectionState", "c");
CLASS_NAMES.put("f_NetworkManager_logger", "f");

CLASS_NAMES.put("m_Button_draw", "a");
CLASS_NAMES.put("m_Button_mouseClicked", "c");
CLASS_NAMES.put("m_Button_mouseReleased", "b");
CLASS_NAMES.put("m_Item_getIdFromItem", "b");
CLASS_NAMES.put("m_ITextComponent_getFormattedText", "d");
CLASS_NAMES.put("m_World_getEntityByUUID", "b");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.gerrygames.the5zig.clientviaversion.classnames;

import java.util.HashMap;
import java.util.Map;

public class ClassNames1_8Forge {
static Map<String, String> CLASS_NAMES = new HashMap<>();

static {
CLASS_NAMES.put("c_Button", "net.minecraft.client.gui.GuiButton");
CLASS_NAMES.put("c_GuiDisconnected", "net.minecraft.client.gui.GuiDisconnected");
CLASS_NAMES.put("c_GuiMultiplayer", "net.minecraft.client.gui.GuiMultiplayer");
CLASS_NAMES.put("c_Item", "net.minecraft.item.Item");
CLASS_NAMES.put("c_NetHandlerLoginClient", "net.minecraft.client.network.NetHandlerLoginClient");
CLASS_NAMES.put("c_NettyCompressionDecoder", "net.minecraft.network.NettyCompressionDecoder");
CLASS_NAMES.put("c_NettyCompressionEncoder", "net.minecraft.network.NettyCompressionEncoder");

CLASS_NAMES.put("f_Entity_entityId", "field_145783_c");
CLASS_NAMES.put("f_EntityPlayer_itemStackMainHand", "field_184831_bT");
CLASS_NAMES.put("f_GuiDisconnected_message", "field_146304_f");
CLASS_NAMES.put("f_GuiDisconnected_textHeight", "field_175353_i");
CLASS_NAMES.put("f_GuiScreen_buttons", "field_146292_n");
CLASS_NAMES.put("f_GuiScreen_height", "field_146295_m");
CLASS_NAMES.put("f_GuiScreen_width", "field_146294_l");
CLASS_NAMES.put("f_ItemStack_item", "field_151002_e");
CLASS_NAMES.put("f_Minecraft_displayHeight", "field_71440_d");
CLASS_NAMES.put("f_Minecraft_displayWidth", "field_71443_c");
CLASS_NAMES.put("f_NetworkManager_channel", "field_150746_k");
CLASS_NAMES.put("f_NetworkManager_connectionState", "field_150739_c");
CLASS_NAMES.put("f_NetworkManager_logger", "field_150735_g");

CLASS_NAMES.put("m_Button_draw", "func_146112_a");
CLASS_NAMES.put("m_Button_mouseClicked", "func_146116_c");
CLASS_NAMES.put("m_Button_mouseReleased", "func_146119_b");
CLASS_NAMES.put("m_Item_getIdFromItem", "func_150891_b");
CLASS_NAMES.put("m_ITextComponent_getFormattedText", "func_150254_d");
CLASS_NAMES.put("m_World_getEntityByUUID", "func_152378_a");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.gerrygames.the5zig.clientviaversion.netty;

import eu.the5zig.mod.The5zigAPI;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler;
Expand All @@ -25,6 +26,11 @@
import java.util.List;

public class ViaTransformerOut extends MessageToByteEncoder<ByteBuf> {
private static boolean oldNetty = false;
static {
oldNetty = ClientViaVersion.CLIENT_PROTOCOL_VERSION<=5 || The5zigAPI.getAPI().getMinecraftVersion().equals("1.8");
}

@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
int packetId = Type.VAR_INT.read(in);
Expand Down Expand Up @@ -102,7 +108,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
ByteBuf buf = null;
try {
ByteBuf cast = (ByteBuf) msg;
if (ClientViaVersion.CLIENT_PROTOCOL_VERSION<=5) {
if (oldNetty) {
buf = ctx.alloc().ioBuffer();
} else {
buf = this.allocateBuffer(ctx, cast, true);
Expand Down

0 comments on commit 1e8410a

Please sign in to comment.