Merge pull request #1728 from KennyTV/abstraction

20w16a
This commit is contained in:
Myles 2020-04-15 22:18:05 +01:00 committed by GitHub
commit 2bd2fa3228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13660 additions and 13629 deletions

View File

@ -80,7 +80,7 @@ public class ProtocolVersion {
register(v1_15 = new ProtocolVersion(573, "1.15")); register(v1_15 = new ProtocolVersion(573, "1.15"));
register(v1_15_1 = new ProtocolVersion(575, "1.15.1")); register(v1_15_1 = new ProtocolVersion(575, "1.15.1"));
register(v1_15_2 = new ProtocolVersion(578, "1.15.2")); register(v1_15_2 = new ProtocolVersion(578, "1.15.2"));
register(v1_16 = new ProtocolVersion(711, "1.16")); register(v1_16 = new ProtocolVersion(712, "1.16"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

View File

@ -1,5 +1,6 @@
package us.myles.ViaVersion.protocols.protocol1_16to1_15_2; package us.myles.ViaVersion.protocols.protocol1_16to1_15_2;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.protocol.Protocol;
@ -126,6 +127,40 @@ public class Protocol1_16To1_15_2 extends Protocol {
registerOutgoing(State.PLAY, 0x4C, 0x4D); registerOutgoing(State.PLAY, 0x4C, 0x4D);
registerOutgoing(State.PLAY, 0x4D, 0x4E); registerOutgoing(State.PLAY, 0x4D, 0x4E);
registerOutgoing(State.PLAY, 0x4E, 0x43); registerOutgoing(State.PLAY, 0x4E, 0x43);
cancelIncoming(State.PLAY, 0x0F); // Generate jisaw
cancelIncoming(State.PLAY, 0x28); // Jigsaw update
registerIncoming(State.PLAY, 0x0F, 0x10);
registerIncoming(State.PLAY, 0x10, 0x11);
registerIncoming(State.PLAY, 0x11, 0x12);
registerIncoming(State.PLAY, 0x12, 0x13);
registerIncoming(State.PLAY, 0x13, 0x14);
registerIncoming(State.PLAY, 0x14, 0x15);
registerIncoming(State.PLAY, 0x15, 0x16);
registerIncoming(State.PLAY, 0x16, 0x17);
registerIncoming(State.PLAY, 0x17, 0x18);
registerIncoming(State.PLAY, 0x18, 0x19);
registerIncoming(State.PLAY, 0x19, 0x1A);
registerIncoming(State.PLAY, 0x1A, 0x1B);
registerIncoming(State.PLAY, 0x1B, 0x1C);
registerIncoming(State.PLAY, 0x1C, 0x1D);
registerIncoming(State.PLAY, 0x1D, 0x1E);
registerIncoming(State.PLAY, 0x1E, 0x1F);
registerIncoming(State.PLAY, 0x1F, 0x20);
registerIncoming(State.PLAY, 0x20, 0x21);
registerIncoming(State.PLAY, 0x21, 0x22);
registerIncoming(State.PLAY, 0x22, 0x23);
registerIncoming(State.PLAY, 0x23, 0x24);
registerIncoming(State.PLAY, 0x24, 0x25);
registerIncoming(State.PLAY, 0x28, 0x29);
registerIncoming(State.PLAY, 0x29, 0x2A);
registerIncoming(State.PLAY, 0x2A, 0x2B);
registerIncoming(State.PLAY, 0x2B, 0x2C);
registerIncoming(State.PLAY, 0x2C, 0x2D);
registerIncoming(State.PLAY, 0x2D, 0x2E);
} }
@Override @Override

View File

@ -132,7 +132,7 @@ public class InventoryPackets {
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09); itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);
// Creative Inventory Action // Creative Inventory Action
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x26); itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x27);
} }
public static void toClient(Item item) { public static void toClient(Item item) {

View File

@ -4,7 +4,6 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.opennbt.tag.builtin.Tag;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk; import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.protocol.Protocol;
@ -92,14 +91,6 @@ public class WorldPackets {
// Spawn Particle // Spawn Particle
blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x24, 3, 23, 32, blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x24, 3, 23, 32,
WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM); WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM);
// Jigsaw
protocol.registerIncoming(State.PLAY, 0x27, 0x27, new PacketRemapper() {
@Override
public void registerMap() {
handler(PacketWrapper::cancel); //TODO possible to translate?
}
});
} }
public static int getNewParticleId(int id) { public static int getNewParticleId(int id) {