Refactored code

This commit is contained in:
RaphiMC 2024-05-17 18:27:27 +02:00
parent f5f99622cf
commit 09828c1747
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
304 changed files with 2675 additions and 2735 deletions

View File

@ -191,7 +191,7 @@ public class BlockList1_6 {
public static Block1_6 getByID(final int id) {
for (Block1_6 block : blockList) {
if (block.blockID == id) {
if (block.blockId == id) {
return block;
}
}
@ -207,13 +207,10 @@ public class BlockList1_6 {
return null;
}
public static class Block1_6 {
public record Block1_6(int blockId, String name) {
public final int blockID;
public final String name;
public Block1_6(final int blockID, final String name) {
this.blockID = blockID;
public Block1_6(final int blockId, final String name) {
this.blockId = blockId;
this.name = name;
blockList.add(this);

View File

@ -221,7 +221,7 @@ public class ItemList1_6 {
public static Item1_6 getByID(final int itemID) {
for (Item1_6 item : itemList) {
if (item.itemID == itemID) {
if (item.itemId() == itemID) {
return item;
}
}
@ -230,22 +230,17 @@ public class ItemList1_6 {
public static Item1_6 getByName(final String name) {
for (Item1_6 item : itemList) {
if (item.name.equalsIgnoreCase(name)) {
if (item.name().equalsIgnoreCase(name)) {
return item;
}
}
return null;
}
public static class Item1_6 {
public record Item1_6(int itemId, String name, int maxDamage, boolean hasSubTypes) {
public final int itemID;
public final int maxDamage;
public final boolean hasSubTypes;
public final String name;
public Item1_6(final int itemID, final String name, final int maxDamage, final boolean hasSubTypes) {
this.itemID = itemID;
public Item1_6(final int itemId, final String name, final int maxDamage, final boolean hasSubTypes) {
this.itemId = itemId;
this.name = name;
this.maxDamage = maxDamage;
this.hasSubTypes = hasSubTypes;
@ -254,7 +249,7 @@ public class ItemList1_6 {
}
public boolean isDamageable() {
return maxDamage > 0 && !hasSubTypes;
return this.maxDamage > 0 && !this.hasSubTypes;
}
}

View File

@ -24,8 +24,8 @@ import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.base.ServerboundHandshakePackets;
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.HandshakeStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.HandshakeStorage;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ProtocolMetadataStorage;
public class PreNettyBaseProtocol extends AbstractSimpleProtocol {

View File

@ -44,8 +44,7 @@ public abstract class StatelessTransitionProtocol<CU extends ClientboundPacketTy
final State currentState = wrapper.user().getProtocolInfo().getServerState();
for (int i = 0; i < handlers.length; i += 2) {
if (handlers[i] instanceof State) {
final State state = (State) handlers[i];
if (handlers[i] instanceof State state) {
if (state != currentState) continue;
} else {
final ClientboundPacketType mappedPacketType = (ClientboundPacketType) handlers[i];

View File

@ -232,21 +232,7 @@ public abstract class LegacyItemRewriter<C extends ClientboundPacketType, S exte
}
private static class RewriteEntry {
private final int oldItemID;
private final short oldItemMeta;
private final int newItemID;
private final short newItemMeta;
private final String newItemName;
public RewriteEntry(final int oldItemID, final short oldItemMeta, final int newItemID, final short newItemMeta, final String newItemName) {
this.oldItemID = oldItemID;
this.oldItemMeta = oldItemMeta;
this.newItemID = newItemID;
this.newItemMeta = newItemMeta;
this.newItemName = newItemName;
}
private record RewriteEntry(int oldItemID, short oldItemMeta, int newItemID, short newItemMeta, String newItemName) {
public boolean rewrites(final Item item) {
return item.identifier() == this.oldItemID && (this.oldItemMeta == -1 || this.oldItemMeta == item.data());
@ -254,15 +240,7 @@ public abstract class LegacyItemRewriter<C extends ClientboundPacketType, S exte
}
private static class NonExistentEntry {
private final int itemId;
private final short itemMeta;
public NonExistentEntry(final int itemId, final short itemMeta) {
this.itemId = itemId;
this.itemMeta = itemMeta;
}
private record NonExistentEntry(int itemId, short itemMeta) {
public boolean rewrites(final Item item) {
return item.identifier() == this.itemId && (this.itemMeta == -1 || this.itemMeta == item.data());

View File

@ -18,7 +18,7 @@
package net.raphimc.vialegacy.api.splitter;
import io.netty.buffer.ByteBuf;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.data.NbtItemList;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.data.NbtItemList1_2_4;
public class PreNettyTypes {
@ -50,7 +50,7 @@ public class PreNettyTypes {
if (s >= 0) {
buffer.readByte();
buffer.readShort();
if (NbtItemList.hasNbt(s)) {
if (NbtItemList1_2_4.hasNbt(s)) {
readTag(buffer);
}
}
@ -86,7 +86,7 @@ public class PreNettyTypes {
for (int i = 0; i < s; i++) buffer.readByte();
}
public static void readEntityMetadata1_4_4(final ByteBuf buffer) {
public static void readEntityDataList1_4_4(final ByteBuf buffer) {
for (byte b = buffer.readByte(); b != 127; b = buffer.readByte()) {
int i = (b & 224) >> 5;
switch (i) {
@ -116,7 +116,7 @@ public class PreNettyTypes {
}
}
public static void readEntityMetadata1_4_2(final ByteBuf buffer) {
public static void readEntityDataList1_4_2(final ByteBuf buffer) {
for (byte b = buffer.readByte(); b != 127; b = buffer.readByte()) {
int i = (b & 224) >> 5;
switch (i) {
@ -150,7 +150,7 @@ public class PreNettyTypes {
}
}
public static void readEntityMetadatab1_5(final ByteBuf buffer) {
public static void readEntityDataListb1_5(final ByteBuf buffer) {
for (byte b = buffer.readByte(); b != 127; b = buffer.readByte()) {
int i = (b & 224) >> 5;
switch (i) {
@ -182,7 +182,7 @@ public class PreNettyTypes {
}
}
public static void readEntityMetadatab1_3(final ByteBuf buffer) {
public static void readEntityDataListb1_3(final ByteBuf buffer) {
for (byte b = buffer.readByte(); b != 127; b = buffer.readByte()) {
int i = (b & 224) >> 5;
switch (i) {
@ -214,7 +214,7 @@ public class PreNettyTypes {
}
}
public static void readEntityMetadatab1_2(final ByteBuf buffer) {
public static void readEntityDataListb1_2(final ByteBuf buffer) {
for (byte b = buffer.readByte(); b != 127; b = buffer.readByte()) {
int i = (b & 224) >> 5;
switch (i) {

View File

@ -22,21 +22,14 @@ import com.viaversion.viaversion.api.minecraft.BlockFace;
public class BlockFaceUtil {
public static BlockFace getFace(final int direction) {
switch (direction) {
case 0:
return BlockFace.BOTTOM;
default:
case 1:
return BlockFace.TOP;
case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST;
}
return switch (direction) {
case 0 -> BlockFace.BOTTOM;
default -> BlockFace.TOP;
case 2 -> BlockFace.NORTH;
case 3 -> BlockFace.SOUTH;
case 4 -> BlockFace.WEST;
case 5 -> BlockFace.EAST;
};
}
}

View File

@ -49,7 +49,7 @@ public class ChunkCoordSpiral implements Iterable<ChunkCoord> {
@Override
public Iterator<ChunkCoord> iterator() {
return new Iterator<ChunkCoord>() {
return new Iterator<>() {
int x = center.chunkX;
int z = center.chunkZ;

View File

@ -23,45 +23,45 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.ViaLegacyConfig;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15.Protocola1_0_16_2toa1_0_15;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.Protocola1_0_17_1_0_17_4toa1_0_16_2;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1.Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1.Protocola1_2_2toa1_2_0_1_2_1_1;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2.Protocola1_2_3_1_2_3_4toa1_2_2;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4.Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_1_2tob1_0_1_1.Protocolb1_1_2tob1_0_1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.Protocolb1_2_0_2tob1_1_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.Protocolb1_3_0_1tob1_2_0_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_4_0_1tob1_3_0_1.Protocolb1_4_0_1tob1_3_0_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.Protocolb1_5_0_2tob1_4_0_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.Protocolb1_6_0_6tob1_5_0_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_7_0_3tob1_6_0_6.Protocolb1_7_0_3tob1_6_0_6;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.Protocolb1_8_0_1tob1_7_0_3;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.Protocola1_0_15toc0_30;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_16a_02to0_0_15a_1.Protocolc0_0_16a_02to0_0_15a_1;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_18a_02toc0_0_16a_02.Protocolc0_0_18a_02toc0_0_16a_02;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_19a_06toc0_0_18a_02.Protocolc0_0_19a_06toc0_0_18a_02;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.Protocolc0_27toc0_0_19a_06;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_0_20a_27.Protocolc0_30toc0_27;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.Protocolc0_30toc0_30cpe;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.Protocol1_1to1_0_0_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.Protocol1_2_1_3to1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.Protocol1_2_4_5to1_2_1_3;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.Protocol1_3_1_2to1_2_4_5;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.Protocol1_4_2to1_3_1_2;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.Protocol1_4_4_5to1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.Protocol1_4_6_7to1_4_4_5;
import net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.Protocol1_5_0_1to1_4_6_7;
import net.raphimc.vialegacy.protocols.release.protocol1_5_2to1_5_0_1.Protocol1_5_2to1_5_0_1;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.Protocol1_6_1to1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_6_2to1_6_1.Protocol1_6_2to1_6_1;
import net.raphimc.vialegacy.protocols.release.protocol1_6_4to1_6_2.Protocol1_6_4to1_6_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.Protocol1_7_2_5to1_6_4;
import net.raphimc.vialegacy.protocols.release.protocol1_7_6_10to1_7_2_5.Protocol1_7_6_10to1_7_2_5;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10;
import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.Protocola1_0_15Toa1_0_16_2;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.Protocola1_0_16_2Toa1_0_17_1_0_17_4;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1;
import net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.Protocola1_2_0_1_2_1_1Toa1_2_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.Protocola1_2_2Toa1_2_3_1_2_3_4;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_1_2_3_4toa1_2_3_5_1_2_6.Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1;
import net.raphimc.vialegacy.protocol.beta.b1_0_1_1tob1_1_2.Protocolb1_0_1_1Tob1_1_2;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.Protocolb1_1_2Tob1_2_0_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.Protocolb1_2_0_2Tob1_3_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1.Protocolb1_3_0_1Tob1_4_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.Protocolb1_4_0_1Tob1_5_0_2;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.Protocolb1_5_0_2Tob1_6_0_6;
import net.raphimc.vialegacy.protocol.beta.b1_6_0_6tob1_7_0_3.Protocolb1_6_0_6Tob1_7_0_3;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.Protocolb1_7_0_3Tob1_8_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.Protocolb1_8_0_1tor1_0_0_1;
import net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02.Protocolc0_0_15a_1Toc0_0_16a_02;
import net.raphimc.vialegacy.protocol.classic.c0_0_16a_02toc0_0_18a_02.Protocolc0_0_16a_02Toc0_0_18a_02;
import net.raphimc.vialegacy.protocol.classic.c0_0_18a_02toc0_0_19a_06.Protocolc0_0_18a_02Toc0_0_19a_06;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.Protocolc0_0_19a_06Toc0_0_20a_27;
import net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30.Protocolc0_0_20a_27Toc0_28_30;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.Protocolc0_28_30Toa1_0_15;
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.Protocolc0_30cpeToc0_28_30;
import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.Protocolr1_0_0_1Tor1_1;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.Protocolr1_1Tor1_2_1_3;
import net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.Protocolr1_2_1_3Tor1_2_4_5;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.Protocolr1_2_4_5Tor1_3_1_2;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.Protocolr1_3_1_2Tor1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.Protocolr1_4_2Tor1_4_4_5;
import net.raphimc.vialegacy.protocol.release.r1_4_4_5tor1_4_6_7.Protocolr1_4_4_5Tor1_4_6_7;
import net.raphimc.vialegacy.protocol.release.r1_4_6_7tor1_5_0_1.Protocolr1_4_6_7Tor1_5_0_1;
import net.raphimc.vialegacy.protocol.release.r1_5_0_1tor1_5_2.Protocolr1_5_0_1Tor1_5_2;
import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.Protocolr1_5_2Tor1_6_1;
import net.raphimc.vialegacy.protocol.release.r1_6_1tor1_6_2.Protocolr1_6_1Tor1_6_2;
import net.raphimc.vialegacy.protocol.release.r1_6_2tor1_6_4.Protocolr1_6_2Tor1_6_4;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.Protocolr1_6_4Tor1_7_2_5;
import net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.Protocolr1_7_2_5Tor1_7_6_10;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.Protocolr1_7_6_10Tor1_8;
import java.io.File;
import java.util.logging.Logger;
@ -76,45 +76,45 @@ public interface ViaLegacyPlatform {
Via.getManager().getSubPlatforms().add(ViaLegacy.IMPL_VERSION);
final ProtocolManager protocolManager = Via.getManager().getProtocolManager();
protocolManager.registerProtocol(new Protocol1_8to1_7_6_10(), ProtocolVersion.v1_8, ProtocolVersion.v1_7_6);
protocolManager.registerProtocol(new Protocol1_7_6_10to1_7_2_5(), ProtocolVersion.v1_7_6, ProtocolVersion.v1_7_2);
protocolManager.registerProtocol(new Protocol1_7_2_5to1_6_4(), ProtocolVersion.v1_7_2, LegacyProtocolVersion.r1_6_4);
protocolManager.registerProtocol(new Protocol1_6_4to1_6_2(), LegacyProtocolVersion.r1_6_4, LegacyProtocolVersion.r1_6_2);
protocolManager.registerProtocol(new Protocol1_6_2to1_6_1(), LegacyProtocolVersion.r1_6_2, LegacyProtocolVersion.r1_6_1);
protocolManager.registerProtocol(new Protocol1_6_1to1_5_2(), LegacyProtocolVersion.r1_6_1, LegacyProtocolVersion.r1_5_2);
protocolManager.registerProtocol(new Protocol1_5_2to1_5_0_1(), LegacyProtocolVersion.r1_5_2, LegacyProtocolVersion.r1_5tor1_5_1);
protocolManager.registerProtocol(new Protocol1_5_0_1to1_4_6_7(), LegacyProtocolVersion.r1_5tor1_5_1, LegacyProtocolVersion.r1_4_6tor1_4_7);
protocolManager.registerProtocol(new Protocol1_4_6_7to1_4_4_5(), LegacyProtocolVersion.r1_4_6tor1_4_7, LegacyProtocolVersion.r1_4_4tor1_4_5);
protocolManager.registerProtocol(new Protocol1_4_4_5to1_4_2(), LegacyProtocolVersion.r1_4_4tor1_4_5, LegacyProtocolVersion.r1_4_2);
protocolManager.registerProtocol(new Protocol1_4_2to1_3_1_2(), LegacyProtocolVersion.r1_4_2, LegacyProtocolVersion.r1_3_1tor1_3_2);
protocolManager.registerProtocol(new Protocol1_3_1_2to1_2_4_5(), LegacyProtocolVersion.r1_3_1tor1_3_2, LegacyProtocolVersion.r1_2_4tor1_2_5);
protocolManager.registerProtocol(new Protocol1_2_4_5to1_2_1_3(), LegacyProtocolVersion.r1_2_4tor1_2_5, LegacyProtocolVersion.r1_2_1tor1_2_3);
protocolManager.registerProtocol(new Protocol1_2_1_3to1_1(), LegacyProtocolVersion.r1_2_1tor1_2_3, LegacyProtocolVersion.r1_1);
protocolManager.registerProtocol(new Protocol1_1to1_0_0_1(), LegacyProtocolVersion.r1_1, LegacyProtocolVersion.r1_0_0tor1_0_1);
protocolManager.registerProtocol(new Protocol1_0_0_1tob1_8_0_1(), LegacyProtocolVersion.r1_0_0tor1_0_1, LegacyProtocolVersion.b1_8tob1_8_1);
protocolManager.registerProtocol(new Protocolb1_8_0_1tob1_7_0_3(), LegacyProtocolVersion.b1_8tob1_8_1, LegacyProtocolVersion.b1_7tob1_7_3);
protocolManager.registerProtocol(new Protocolb1_7_0_3tob1_6_0_6(), LegacyProtocolVersion.b1_7tob1_7_3, LegacyProtocolVersion.b1_6tob1_6_6);
protocolManager.registerProtocol(new Protocolb1_6_0_6tob1_5_0_2(), LegacyProtocolVersion.b1_6tob1_6_6, LegacyProtocolVersion.b1_5tob1_5_2);
protocolManager.registerProtocol(new Protocolb1_5_0_2tob1_4_0_1(), LegacyProtocolVersion.b1_5tob1_5_2, LegacyProtocolVersion.b1_4tob1_4_1);
protocolManager.registerProtocol(new Protocolb1_4_0_1tob1_3_0_1(), LegacyProtocolVersion.b1_4tob1_4_1, LegacyProtocolVersion.b1_3tob1_3_1);
protocolManager.registerProtocol(new Protocolb1_3_0_1tob1_2_0_2(), LegacyProtocolVersion.b1_3tob1_3_1, LegacyProtocolVersion.b1_2_0tob1_2_2);
protocolManager.registerProtocol(new Protocolb1_2_0_2tob1_1_2(), LegacyProtocolVersion.b1_2_0tob1_2_2, LegacyProtocolVersion.b1_1_2);
protocolManager.registerProtocol(new Protocolb1_1_2tob1_0_1_1(), LegacyProtocolVersion.b1_1_2, LegacyProtocolVersion.b1_0tob1_1_1);
protocolManager.registerProtocol(new Protocolb1_0_1_1_1toa1_2_3_5_1_2_6(), LegacyProtocolVersion.b1_0tob1_1_1, LegacyProtocolVersion.a1_2_3_5toa1_2_6);
protocolManager.registerProtocol(new Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4(), LegacyProtocolVersion.a1_2_3_5toa1_2_6, LegacyProtocolVersion.a1_2_3toa1_2_3_4);
protocolManager.registerProtocol(new Protocola1_2_3_1_2_3_4toa1_2_2(), LegacyProtocolVersion.a1_2_3toa1_2_3_4, LegacyProtocolVersion.a1_2_2);
protocolManager.registerProtocol(new Protocola1_2_2toa1_2_0_1_2_1_1(), LegacyProtocolVersion.a1_2_2, LegacyProtocolVersion.a1_2_0toa1_2_1_1);
protocolManager.registerProtocol(new Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1(), LegacyProtocolVersion.a1_2_0toa1_2_1_1, LegacyProtocolVersion.a1_1_0toa1_1_2_1);
protocolManager.registerProtocol(new Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4(), LegacyProtocolVersion.a1_1_0toa1_1_2_1, LegacyProtocolVersion.a1_0_17toa1_0_17_4);
protocolManager.registerProtocol(new Protocola1_0_17_1_0_17_4toa1_0_16_2(), LegacyProtocolVersion.a1_0_17toa1_0_17_4, LegacyProtocolVersion.a1_0_16toa1_0_16_2);
protocolManager.registerProtocol(new Protocola1_0_16_2toa1_0_15(), LegacyProtocolVersion.a1_0_16toa1_0_16_2, LegacyProtocolVersion.a1_0_15);
protocolManager.registerProtocol(new Protocola1_0_15toc0_30(), LegacyProtocolVersion.a1_0_15, LegacyProtocolVersion.c0_28toc0_30);
protocolManager.registerProtocol(new Protocolc0_30toc0_30cpe(), LegacyProtocolVersion.c0_28toc0_30, LegacyProtocolVersion.c0_30cpe);
protocolManager.registerProtocol(new Protocolc0_30toc0_27(), LegacyProtocolVersion.c0_28toc0_30, LegacyProtocolVersion.c0_0_20ac0_27);
protocolManager.registerProtocol(new Protocolc0_27toc0_0_19a_06(), LegacyProtocolVersion.c0_0_20ac0_27, LegacyProtocolVersion.c0_0_19a_06);
protocolManager.registerProtocol(new Protocolc0_0_19a_06toc0_0_18a_02(), LegacyProtocolVersion.c0_0_19a_06, LegacyProtocolVersion.c0_0_18a_02);
protocolManager.registerProtocol(new Protocolc0_0_18a_02toc0_0_16a_02(), LegacyProtocolVersion.c0_0_18a_02, LegacyProtocolVersion.c0_0_16a_02);
protocolManager.registerProtocol(new Protocolc0_0_16a_02to0_0_15a_1(), LegacyProtocolVersion.c0_0_16a_02, LegacyProtocolVersion.c0_0_15a_1);
protocolManager.registerProtocol(new Protocolr1_7_6_10Tor1_8(), ProtocolVersion.v1_8, ProtocolVersion.v1_7_6);
protocolManager.registerProtocol(new Protocolr1_7_2_5Tor1_7_6_10(), ProtocolVersion.v1_7_6, ProtocolVersion.v1_7_2);
protocolManager.registerProtocol(new Protocolr1_6_4Tor1_7_2_5(), ProtocolVersion.v1_7_2, LegacyProtocolVersion.r1_6_4);
protocolManager.registerProtocol(new Protocolr1_6_2Tor1_6_4(), LegacyProtocolVersion.r1_6_4, LegacyProtocolVersion.r1_6_2);
protocolManager.registerProtocol(new Protocolr1_6_1Tor1_6_2(), LegacyProtocolVersion.r1_6_2, LegacyProtocolVersion.r1_6_1);
protocolManager.registerProtocol(new Protocolr1_5_2Tor1_6_1(), LegacyProtocolVersion.r1_6_1, LegacyProtocolVersion.r1_5_2);
protocolManager.registerProtocol(new Protocolr1_5_0_1Tor1_5_2(), LegacyProtocolVersion.r1_5_2, LegacyProtocolVersion.r1_5tor1_5_1);
protocolManager.registerProtocol(new Protocolr1_4_6_7Tor1_5_0_1(), LegacyProtocolVersion.r1_5tor1_5_1, LegacyProtocolVersion.r1_4_6tor1_4_7);
protocolManager.registerProtocol(new Protocolr1_4_4_5Tor1_4_6_7(), LegacyProtocolVersion.r1_4_6tor1_4_7, LegacyProtocolVersion.r1_4_4tor1_4_5);
protocolManager.registerProtocol(new Protocolr1_4_2Tor1_4_4_5(), LegacyProtocolVersion.r1_4_4tor1_4_5, LegacyProtocolVersion.r1_4_2);
protocolManager.registerProtocol(new Protocolr1_3_1_2Tor1_4_2(), LegacyProtocolVersion.r1_4_2, LegacyProtocolVersion.r1_3_1tor1_3_2);
protocolManager.registerProtocol(new Protocolr1_2_4_5Tor1_3_1_2(), LegacyProtocolVersion.r1_3_1tor1_3_2, LegacyProtocolVersion.r1_2_4tor1_2_5);
protocolManager.registerProtocol(new Protocolr1_2_1_3Tor1_2_4_5(), LegacyProtocolVersion.r1_2_4tor1_2_5, LegacyProtocolVersion.r1_2_1tor1_2_3);
protocolManager.registerProtocol(new Protocolr1_1Tor1_2_1_3(), LegacyProtocolVersion.r1_2_1tor1_2_3, LegacyProtocolVersion.r1_1);
protocolManager.registerProtocol(new Protocolr1_0_0_1Tor1_1(), LegacyProtocolVersion.r1_1, LegacyProtocolVersion.r1_0_0tor1_0_1);
protocolManager.registerProtocol(new Protocolb1_8_0_1tor1_0_0_1(), LegacyProtocolVersion.r1_0_0tor1_0_1, LegacyProtocolVersion.b1_8tob1_8_1);
protocolManager.registerProtocol(new Protocolb1_7_0_3Tob1_8_0_1(), LegacyProtocolVersion.b1_8tob1_8_1, LegacyProtocolVersion.b1_7tob1_7_3);
protocolManager.registerProtocol(new Protocolb1_6_0_6Tob1_7_0_3(), LegacyProtocolVersion.b1_7tob1_7_3, LegacyProtocolVersion.b1_6tob1_6_6);
protocolManager.registerProtocol(new Protocolb1_5_0_2Tob1_6_0_6(), LegacyProtocolVersion.b1_6tob1_6_6, LegacyProtocolVersion.b1_5tob1_5_2);
protocolManager.registerProtocol(new Protocolb1_4_0_1Tob1_5_0_2(), LegacyProtocolVersion.b1_5tob1_5_2, LegacyProtocolVersion.b1_4tob1_4_1);
protocolManager.registerProtocol(new Protocolb1_3_0_1Tob1_4_0_1(), LegacyProtocolVersion.b1_4tob1_4_1, LegacyProtocolVersion.b1_3tob1_3_1);
protocolManager.registerProtocol(new Protocolb1_2_0_2Tob1_3_0_1(), LegacyProtocolVersion.b1_3tob1_3_1, LegacyProtocolVersion.b1_2_0tob1_2_2);
protocolManager.registerProtocol(new Protocolb1_1_2Tob1_2_0_2(), LegacyProtocolVersion.b1_2_0tob1_2_2, LegacyProtocolVersion.b1_1_2);
protocolManager.registerProtocol(new Protocolb1_0_1_1Tob1_1_2(), LegacyProtocolVersion.b1_1_2, LegacyProtocolVersion.b1_0tob1_1_1);
protocolManager.registerProtocol(new Protocola1_2_3_5_1_2_6Tob1_0_1_1_1(), LegacyProtocolVersion.b1_0tob1_1_1, LegacyProtocolVersion.a1_2_3_5toa1_2_6);
protocolManager.registerProtocol(new Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6(), LegacyProtocolVersion.a1_2_3_5toa1_2_6, LegacyProtocolVersion.a1_2_3toa1_2_3_4);
protocolManager.registerProtocol(new Protocola1_2_2Toa1_2_3_1_2_3_4(), LegacyProtocolVersion.a1_2_3toa1_2_3_4, LegacyProtocolVersion.a1_2_2);
protocolManager.registerProtocol(new Protocola1_2_0_1_2_1_1Toa1_2_2(), LegacyProtocolVersion.a1_2_2, LegacyProtocolVersion.a1_2_0toa1_2_1_1);
protocolManager.registerProtocol(new Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1(), LegacyProtocolVersion.a1_2_0toa1_2_1_1, LegacyProtocolVersion.a1_1_0toa1_1_2_1);
protocolManager.registerProtocol(new Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1(), LegacyProtocolVersion.a1_1_0toa1_1_2_1, LegacyProtocolVersion.a1_0_17toa1_0_17_4);
protocolManager.registerProtocol(new Protocola1_0_16_2Toa1_0_17_1_0_17_4(), LegacyProtocolVersion.a1_0_17toa1_0_17_4, LegacyProtocolVersion.a1_0_16toa1_0_16_2);
protocolManager.registerProtocol(new Protocola1_0_15Toa1_0_16_2(), LegacyProtocolVersion.a1_0_16toa1_0_16_2, LegacyProtocolVersion.a1_0_15);
protocolManager.registerProtocol(new Protocolc0_28_30Toa1_0_15(), LegacyProtocolVersion.a1_0_15, LegacyProtocolVersion.c0_28toc0_30);
protocolManager.registerProtocol(new Protocolc0_30cpeToc0_28_30(), LegacyProtocolVersion.c0_28toc0_30, LegacyProtocolVersion.c0_30cpe);
protocolManager.registerProtocol(new Protocolc0_0_20a_27Toc0_28_30(), LegacyProtocolVersion.c0_28toc0_30, LegacyProtocolVersion.c0_0_20ac0_27);
protocolManager.registerProtocol(new Protocolc0_0_19a_06Toc0_0_20a_27(), LegacyProtocolVersion.c0_0_20ac0_27, LegacyProtocolVersion.c0_0_19a_06);
protocolManager.registerProtocol(new Protocolc0_0_18a_02Toc0_0_19a_06(), LegacyProtocolVersion.c0_0_19a_06, LegacyProtocolVersion.c0_0_18a_02);
protocolManager.registerProtocol(new Protocolc0_0_16a_02Toc0_0_18a_02(), LegacyProtocolVersion.c0_0_18a_02, LegacyProtocolVersion.c0_0_16a_02);
protocolManager.registerProtocol(new Protocolc0_0_15a_1Toc0_0_16a_02(), LegacyProtocolVersion.c0_0_16a_02, LegacyProtocolVersion.c0_0_15a_1);
}
Logger getLogger();

View File

@ -15,19 +15,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15;
package net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.ClientboundPacketsa1_0_16;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.ServerboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet.ClientboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet.ServerboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.packet.ClientboundPacketsa1_0_16;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ServerboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
public class Protocola1_0_16_2toa1_0_15 extends StatelessProtocol<ClientboundPacketsa1_0_15, ClientboundPacketsa1_0_16, ServerboundPacketsa1_0_15, ServerboundPacketsa1_0_17> {
public class Protocola1_0_15Toa1_0_16_2 extends StatelessProtocol<ClientboundPacketsa1_0_15, ClientboundPacketsa1_0_16, ServerboundPacketsa1_0_15, ServerboundPacketsa1_0_17> {
public Protocola1_0_16_2toa1_0_15() {
public Protocola1_0_15Toa1_0_16_2() {
super(ClientboundPacketsa1_0_15.class, ClientboundPacketsa1_0_16.class, ServerboundPacketsa1_0_15.class, ServerboundPacketsa1_0_17.class);
}
@ -37,13 +39,13 @@ public class Protocola1_0_16_2toa1_0_15 extends StatelessProtocol<ClientboundPac
wrapper.cancel();
final PacketWrapper handshake = PacketWrapper.create(ClientboundPacketsa1_0_16.HANDSHAKE, wrapper.user());
handshake.write(Typesb1_7_0_3.STRING, "-"); // server hash
handshake.send(Protocola1_0_16_2toa1_0_15.class);
handshake.send(Protocola1_0_15Toa1_0_16_2.class);
});
}
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_0_16_2toa1_0_15.class, ClientboundPacketsa1_0_15::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_0_15Toa1_0_16_2.class, ClientboundPacketsa1_0_15::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15;
package net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15;
package net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2;
package net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -24,15 +24,16 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.task.TimeLockTask;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.ClientboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.ServerboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.packet.ClientboundPacketsa1_0_16;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.task.TimeLockTask;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ClientboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ServerboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
public class Protocola1_0_17_1_0_17_4toa1_0_16_2 extends StatelessProtocol<ClientboundPacketsa1_0_16, ClientboundPacketsa1_0_17, ServerboundPacketsa1_0_17, ServerboundPacketsa1_0_17> {
public class Protocola1_0_16_2Toa1_0_17_1_0_17_4 extends StatelessProtocol<ClientboundPacketsa1_0_16, ClientboundPacketsa1_0_17, ServerboundPacketsa1_0_17, ServerboundPacketsa1_0_17> {
public Protocola1_0_17_1_0_17_4toa1_0_16_2() {
public Protocola1_0_16_2Toa1_0_17_1_0_17_4() {
super(ClientboundPacketsa1_0_16.class, ClientboundPacketsa1_0_17.class, ServerboundPacketsa1_0_17.class, ServerboundPacketsa1_0_17.class);
}
@ -60,7 +61,7 @@ public class Protocola1_0_17_1_0_17_4toa1_0_16_2 extends StatelessProtocol<Clien
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_0_17_1_0_17_4toa1_0_16_2.class, ClientboundPacketsa1_0_16::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_0_16_2Toa1_0_17_1_0_17_4.class, ClientboundPacketsa1_0_16::getPacket));
userConnection.put(new TimeLockStorage(0));
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2;
package net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage;
package net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage;
import com.viaversion.viaversion.api.connection.StorableObject;

View File

@ -15,19 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.task;
package net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.task;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.Protocola1_0_17_1_0_17_4toa1_0_16_2;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.ClientboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.Protocol1_6_1to1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_6_2to1_6_1.ClientboundPackets1_6_1;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.Protocola1_0_16_2Toa1_0_17_1_0_17_4;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ClientboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.release.r1_5_2tor1_6_1.Protocolr1_5_2Tor1_6_1;
import net.raphimc.vialegacy.protocol.release.r1_6_1tor1_6_2.packet.ClientboundPackets1_6_1;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.PlayerInfoStorage;
import java.util.logging.Level;
@ -43,18 +43,18 @@ public class TimeLockTask implements Runnable {
if (!info.getChannel().isActive()) return;
try {
if (info.getProtocolInfo().getPipeline().contains(Protocol1_6_1to1_5_2.class)) {
if (info.getProtocolInfo().getPipeline().contains(Protocolr1_5_2Tor1_6_1.class)) {
if (timeLockStorage.getTime() == 0) { // 0 always does the daylight cycle
timeLockStorage.setTime(1); // Set it to 1 which is close enough
}
final PacketWrapper updateTime = PacketWrapper.create(ClientboundPackets1_6_1.SET_TIME, info);
updateTime.write(Types.LONG, timeLockStorage.getTime()); // time
updateTime.write(Types.LONG, -(timeLockStorage.getTime() % 24000)); // time of day
updateTime.send(Protocol1_6_1to1_5_2.class);
updateTime.send(Protocolr1_5_2Tor1_6_1.class);
} else {
final PacketWrapper updateTime = PacketWrapper.create(ClientboundPacketsa1_0_17.SET_TIME, info);
updateTime.write(Types.LONG, timeLockStorage.getTime()); // time
updateTime.send(Protocola1_0_17_1_0_17_4toa1_0_16_2.class);
updateTime.send(Protocola1_0_16_2Toa1_0_17_1_0_17_4.class);
}
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error sending time update", e);

View File

@ -15,17 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4;
package net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1.ClientboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1.ServerboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ClientboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet.ServerboundPacketsa1_0_17;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet.ClientboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet.ServerboundPacketsa1_1_0;
public class Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4 extends StatelessProtocol<ClientboundPacketsa1_0_17, ClientboundPacketsa1_1_0, ServerboundPacketsa1_0_17, ServerboundPacketsa1_1_0> {
public class Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1 extends StatelessProtocol<ClientboundPacketsa1_0_17, ClientboundPacketsa1_1_0, ServerboundPacketsa1_0_17, ServerboundPacketsa1_1_0> {
public Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4() {
public Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1() {
super(ClientboundPacketsa1_0_17.class, ClientboundPacketsa1_1_0.class, ServerboundPacketsa1_0_17.class, ServerboundPacketsa1_1_0.class);
}
@ -37,7 +39,7 @@ public class Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4 extends StatelessProtocol<
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.class, ClientboundPacketsa1_0_17::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1.class, ClientboundPacketsa1_0_17::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4;
package net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4;
package net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,20 +15,22 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1;
package net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1.ClientboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1.ServerboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet.ClientboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet.ServerboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet.ClientboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet.ServerboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
public class Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1 extends StatelessProtocol<ClientboundPacketsa1_1_0, ClientboundPacketsa1_2_0, ServerboundPacketsa1_1_0, ServerboundPacketsa1_2_0> {
public class Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1 extends StatelessProtocol<ClientboundPacketsa1_1_0, ClientboundPacketsa1_2_0, ServerboundPacketsa1_1_0, ServerboundPacketsa1_2_0> {
public Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1() {
public Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1() {
super(ClientboundPacketsa1_1_0.class, ClientboundPacketsa1_2_0.class, ServerboundPacketsa1_1_0.class, ServerboundPacketsa1_2_0.class);
}
@ -59,7 +61,7 @@ public class Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1 extends StatelessProtocol<Cl
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1.class, ClientboundPacketsa1_1_0::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_1_0_1_1_2_1Toa1_2_0_1_2_1_1.class, ClientboundPacketsa1_1_0::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1;
package net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1;
package net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,19 +15,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1;
package net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2.ClientboundPacketsa1_2_2;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2.ServerboundPacketsa1_2_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet.ClientboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet.ServerboundPacketsa1_2_0;
import net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet.ClientboundPacketsa1_2_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet.ServerboundPacketsa1_2_2;
public class Protocola1_2_2toa1_2_0_1_2_1_1 extends StatelessProtocol<ClientboundPacketsa1_2_0, ClientboundPacketsa1_2_2, ServerboundPacketsa1_2_0, ServerboundPacketsa1_2_2> {
public class Protocola1_2_0_1_2_1_1Toa1_2_2 extends StatelessProtocol<ClientboundPacketsa1_2_0, ClientboundPacketsa1_2_2, ServerboundPacketsa1_2_0, ServerboundPacketsa1_2_2> {
public Protocola1_2_2toa1_2_0_1_2_1_1() {
public Protocola1_2_0_1_2_1_1Toa1_2_2() {
super(ClientboundPacketsa1_2_0.class, ClientboundPacketsa1_2_2.class, ServerboundPacketsa1_2_0.class, ServerboundPacketsa1_2_2.class);
}
@ -56,7 +58,7 @@ public class Protocola1_2_2toa1_2_0_1_2_1_1 extends StatelessProtocol<Clientboun
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_2_2toa1_2_0_1_2_1_1.class, ClientboundPacketsa1_2_0::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_2_0_1_2_1_1Toa1_2_2.class, ClientboundPacketsa1_2_0::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1;
package net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_2toa1_2_0_1_2_1_1;
package net.raphimc.vialegacy.protocol.alpha.a1_2_0_1_2_1_1toa1_2_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2;
package net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
@ -23,12 +23,14 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4.ClientboundPacketsa1_2_3;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.ServerboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet.ClientboundPacketsa1_2_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet.ServerboundPacketsa1_2_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_1_2_3_4toa1_2_3_5_1_2_6.packet.ClientboundPacketsa1_2_3;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ServerboundPacketsa1_2_6;
public class Protocola1_2_3_1_2_3_4toa1_2_2 extends StatelessProtocol<ClientboundPacketsa1_2_2, ClientboundPacketsa1_2_3, ServerboundPacketsa1_2_2, ServerboundPacketsa1_2_6> {
public class Protocola1_2_2Toa1_2_3_1_2_3_4 extends StatelessProtocol<ClientboundPacketsa1_2_2, ClientboundPacketsa1_2_3, ServerboundPacketsa1_2_2, ServerboundPacketsa1_2_6> {
public Protocola1_2_3_1_2_3_4toa1_2_2() {
public Protocola1_2_2Toa1_2_3_1_2_3_4() {
super(ClientboundPacketsa1_2_2.class, ClientboundPacketsa1_2_3.class, ServerboundPacketsa1_2_2.class, ServerboundPacketsa1_2_6.class);
}
@ -38,8 +40,8 @@ public class Protocola1_2_3_1_2_3_4toa1_2_2 extends StatelessProtocol<Clientboun
final PacketWrapper updateHealth = PacketWrapper.create(ClientboundPacketsa1_2_3.SET_HEALTH, wrapper.user());
updateHealth.write(Types.BYTE, (byte) 20); // health
wrapper.send(Protocola1_2_3_1_2_3_4toa1_2_2.class);
updateHealth.send(Protocola1_2_3_1_2_3_4toa1_2_2.class);
wrapper.send(Protocola1_2_2Toa1_2_3_1_2_3_4.class);
updateHealth.send(Protocola1_2_2Toa1_2_3_1_2_3_4.class);
wrapper.cancel();
});
@ -56,7 +58,7 @@ public class Protocola1_2_3_1_2_3_4toa1_2_2 extends StatelessProtocol<Clientboun
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_2_3_1_2_3_4toa1_2_2.class, ClientboundPacketsa1_2_2::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_2_2Toa1_2_3_1_2_3_4.class, ClientboundPacketsa1_2_2::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2;
package net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_1_2_3_4toa1_2_2;
package net.raphimc.vialegacy.protocol.alpha.a1_2_2toa1_2_3_1_2_3_4.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,19 +15,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_1_2_3_4toa1_2_3_5_1_2_6;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.ClientboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.ServerboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_1_2_3_4toa1_2_3_5_1_2_6.packet.ClientboundPacketsa1_2_3;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ClientboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ServerboundPacketsa1_2_6;
public class Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4 extends StatelessProtocol<ClientboundPacketsa1_2_3, ClientboundPacketsa1_2_6, ServerboundPacketsa1_2_6, ServerboundPacketsa1_2_6> {
public class Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6 extends StatelessProtocol<ClientboundPacketsa1_2_3, ClientboundPacketsa1_2_6, ServerboundPacketsa1_2_6, ServerboundPacketsa1_2_6> {
public Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4() {
public Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6() {
super(ClientboundPacketsa1_2_3.class, ClientboundPacketsa1_2_6.class, ServerboundPacketsa1_2_6.class, ServerboundPacketsa1_2_6.class);
}
@ -46,7 +47,7 @@ public class Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4 extends StatelessProtocol<Cl
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4.class, ClientboundPacketsa1_2_3::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_2_3_1_2_3_4Toa1_2_3_5_1_2_6.class, ClientboundPacketsa1_2_3::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocola1_2_3_5_1_2_6toa1_2_3_1_2_3_4;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_1_2_3_4toa1_2_3_5_1_2_6.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,9 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1;
import com.viaversion.nbt.tag.*;
import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.ListTag;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.Position;
@ -33,32 +34,34 @@ import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data.AlphaItems;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.TrackingAlphaInventoryProvider;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.InventoryStorage;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.task.AlphaInventoryUpdateTask;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.Protocol1_2_1_3to1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.ClientboundPackets1_2_1;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.data.EntityList;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.data.AlphaItems;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ClientboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ServerboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider.TrackingAlphaInventoryProvider;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.task.AlphaInventoryUpdateTask;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.Protocolr1_1Tor1_2_1_3;
import net.raphimc.vialegacy.protocol.release.r1_2_1_3tor1_2_4_5.packet.ClientboundPackets1_2_1;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.data.EntityList1_2_4;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<ClientboundPacketsa1_2_6, ClientboundPacketsb1_1, ServerboundPacketsa1_2_6, ServerboundPacketsb1_1> {
public class Protocola1_2_3_5_1_2_6Tob1_0_1_1_1 extends StatelessProtocol<ClientboundPacketsa1_2_6, ClientboundPacketsb1_1, ServerboundPacketsa1_2_6, ServerboundPacketsb1_1> {
public Protocolb1_0_1_1_1toa1_2_3_5_1_2_6() {
public Protocola1_2_3_5_1_2_6Tob1_0_1_1_1() {
super(ClientboundPacketsa1_2_6.class, ClientboundPacketsb1_1.class, ServerboundPacketsa1_2_6.class, ServerboundPacketsb1_1.class);
}
@ -149,30 +152,30 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
final IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
final String blockName = tag.getString("id", "");
if (block.getId() == BlockList1_6.signPost.blockID || block.getId() == BlockList1_6.signWall.blockID || blockName.equals("Sign")) {
if (block.getId() == BlockList1_6.signPost.blockId() || block.getId() == BlockList1_6.signWall.blockId() || blockName.equals("Sign")) {
final PacketWrapper updateSign = PacketWrapper.create(ClientboundPacketsb1_1.UPDATE_SIGN, wrapper.user());
updateSign.write(Types1_7_6.POSITION_SHORT, pos); // position
updateSign.write(Typesb1_7_0_3.STRING, tag.getString("Text1", "")); // line 1
updateSign.write(Typesb1_7_0_3.STRING, tag.getString("Text2", "")); // line 2
updateSign.write(Typesb1_7_0_3.STRING, tag.getString("Text3", "")); // line 3
updateSign.write(Typesb1_7_0_3.STRING, tag.getString("Text4", "")); // line 4
updateSign.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
} else if (block.getId() == BlockList1_6.mobSpawner.blockID || blockName.equals("MobSpawner")) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocol1_2_1_3to1_1.class)) {
updateSign.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
} else if (block.getId() == BlockList1_6.mobSpawner.blockId() || blockName.equals("MobSpawner")) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolr1_1Tor1_2_1_3.class)) {
final PacketWrapper spawnerData = PacketWrapper.create(ClientboundPackets1_2_1.BLOCK_ENTITY_DATA, wrapper.user());
spawnerData.write(Types1_7_6.POSITION_SHORT, pos); // position
spawnerData.write(Types.BYTE, (byte) 1); // type
spawnerData.write(Types.INT, EntityList.getEntityId(tag.getString("EntityId"))); // entity id
spawnerData.write(Types.INT, EntityList1_2_4.getEntityId(tag.getString("EntityId"))); // entity id
spawnerData.write(Types.INT, 0); // unused
spawnerData.write(Types.INT, 0); // unused
spawnerData.send(Protocol1_2_1_3to1_1.class);
spawnerData.send(Protocolr1_1Tor1_2_1_3.class);
}
} else if (block.getId() == BlockList1_6.chest.blockID || blockName.equals("Chest")) {
} else if (block.getId() == BlockList1_6.chest.blockId() || blockName.equals("Chest")) {
final Item[] chestItems = new Item[3 * 9];
readItemsFromTag(tag, chestItems);
tracker.containers.put(pos, chestItems);
if (pos.equals(tracker.openContainerPos)) sendWindowItems(wrapper.user(), InventoryStorage.CHEST_WID, chestItems);
} else if (block.getId() == BlockList1_6.furnaceIdle.blockID || block.getId() == BlockList1_6.furnaceBurning.blockID || blockName.equals("Furnace")) {
} else if (block.getId() == BlockList1_6.furnaceIdle.blockId() || block.getId() == BlockList1_6.furnaceBurning.blockId() || blockName.equals("Furnace")) {
final Item[] furnaceItems = new Item[3];
readItemsFromTag(tag, furnaceItems);
tracker.containers.put(pos, furnaceItems);
@ -232,27 +235,27 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
if (direction == 255) return;
final IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
if (block.getId() != BlockList1_6.furnaceIdle.blockID && block.getId() != BlockList1_6.furnaceBurning.blockID && block.getId() != BlockList1_6.chest.blockID && block.getId() != BlockList1_6.workbench.blockID) {
if (block.getId() != BlockList1_6.furnaceIdle.blockId() && block.getId() != BlockList1_6.furnaceBurning.blockId() && block.getId() != BlockList1_6.chest.blockId() && block.getId() != BlockList1_6.workbench.blockId()) {
return;
}
final Item[] containerItems = tracker.containers.get(tracker.openContainerPos = pos);
if (containerItems == null && block.getId() != BlockList1_6.workbench.blockID) {
if (containerItems == null && block.getId() != BlockList1_6.workbench.blockId()) {
tracker.openContainerPos = null;
final PacketWrapper chatMessage = PacketWrapper.create(ClientboundPacketsb1_1.CHAT, wrapper.user());
chatMessage.write(Typesb1_7_0_3.STRING, "§cMissing Container"); // message
chatMessage.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
chatMessage.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
return;
}
final PacketWrapper openWindow = PacketWrapper.create(ClientboundPacketsb1_1.OPEN_SCREEN, wrapper.user());
if (block.getId() == BlockList1_6.chest.blockID) {
if (block.getId() == BlockList1_6.chest.blockId()) {
openWindow.write(Types.UNSIGNED_BYTE, (short) InventoryStorage.CHEST_WID); // window id
openWindow.write(Types.UNSIGNED_BYTE, (short) 0); // window type
openWindow.write(Typesb1_7_0_3.STRING, "Chest"); // title
openWindow.write(Types.UNSIGNED_BYTE, (short) (3 * 9)); // slots
if (inventoryTracker != null) inventoryTracker.onWindowOpen(0, 3 * 9);
} else if (block.getId() == BlockList1_6.workbench.blockID) {
} else if (block.getId() == BlockList1_6.workbench.blockId()) {
openWindow.write(Types.UNSIGNED_BYTE, (short) InventoryStorage.WORKBENCH_WID); // window id
openWindow.write(Types.UNSIGNED_BYTE, (short) 1); // window type
openWindow.write(Typesb1_7_0_3.STRING, "Crafting Table"); // title
@ -265,10 +268,10 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
openWindow.write(Types.UNSIGNED_BYTE, (short) 3); // slots
if (inventoryTracker != null) inventoryTracker.onWindowOpen(2, 3);
}
openWindow.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
openWindow.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
if (block.getId() != BlockList1_6.workbench.blockID) {
sendWindowItems(wrapper.user(), block.getId() == BlockList1_6.chest.blockID ? InventoryStorage.CHEST_WID : InventoryStorage.FURNACE_WID, containerItems);
if (block.getId() != BlockList1_6.workbench.blockId()) {
sendWindowItems(wrapper.user(), block.getId() == BlockList1_6.chest.blockId() ? InventoryStorage.CHEST_WID : InventoryStorage.FURNACE_WID, containerItems);
}
});
this.registerServerbound(ServerboundPacketsb1_1.SET_CARRIED_ITEM, wrapper -> {
@ -316,10 +319,10 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
tracker.containers.put(tracker.openContainerPos, containerItems);
final CompoundTag tag = new CompoundTag();
tag.put("id", new StringTag(windowId == InventoryStorage.CHEST_WID ? "Chest" : "Furnace"));
tag.put("x", new IntTag(tracker.openContainerPos.x()));
tag.put("y", new IntTag(tracker.openContainerPos.y()));
tag.put("z", new IntTag(tracker.openContainerPos.z()));
tag.putString("id", windowId == InventoryStorage.CHEST_WID ? "Chest" : "Furnace");
tag.putInt("x", tracker.openContainerPos.x());
tag.putInt("y", tracker.openContainerPos.y());
tag.putInt("z", tracker.openContainerPos.z());
writeItemsToTag(tag, containerItems);
wrapper.write(Types.INT, tracker.openContainerPos.x());
@ -331,14 +334,14 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
final Position pos = wrapper.passthrough(Types1_7_6.POSITION_SHORT); // position
final CompoundTag tag = new CompoundTag();
tag.put("id", new StringTag("Sign"));
tag.put("x", new IntTag(pos.x()));
tag.put("y", new IntTag(pos.y()));
tag.put("z", new IntTag(pos.z()));
tag.put("Text1", new StringTag(wrapper.read(Typesb1_7_0_3.STRING))); // line 1
tag.put("Text2", new StringTag(wrapper.read(Typesb1_7_0_3.STRING))); // line 2
tag.put("Text3", new StringTag(wrapper.read(Typesb1_7_0_3.STRING))); // line 3
tag.put("Text4", new StringTag(wrapper.read(Typesb1_7_0_3.STRING))); // line 4
tag.putString("id", "Sign");
tag.putInt("x", pos.x());
tag.putInt("y", pos.y());
tag.putInt("z", pos.z());
tag.putString("Text1", wrapper.read(Typesb1_7_0_3.STRING)); // line 1
tag.putString("Text2", wrapper.read(Typesb1_7_0_3.STRING)); // line 2
tag.putString("Text3", wrapper.read(Typesb1_7_0_3.STRING)); // line 3
tag.putString("Text4", wrapper.read(Typesb1_7_0_3.STRING)); // line 4
wrapper.write(Types1_7_6.NBT, tag); // data
});
this.cancelServerbound(ServerboundPacketsb1_1.CONTAINER_ACK);
@ -350,10 +353,10 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
final Item item = items[i];
if (item == null) continue;
final CompoundTag itemTag = new CompoundTag();
itemTag.put("Slot", new ByteTag((byte) i));
itemTag.put("id", new ShortTag((short) item.identifier()));
itemTag.put("Count", new ByteTag((byte) item.amount()));
itemTag.put("Damage", new ShortTag(item.data()));
itemTag.putByte("Slot", (byte) i);
itemTag.putShort("id", (short) item.identifier());
itemTag.putByte("Count", (byte) item.amount());
itemTag.putShort("Damage", item.data());
itemList.add(itemTag);
}
tag.put("Items", itemList);
@ -370,7 +373,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
final PacketWrapper windowItems = PacketWrapper.create(ClientboundPacketsb1_1.CONTAINER_SET_CONTENT, user);
windowItems.write(Types.BYTE, windowId); // window id
windowItems.write(Types1_4_2.NBTLESS_ITEM_ARRAY, copyItems(items)); // items
windowItems.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
windowItems.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
final AlphaInventoryTracker inventoryTracker = user.get(AlphaInventoryTracker.class);
if (inventoryTracker != null) inventoryTracker.setOpenContainerItems(copyItems(items));
@ -381,20 +384,20 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
windowProperty.write(Types.UNSIGNED_BYTE, windowId); // window id
windowProperty.write(Types.SHORT, id); // progress bar id
windowProperty.write(Types.SHORT, value); // progress bar value
windowProperty.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
windowProperty.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
}
private short getBurningTime(final Item item) {
if (item == null) return 0;
final int id = item.identifier();
if (id == BlockList1_6.bookShelf.blockID || id == BlockList1_6.chest.blockID || id == BlockList1_6.fence.blockID || id == BlockList1_6.jukebox.blockID || id == BlockList1_6.wood.blockID || id == BlockList1_6.planks.blockID || id == BlockList1_6.doorWood.blockID || id == BlockList1_6.signWall.blockID || id == BlockList1_6.signPost.blockID || id == BlockList1_6.workbench.blockID) {
if (id == BlockList1_6.bookShelf.blockId() || id == BlockList1_6.chest.blockId() || id == BlockList1_6.fence.blockId() || id == BlockList1_6.jukebox.blockId() || id == BlockList1_6.wood.blockId() || id == BlockList1_6.planks.blockId() || id == BlockList1_6.doorWood.blockId() || id == BlockList1_6.signWall.blockId() || id == BlockList1_6.signPost.blockId() || id == BlockList1_6.workbench.blockId()) {
return 300;
} else if (id == ItemList1_6.stick.itemID) {
} else if (id == ItemList1_6.stick.itemId()) {
return 100;
} else if (id == ItemList1_6.coal.itemID) {
} else if (id == ItemList1_6.coal.itemId()) {
return 1600;
} else if (id == ItemList1_6.bucketLava.itemID) {
} else if (id == ItemList1_6.bucketLava.itemId()) {
return 20000;
}
return 0;
@ -435,7 +438,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
spawnItem.write(Types.BYTE, (byte) (motionX * 128)); // velocity x
spawnItem.write(Types.BYTE, (byte) (motionY * 128)); // velocity y
spawnItem.write(Types.BYTE, (byte) (motionZ * 128)); // velocity z
spawnItem.sendToServer(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
spawnItem.sendToServer(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
}
public static Item[] reverseArray(final Item[] array) {
@ -455,7 +458,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
}
public static Item[] copyItems(final Item[] items) {
return Arrays.stream(items).map(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6::copyItem).toArray(Item[]::new);
return Arrays.stream(items).map(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1::copyItem).toArray(Item[]::new);
}
public static Item fixItem(final Item item) {
@ -480,7 +483,7 @@ public class Protocolb1_0_1_1_1toa1_2_3_5_1_2_6 extends StatelessProtocol<Client
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class, ClientboundPacketsa1_2_6::getPacket));
userConnection.put(new PreNettySplitter(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class, ClientboundPacketsa1_2_6::getPacket));
userConnection.put(new InventoryStorage());
if (Via.getManager().getProviders().get(AlphaInventoryProvider.class).usesInventoryTracker()) {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.data;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.libs.fastutil.ints.*;
@ -312,7 +312,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(290, (i, d) -> {
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
if (d.value().getId() == BlockList1_6.grass.blockId() || d.value().getId() == BlockList1_6.dirt.blockId()) {
i.setData((short) (i.data() + 1));
if (i.data() > 32) {
i.setAmount(i.amount() - 1);
@ -320,7 +320,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(291, (i, d) -> {
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
if (d.value().getId() == BlockList1_6.grass.blockId() || d.value().getId() == BlockList1_6.dirt.blockId()) {
i.setData((short) (i.data() + 1));
if (i.data() > 64) {
i.setAmount(i.amount() - 1);
@ -328,7 +328,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(292, (i, d) -> {
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
if (d.value().getId() == BlockList1_6.grass.blockId() || d.value().getId() == BlockList1_6.dirt.blockId()) {
i.setData((short) (i.data() + 1));
if (i.data() > 128) {
i.setAmount(i.amount() - 1);
@ -336,7 +336,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(293, (i, d) -> {
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
if (d.value().getId() == BlockList1_6.grass.blockId() || d.value().getId() == BlockList1_6.dirt.blockId()) {
i.setData((short) (i.data() + 1));
if (i.data() > 256) {
i.setAmount(i.amount() - 1);
@ -344,7 +344,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(294, (i, d) -> {
if (d.value().getId() == BlockList1_6.grass.blockID || d.value().getId() == BlockList1_6.dirt.blockID) {
if (d.value().getId() == BlockList1_6.grass.blockId() || d.value().getId() == BlockList1_6.dirt.blockId()) {
i.setData((short) (i.data() + 1));
if (i.data() > 64) {
i.setAmount(i.amount() - 1);
@ -352,7 +352,7 @@ public class AlphaItems {
}
});
PLACE_ACTION.put(295, (i, d) -> {
if (d.keyInt() == 1 && d.value().getId() == BlockList1_6.tilledField.blockID) {
if (d.keyInt() == 1 && d.value().getId() == BlockList1_6.tilledField.blockId()) {
i.setAmount(i.amount() - 1);
}
});
@ -363,7 +363,7 @@ public class AlphaItems {
if (d.keyInt() == 1) i.setAmount(i.amount() - 1);
});
PLACE_ACTION.put(328, (i, d) -> {
if (d.value().getId() == BlockList1_6.rail.blockID) {
if (d.value().getId() == BlockList1_6.rail.blockId()) {
i.setAmount(i.amount() - 1);
}
});
@ -371,22 +371,22 @@ public class AlphaItems {
if (d.keyInt() == 1) i.setAmount(i.amount() - 1);
});
PLACE_ACTION.put(342, (i, d) -> {
if (d.value().getId() == BlockList1_6.rail.blockID) {
if (d.value().getId() == BlockList1_6.rail.blockId()) {
i.setAmount(i.amount() - 1);
}
});
PLACE_ACTION.put(343, (i, d) -> {
if (d.value().getId() == BlockList1_6.rail.blockID) {
if (d.value().getId() == BlockList1_6.rail.blockId()) {
i.setAmount(i.amount() - 1);
}
});
PLACE_ACTION.put(2256, (i, d) -> {
if (d.value().getId() == BlockList1_6.jukebox.blockID && d.value().getData() == 0) {
if (d.value().getId() == BlockList1_6.jukebox.blockId() && d.value().getData() == 0) {
i.setAmount(i.amount() - 1);
}
});
PLACE_ACTION.put(2257, (i, d) -> {
if (d.value().getId() == BlockList1_6.jukebox.blockID && d.value().getData() == 0) {
if (d.value().getId() == BlockList1_6.jukebox.blockId() && d.value().getData() == 0) {
i.setAmount(i.amount() - 1);
}
});

View File

@ -0,0 +1,182 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.data;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;
import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.model.CraftingRecipe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CraftingManager {
private static final List<CraftingRecipe> recipes = new ArrayList<>();
private static final String[][] tools_pattern = new String[][]{{"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}, {"XX", " #", " #"}};
private static final int[][] tools_ingredients = new int[][]{{BlockList1_6.planks.blockId(), BlockList1_6.cobblestone.blockId(), ItemList1_6.ingotIron.itemId(), ItemList1_6.diamond.itemId(), ItemList1_6.ingotGold.itemId()}, {ItemList1_6.pickaxeWood.itemId(), ItemList1_6.pickaxeStone.itemId(), ItemList1_6.pickaxeIron.itemId(), ItemList1_6.pickaxeDiamond.itemId(), ItemList1_6.pickaxeGold.itemId()}, {ItemList1_6.shovelWood.itemId(), ItemList1_6.shovelStone.itemId(), ItemList1_6.shovelIron.itemId(), ItemList1_6.shovelDiamond.itemId(), ItemList1_6.shovelGold.itemId()}, {ItemList1_6.axeWood.itemId(), ItemList1_6.axeStone.itemId(), ItemList1_6.axeIron.itemId(), ItemList1_6.axeDiamond.itemId(), ItemList1_6.axeGold.itemId()}, {ItemList1_6.hoeWood.itemId(), ItemList1_6.hoeStone.itemId(), ItemList1_6.hoeIron.itemId(), ItemList1_6.hoeDiamond.itemId(), ItemList1_6.hoeGold.itemId()}};
private static final String[][] weapons_pattern = new String[][]{{"X", "X", "#"}};
private static final int[][] weapons_ingredients = new int[][]{{BlockList1_6.planks.blockId(), BlockList1_6.cobblestone.blockId(), ItemList1_6.ingotIron.itemId(), ItemList1_6.diamond.itemId(), ItemList1_6.ingotGold.itemId()}, {ItemList1_6.swordWood.itemId(), ItemList1_6.swordStone.itemId(), ItemList1_6.swordIron.itemId(), ItemList1_6.swordDiamond.itemId(), ItemList1_6.swordGold.itemId()}};
private static final int[][] ingots_ingredients = new int[][]{{BlockList1_6.blockGold.blockId(), ItemList1_6.ingotGold.itemId()}, {BlockList1_6.blockIron.blockId(), ItemList1_6.ingotIron.itemId()}, {BlockList1_6.blockDiamond.blockId(), ItemList1_6.diamond.itemId()}};
private static final String[][] armor_pattern = new String[][]{{"XXX", "X X"}, {"X X", "XXX", "XXX"}, {"XXX", "X X", "X X"}, {"X X", "X X"}};
private static final int[][] armor_ingredients = new int[][]{{ItemList1_6.leather.itemId(), BlockList1_6.fire.blockId(), ItemList1_6.ingotIron.itemId(), ItemList1_6.diamond.itemId(), ItemList1_6.ingotGold.itemId()}, {ItemList1_6.helmetLeather.itemId(), ItemList1_6.helmetChain.itemId(), ItemList1_6.helmetIron.itemId(), ItemList1_6.helmetDiamond.itemId(), ItemList1_6.helmetGold.itemId()}, {ItemList1_6.plateLeather.itemId(), ItemList1_6.plateChain.itemId(), ItemList1_6.plateIron.itemId(), ItemList1_6.plateDiamond.itemId(), ItemList1_6.plateGold.itemId()}, {ItemList1_6.legsLeather.itemId(), ItemList1_6.legsChain.itemId(), ItemList1_6.legsIron.itemId(), ItemList1_6.legsDiamond.itemId(), ItemList1_6.legsGold.itemId()}, {ItemList1_6.bootsLeather.itemId(), ItemList1_6.bootsChain.itemId(), ItemList1_6.bootsIron.itemId(), ItemList1_6.bootsDiamond.itemId(), ItemList1_6.bootsGold.itemId()}};
static {
for (int i = 0; i < tools_ingredients[0].length; ++i) {
for (int i1 = 0; i1 < tools_ingredients.length - 1; ++i1) {
addRecipe(new DataItem(tools_ingredients[i1 + 1][i], (byte) 1, (short) 0, null), tools_pattern[i1], '#', ItemList1_6.stick.itemId(), 'X', tools_ingredients[0][i]);
}
}
for (int i = 0; i < weapons_ingredients[0].length; ++i) {
for (int i1 = 0; i1 < weapons_ingredients.length - 1; ++i1) {
addRecipe(new DataItem(weapons_ingredients[i1 + 1][i], (byte) 1, (short) 0, null), weapons_pattern[i1], '#', ItemList1_6.stick.itemId(), 'X', weapons_ingredients[0][i]);
}
}
addRecipe(new DataItem(ItemList1_6.bow.itemId(), (byte) 1, (short) 0, null), " #X", "# X", " #X", 'X', ItemList1_6.silk.itemId(), '#', ItemList1_6.stick.itemId());
addRecipe(new DataItem(ItemList1_6.arrow.itemId(), (byte) 4, (short) 0, null), "X", "#", "Y", 'Y', ItemList1_6.feather.itemId(), 'X', ItemList1_6.flint.itemId(), '#', ItemList1_6.stick.itemId());
for (int[] ingots_ingredient : ingots_ingredients) {
addRecipe(new DataItem(ingots_ingredient[0], (byte) 1, (short) 0, null), "###", "###", "###", '#', ingots_ingredient[1]);
addRecipe(new DataItem(ingots_ingredient[1], (byte) 9, (short) 0, null), "#", '#', ingots_ingredient[0]);
}
addRecipe(new DataItem(ItemList1_6.bowlSoup.itemId(), (byte) 1, (short) 0, null), "Y", "X", "#", 'X', BlockList1_6.mushroomBrown.blockId(), 'Y', BlockList1_6.mushroomRed.blockId(), '#', ItemList1_6.bowlEmpty.itemId());
addRecipe(new DataItem(ItemList1_6.bowlSoup.itemId(), (byte) 1, (short) 0, null), "Y", "X", "#", 'X', BlockList1_6.mushroomRed.blockId(), 'Y', BlockList1_6.mushroomBrown.blockId(), '#', ItemList1_6.bowlEmpty.itemId());
addRecipe(new DataItem(BlockList1_6.chest.blockId(), (byte) 1, (short) 0, null), "###", "# #", "###", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(BlockList1_6.furnaceIdle.blockId(), (byte) 1, (short) 0, null), "###", "# #", "###", '#', BlockList1_6.cobblestone.blockId());
addRecipe(new DataItem(BlockList1_6.workbench.blockId(), (byte) 1, (short) 0, null), "##", "##", '#', BlockList1_6.planks.blockId());
for (int i = 0; i < armor_ingredients[0].length; ++i) {
for (int i1 = 0; i1 < armor_ingredients.length - 1; ++i1) {
addRecipe(new DataItem(armor_ingredients[i1 + 1][i], (byte) 1, (short) 0, null), armor_pattern[i1], 'X', armor_ingredients[0][i]);
}
}
addRecipe(new DataItem(ItemList1_6.paper.itemId(), (byte) 3, (short) 0, null), "###", '#', ItemList1_6.reed.itemId());
addRecipe(new DataItem(ItemList1_6.book.itemId(), (byte) 1, (short) 0, null), "#", "#", "#", '#', ItemList1_6.paper.itemId());
addRecipe(new DataItem(BlockList1_6.fence.blockId(), (byte) 2, (short) 0, null), "###", "###", '#', ItemList1_6.stick.itemId());
addRecipe(new DataItem(BlockList1_6.jukebox.blockId(), (byte) 1, (short) 0, null), "###", "#X#", "###", '#', BlockList1_6.planks.blockId(), 'X', ItemList1_6.diamond.itemId());
addRecipe(new DataItem(BlockList1_6.bookShelf.blockId(), (byte) 1, (short) 0, null), "###", "XXX", "###", '#', BlockList1_6.planks.blockId(), 'X', ItemList1_6.book.itemId());
addRecipe(new DataItem(BlockList1_6.blockSnow.blockId(), (byte) 1, (short) 0, null), "##", "##", '#', ItemList1_6.snowball.itemId());
addRecipe(new DataItem(BlockList1_6.blockClay.blockId(), (byte) 1, (short) 0, null), "##", "##", '#', ItemList1_6.clay.itemId());
addRecipe(new DataItem(BlockList1_6.brick.blockId(), (byte) 1, (short) 0, null), "##", "##", '#', ItemList1_6.brick.itemId());
addRecipe(new DataItem(BlockList1_6.glowStone.blockId(), (byte) 1, (short) 0, null), "###", "###", "###", '#', ItemList1_6.glowstone.itemId());
addRecipe(new DataItem(BlockList1_6.cloth.blockId(), (byte) 1, (short) 0, null), "###", "###", "###", '#', ItemList1_6.silk.itemId());
addRecipe(new DataItem(BlockList1_6.tnt.blockId(), (byte) 1, (short) 0, null), "X#X", "#X#", "X#X", 'X', ItemList1_6.gunpowder.itemId(), '#', BlockList1_6.sand.blockId());
addRecipe(new DataItem(BlockList1_6.stoneSingleSlab.blockId(), (byte) 3, (short) 0, null), "###", '#', BlockList1_6.cobblestone.blockId());
addRecipe(new DataItem(BlockList1_6.ladder.blockId(), (byte) 1, (short) 0, null), "# #", "###", "# #", '#', ItemList1_6.stick.itemId());
addRecipe(new DataItem(ItemList1_6.doorWood.itemId(), (byte) 1, (short) 0, null), "##", "##", "##", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(ItemList1_6.doorIron.itemId(), (byte) 1, (short) 0, null), "##", "##", "##", '#', ItemList1_6.ingotIron.itemId());
addRecipe(new DataItem(ItemList1_6.sign.itemId(), (byte) 1, (short) 0, null), "###", "###", " X ", '#', BlockList1_6.planks.blockId(), 'X', ItemList1_6.stick.itemId());
addRecipe(new DataItem(BlockList1_6.planks.blockId(), (byte) 4, (short) 0, null), "#", '#', BlockList1_6.wood.blockId());
addRecipe(new DataItem(ItemList1_6.stick.itemId(), (byte) 4, (short) 0, null), "#", "#", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(BlockList1_6.torchWood.blockId(), (byte) 4, (short) 0, null), "X", "#", 'X', ItemList1_6.coal.itemId(), '#', ItemList1_6.stick.itemId());
addRecipe(new DataItem(ItemList1_6.bowlEmpty.itemId(), (byte) 4, (short) 0, null), "# #", " # ", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(BlockList1_6.rail.blockId(), (byte) 16, (short) 0, null), "X X", "X#X", "X X", 'X', ItemList1_6.ingotIron.itemId(), '#', ItemList1_6.stick.itemId());
addRecipe(new DataItem(ItemList1_6.minecartEmpty.itemId(), (byte) 1, (short) 0, null), "# #", "###", '#', ItemList1_6.ingotIron.itemId());
addRecipe(new DataItem(BlockList1_6.pumpkinLantern.blockId(), (byte) 1, (short) 0, null), "A", "B", 'A', BlockList1_6.pumpkin.blockId(), 'B', BlockList1_6.torchWood.blockId());
addRecipe(new DataItem(ItemList1_6.minecartCrate.itemId(), (byte) 1, (short) 0, null), "A", "B", 'A', BlockList1_6.chest.blockId(), 'B', ItemList1_6.minecartEmpty.itemId());
addRecipe(new DataItem(ItemList1_6.minecartPowered.itemId(), (byte) 1, (short) 0, null), "A", "B", 'A', BlockList1_6.furnaceIdle.blockId(), 'B', ItemList1_6.minecartEmpty.itemId());
addRecipe(new DataItem(ItemList1_6.boat.itemId(), (byte) 1, (short) 0, null), "# #", "###", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(ItemList1_6.bucketEmpty.itemId(), (byte) 1, (short) 0, null), "# #", " # ", '#', ItemList1_6.ingotIron.itemId());
addRecipe(new DataItem(ItemList1_6.flintAndSteel.itemId(), (byte) 1, (short) 0, null), "A ", " B", 'A', ItemList1_6.ingotIron.itemId(), 'B', ItemList1_6.flint.itemId());
addRecipe(new DataItem(ItemList1_6.bread.itemId(), (byte) 1, (short) 0, null), "###", '#', ItemList1_6.wheat.itemId());
addRecipe(new DataItem(BlockList1_6.stairsWoodOak.blockId(), (byte) 4, (short) 0, null), "# ", "## ", "###", '#', BlockList1_6.planks.blockId());
addRecipe(new DataItem(ItemList1_6.fishingRod.itemId(), (byte) 1, (short) 0, null), " #", " #X", "# X", '#', ItemList1_6.stick.itemId(), 'X', ItemList1_6.silk.itemId());
addRecipe(new DataItem(BlockList1_6.stairsCobblestone.blockId(), (byte) 4, (short) 0, null), "# ", "## ", "###", '#', BlockList1_6.cobblestone.blockId());
addRecipe(new DataItem(ItemList1_6.painting.itemId(), (byte) 1, (short) 0, null), "###", "#X#", "###", '#', ItemList1_6.stick.itemId(), 'X', BlockList1_6.cloth.blockId());
addRecipe(new DataItem(ItemList1_6.appleGold.itemId(), (byte) 1, (short) 0, null), "###", "#X#", "###", '#', BlockList1_6.blockGold.blockId(), 'X', ItemList1_6.appleRed.itemId());
addRecipe(new DataItem(BlockList1_6.lever.blockId(), (byte) 1, (short) 0, null), "X", "#", '#', BlockList1_6.cobblestone.blockId(), 'X', ItemList1_6.stick.itemId());
addRecipe(new DataItem(BlockList1_6.torchRedstoneActive.blockId(), (byte) 1, (short) 0, null), "X", "#", '#', ItemList1_6.stick.itemId(), 'X', ItemList1_6.redstone.itemId());
addRecipe(new DataItem(ItemList1_6.pocketSundial.itemId(), (byte) 1, (short) 0, null), " # ", "#X#", " # ", '#', ItemList1_6.ingotGold.itemId(), 'X', ItemList1_6.redstone.itemId());
addRecipe(new DataItem(ItemList1_6.compass.itemId(), (byte) 1, (short) 0, null), " # ", "#X#", " # ", '#', ItemList1_6.ingotIron.itemId(), 'X', ItemList1_6.redstone.itemId());
addRecipe(new DataItem(BlockList1_6.stoneButton.blockId(), (byte) 1, (short) 0, null), "#", "#", '#', BlockList1_6.stone.blockId());
addRecipe(new DataItem(BlockList1_6.pressurePlateStone.blockId(), (byte) 1, (short) 0, null), "###", '#', BlockList1_6.stone.blockId());
addRecipe(new DataItem(BlockList1_6.pressurePlatePlanks.blockId(), (byte) 1, (short) 0, null), "###", '#', BlockList1_6.planks.blockId());
recipes.sort((o1, o2) -> Integer.compare(o2.getRecipeSize(), o1.getRecipeSize()));
}
private static void addRecipe(final Item resultItem, final Object... objects) {
StringBuilder var3 = new StringBuilder();
int pos = 0;
int width = 0;
int height = 0;
if (objects[pos] instanceof String[]) {
String[] var11 = (String[]) objects[pos++];
for (String var9 : var11) {
height++;
width = var9.length();
var3.append(var9);
}
} else {
while (objects[pos] instanceof String) {
String var7 = (String) objects[pos++];
height++;
width = var7.length();
var3.append(var7);
}
}
final HashMap<Character, Integer> lookup = new HashMap<>();
while (pos < objects.length) {
lookup.put((char) objects[pos], (int) objects[pos + 1]);
pos += 2;
}
final int[] ingredientMap = new int[width * height];
for (int i = 0; i < ingredientMap.length; i++) {
ingredientMap[i] = lookup.getOrDefault(var3.charAt(i), -1);
}
recipes.add(new CraftingRecipe(width, height, ingredientMap, resultItem));
}
public static Item getResult(final Item[] craftingGrid) {
final int gridSize = (int) Math.sqrt(craftingGrid.length);
final int[] ingredientMap = new int[9];
for (int x = 0; x < 3; ++x) {
for (int y = 0; y < 3; ++y) {
int ingredient = -1;
if (x < gridSize && y < gridSize) {
final Item item = craftingGrid[x + y * gridSize];
if (item != null) {
ingredient = item.identifier();
}
}
ingredientMap[x + y * 3] = ingredient;
}
}
return getResult(ingredientMap);
}
public static Item getResult(final int[] ingredientMap) {
for (CraftingRecipe recipe : recipes) {
if (recipe.matches(ingredientMap)) {
return recipe.createResult();
}
}
return null;
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.model;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.model;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,12 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.platform.providers.Provider;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.InventoryStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage;
public abstract class AlphaInventoryProvider implements Provider {

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.Item;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.InventoryStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage;
public class NoOpAlphaInventoryProvider extends AlphaInventoryProvider {

View File

@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.Item;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.AlphaInventoryTracker;
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.copyItems;
import static net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.copyItems;
public class TrackingAlphaInventoryProvider extends AlphaInventoryProvider {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage;
import com.viaversion.viaversion.api.connection.StoredObject;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -29,17 +29,17 @@ import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.util.BlockFaceUtil;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data.AlphaItems;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.data.CraftingManager;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.data.AlphaItems;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.data.CraftingManager;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import java.util.Arrays;
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.*;
import static net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.*;
public class AlphaInventoryTracker extends StoredObject {
@ -260,13 +260,13 @@ public class AlphaInventoryTracker extends StoredObject {
final IdAndData targetBlock = this.getUser().get(ChunkTracker.class).getBlockNotNull(position.getRelative(BlockFaceUtil.getFace(direction)));
AlphaItems.doPlace(handItem, direction, placedAgainst);
if (handItem.identifier() < 256 || handItem.identifier() == ItemList1_6.reed.itemID) { // block item
if (targetBlock.getId() == 0 || targetBlock.getId() == BlockList1_6.waterStill.blockID || targetBlock.getId() == BlockList1_6.waterMoving.blockID || targetBlock.getId() == BlockList1_6.lavaStill.blockID || targetBlock.getId() == BlockList1_6.lavaMoving.blockID || targetBlock.getId() == BlockList1_6.fire.blockID || targetBlock.getId() == BlockList1_6.snow.blockID) {
if (handItem.identifier() < 256 || handItem.identifier() == ItemList1_6.reed.itemId()) { // block item
if (targetBlock.getId() == 0 || targetBlock.getId() == BlockList1_6.waterStill.blockId() || targetBlock.getId() == BlockList1_6.waterMoving.blockId() || targetBlock.getId() == BlockList1_6.lavaStill.blockId() || targetBlock.getId() == BlockList1_6.lavaMoving.blockId() || targetBlock.getId() == BlockList1_6.fire.blockId() || targetBlock.getId() == BlockList1_6.snow.blockId()) {
handItem.setAmount(handItem.amount() - 1);
}
} else if (handItem.identifier() == ItemList1_6.sign.itemID) {
} else if (handItem.identifier() == ItemList1_6.sign.itemId()) {
if (direction != 0 && targetBlock.getId() == 0) handItem.setAmount(handItem.amount() - 1);
} else if (handItem.identifier() == ItemList1_6.redstone.itemID) {
} else if (handItem.identifier() == ItemList1_6.redstone.itemId()) {
if (targetBlock.getId() == 0) handItem.setAmount(handItem.amount() - 1);
}
}
@ -409,7 +409,7 @@ public class AlphaInventoryTracker extends StoredObject {
setSlot.write(Types.BYTE, windowId); // window id
setSlot.write(Types.SHORT, slot); // slot
setSlot.write(Typesb1_1.NBTLESS_ITEM, copyItem(item)); // item
setSlot.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
setSlot.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
}
private void updatePlayerInventory() {
@ -426,7 +426,7 @@ public class AlphaInventoryTracker extends StoredObject {
final PacketWrapper windowItems = PacketWrapper.create(ClientboundPacketsb1_1.CONTAINER_SET_CONTENT, this.getUser());
windowItems.write(Types.BYTE, windowId); // window id
windowItems.write(Types1_4_2.NBTLESS_ITEM_ARRAY, copyItems(items)); // items
windowItems.send(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
windowItems.send(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
}
private Item splitStack(final Item item, final int size) {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.api.minecraft.Position;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.task;
package net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.task;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -23,18 +23,18 @@ import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.ServerboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.InventoryStorage;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.packet.ServerboundPacketsa1_2_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.InventoryStorage;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import java.util.Arrays;
import java.util.Objects;
import java.util.logging.Level;
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.*;
import static net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.*;
public class AlphaInventoryUpdateTask implements Runnable {
@ -56,7 +56,7 @@ public class AlphaInventoryUpdateTask implements Runnable {
if (!Objects.equals(handItem, inventoryStorage.handItem)) {
final PacketWrapper heldItemChange = PacketWrapper.create(ServerboundPacketsb1_1.SET_CARRIED_ITEM, info);
heldItemChange.write(Types.SHORT, inventoryStorage.selectedHotbarSlot); // slot
heldItemChange.sendToServer(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class, false);
heldItemChange.sendToServer(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class, false);
}
final Item[] mergedMainInventory = copyItems(inventoryStorage.mainInventory);
@ -85,9 +85,9 @@ public class AlphaInventoryUpdateTask implements Runnable {
armorContent.write(Types.INT, -3); // type
armorContent.write(Types1_4_2.NBTLESS_ITEM_ARRAY, mergedArmorInventory); // items
mainContent.sendToServer(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
craftingContent.sendToServer(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
armorContent.sendToServer(Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.class);
mainContent.sendToServer(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
craftingContent.sendToServer(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
armorContent.sendToServer(Protocola1_2_3_5_1_2_6Tob1_0_1_1_1.class);
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error sending inventory update packets", e);
}

View File

@ -15,15 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_1_2tob1_0_1_1;
package net.raphimc.vialegacy.protocol.beta.b1_0_1_1tob1_1_2;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ServerboundPacketsb1_1;
public class Protocolb1_1_2tob1_0_1_1 extends StatelessProtocol<ClientboundPacketsb1_1, ClientboundPacketsb1_1, ServerboundPacketsb1_1, ServerboundPacketsb1_1> {
public class Protocolb1_0_1_1Tob1_1_2 extends StatelessProtocol<ClientboundPacketsb1_1, ClientboundPacketsb1_1, ServerboundPacketsb1_1, ServerboundPacketsb1_1> {
public Protocolb1_1_2tob1_0_1_1() {
public Protocolb1_0_1_1Tob1_1_2() {
super(ClientboundPacketsb1_1.class, ClientboundPacketsb1_1.class, ServerboundPacketsb1_1.class, ServerboundPacketsb1_1.class);
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2;
import com.google.common.collect.Lists;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -27,23 +27,25 @@ import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.util.IdAndData;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.rewriter.BlockDataRewriter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.storage.EntityFlagStorage;
import net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.ClientboundPacketsb1_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.ServerboundPacketsb1_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.types.MetaTypeb1_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.types.Typesb1_2;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.types.Types1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ClientboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet.ServerboundPacketsb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.rewriter.BlockDataRewriter;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.storage.EntityFlagStorage;
import net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types.Typesb1_1;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet.ClientboundPacketsb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet.ServerboundPacketsb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types.EntityDataTypesb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types.Typesb1_2;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.types.Types1_1;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
public class Protocolb1_2_0_2tob1_1_2 extends StatelessProtocol<ClientboundPacketsb1_1, ClientboundPacketsb1_2, ServerboundPacketsb1_1, ServerboundPacketsb1_2> {
public class Protocolb1_1_2Tob1_2_0_2 extends StatelessProtocol<ClientboundPacketsb1_1, ClientboundPacketsb1_2, ServerboundPacketsb1_1, ServerboundPacketsb1_2> {
private final BlockDataRewriter BLOCK_DATA_REWRITER = new BlockDataRewriter();
public Protocolb1_2_0_2tob1_1_2() {
public Protocolb1_1_2Tob1_2_0_2() {
super(ClientboundPacketsb1_1.class, ClientboundPacketsb1_2.class, ServerboundPacketsb1_1.class, ServerboundPacketsb1_2.class);
}
@ -93,10 +95,10 @@ public class Protocolb1_2_0_2tob1_1_2 extends StatelessProtocol<ClientboundPacke
}
if (oldMask != entityFlagStorage.getFlagMask(entityId)) {
final PacketWrapper metadata = PacketWrapper.create(ClientboundPacketsb1_2.SET_ENTITY_DATA, wrapper.user());
metadata.write(Types.INT, wrapper.get(Types.INT, 0)); // entity id
metadata.write(Typesb1_2.METADATA_LIST, Lists.newArrayList(new EntityData(0, MetaTypeb1_2.Byte, (byte) entityFlagStorage.getFlagMask(entityId)))); // metadata
metadata.send(Protocolb1_2_0_2tob1_1_2.class);
final PacketWrapper setEntityData = PacketWrapper.create(ClientboundPacketsb1_2.SET_ENTITY_DATA, wrapper.user());
setEntityData.write(Types.INT, wrapper.get(Types.INT, 0)); // entity id
setEntityData.write(Typesb1_2.ENTITY_DATA_LIST, Lists.newArrayList(new EntityData(0, EntityDataTypesb1_2.BYTE, (byte) entityFlagStorage.getFlagMask(entityId)))); // entity data
setEntityData.send(Protocolb1_1_2Tob1_2_0_2.class);
}
});
}
@ -128,7 +130,7 @@ public class Protocolb1_2_0_2tob1_1_2 extends StatelessProtocol<ClientboundPacke
map(Types.INT); // z
map(Types.BYTE); // yaw
map(Types.BYTE); // pitch
handler(wrapper -> wrapper.write(Typesb1_2.METADATA_LIST, Lists.newArrayList(new EntityData(0, MetaTypeb1_2.Byte, (byte) 0)))); // metadata
handler(wrapper -> wrapper.write(Typesb1_2.ENTITY_DATA_LIST, Lists.newArrayList(new EntityData(0, EntityDataTypesb1_2.BYTE, (byte) 0)))); // entity data
}
});
this.registerClientbound(ClientboundPacketsb1_1.LEVEL_CHUNK, new PacketHandlers() {
@ -198,7 +200,7 @@ public class Protocolb1_2_0_2tob1_1_2 extends StatelessProtocol<ClientboundPacke
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_2_0_2tob1_1_2.class, ClientboundPacketsb1_1::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_1_2Tob1_2_0_2.class, ClientboundPacketsb1_1::getPacket));
userConnection.put(new EntityFlagStorage());
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.rewriter;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.rewriter;
import com.viaversion.viaversion.util.IdAndData;
import net.raphimc.vialegacy.api.data.BlockList1_6;
@ -25,16 +25,16 @@ public class BlockDataRewriter extends AbstractBlockRemapper {
public BlockDataRewriter() {
for (int i = 1; i < 16; i++) { // cobblestone
this.registerReplacement(new IdAndData(BlockList1_6.cobblestone.blockID, i), new IdAndData(BlockList1_6.cobblestone.blockID, 0));
this.registerReplacement(new IdAndData(BlockList1_6.cobblestone.blockId(), i), new IdAndData(BlockList1_6.cobblestone.blockId(), 0));
}
for (int i = 1; i < 16; i++) { // sand
this.registerReplacement(new IdAndData(BlockList1_6.sand.blockID, i), new IdAndData(BlockList1_6.sand.blockID, 0));
this.registerReplacement(new IdAndData(BlockList1_6.sand.blockId(), i), new IdAndData(BlockList1_6.sand.blockId(), 0));
}
for (int i = 1; i < 16; i++) { // gravel
this.registerReplacement(new IdAndData(BlockList1_6.gravel.blockID, i), new IdAndData(BlockList1_6.gravel.blockID, 0));
this.registerReplacement(new IdAndData(BlockList1_6.gravel.blockId(), i), new IdAndData(BlockList1_6.gravel.blockId(), 0));
}
for (int i = 1; i < 16; i++) { // obsidian
this.registerReplacement(new IdAndData(BlockList1_6.obsidian.blockID, i), new IdAndData(BlockList1_6.obsidian.blockID, 0));
this.registerReplacement(new IdAndData(BlockList1_6.obsidian.blockId(), i), new IdAndData(BlockList1_6.obsidian.blockId(), 0));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.storage;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.types;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_2_0_2tob1_1_2.types;
package net.raphimc.vialegacy.protocol.beta.b1_1_2tob1_2_0_2.types;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.type.Type;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -28,22 +28,24 @@ import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.util.IdAndData;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.data.BlockHardnessList;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.storage.BlockDigStorage;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.task.BlockDigTickTask;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.types.Typesb1_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_4_0_1tob1_3_0_1.ClientboundPacketsb1_3;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.ServerboundPacketsb1_4;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.types.MetaTypeb1_4;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.types.Typesb1_4;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.data.BlockHardnessList;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet.ClientboundPacketsb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet.ServerboundPacketsb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage.BlockDigStorage;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.task.BlockDigTickTask;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types.Typesb1_2;
import net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1.packet.ClientboundPacketsb1_3;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ServerboundPacketsb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types.EntityDataTypesb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types.Typesb1_4;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
import java.util.List;
public class Protocolb1_3_0_1tob1_2_0_2 extends StatelessProtocol<ClientboundPacketsb1_2, ClientboundPacketsb1_3, ServerboundPacketsb1_2, ServerboundPacketsb1_4> {
public class Protocolb1_2_0_2Tob1_3_0_1 extends StatelessProtocol<ClientboundPacketsb1_2, ClientboundPacketsb1_3, ServerboundPacketsb1_2, ServerboundPacketsb1_4> {
public Protocolb1_3_0_1tob1_2_0_2() {
public Protocolb1_2_0_2Tob1_3_0_1() {
super(ClientboundPacketsb1_2.class, ClientboundPacketsb1_3.class, ServerboundPacketsb1_2.class, ServerboundPacketsb1_4.class);
}
@ -59,16 +61,16 @@ public class Protocolb1_3_0_1tob1_2_0_2 extends StatelessProtocol<ClientboundPac
map(Types.INT); // z
map(Types.BYTE); // yaw
map(Types.BYTE); // pitch
map(Typesb1_2.METADATA_LIST, Typesb1_4.METADATA_LIST); // metadata
handler(wrapper -> rewriteMetadata(wrapper.get(Typesb1_4.METADATA_LIST, 0)));
map(Typesb1_2.ENTITY_DATA_LIST, Typesb1_4.ENTITY_DATA_LIST); // entity data
handler(wrapper -> rewriteEntityData(wrapper.get(Typesb1_4.ENTITY_DATA_LIST, 0)));
}
});
this.registerClientbound(ClientboundPacketsb1_2.SET_ENTITY_DATA, new PacketHandlers() {
@Override
public void register() {
map(Types.INT); // entity id
map(Typesb1_2.METADATA_LIST, Typesb1_4.METADATA_LIST); // metadata
handler(wrapper -> rewriteMetadata(wrapper.get(Typesb1_4.METADATA_LIST, 0)));
map(Typesb1_2.ENTITY_DATA_LIST, Typesb1_4.ENTITY_DATA_LIST); // entity data
handler(wrapper -> rewriteEntityData(wrapper.get(Typesb1_4.ENTITY_DATA_LIST, 0)));
}
});
@ -122,9 +124,9 @@ public class Protocolb1_3_0_1tob1_2_0_2 extends StatelessProtocol<ClientboundPac
this.cancelServerbound(ServerboundPacketsb1_4.POSITION);
}
private void rewriteMetadata(final List<EntityData> metadataList) {
for (EntityData metadata : metadataList) {
metadata.setDataType(MetaTypeb1_4.byId(metadata.dataType().typeId()));
private void rewriteEntityData(final List<EntityData> entityDataList) {
for (EntityData entityData : entityDataList) {
entityData.setDataType(EntityDataTypesb1_4.byId(entityData.dataType().typeId()));
}
}
@ -135,7 +137,7 @@ public class Protocolb1_3_0_1tob1_2_0_2 extends StatelessProtocol<ClientboundPac
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_3_0_1tob1_2_0_2.class, ClientboundPacketsb1_2::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_2_0_2Tob1_3_0_1.class, ClientboundPacketsb1_2::getPacket));
}
@ -144,7 +146,7 @@ public class Protocolb1_3_0_1tob1_2_0_2 extends StatelessProtocol<ClientboundPac
blockDig.write(Types.UNSIGNED_BYTE, status); // status
blockDig.write(Types1_7_6.POSITION_UBYTE, position); // position
blockDig.write(Types.UNSIGNED_BYTE, facing); // direction
blockDig.sendToServer(Protocolb1_3_0_1tob1_2_0_2.class);
blockDig.sendToServer(Protocolb1_2_0_2Tob1_3_0_1.class);
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.data;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.data;
import com.viaversion.viaversion.util.IdAndData;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -58,7 +58,7 @@ public enum ClientboundPacketsb1_2 implements ClientboundPacketType, PreNettyPac
ADD_ENTITY(23, (user, buf) -> buf.skipBytes(17)),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
PreNettyTypes.readEntityMetadatab1_2(buf);
PreNettyTypes.readEntityDataListb1_2(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -76,7 +76,7 @@ public enum ClientboundPacketsb1_2 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
PreNettyTypes.readEntityMetadatab1_2(buf);
PreNettyTypes.readEntityDataListb1_2(buf);
}),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
LEVEL_CHUNK(51, (user, buf) -> {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,12 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.storage;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage;
import com.viaversion.viaversion.api.connection.StoredObject;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.Position;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.Protocolb1_3_0_1tob1_2_0_2;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.Protocolb1_2_0_2Tob1_3_0_1;
public class BlockDigStorage extends StoredObject {
@ -36,12 +36,12 @@ public class BlockDigStorage extends StoredObject {
public void tick() {
if (this.tick >= 5) {
Protocolb1_3_0_1tob1_2_0_2.sendBlockDigPacket(this.getUser(), (byte) 0, this.position, this.facing);
Protocolb1_2_0_2Tob1_3_0_1.sendBlockDigPacket(this.getUser(), (byte) 0, this.position, this.facing);
this.tick = 0;
} else {
this.tick++;
}
Protocolb1_3_0_1tob1_2_0_2.sendBlockDigPacket(this.getUser(), (byte) 1, this.position, this.facing);
Protocolb1_2_0_2Tob1_3_0_1.sendBlockDigPacket(this.getUser(), (byte) 1, this.position, this.facing);
}
}

View File

@ -15,12 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.task;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.task;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.storage.BlockDigStorage;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage.BlockDigStorage;
import java.util.logging.Level;

View File

@ -15,16 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType;
public class MetadataType extends OldEntityDataType {
public class EntityDataType extends OldEntityDataType {
@Override
protected EntityDataType getType(int index) {
return MetaType1_7_6.byId(index);
protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) {
return EntityDataTypesb1_2.byId(index);
}
}

View File

@ -0,0 +1,55 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
public enum EntityDataTypesb1_2 implements EntityDataType {
BYTE(0, Types.BYTE),
SHORT(1, Types.SHORT),
INT(2, Types.INT),
FLOAT(3, Types.FLOAT),
STRING(4, Typesb1_7_0_3.STRING),
ITEM(5, Types1_3_1.NBTLESS_ITEM);
private final int typeID;
private final Type<?> type;
EntityDataTypesb1_2(int typeID, Type<?> type) {
this.typeID = typeID;
this.type = type;
}
public static EntityDataTypesb1_2 byId(int id) {
return values()[id];
}
public int typeId() {
return this.typeID;
}
public Type<?> type() {
return this.type;
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.types;
package net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.api.type.Type;
@ -25,7 +25,7 @@ import java.util.List;
public class Typesb1_2 {
public static final Type<EntityData> METADATA = new MetadataType();
public static final Type<List<EntityData>> METADATA_LIST = new EntityDataListType(METADATA);
public static final Type<EntityData> ENTITY_DATA = new EntityDataType();
public static final Type<List<EntityData>> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA);
}

View File

@ -15,23 +15,24 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_4_0_1tob1_3_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.ClientboundPacketsb1_4;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.ServerboundPacketsb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1.packet.ClientboundPacketsb1_3;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ClientboundPacketsb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ServerboundPacketsb1_4;
public class Protocolb1_4_0_1tob1_3_0_1 extends StatelessProtocol<ClientboundPacketsb1_3, ClientboundPacketsb1_4, ServerboundPacketsb1_4, ServerboundPacketsb1_4> {
public class Protocolb1_3_0_1Tob1_4_0_1 extends StatelessProtocol<ClientboundPacketsb1_3, ClientboundPacketsb1_4, ServerboundPacketsb1_4, ServerboundPacketsb1_4> {
public Protocolb1_4_0_1tob1_3_0_1() {
public Protocolb1_3_0_1Tob1_4_0_1() {
super(ClientboundPacketsb1_3.class, ClientboundPacketsb1_4.class, ServerboundPacketsb1_4.class, ServerboundPacketsb1_4.class);
}
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_4_0_1tob1_3_0_1.class, ClientboundPacketsb1_3::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_3_0_1Tob1_4_0_1.class, ClientboundPacketsb1_3::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_4_0_1tob1_3_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_3_0_1tob1_4_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -60,7 +60,7 @@ public enum ClientboundPacketsb1_3 implements ClientboundPacketType, PreNettyPac
ADD_ENTITY(23, (user, buf) -> buf.skipBytes(17)),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
readEntityMetadatab1_3(buf);
readEntityDataListb1_3(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -78,7 +78,7 @@ public enum ClientboundPacketsb1_3 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
readEntityMetadatab1_3(buf);
readEntityDataListb1_3(buf);
}),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
LEVEL_CHUNK(51, (user, buf) -> {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
@ -23,21 +23,23 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.types.Typesb1_4;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.ClientboundPacketsb1_5;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.ServerboundPacketsb1_5;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.MetaType1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ClientboundPacketsb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet.ServerboundPacketsb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types.Typesb1_4;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet.ClientboundPacketsb1_5;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet.ServerboundPacketsb1_5;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.EntityDataTypes1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types.Types1_6_4;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
import java.util.List;
public class Protocolb1_5_0_2tob1_4_0_1 extends StatelessProtocol<ClientboundPacketsb1_4, ClientboundPacketsb1_5, ServerboundPacketsb1_4, ServerboundPacketsb1_5> {
public class Protocolb1_4_0_1Tob1_5_0_2 extends StatelessProtocol<ClientboundPacketsb1_4, ClientboundPacketsb1_5, ServerboundPacketsb1_4, ServerboundPacketsb1_5> {
public Protocolb1_5_0_2tob1_4_0_1() {
public Protocolb1_4_0_1Tob1_5_0_2() {
super(ClientboundPacketsb1_4.class, ClientboundPacketsb1_5.class, ServerboundPacketsb1_4.class, ServerboundPacketsb1_5.class);
}
@ -93,8 +95,8 @@ public class Protocolb1_5_0_2tob1_4_0_1 extends StatelessProtocol<ClientboundPac
map(Types.INT); // z
map(Types.BYTE); // yaw
map(Types.BYTE); // pitch
map(Typesb1_4.METADATA_LIST, Types1_3_1.METADATA_LIST); // metadata
handler(wrapper -> rewriteMetadata(wrapper.get(Types1_3_1.METADATA_LIST, 0)));
map(Typesb1_4.ENTITY_DATA_LIST, Types1_3_1.ENTITY_DATA_LIST); // entity data
handler(wrapper -> rewriteEntityData(wrapper.get(Types1_3_1.ENTITY_DATA_LIST, 0)));
}
});
this.registerClientbound(ClientboundPacketsb1_4.ADD_PAINTING, new PacketHandlers() {
@ -110,8 +112,8 @@ public class Protocolb1_5_0_2tob1_4_0_1 extends StatelessProtocol<ClientboundPac
@Override
public void register() {
map(Types.INT); // entity id
map(Typesb1_4.METADATA_LIST, Types1_3_1.METADATA_LIST); // metadata
handler(wrapper -> rewriteMetadata(wrapper.get(Types1_3_1.METADATA_LIST, 0)));
map(Typesb1_4.ENTITY_DATA_LIST, Types1_3_1.ENTITY_DATA_LIST); // entity data
handler(wrapper -> rewriteEntityData(wrapper.get(Types1_3_1.ENTITY_DATA_LIST, 0)));
}
});
this.registerClientbound(ClientboundPacketsb1_4.UPDATE_SIGN, new PacketHandlers() {
@ -182,15 +184,15 @@ public class Protocolb1_5_0_2tob1_4_0_1 extends StatelessProtocol<ClientboundPac
});
}
private void rewriteMetadata(final List<EntityData> metadataList) {
for (EntityData metadata : metadataList) {
metadata.setDataType(MetaType1_3_1.byId(metadata.dataType().typeId()));
private void rewriteEntityData(final List<EntityData> entityDataList) {
for (EntityData entityData : entityDataList) {
entityData.setDataType(EntityDataTypes1_3_1.byId(entityData.dataType().typeId()));
}
}
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_5_0_2tob1_4_0_1.class, ClientboundPacketsb1_4::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_4_0_1Tob1_5_0_2.class, ClientboundPacketsb1_4::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -60,7 +60,7 @@ public enum ClientboundPacketsb1_4 implements ClientboundPacketType, PreNettyPac
ADD_ENTITY(23, (user, buf) -> buf.skipBytes(17)),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
readEntityMetadatab1_3(buf);
readEntityDataListb1_3(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -78,7 +78,7 @@ public enum ClientboundPacketsb1_4 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
readEntityMetadatab1_3(buf);
readEntityDataListb1_3(buf);
}),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
LEVEL_CHUNK(51, (user, buf) -> {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,16 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.types;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
import com.viaversion.viaversion.api.type.types.entitydata.OldEntityDataType;
public class MetadataType extends OldEntityDataType {
public class EntityDataType extends OldEntityDataType {
@Override
protected EntityDataType getType(int index) {
return MetaTypeb1_2.byId(index);
protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(int index) {
return EntityDataTypesb1_4.byId(index);
}
}

View File

@ -15,24 +15,24 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.types;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.Types;
import io.netty.buffer.ByteBuf;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
public enum MetaTypeb1_4 implements EntityDataType {
public enum EntityDataTypesb1_4 implements EntityDataType {
Byte(0, Types.BYTE),
Short(1, Types.SHORT),
Int(2, Types.INT),
Float(3, Types.FLOAT),
String(4, Typesb1_7_0_3.STRING),
Slot(5, new Type<Item>(Item.class) { // b1.3 - b1.4 had broken read/write code where type 5 had a missing break statement causing it to read a type 6 as well (Both are unused)
BYTE(0, Types.BYTE),
SHORT(1, Types.SHORT),
INT(2, Types.INT),
FLOAT(3, Types.FLOAT),
STRING(4, Typesb1_7_0_3.STRING),
ITEM(5, new Type<>(Item.class) { // b1.3 - b1.4 had broken read/write code where type 5 had a missing break statement causing it to read a type 6 as well (Both are unused)
@Override
public Item read(ByteBuf buffer) {
Types1_3_1.NBTLESS_ITEM.read(buffer);
@ -45,17 +45,17 @@ public enum MetaTypeb1_4 implements EntityDataType {
throw new UnsupportedOperationException();
}
}),
Position(6, Types.VECTOR);
BLOCK_POSITION(6, Types.VECTOR);
private final int typeID;
private final Type<?> type;
MetaTypeb1_4(int typeID, Type<?> type) {
EntityDataTypesb1_4(int typeID, Type<?> type) {
this.typeID = typeID;
this.type = type;
}
public static MetaTypeb1_4 byId(int id) {
public static EntityDataTypesb1_4 byId(int id) {
return values()[id];
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_5_0_2tob1_4_0_1.types;
package net.raphimc.vialegacy.protocol.beta.b1_4_0_1tob1_5_0_2.types;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.api.type.Type;
@ -25,7 +25,7 @@ import java.util.List;
public class Typesb1_4 {
public static final Type<EntityData> METADATA = new MetadataType();
public static final Type<List<EntityData>> METADATA_LIST = new EntityDataListType(METADATA);
public static final Type<EntityData> ENTITY_DATA = new EntityDataType();
public static final Type<List<EntityData>> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA);
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -30,19 +30,21 @@ import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.storage.WorldTimeStorage;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.task.TimeTrackTask;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ServerboundPacketsb1_7;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet.ClientboundPacketsb1_5;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet.ServerboundPacketsb1_5;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.storage.WorldTimeStorage;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.task.TimeTrackTask;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ServerboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types.Types1_6_4;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPacketsb1_5, ClientboundPacketsb1_7, ServerboundPacketsb1_5, ServerboundPacketsb1_7> {
public class Protocolb1_5_0_2Tob1_6_0_6 extends StatelessProtocol<ClientboundPacketsb1_5, ClientboundPacketsb1_7, ServerboundPacketsb1_5, ServerboundPacketsb1_7> {
public Protocolb1_6_0_6tob1_5_0_2() {
public Protocolb1_5_0_2Tob1_6_0_6() {
super(ClientboundPacketsb1_5.class, ClientboundPacketsb1_7.class, ServerboundPacketsb1_5.class, ServerboundPacketsb1_7.class);
}
@ -90,21 +92,21 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
Position pos = wrapper.get(Types1_7_6.POSITION_UBYTE, 0);
IdAndData block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
final Item item = wrapper.get(Types1_4_2.NBTLESS_ITEM, 0);
if (block.getId() == BlockList1_6.bed.blockID) {
if (block.getId() == BlockList1_6.bed.blockId()) {
final byte[][] headBlockToFootBlock = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
final boolean isFoot = (block.getData() & 8) != 0;
if (!isFoot) {
final int bedDirection = block.getData() & 3;
pos = new Position(pos.x() + headBlockToFootBlock[bedDirection][0], pos.y(), pos.z() + headBlockToFootBlock[bedDirection][1]);
block = wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos);
if (block.getId() != BlockList1_6.bed.blockID) return;
if (block.getId() != BlockList1_6.bed.blockId()) return;
}
final boolean isOccupied = (block.getData() & 4) != 0;
if (isOccupied) {
final PacketWrapper chat = PacketWrapper.create(ClientboundPacketsb1_7.CHAT, wrapper.user());
chat.write(Types1_6_4.STRING, "This bed is occupied");
chat.send(Protocolb1_6_0_6tob1_5_0_2.class);
chat.send(Protocolb1_5_0_2Tob1_6_0_6.class);
return;
}
@ -125,7 +127,7 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
if (isDayTime) {
final PacketWrapper chat = PacketWrapper.create(ClientboundPacketsb1_7.CHAT, wrapper.user());
chat.write(Types1_6_4.STRING, "You can only sleep at night");
chat.send(Protocolb1_6_0_6tob1_5_0_2.class);
chat.send(Protocolb1_5_0_2Tob1_6_0_6.class);
return;
}
@ -137,20 +139,20 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
useBed.write(Types.INT, playerInfoStorage.entityId); // entity id
useBed.write(Types.BYTE, (byte) 0); // magic value (always 0)
useBed.write(Types1_7_6.POSITION_BYTE, pos); // position
useBed.send(Protocolb1_6_0_6tob1_5_0_2.class);
} else if (block.getId() == BlockList1_6.jukebox.blockID) {
useBed.send(Protocolb1_5_0_2Tob1_6_0_6.class);
} else if (block.getId() == BlockList1_6.jukebox.blockId()) {
if (block.getData() > 0) {
final PacketWrapper effect = PacketWrapper.create(ClientboundPacketsb1_7.LEVEL_EVENT, wrapper.user());
effect.write(Types.INT, 1005); // effect id
effect.write(Types1_7_6.POSITION_UBYTE, pos); // position
effect.write(Types.INT, 0); // data
effect.send(Protocolb1_6_0_6tob1_5_0_2.class);
} else if (item != null && (item.identifier() == ItemList1_6.record13.itemID || item.identifier() == ItemList1_6.recordCat.itemID)) {
effect.send(Protocolb1_5_0_2Tob1_6_0_6.class);
} else if (item != null && (item.identifier() == ItemList1_6.record13.itemId() || item.identifier() == ItemList1_6.recordCat.itemId())) {
final PacketWrapper effect = PacketWrapper.create(ClientboundPacketsb1_7.LEVEL_EVENT, wrapper.user());
effect.write(Types.INT, 1005); // effect id
effect.write(Types1_7_6.POSITION_UBYTE, pos); // position
effect.write(Types.INT, item.identifier()); // data
effect.send(Protocolb1_6_0_6tob1_5_0_2.class);
effect.send(Protocolb1_5_0_2Tob1_6_0_6.class);
}
}
});
@ -165,7 +167,7 @@ public class Protocolb1_6_0_6tob1_5_0_2 extends StatelessProtocol<ClientboundPac
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_6_0_6tob1_5_0_2.class, ClientboundPacketsb1_5::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_5_0_2Tob1_6_0_6.class, ClientboundPacketsb1_5::getPacket));
userConnection.put(new WorldTimeStorage());
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -59,7 +59,7 @@ public enum ClientboundPacketsb1_5 implements ClientboundPacketType, PreNettyPac
ADD_ENTITY(23, (user, buf) -> buf.skipBytes(17)),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -77,7 +77,7 @@ public enum ClientboundPacketsb1_5 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
LEVEL_CHUNK(51, (user, buf) -> {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2;
package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.storage;
package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.storage;
import com.viaversion.viaversion.api.connection.StorableObject;

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.task;
package net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.task;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.storage.WorldTimeStorage;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.storage.WorldTimeStorage;
public class TimeTrackTask implements Runnable {

View File

@ -15,15 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_7_0_3tob1_6_0_6;
package net.raphimc.vialegacy.protocol.beta.b1_6_0_6tob1_7_0_3;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ServerboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ServerboundPacketsb1_7;
public class Protocolb1_7_0_3tob1_6_0_6 extends StatelessProtocol<ClientboundPacketsb1_7, ClientboundPacketsb1_7, ServerboundPacketsb1_7, ServerboundPacketsb1_7> {
public class Protocolb1_6_0_6Tob1_7_0_3 extends StatelessProtocol<ClientboundPacketsb1_7, ClientboundPacketsb1_7, ServerboundPacketsb1_7, ServerboundPacketsb1_7> {
public Protocolb1_7_0_3tob1_6_0_6() {
public Protocolb1_6_0_6Tob1_7_0_3() {
super(ClientboundPacketsb1_7.class, ClientboundPacketsb1_7.class, ServerboundPacketsb1_7.class, ServerboundPacketsb1_7.class);
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.Position;
@ -32,29 +32,31 @@ import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ServerboundPacketsb1_8;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types.Typesb1_8_0_1;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.storage.PlayerHealthTracker;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.storage.PlayerNameTracker;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_0_20a_27.Protocolc0_30toc0_27;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.chunks.NibbleArray1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.types.Types1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ServerboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage.PlayerHealthTracker;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage.PlayerNameTracker;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ServerboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types.Typesb1_8_0_1;
import net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30.Protocolc0_0_20a_27Toc0_28_30;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.model.LegacyNibbleArray;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.storage.SeedStorage;
import net.raphimc.vialegacy.protocol.release.r1_1tor1_2_1_3.types.Types1_1;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.storage.EntityTracker;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.types.Types1_6_4;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
import java.util.concurrent.ThreadLocalRandom;
public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPacketsb1_7, ClientboundPacketsb1_8, ServerboundPacketsb1_7, ServerboundPacketsb1_8> {
public class Protocolb1_7_0_3Tob1_8_0_1 extends StatelessProtocol<ClientboundPacketsb1_7, ClientboundPacketsb1_8, ServerboundPacketsb1_7, ServerboundPacketsb1_8> {
public Protocolb1_8_0_1tob1_7_0_3() {
public Protocolb1_7_0_3Tob1_8_0_1() {
super(ClientboundPacketsb1_7.class, ClientboundPacketsb1_8.class, ServerboundPacketsb1_7.class, ServerboundPacketsb1_8.class);
}
@ -83,10 +85,10 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
final PacketWrapper updateHealth = PacketWrapper.create(ClientboundPacketsb1_7.SET_HEALTH, wrapper.user());
updateHealth.write(Types.SHORT, (short) 20); // health
wrapper.send(Protocolb1_8_0_1tob1_7_0_3.class);
wrapper.send(Protocolb1_7_0_3Tob1_8_0_1.class);
wrapper.cancel();
playerListEntry.send(Protocolb1_8_0_1tob1_7_0_3.class);
updateHealth.send(Protocolb1_8_0_1tob1_7_0_3.class, false);
playerListEntry.send(Protocolb1_7_0_3Tob1_8_0_1.class);
updateHealth.send(Protocolb1_7_0_3Tob1_8_0_1.class, false);
});
}
});
@ -135,7 +137,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
playerListEntry.write(Types1_6_4.STRING, playerNameTracker.names.get(entityId)); // name
playerListEntry.write(Types.BOOLEAN, true); // online
playerListEntry.write(Types.SHORT, (short) 0); // ping
playerListEntry.send(Protocolb1_8_0_1tob1_7_0_3.class);
playerListEntry.send(Protocolb1_7_0_3Tob1_8_0_1.class);
});
}
});
@ -149,7 +151,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
map(Types.INT); // z
map(Types.BYTE); // yaw
map(Types.BYTE); // pitch
map(Types1_3_1.METADATA_LIST); // metadata
map(Types1_3_1.ENTITY_DATA_LIST); // entity data
handler(wrapper -> {
final short entityType = wrapper.get(Types.UNSIGNED_BYTE, 0);
if (entityType == 49) { // monster
@ -163,13 +165,13 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
spawnMonster.write(Types.BYTE, wrapper.get(Types.BYTE, 1)); // pitch
spawnMonster.write(Types.UNSIGNED_SHORT, 0); // item
final PacketWrapper entityMetadata = PacketWrapper.create(ClientboundPacketsb1_8.SET_ENTITY_DATA, wrapper.user());
entityMetadata.write(Types.INT, wrapper.get(Types.INT, 0)); // entity id
entityMetadata.write(Types1_3_1.METADATA_LIST, wrapper.get(Types1_3_1.METADATA_LIST, 0)); // metadata
final PacketWrapper setEntityData = PacketWrapper.create(ClientboundPacketsb1_8.SET_ENTITY_DATA, wrapper.user());
setEntityData.write(Types.INT, wrapper.get(Types.INT, 0)); // entity id
setEntityData.write(Types1_3_1.ENTITY_DATA_LIST, wrapper.get(Types1_3_1.ENTITY_DATA_LIST, 0)); // entity data
wrapper.cancel();
spawnMonster.send(Protocolb1_8_0_1tob1_7_0_3.class);
entityMetadata.send(Protocolb1_8_0_1tob1_7_0_3.class);
spawnMonster.send(Protocolb1_7_0_3Tob1_8_0_1.class);
setEntityData.send(Protocolb1_7_0_3Tob1_8_0_1.class);
}
});
}
@ -186,7 +188,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
playerListEntry.write(Types1_6_4.STRING, name); // name
playerListEntry.write(Types.BOOLEAN, false); // online
playerListEntry.write(Types.SHORT, (short) 0); // ping
playerListEntry.send(Protocolb1_8_0_1tob1_7_0_3.class);
playerListEntry.send(Protocolb1_7_0_3Tob1_8_0_1.class);
}
});
}
@ -198,18 +200,18 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
for (ChunkSection section : chunk.getSections()) {
if (section == null || !section.getLight().hasSkyLight()) continue;
for (int i = 0; i < section.palette(PaletteType.BLOCKS).size(); i++) {
if (section.palette(PaletteType.BLOCKS).idByIndex(i) >> 4 == BlockList1_6.chest.blockID) {
if (section.palette(PaletteType.BLOCKS).idByIndex(i) >> 4 == BlockList1_6.chest.blockId()) {
hasChest = true;
break;
}
}
if (!hasChest) continue;
final NibbleArray1_1 sectionSkyLight = new NibbleArray1_1(section.getLight().getSkyLight(), 4);
final LegacyNibbleArray sectionSkyLight = new LegacyNibbleArray(section.getLight().getSkyLight(), 4);
for (int y = 0; y < 16; y++)
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
if (section.palette(PaletteType.BLOCKS).idAt(x, y, z) >> 4 == BlockList1_6.chest.blockID)
if (section.palette(PaletteType.BLOCKS).idAt(x, y, z) >> 4 == BlockList1_6.chest.blockId())
sectionSkyLight.set(x, y, z, 15);
}
});
@ -231,7 +233,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
});
this.registerServerbound(State.PLAY, ServerboundPacketsb1_8.SERVER_PING.getId(), -2, wrapper -> {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolc0_30toc0_27.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolc0_0_20a_27Toc0_28_30.class)) {
// Classic servers have issues with sockets connecting and disconnecting without sending any data.
// Because of that we send an invalid packet id to force the server to disconnect us.
// This is the reason why the packet id is mapped to -2. (-1 gets handled internally by ViaVersion)
@ -242,7 +244,7 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
}
final PacketWrapper pingResponse = PacketWrapper.create(ClientboundPacketsb1_8.DISCONNECT, wrapper.user());
pingResponse.write(Types1_6_4.STRING, "The server seems to be running!\nWait 5 seconds between each connection§0§1");
pingResponse.send(Protocolb1_8_0_1tob1_7_0_3.class);
pingResponse.send(Protocolb1_7_0_3Tob1_8_0_1.class);
});
this.registerServerbound(ServerboundPacketsb1_8.LOGIN, new PacketHandlers() {
@Override
@ -293,14 +295,14 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
final PacketWrapper entityStatus = PacketWrapper.create(ClientboundPacketsb1_8.ENTITY_EVENT, wrapper.user());
entityStatus.write(Types.INT, wrapper.user().get(EntityTracker.class).getPlayerID()); // entity id
entityStatus.write(Types.BYTE, (byte) 9); // status | 9 = STOP_ITEM_USE
entityStatus.send(Protocolb1_8_0_1tob1_7_0_3.class);
entityStatus.send(Protocolb1_7_0_3Tob1_8_0_1.class);
}
} else {
final Position pos = wrapper.get(Types1_7_6.POSITION_UBYTE, 0);
if (wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos).getId() == BlockList1_6.cake.blockID) {
if (wrapper.user().get(ChunkTracker.class).getBlockNotNull(pos).getId() == BlockList1_6.cake.blockId()) {
final PacketWrapper updateHealth = PacketWrapper.create(ClientboundPacketsb1_7.SET_HEALTH, wrapper.user());
updateHealth.write(Types.SHORT, wrapper.user().get(PlayerHealthTracker.class).getHealth()); // health
updateHealth.send(Protocolb1_8_0_1tob1_7_0_3.class, false);
updateHealth.send(Protocolb1_7_0_3Tob1_8_0_1.class, false);
}
}
});
@ -344,18 +346,18 @@ public class Protocolb1_8_0_1tob1_7_0_3 extends StatelessProtocol<ClientboundPac
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolb1_8_0_1tob1_7_0_3.class, ClientboundPacketsb1_7::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_7_0_3Tob1_8_0_1.class, ClientboundPacketsb1_7::getPacket));
userConnection.put(new PlayerNameTracker());
userConnection.put(new PlayerHealthTracker());
}
private boolean isSword(final Item item) {
return item.identifier() == ItemList1_6.swordWood.itemID ||
item.identifier() == ItemList1_6.swordStone.itemID ||
item.identifier() == ItemList1_6.swordIron.itemID ||
item.identifier() == ItemList1_6.swordGold.itemID ||
item.identifier() == ItemList1_6.swordDiamond.itemID;
return item.identifier() == ItemList1_6.swordWood.itemId() ||
item.identifier() == ItemList1_6.swordStone.itemId() ||
item.identifier() == ItemList1_6.swordIron.itemId() ||
item.identifier() == ItemList1_6.swordGold.itemId() ||
item.identifier() == ItemList1_6.swordDiamond.itemId();
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -64,7 +64,7 @@ public enum ClientboundPacketsb1_7 implements ClientboundPacketType, PreNettyPac
}),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -82,7 +82,7 @@ public enum ClientboundPacketsb1_7 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
LEVEL_CHUNK(51, (user, buf) -> {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.storage;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage;
import com.viaversion.viaversion.api.connection.StorableObject;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.storage;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectArrayMap;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types;
package net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types;
import com.viaversion.viaversion.api.type.Type;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -24,26 +24,28 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage.PlayerAirTimeStorage;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.task.PlayerAirTimeUpdateTask;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ClientboundPackets1_0;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ServerboundPackets1_0;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ServerboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.storage.PlayerAirTimeStorage;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.task.PlayerAirTimeUpdateTask;
import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ClientboundPackets1_0_0;
import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ServerboundPackets1_0_0;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4;
import net.raphimc.vialegacy.protocol.release.r1_4_2tor1_4_4_5.types.Types1_4_2;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol<ClientboundPacketsb1_8, ClientboundPackets1_0, ServerboundPacketsb1_8, ServerboundPackets1_0> {
public class Protocolb1_8_0_1tor1_0_0_1 extends StatelessProtocol<ClientboundPacketsb1_8, ClientboundPackets1_0_0, ServerboundPacketsb1_8, ServerboundPackets1_0_0> {
private final ItemRewriter itemRewriter = new ItemRewriter(this);
public Protocol1_0_0_1tob1_8_0_1() {
super(ClientboundPacketsb1_8.class, ClientboundPackets1_0.class, ServerboundPacketsb1_8.class, ServerboundPackets1_0.class);
public Protocolb1_8_0_1tor1_0_0_1() {
super(ClientboundPacketsb1_8.class, ClientboundPackets1_0_0.class, ServerboundPacketsb1_8.class, ServerboundPackets1_0_0.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
super.registerPackets();
this.registerClientbound(ClientboundPacketsb1_8.SET_EXPERIENCE, wrapper -> {
float experience = (float) wrapper.read(Types.BYTE);
@ -70,7 +72,7 @@ public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol<ClientboundPack
}
});
this.registerServerbound(ServerboundPackets1_0.USE_ITEM_ON, new PacketHandlers() {
this.registerServerbound(ServerboundPackets1_0_0.USE_ITEM_ON, new PacketHandlers() {
@Override
public void register() {
map(Types1_7_6.POSITION_UBYTE); // position
@ -78,7 +80,7 @@ public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol<ClientboundPack
map(Types1_2_4.NBT_ITEM, Types1_4_2.NBTLESS_ITEM);
}
});
this.registerServerbound(ServerboundPackets1_0.CONTAINER_CLICK, new PacketHandlers() {
this.registerServerbound(ServerboundPackets1_0_0.CONTAINER_CLICK, new PacketHandlers() {
@Override
public void register() {
map(Types.BYTE); // window id
@ -89,7 +91,7 @@ public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol<ClientboundPack
map(Types1_2_4.NBT_ITEM, Types1_4_2.NBTLESS_ITEM); // item
}
});
this.cancelServerbound(ServerboundPackets1_0.CONTAINER_BUTTON_CLICK);
this.cancelServerbound(ServerboundPackets1_0_0.CONTAINER_BUTTON_CLICK);
}
@Override
@ -99,7 +101,7 @@ public class Protocol1_0_0_1tob1_8_0_1 extends StatelessProtocol<ClientboundPack
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocol1_0_0_1tob1_8_0_1.class, ClientboundPacketsb1_8::getPacket));
userConnection.put(new PreNettySplitter(Protocolb1_8_0_1tor1_0_0_1.class, ClientboundPacketsb1_8::getPacket));
userConnection.put(new PlayerAirTimeStorage());
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -63,7 +63,7 @@ public enum ClientboundPacketsb1_8 implements ClientboundPacketType, PreNettyPac
}),
ADD_MOB(24, (user, buf) -> {
buf.skipBytes(19);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
ADD_PAINTING(25, (user, buf) -> {
buf.skipBytes(4);
@ -82,7 +82,7 @@ public enum ClientboundPacketsb1_8 implements ClientboundPacketType, PreNettyPac
SET_ENTITY_LINK(39, (user, buf) -> buf.skipBytes(8)),
SET_ENTITY_DATA(40, (user, buf) -> {
buf.skipBytes(4);
readEntityMetadatab1_5(buf);
readEntityDataListb1_5(buf);
}),
UPDATE_MOB_EFFECT(41, (user, buf) -> buf.skipBytes(8)),
REMOVE_MOB_EFFECT(42, (user, buf) -> buf.skipBytes(5)),

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,18 +15,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types.Typesb1_8_0_1;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ServerboundPackets1_0;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.Protocolb1_8_0_1tor1_0_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types.Typesb1_8_0_1;
import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ServerboundPackets1_0_0;
import net.raphimc.vialegacy.protocol.release.r1_2_4_5tor1_3_1_2.types.Types1_2_4;
public class ItemRewriter extends LegacyItemRewriter<ClientboundPacketsb1_8, ServerboundPackets1_0, Protocol1_0_0_1tob1_8_0_1> {
public class ItemRewriter extends LegacyItemRewriter<ClientboundPacketsb1_8, ServerboundPackets1_0_0, Protocolb1_8_0_1tor1_0_0_1> {
public ItemRewriter(final Protocol1_0_0_1tob1_8_0_1 protocol) {
public ItemRewriter(final Protocolb1_8_0_1tor1_0_0_1 protocol) {
super(protocol, "b1.8.1", Typesb1_8_0_1.CREATIVE_ITEM, null, Types1_2_4.NBT_ITEM, Types1_2_4.NBT_ITEM_ARRAY);
this.addNonExistentItemRange(110, 122);
@ -37,7 +37,7 @@ public class ItemRewriter extends LegacyItemRewriter<ClientboundPacketsb1_8, Ser
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_0.SET_CREATIVE_MODE_SLOT);
this.registerCreativeInventoryAction(ServerboundPackets1_0_0.SET_CREATIVE_MODE_SLOT);
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.storage;
import com.viaversion.viaversion.api.connection.StorableObject;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.task;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.task;
import com.google.common.collect.Lists;
import com.viaversion.viaversion.api.Via;
@ -26,13 +26,13 @@ import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.util.IdAndData;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage.PlayerAirTimeStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.ClientboundPackets1_0;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.MetaType1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ChunkTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.PlayerInfoStorage;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.Protocolb1_8_0_1tor1_0_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.storage.PlayerAirTimeStorage;
import net.raphimc.vialegacy.protocol.release.r1_0_0_1tor1_1.packet.ClientboundPackets1_0_0;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.EntityDataTypes1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_3_1_2tor1_4_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.ChunkTracker;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.storage.PlayerInfoStorage;
import java.util.logging.Level;
@ -50,7 +50,7 @@ public class PlayerAirTimeUpdateTask implements Runnable {
try {
final IdAndData headBlock = info.get(ChunkTracker.class).getBlockNotNull(floor(playerInfoStorage.posX), floor(playerInfoStorage.posY + 1.62F), floor(playerInfoStorage.posZ));
if (headBlock.getId() == BlockList1_6.waterMoving.blockID || headBlock.getId() == BlockList1_6.waterStill.blockID) {
if (headBlock.getId() == BlockList1_6.waterMoving.blockId() || headBlock.getId() == BlockList1_6.waterStill.blockId()) {
playerAirTimeStorage.sentPacket = false;
playerAirTimeStorage.air--;
if (playerAirTimeStorage.air < 0) playerAirTimeStorage.air = 0;
@ -69,10 +69,10 @@ public class PlayerAirTimeUpdateTask implements Runnable {
}
private void sendAirTime(final PlayerInfoStorage playerInfoStorage, final PlayerAirTimeStorage playerAirTimeStorage, final UserConnection userConnection) {
final PacketWrapper updateAirTime = PacketWrapper.create(ClientboundPackets1_0.SET_ENTITY_DATA, userConnection);
final PacketWrapper updateAirTime = PacketWrapper.create(ClientboundPackets1_0_0.SET_ENTITY_DATA, userConnection);
updateAirTime.write(Types.INT, playerInfoStorage.entityId); // entity id
updateAirTime.write(Types1_3_1.METADATA_LIST, Lists.newArrayList(new EntityData(1, MetaType1_3_1.Short, Integer.valueOf(playerAirTimeStorage.air).shortValue()))); // metadata
updateAirTime.send(Protocol1_0_0_1tob1_8_0_1.class);
updateAirTime.write(Types1_3_1.ENTITY_DATA_LIST, Lists.newArrayList(new EntityData(1, EntityDataTypes1_3_1.SHORT, Integer.valueOf(playerAirTimeStorage.air).shortValue()))); // entity data
updateAirTime.send(Protocolb1_8_0_1tor1_0_0_1.class);
}
private static int floor(double f) {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types;
package net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.types;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.type.Type;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_16a_02to0_0_15a_1;
package net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
@ -23,13 +23,15 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.types.Typesc0_30;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02.packet.ClientboundPacketsc0_15a;
import net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02.packet.ServerboundPacketsc0_15a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types.Typesc0_30;
public class Protocolc0_0_16a_02to0_0_15a_1 extends StatelessProtocol<ClientboundPacketsc0_15a, ClientboundPacketsc0_19a, ServerboundPacketsc0_15a, ServerboundPacketsc0_19a> {
public class Protocolc0_0_15a_1Toc0_0_16a_02 extends StatelessProtocol<ClientboundPacketsc0_15a, ClientboundPacketsc0_19a, ServerboundPacketsc0_15a, ServerboundPacketsc0_19a> {
public Protocolc0_0_16a_02to0_0_15a_1() {
public Protocolc0_0_15a_1Toc0_0_16a_02() {
super(ClientboundPacketsc0_15a.class, ClientboundPacketsc0_19a.class, ServerboundPacketsc0_15a.class, ServerboundPacketsc0_19a.class);
}
@ -61,8 +63,8 @@ public class Protocolc0_0_16a_02to0_0_15a_1 extends StatelessProtocol<Clientboun
entityRotation.write(Types.BYTE, yaw); // yaw
entityRotation.write(Types.BYTE, pitch); // pitch
wrapper.send(Protocolc0_0_16a_02to0_0_15a_1.class);
entityRotation.send(Protocolc0_0_16a_02to0_0_15a_1.class);
wrapper.send(Protocolc0_0_15a_1Toc0_0_16a_02.class);
entityRotation.send(Protocolc0_0_15a_1Toc0_0_16a_02.class);
wrapper.cancel();
});
}
@ -77,7 +79,7 @@ public class Protocolc0_0_16a_02to0_0_15a_1 extends StatelessProtocol<Clientboun
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolc0_0_16a_02to0_0_15a_1.class, ClientboundPacketsc0_15a::getPacket));
userConnection.put(new PreNettySplitter(Protocolc0_0_15a_1Toc0_0_16a_02.class, ClientboundPacketsc0_15a::getPacket));
}
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_16a_02to0_0_15a_1;
package net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_16a_02to0_0_15a_1;
package net.raphimc.vialegacy.protocol.classic.c0_0_15a_1toc0_0_16a_02.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,15 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_18a_02toc0_0_16a_02;
package net.raphimc.vialegacy.protocol.classic.c0_0_16a_02toc0_0_18a_02;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ServerboundPacketsc0_19a;
public class Protocolc0_0_18a_02toc0_0_16a_02 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_19a, ServerboundPacketsc0_19a, ServerboundPacketsc0_19a> {
public class Protocolc0_0_16a_02Toc0_0_18a_02 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_19a, ServerboundPacketsc0_19a, ServerboundPacketsc0_19a> {
public Protocolc0_0_18a_02toc0_0_16a_02() {
public Protocolc0_0_16a_02Toc0_0_18a_02() {
super(ClientboundPacketsc0_19a.class, ClientboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class);
}

View File

@ -15,26 +15,26 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_19a_06toc0_0_18a_02;
package net.raphimc.vialegacy.protocol.classic.c0_0_18a_02toc0_0_19a_06;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data.ClassicBlocks;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.ClassicBlockRemapper;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data.ClassicBlocks;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage.ClassicBlockRemapper;
public class Protocolc0_0_19a_06toc0_0_18a_02 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_19a, ServerboundPacketsc0_19a, ServerboundPacketsc0_19a> {
public class Protocolc0_0_18a_02Toc0_0_19a_06 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_19a, ServerboundPacketsc0_19a, ServerboundPacketsc0_19a> {
public Protocolc0_0_19a_06toc0_0_18a_02() {
public Protocolc0_0_18a_02Toc0_0_19a_06() {
super(ClientboundPacketsc0_19a.class, ClientboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class, ServerboundPacketsc0_19a.class);
}
@Override
public void init(UserConnection userConnection) {
final ClassicBlockRemapper previousRemapper = userConnection.get(ClassicBlockRemapper.class);
userConnection.put(new ClassicBlockRemapper(previousRemapper.getMapper(), o -> {
int block = previousRemapper.getReverseMapper().getInt(o);
userConnection.put(new ClassicBlockRemapper(previousRemapper.mapper(), o -> {
int block = previousRemapper.reverseMapper().getInt(o);
if (block != ClassicBlocks.STONE && block != ClassicBlocks.DIRT && block != ClassicBlocks.WOOD && block != ClassicBlocks.SAPLING && block != ClassicBlocks.GRAVEL && block != ClassicBlocks.LOG && block != ClassicBlocks.LEAVES && block != ClassicBlocks.SAND && block != ClassicBlocks.COBBLESTONE) {
block = ClassicBlocks.STONE;
}

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06;
package net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
@ -23,15 +23,17 @@ import com.viaversion.viaversion.api.type.Types;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.ServerboundPacketsc0_28;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data.ClassicBlocks;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.ClassicBlockRemapper;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.types.Typesc0_30;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_0_20a_27.ClientboundPacketsc0_20a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ClientboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet.ServerboundPacketsc0_19a;
import net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30.packet.ClientboundPacketsc0_20a;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data.ClassicBlocks;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.packet.ServerboundPacketsc0_28;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage.ClassicBlockRemapper;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types.Typesc0_30;
public class Protocolc0_27toc0_0_19a_06 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_20a, ServerboundPacketsc0_19a, ServerboundPacketsc0_28> {
public class Protocolc0_0_19a_06Toc0_0_20a_27 extends StatelessProtocol<ClientboundPacketsc0_19a, ClientboundPacketsc0_20a, ServerboundPacketsc0_19a, ServerboundPacketsc0_28> {
public Protocolc0_27toc0_0_19a_06() {
public Protocolc0_0_19a_06Toc0_0_20a_27() {
super(ClientboundPacketsc0_19a.class, ClientboundPacketsc0_20a.class, ServerboundPacketsc0_19a.class, ServerboundPacketsc0_28.class);
}
@ -60,11 +62,11 @@ public class Protocolc0_27toc0_0_19a_06 extends StatelessProtocol<ClientboundPac
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolc0_27toc0_0_19a_06.class, ClientboundPacketsc0_19a::getPacket));
userConnection.put(new PreNettySplitter(Protocolc0_0_19a_06Toc0_0_20a_27.class, ClientboundPacketsc0_19a::getPacket));
final ClassicBlockRemapper previousRemapper = userConnection.get(ClassicBlockRemapper.class);
userConnection.put(new ClassicBlockRemapper(previousRemapper.getMapper(), o -> {
int block = previousRemapper.getReverseMapper().getInt(o);
userConnection.put(new ClassicBlockRemapper(previousRemapper.mapper(), o -> {
int block = previousRemapper.reverseMapper().getInt(o);
if (userConnection.getProtocolInfo().serverProtocolVersion().equals(LegacyProtocolVersion.c0_0_19a_06)) {
if (block != ClassicBlocks.STONE && block != ClassicBlocks.DIRT && block != ClassicBlocks.WOOD && block != ClassicBlocks.SAPLING && block != ClassicBlocks.GRAVEL && block != ClassicBlocks.LOG && block != ClassicBlocks.LEAVES && block != ClassicBlocks.SPONGE && block != ClassicBlocks.GLASS) {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06;
package net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_0_20a_27toc0_0_19a_06;
package net.raphimc.vialegacy.protocol.classic.c0_0_19a_06toc0_0_20a_27.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;

View File

@ -15,30 +15,31 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_0_20a_27;
package net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30;
import com.viaversion.viaversion.api.connection.UserConnection;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.ClientboundPacketsc0_28;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.ServerboundPacketsc0_28;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data.ClassicBlocks;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.ClassicBlockRemapper;
import net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30.packet.ClientboundPacketsc0_20a;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data.ClassicBlocks;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.packet.ClientboundPacketsc0_28;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.packet.ServerboundPacketsc0_28;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage.ClassicBlockRemapper;
public class Protocolc0_30toc0_27 extends StatelessProtocol<ClientboundPacketsc0_20a, ClientboundPacketsc0_28, ServerboundPacketsc0_28, ServerboundPacketsc0_28> {
public class Protocolc0_0_20a_27Toc0_28_30 extends StatelessProtocol<ClientboundPacketsc0_20a, ClientboundPacketsc0_28, ServerboundPacketsc0_28, ServerboundPacketsc0_28> {
public Protocolc0_30toc0_27() {
public Protocolc0_0_20a_27Toc0_28_30() {
super(ClientboundPacketsc0_20a.class, ClientboundPacketsc0_28.class, ServerboundPacketsc0_28.class, ServerboundPacketsc0_28.class);
}
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocolc0_30toc0_27.class, ClientboundPacketsc0_20a::getPacket));
userConnection.put(new PreNettySplitter(Protocolc0_0_20a_27Toc0_28_30.class, ClientboundPacketsc0_20a::getPacket));
final ClassicBlockRemapper previousRemapper = userConnection.get(ClassicBlockRemapper.class);
userConnection.put(new ClassicBlockRemapper(previousRemapper.getMapper(), o -> {
int block = previousRemapper.getReverseMapper().getInt(o);
userConnection.put(new ClassicBlockRemapper(previousRemapper.mapper(), o -> {
int block = previousRemapper.reverseMapper().getInt(o);
if (userConnection.getProtocolInfo().serverProtocolVersion().equals(LegacyProtocolVersion.c0_0_20ac0_27)) {
if (block == ClassicBlocks.GOLD_ORE || block == ClassicBlocks.IRON_ORE || block == ClassicBlocks.COAL_ORE || block == ClassicBlocks.SLAB || block == ClassicBlocks.BRICK || block == ClassicBlocks.TNT || block == ClassicBlocks.BOOKSHELF || block == ClassicBlocks.MOSSY_COBBLESTONE || block == ClassicBlocks.OBSIDIAN) {

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_0_20a_27;
package net.raphimc.vialegacy.protocol.classic.c0_0_20a_27toc0_28_30.packet;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30;
package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
@ -33,35 +33,37 @@ import net.raphimc.vialegacy.api.model.ChunkCoord;
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.api.util.BlockFaceUtil;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15.ClientboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_16_2toa1_0_15.ServerboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocols.alpha.protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4;
import net.raphimc.vialegacy.protocols.alpha.protocola1_2_0_1_2_1_1toa1_1_0_1_1_2_1.ClientboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocols.beta.protocolb1_3_0_1tob1_2_0_2.storage.BlockDigStorage;
import net.raphimc.vialegacy.protocols.beta.protocolb1_6_0_6tob1_5_0_2.Protocolb1_6_0_6tob1_5_0_2;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.Protocolb1_8_0_1tob1_7_0_3;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data.ClassicBlocks;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.model.ClassicLevel;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicCustomCommandProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.*;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.task.ClassicLevelStorageTickTask;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.types.Typesc0_30;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.Protocolc0_30toc0_30cpe;
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtBlockPermissionsStorage;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.Protocol1_8to1_7_6_10;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet.ClientboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocol.alpha.a1_0_15toa1_0_16_2.packet.ServerboundPacketsa1_0_15;
import net.raphimc.vialegacy.protocol.alpha.a1_0_16_2toa1_0_17_1_0_17_4.storage.TimeLockStorage;
import net.raphimc.vialegacy.protocol.alpha.a1_0_17_1_0_17_4toa1_1_0_1_1_2_1.Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1;
import net.raphimc.vialegacy.protocol.alpha.a1_1_0_1_1_2_1toa1_2_0_1_2_1_1.packet.ClientboundPacketsa1_1_0;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.provider.AlphaInventoryProvider;
import net.raphimc.vialegacy.protocol.alpha.a1_2_3_5_1_2_6tob1_0_1_1_1.storage.AlphaInventoryTracker;
import net.raphimc.vialegacy.protocol.beta.b1_2_0_2tob1_3_0_1.storage.BlockDigStorage;
import net.raphimc.vialegacy.protocol.beta.b1_5_0_2tob1_6_0_6.Protocolb1_5_0_2Tob1_6_0_6;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.Protocolb1_7_0_3Tob1_8_0_1;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.packet.ClientboundPacketsb1_7;
import net.raphimc.vialegacy.protocol.beta.b1_7_0_3tob1_8_0_1.types.Typesb1_7_0_3;
import net.raphimc.vialegacy.protocol.beta.b1_8_0_1tor1_0_0_1.packet.ClientboundPacketsb1_8;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data.ClassicBlocks;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.model.ClassicLevel;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.packet.ClientboundPacketsc0_28;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.packet.ServerboundPacketsc0_28;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicCustomCommandProvider;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicMPPassProvider;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.provider.ClassicWorldHeightProvider;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.storage.*;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.task.ClassicLevelStorageTickTask;
import net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.types.Typesc0_30;
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.Protocolc0_30cpeToc0_28_30;
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.storage.ExtBlockPermissionsStorage;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.Protocolr1_7_6_10Tor1_8;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.types.Types1_7_6;
public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPacketsc0_28, ClientboundPacketsa1_0_15, ServerboundPacketsc0_28, ServerboundPacketsa1_0_15> {
public class Protocolc0_28_30Toa1_0_15 extends StatelessProtocol<ClientboundPacketsc0_28, ClientboundPacketsa1_0_15, ServerboundPacketsc0_28, ServerboundPacketsa1_0_15> {
public Protocola1_0_15toc0_30() {
public Protocolc0_28_30Toa1_0_15() {
super(ClientboundPacketsc0_28.class, ClientboundPacketsa1_0_15.class, ServerboundPacketsc0_28.class, ServerboundPacketsa1_0_15.class);
}
@ -86,11 +88,11 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
wrapper.cancel();
}
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocol1_8to1_7_6_10.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolr1_7_6_10Tor1_8.class)) {
final PacketWrapper tabList = PacketWrapper.create(ClientboundPackets1_8.TAB_LIST, wrapper.user());
tabList.write(Types.STRING, Protocol1_8to1_7_6_10.LEGACY_TO_JSON.transform(wrapper, "§6" + title + "\n")); // header
tabList.write(Types.STRING, Protocol1_8to1_7_6_10.LEGACY_TO_JSON.transform(wrapper, "\n§b" + motd)); // footer
tabList.send(Protocol1_8to1_7_6_10.class);
tabList.write(Types.STRING, Protocolr1_7_6_10Tor1_8.LEGACY_TO_JSON.transform(wrapper, "§6" + title + "\n")); // header
tabList.write(Types.STRING, Protocolr1_7_6_10Tor1_8.LEGACY_TO_JSON.transform(wrapper, "\n§b" + motd)); // footer
tabList.send(Protocolr1_7_6_10Tor1_8.class);
}
final ClassicProgressStorage classicProgressStorage = wrapper.user().get(ClassicProgressStorage.class);
@ -104,21 +106,21 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
wrapper.cancel();
if (wrapper.user().has(ClassicLevelStorage.class)) { // Switch world
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_6_0_6tob1_5_0_2.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_5_0_2Tob1_6_0_6.class)) {
final PacketWrapper fakeRespawn = PacketWrapper.create(ClientboundPacketsb1_7.RESPAWN, wrapper.user());
fakeRespawn.write(Types.BYTE, (byte) -1); // dimension id
fakeRespawn.send(Protocolb1_6_0_6tob1_5_0_2.class);
fakeRespawn.send(Protocolb1_5_0_2Tob1_6_0_6.class);
final PacketWrapper respawn = PacketWrapper.create(ClientboundPacketsb1_7.RESPAWN, wrapper.user());
respawn.write(Types.BYTE, (byte) 0); // dimension id
respawn.send(Protocolb1_6_0_6tob1_5_0_2.class);
respawn.send(Protocolb1_5_0_2Tob1_6_0_6.class);
wrapper.user().get(ClassicPositionTracker.class).spawned = false;
}
}
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_8_0_1tob1_7_0_3.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_7_0_3Tob1_8_0_1.class)) {
final PacketWrapper gameEvent = PacketWrapper.create(ClientboundPacketsb1_8.GAME_EVENT, wrapper.user());
gameEvent.write(Types.BYTE, (byte) 3); // reason (game mode)
gameEvent.write(Types.BYTE, (byte) 1); // value (creative)
gameEvent.send(Protocolb1_8_0_1tob1_7_0_3.class);
gameEvent.send(Protocolb1_7_0_3Tob1_8_0_1.class);
}
wrapper.user().get(ClassicOpLevelStorage.class).updateAbilities();
@ -158,7 +160,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
levelStorage.finish(sizeX, sizeY, sizeZ);
levelStorage.sendChunk(new ChunkCoord(0, 0));
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocol1_8to1_7_6_10.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocolr1_7_6_10Tor1_8.class)) {
final PacketWrapper worldBorder = PacketWrapper.create(ClientboundPackets1_8.SET_BORDER, wrapper.user());
worldBorder.write(Types.VAR_INT, 3); // action (INITIALIZE)
worldBorder.write(Types.DOUBLE, sizeX / 2D); // centerX
@ -169,7 +171,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
worldBorder.write(Types.VAR_INT, Math.max(sizeX, sizeZ)); // size
worldBorder.write(Types.VAR_INT, 0); // warning distance
worldBorder.write(Types.VAR_INT, 0); // warning time
worldBorder.send(Protocol1_8to1_7_6_10.class);
worldBorder.send(Protocolr1_7_6_10Tor1_8.class);
}
sendChatMessage(wrapper.user(), "§aWorld dimensions: §6" + sizeX + "§ax§6" + sizeY + "§ax§6" + sizeZ);
@ -198,7 +200,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
wrapper.cancel();
return;
}
final IdAndData mappedBlock = remapper.getMapper().get(blockId);
final IdAndData mappedBlock = remapper.mapper().get(blockId);
wrapper.write(Types.UNSIGNED_BYTE, (short) mappedBlock.getId()); // block id
wrapper.write(Types.UNSIGNED_BYTE, (short) mappedBlock.getData()); // block data
});
@ -236,10 +238,10 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
classicPositionTracker.pitch = pitch * 360 / 256.0F;
wrapper.user().get(ClassicLevelStorage.class).sendChunks(classicPositionTracker.getChunkPosition(), 1);
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.class)) {
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1.class)) {
final PacketWrapper spawnPosition = PacketWrapper.create(ClientboundPacketsa1_1_0.SET_DEFAULT_SPAWN_POSITION, wrapper.user());
spawnPosition.write(Types1_7_6.POSITION_INT, new Position((int) classicPositionTracker.posX, (int) (classicPositionTracker.stance), (int) classicPositionTracker.posZ));
spawnPosition.send(Protocola1_1_0_1_1_2_1toa1_0_17_1_0_17_4.class);
spawnPosition.send(Protocola1_0_17_1_0_17_4Toa1_1_0_1_1_2_1.class);
}
final PacketWrapper playerPosition = PacketWrapper.create(ClientboundPacketsa1_0_15.PLAYER_POSITION, wrapper.user());
@ -250,7 +252,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
playerPosition.write(Types.FLOAT, classicPositionTracker.yaw); // yaw
playerPosition.write(Types.FLOAT, classicPositionTracker.pitch); // pitch
playerPosition.write(Types.BOOLEAN, true); // onGround
playerPosition.send(Protocola1_0_15toc0_30.class);
playerPosition.send(Protocolc0_28_30Toa1_0_15.class);
classicPositionTracker.spawned = true;
} else {
wrapper.set(Types.INT, 2, wrapper.get(Types.INT, 2) - Float.valueOf(1.62F * 32).intValue());
@ -409,12 +411,12 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
wrapper.read(Types.UNSIGNED_BYTE); // direction
final int blockId = level.getBlock(pos);
final boolean hasCreative = wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_8_0_1tob1_7_0_3.class);
final boolean hasCreative = wrapper.user().getProtocolInfo().getPipeline().contains(Protocolb1_7_0_3Tob1_8_0_1.class);
if ((status == 0 && hasCreative) || (status == 2 && !hasCreative)) {
if (!extendedVerification && blockId == ClassicBlocks.BEDROCK && opTracker.getOpLevel() < 100) {
wrapper.cancel();
sendChatMessage(wrapper.user(), "§cOnly op players can break bedrock!");
sendBlockChange(wrapper.user(), pos, new IdAndData(BlockList1_6.bedrock.blockID, 0));
sendBlockChange(wrapper.user(), pos, new IdAndData(BlockList1_6.bedrock.blockId(), 0));
return;
}
if (!extendedVerification) {
@ -452,11 +454,11 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
return;
}
final byte classicBlock = (byte) remapper.getReverseMapper().getInt(new IdAndData(item.identifier(), item.data() & 15));
final byte classicBlock = (byte) remapper.reverseMapper().getInt(new IdAndData(item.identifier(), item.data() & 15));
if (!extendedVerification) {
level.setBlock(pos, classicBlock);
sendBlockChange(wrapper.user(), pos, remapper.getMapper().get(classicBlock));
sendBlockChange(wrapper.user(), pos, remapper.mapper().get(classicBlock));
}
wrapper.write(Typesc0_30.POSITION, pos); // position
@ -473,7 +475,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
private void sendChatMessage(final UserConnection user, final String msg) {
final PacketWrapper message = PacketWrapper.create(ClientboundPacketsa1_0_15.CHAT, user);
message.write(Typesb1_7_0_3.STRING, msg); // message
message.send(Protocola1_0_15toc0_30.class);
message.send(Protocolc0_28_30Toa1_0_15.class);
}
private void sendBlockChange(final UserConnection user, final Position pos, final IdAndData block) {
@ -481,7 +483,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
blockChange.write(Types1_7_6.POSITION_UBYTE, pos); // position
blockChange.write(Types.UNSIGNED_BYTE, (short) block.getId()); // block id
blockChange.write(Types.UNSIGNED_BYTE, (short) block.getData()); // block data
blockChange.send(Protocola1_0_15toc0_30.class);
blockChange.send(Protocolc0_28_30Toa1_0_15.class);
}
@Override
@ -495,7 +497,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
@Override
public void init(UserConnection userConnection) {
userConnection.put(new PreNettySplitter(Protocola1_0_15toc0_30.class, ClientboundPacketsc0_28::getPacket));
userConnection.put(new PreNettySplitter(Protocolc0_28_30Toa1_0_15.class, ClientboundPacketsc0_28::getPacket));
userConnection.put(new ClassicPositionTracker());
userConnection.put(new ClassicOpLevelStorage(userConnection, ViaLegacy.getConfig().enableClassicFly()));
@ -503,7 +505,7 @@ public class Protocola1_0_15toc0_30 extends StatelessProtocol<ClientboundPackets
userConnection.put(new ClassicBlockRemapper(i -> ClassicBlocks.MAPPING.get(i), o -> {
int block = ClassicBlocks.REVERSE_MAPPING.getInt(o);
if (!userConnection.getProtocolInfo().getPipeline().contains(Protocolc0_30toc0_30cpe.class)) {
if (!userConnection.getProtocolInfo().getPipeline().contains(Protocolc0_30cpeToc0_28_30.class)) {
if (block == ClassicBlocks.GRASS) block = ClassicBlocks.DIRT;
else if (block == ClassicBlocks.BEDROCK) block = ClassicBlocks.STONE;
else if (block == ClassicBlocks.STATIONARY_WATER) block = ClassicBlocks.BLUE_WOOL;

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.data;
package net.raphimc.vialegacy.protocol.classic.c0_28_30toa1_0_15.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
@ -82,104 +82,104 @@ public class ClassicBlocks {
public static Object2IntMap<IdAndData> REVERSE_MAPPING = new Object2IntOpenHashMap<>(42, 0.99F);
static {
MAPPING.defaultReturnValue(new IdAndData(BlockList1_6.stone.blockID, 0));
MAPPING.defaultReturnValue(new IdAndData(BlockList1_6.stone.blockId(), 0));
REVERSE_MAPPING.defaultReturnValue(STONE);
MAPPING.put(AIR, new IdAndData(0, 0));
MAPPING.put(STONE, new IdAndData(BlockList1_6.stone.blockID, 0));
MAPPING.put(GRASS, new IdAndData(BlockList1_6.grass.blockID, 0));
MAPPING.put(DIRT, new IdAndData(BlockList1_6.dirt.blockID, 0));
MAPPING.put(COBBLESTONE, new IdAndData(BlockList1_6.cobblestone.blockID, 0));
MAPPING.put(WOOD, new IdAndData(BlockList1_6.planks.blockID, 0));
MAPPING.put(SAPLING, new IdAndData(BlockList1_6.sapling.blockID, 0));
MAPPING.put(BEDROCK, new IdAndData(BlockList1_6.bedrock.blockID, 0));
MAPPING.put(WATER, new IdAndData(BlockList1_6.waterMoving.blockID, 0));
MAPPING.put(STATIONARY_WATER, new IdAndData(BlockList1_6.waterStill.blockID, 0));
MAPPING.put(LAVA, new IdAndData(BlockList1_6.lavaMoving.blockID, 0));
MAPPING.put(STATIONARY_LAVA, new IdAndData(BlockList1_6.lavaStill.blockID, 0));
MAPPING.put(SAND, new IdAndData(BlockList1_6.sand.blockID, 0));
MAPPING.put(GRAVEL, new IdAndData(BlockList1_6.gravel.blockID, 0));
MAPPING.put(GOLD_ORE, new IdAndData(BlockList1_6.oreGold.blockID, 0));
MAPPING.put(IRON_ORE, new IdAndData(BlockList1_6.oreIron.blockID, 0));
MAPPING.put(COAL_ORE, new IdAndData(BlockList1_6.oreCoal.blockID, 0));
MAPPING.put(LOG, new IdAndData(BlockList1_6.wood.blockID, 0));
MAPPING.put(LEAVES, new IdAndData(BlockList1_6.leaves.blockID, 0));
MAPPING.put(SPONGE, new IdAndData(BlockList1_6.sponge.blockID, 0));
MAPPING.put(GLASS, new IdAndData(BlockList1_6.glass.blockID, 0));
MAPPING.put(RED_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 14));
MAPPING.put(ORANGE_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 1));
MAPPING.put(YELLOW_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 4));
MAPPING.put(LIME_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 5));
MAPPING.put(GREEN_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 13));
MAPPING.put(TEAL_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 5));
MAPPING.put(AQUA_BLUE_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 3));
MAPPING.put(CYAN_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 9));
MAPPING.put(BLUE_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 11));
MAPPING.put(INDIGO_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 10));
MAPPING.put(VIOLET_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 2));
MAPPING.put(MAGENTA_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 2));
MAPPING.put(PINK_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 6));
MAPPING.put(BLACK_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 7));
MAPPING.put(GRAY_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 8));
MAPPING.put(WHITE_WOOL, new IdAndData(BlockList1_6.cloth.blockID, 0));
MAPPING.put(DANDELION, new IdAndData(BlockList1_6.plantYellow.blockID, 0));
MAPPING.put(ROSE, new IdAndData(BlockList1_6.plantRed.blockID, 0));
MAPPING.put(BROWN_MUSHROOM, new IdAndData(BlockList1_6.mushroomBrown.blockID, 0));
MAPPING.put(RED_MUSHROOM, new IdAndData(BlockList1_6.mushroomRed.blockID, 0));
MAPPING.put(GOLD_BLOCK, new IdAndData(BlockList1_6.blockGold.blockID, 0));
MAPPING.put(IRON_BLOCK, new IdAndData(BlockList1_6.blockIron.blockID, 0));
MAPPING.put(DOUBLE_SLAB, new IdAndData(BlockList1_6.stoneDoubleSlab.blockID, 0));
MAPPING.put(SLAB, new IdAndData(BlockList1_6.stoneSingleSlab.blockID, 0));
MAPPING.put(BRICK, new IdAndData(BlockList1_6.brick.blockID, 0));
MAPPING.put(TNT, new IdAndData(BlockList1_6.tnt.blockID, 0));
MAPPING.put(BOOKSHELF, new IdAndData(BlockList1_6.bookShelf.blockID, 0));
MAPPING.put(MOSSY_COBBLESTONE, new IdAndData(BlockList1_6.cobblestoneMossy.blockID, 0));
MAPPING.put(OBSIDIAN, new IdAndData(BlockList1_6.obsidian.blockID, 0));
MAPPING.put(STONE, new IdAndData(BlockList1_6.stone.blockId(), 0));
MAPPING.put(GRASS, new IdAndData(BlockList1_6.grass.blockId(), 0));
MAPPING.put(DIRT, new IdAndData(BlockList1_6.dirt.blockId(), 0));
MAPPING.put(COBBLESTONE, new IdAndData(BlockList1_6.cobblestone.blockId(), 0));
MAPPING.put(WOOD, new IdAndData(BlockList1_6.planks.blockId(), 0));
MAPPING.put(SAPLING, new IdAndData(BlockList1_6.sapling.blockId(), 0));
MAPPING.put(BEDROCK, new IdAndData(BlockList1_6.bedrock.blockId(), 0));
MAPPING.put(WATER, new IdAndData(BlockList1_6.waterMoving.blockId(), 0));
MAPPING.put(STATIONARY_WATER, new IdAndData(BlockList1_6.waterStill.blockId(), 0));
MAPPING.put(LAVA, new IdAndData(BlockList1_6.lavaMoving.blockId(), 0));
MAPPING.put(STATIONARY_LAVA, new IdAndData(BlockList1_6.lavaStill.blockId(), 0));
MAPPING.put(SAND, new IdAndData(BlockList1_6.sand.blockId(), 0));
MAPPING.put(GRAVEL, new IdAndData(BlockList1_6.gravel.blockId(), 0));
MAPPING.put(GOLD_ORE, new IdAndData(BlockList1_6.oreGold.blockId(), 0));
MAPPING.put(IRON_ORE, new IdAndData(BlockList1_6.oreIron.blockId(), 0));
MAPPING.put(COAL_ORE, new IdAndData(BlockList1_6.oreCoal.blockId(), 0));
MAPPING.put(LOG, new IdAndData(BlockList1_6.wood.blockId(), 0));
MAPPING.put(LEAVES, new IdAndData(BlockList1_6.leaves.blockId(), 0));
MAPPING.put(SPONGE, new IdAndData(BlockList1_6.sponge.blockId(), 0));
MAPPING.put(GLASS, new IdAndData(BlockList1_6.glass.blockId(), 0));
MAPPING.put(RED_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 14));
MAPPING.put(ORANGE_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 1));
MAPPING.put(YELLOW_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 4));
MAPPING.put(LIME_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 5));
MAPPING.put(GREEN_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 13));
MAPPING.put(TEAL_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 5));
MAPPING.put(AQUA_BLUE_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 3));
MAPPING.put(CYAN_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 9));
MAPPING.put(BLUE_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 11));
MAPPING.put(INDIGO_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 10));
MAPPING.put(VIOLET_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 2));
MAPPING.put(MAGENTA_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 2));
MAPPING.put(PINK_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 6));
MAPPING.put(BLACK_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 7));
MAPPING.put(GRAY_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 8));
MAPPING.put(WHITE_WOOL, new IdAndData(BlockList1_6.cloth.blockId(), 0));
MAPPING.put(DANDELION, new IdAndData(BlockList1_6.plantYellow.blockId(), 0));
MAPPING.put(ROSE, new IdAndData(BlockList1_6.plantRed.blockId(), 0));
MAPPING.put(BROWN_MUSHROOM, new IdAndData(BlockList1_6.mushroomBrown.blockId(), 0));
MAPPING.put(RED_MUSHROOM, new IdAndData(BlockList1_6.mushroomRed.blockId(), 0));
MAPPING.put(GOLD_BLOCK, new IdAndData(BlockList1_6.blockGold.blockId(), 0));
MAPPING.put(IRON_BLOCK, new IdAndData(BlockList1_6.blockIron.blockId(), 0));
MAPPING.put(DOUBLE_SLAB, new IdAndData(BlockList1_6.stoneDoubleSlab.blockId(), 0));
MAPPING.put(SLAB, new IdAndData(BlockList1_6.stoneSingleSlab.blockId(), 0));
MAPPING.put(BRICK, new IdAndData(BlockList1_6.brick.blockId(), 0));
MAPPING.put(TNT, new IdAndData(BlockList1_6.tnt.blockId(), 0));
MAPPING.put(BOOKSHELF, new IdAndData(BlockList1_6.bookShelf.blockId(), 0));
MAPPING.put(MOSSY_COBBLESTONE, new IdAndData(BlockList1_6.cobblestoneMossy.blockId(), 0));
MAPPING.put(OBSIDIAN, new IdAndData(BlockList1_6.obsidian.blockId(), 0));
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.stone.blockID, 0), STONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.grass.blockID, 0), GRASS); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.dirt.blockID, 0), DIRT);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cobblestone.blockID, 0), COBBLESTONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.planks.blockID, 0), WOOD);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sapling.blockID, 0), SAPLING);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.bedrock.blockID, 0), BEDROCK); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(ItemList1_6.bucketWater.itemID, 0), STATIONARY_WATER); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(ItemList1_6.bucketLava.itemID, 0), STATIONARY_LAVA); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sand.blockID, 0), SAND);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.gravel.blockID, 0), GRAVEL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreGold.blockID, 0), GOLD_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreIron.blockID, 0), IRON_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreCoal.blockID, 0), COAL_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.wood.blockID, 0), LOG);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.leaves.blockID, 0), LEAVES);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sponge.blockID, 0), SPONGE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.glass.blockID, 0), GLASS);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.plantYellow.blockID, 0), DANDELION);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.plantRed.blockID, 0), ROSE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.mushroomBrown.blockID, 0), BROWN_MUSHROOM);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.mushroomRed.blockID, 0), RED_MUSHROOM);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 14), RED_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 1), ORANGE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 4), YELLOW_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 5), LIME_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 13), GREEN_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 3), AQUA_BLUE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 9), CYAN_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 11), BLUE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 10), INDIGO_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 2), MAGENTA_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 6), PINK_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 7), BLACK_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 8), GRAY_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockID, 0), WHITE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.blockGold.blockID, 0), GOLD_BLOCK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.blockIron.blockID, 0), IRON_BLOCK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.stoneSingleSlab.blockID, 0), SLAB);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.brick.blockID, 0), BRICK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.tnt.blockID, 0), TNT);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.bookShelf.blockID, 0), BOOKSHELF);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cobblestoneMossy.blockID, 0), MOSSY_COBBLESTONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.obsidian.blockID, 0), OBSIDIAN);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.stone.blockId(), 0), STONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.grass.blockId(), 0), GRASS); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.dirt.blockId(), 0), DIRT);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cobblestone.blockId(), 0), COBBLESTONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.planks.blockId(), 0), WOOD);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sapling.blockId(), 0), SAPLING);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.bedrock.blockId(), 0), BEDROCK); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(ItemList1_6.bucketWater.itemId(), 0), STATIONARY_WATER); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(ItemList1_6.bucketLava.itemId(), 0), STATIONARY_LAVA); // normally not placeable
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sand.blockId(), 0), SAND);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.gravel.blockId(), 0), GRAVEL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreGold.blockId(), 0), GOLD_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreIron.blockId(), 0), IRON_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.oreCoal.blockId(), 0), COAL_ORE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.wood.blockId(), 0), LOG);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.leaves.blockId(), 0), LEAVES);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.sponge.blockId(), 0), SPONGE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.glass.blockId(), 0), GLASS);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.plantYellow.blockId(), 0), DANDELION);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.plantRed.blockId(), 0), ROSE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.mushroomBrown.blockId(), 0), BROWN_MUSHROOM);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.mushroomRed.blockId(), 0), RED_MUSHROOM);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 14), RED_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 1), ORANGE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 4), YELLOW_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 5), LIME_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 13), GREEN_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 3), AQUA_BLUE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 9), CYAN_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 11), BLUE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 10), INDIGO_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 2), MAGENTA_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 6), PINK_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 7), BLACK_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 8), GRAY_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cloth.blockId(), 0), WHITE_WOOL);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.blockGold.blockId(), 0), GOLD_BLOCK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.blockIron.blockId(), 0), IRON_BLOCK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.stoneSingleSlab.blockId(), 0), SLAB);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.brick.blockId(), 0), BRICK);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.tnt.blockId(), 0), TNT);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.bookShelf.blockId(), 0), BOOKSHELF);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.cobblestoneMossy.blockId(), 0), MOSSY_COBBLESTONE);
REVERSE_MAPPING.put(new IdAndData(BlockList1_6.obsidian.blockId(), 0), OBSIDIAN);
}
}

Some files were not shown because too many files have changed in this diff Show More