Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-12 19:10:29 +01:00
Merge branch 'myles_dev' into 1.14
# Conflicts: # common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java
Dieser Commit ist enthalten in:
Commit
aa067d4073
@ -5,8 +5,8 @@ jdk: oraclejdk8
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- '$HOME/.m2/repository'
|
- '$HOME/.m2/repository'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false
|
- mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false
|
||||||
- mvn clean install -B -U
|
- mvn clean install -B -U
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class DeathListener extends ViaBukkitListener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// If online
|
// If online
|
||||||
if(getUserConnection(p) != null) {
|
if (getUserConnection(p) != null) {
|
||||||
PacketWrapper wrapper = new PacketWrapper(0x2C, null, getUserConnection(p));
|
PacketWrapper wrapper = new PacketWrapper(0x2C, null, getUserConnection(p));
|
||||||
try {
|
try {
|
||||||
wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
|
wrapper.write(Type.VAR_INT, 2); // Event - Entity dead
|
||||||
|
@ -6,7 +6,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class HandItemCache extends BukkitRunnable {
|
public class HandItemCache extends BukkitRunnable {
|
||||||
|
@ -13,12 +13,12 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
|
|||||||
import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
|
import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||||
|
import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator;
|
||||||
import us.myles.ViaVersion.bukkit.listeners.UpdateListener;
|
import us.myles.ViaVersion.bukkit.listeners.UpdateListener;
|
||||||
import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.*;
|
import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.*;
|
||||||
import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider;
|
import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider;
|
||||||
import us.myles.ViaVersion.bukkit.providers.BukkitViaBulkChunkTranslator;
|
import us.myles.ViaVersion.bukkit.providers.BukkitViaBulkChunkTranslator;
|
||||||
import us.myles.ViaVersion.bukkit.providers.BukkitViaMovementTransmitter;
|
import us.myles.ViaVersion.bukkit.providers.BukkitViaMovementTransmitter;
|
||||||
import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator;
|
|
||||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
|
||||||
@ -77,7 +77,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
|
|||||||
if ((Bukkit.getVersion().toLowerCase().contains("paper")
|
if ((Bukkit.getVersion().toLowerCase().contains("paper")
|
||||||
|| Bukkit.getVersion().toLowerCase().contains("taco")
|
|| Bukkit.getVersion().toLowerCase().contains("taco")
|
||||||
|| Bukkit.getVersion().toLowerCase().contains("torch"))
|
|| Bukkit.getVersion().toLowerCase().contains("torch"))
|
||||||
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
|
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
|
||||||
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
||||||
storeListener(new PaperPatch(plugin)).register();
|
storeListener(new PaperPatch(plugin)).register();
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,10 @@
|
|||||||
package us.myles.ViaVersion.bukkit.providers;
|
package us.myles.ViaVersion.bukkit.providers;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||||
@ -25,6 +16,14 @@ import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InventoryQui
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
|
||||||
import us.myles.ViaVersion.util.ReflectionUtil;
|
import us.myles.ViaVersion.util.ReflectionUtil;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider {
|
public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider {
|
||||||
|
|
||||||
private static Map<UUID, BukkitInventoryUpdateTask> updateTasks = new ConcurrentHashMap<UUID, BukkitInventoryUpdateTask>();
|
private static Map<UUID, BukkitInventoryUpdateTask> updateTasks = new ConcurrentHashMap<UUID, BukkitInventoryUpdateTask>();
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package us.myles.ViaVersion.bukkit.tasks.protocol1_12to1_11_1;
|
package us.myles.ViaVersion.bukkit.tasks.protocol1_12to1_11_1;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage.ItemTransaction;
|
|
||||||
|
|
||||||
public class BukkitInventoryUpdateTask implements Runnable {
|
public class BukkitInventoryUpdateTask implements Runnable {
|
||||||
|
|
||||||
private BukkitInventoryQuickMoveProvider provider;
|
private BukkitInventoryQuickMoveProvider provider;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||||
import us.myles.ViaVersion.api.Via;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -3,9 +3,9 @@ machine:
|
|||||||
version: oraclejdk8
|
version: oraclejdk8
|
||||||
general:
|
general:
|
||||||
artifacts:
|
artifacts:
|
||||||
- "target/*.jar"
|
- "target/*.jar"
|
||||||
test:
|
test:
|
||||||
override:
|
override:
|
||||||
- mvn clean install -B
|
- mvn clean install -B
|
||||||
post:
|
post:
|
||||||
- cp ./target/*.jar $CIRCLE_ARTIFACTS
|
- cp ./target/*.jar $CIRCLE_ARTIFACTS
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -278,8 +278,8 @@ public class PacketWrapper {
|
|||||||
* Be careful not to send packets twice.
|
* Be careful not to send packets twice.
|
||||||
* (Sends it after current)
|
* (Sends it after current)
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @param skipCurrentPipeline - Skip the current pipeline
|
* @param skipCurrentPipeline Skip the current pipeline
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline) throws Exception {
|
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline) throws Exception {
|
||||||
@ -291,9 +291,9 @@ public class PacketWrapper {
|
|||||||
* Be careful not to send packets twice.
|
* Be careful not to send packets twice.
|
||||||
* (Sends it after current)
|
* (Sends it after current)
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @param skipCurrentPipeline - Skip the current pipeline
|
* @param skipCurrentPipeline Skip the current pipeline
|
||||||
* @param currentThread - Run in the same thread
|
* @param currentThread Run in the same thread
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
|
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
|
||||||
@ -306,8 +306,8 @@ public class PacketWrapper {
|
|||||||
/**
|
/**
|
||||||
* Let the packet go through the protocol pipes and write it to ByteBuf
|
* Let the packet go through the protocol pipes and write it to ByteBuf
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @param skipCurrentPipeline - Skip the current pipeline
|
* @param skipCurrentPipeline Skip the current pipeline
|
||||||
* @return Packet buffer
|
* @return Packet buffer
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
@ -343,7 +343,7 @@ public class PacketWrapper {
|
|||||||
* Be careful not to send packets twice.
|
* Be careful not to send packets twice.
|
||||||
* (Sends it after current)
|
* (Sends it after current)
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public void send(Class<? extends Protocol> packetProtocol) throws Exception {
|
public void send(Class<? extends Protocol> packetProtocol) throws Exception {
|
||||||
@ -356,7 +356,7 @@ public class PacketWrapper {
|
|||||||
* (Sends it after current)
|
* (Sends it after current)
|
||||||
* Also returns the packets ChannelFuture
|
* Also returns the packets ChannelFuture
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @return The packets ChannelFuture
|
* @return The packets ChannelFuture
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
@ -486,9 +486,9 @@ public class PacketWrapper {
|
|||||||
/**
|
/**
|
||||||
* Send this packet to the server.
|
* Send this packet to the server.
|
||||||
*
|
*
|
||||||
* @param packetProtocol - The protocol version of the packet.
|
* @param packetProtocol The protocol version of the packet.
|
||||||
* @param skipCurrentPipeline - Skip the current pipeline
|
* @param skipCurrentPipeline Skip the current pipeline
|
||||||
* @param currentThread - Run in the same thread
|
* @param currentThread Run in the same thread
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public void sendToServer(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
|
public void sendToServer(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
|
||||||
|
@ -205,7 +205,7 @@ public class UserConnection {
|
|||||||
/**
|
/**
|
||||||
* Sends a raw packet to the server
|
* Sends a raw packet to the server
|
||||||
*
|
*
|
||||||
* @param packet Raw packet to be sent
|
* @param packet Raw packet to be sent
|
||||||
* @param currentThread If {@code true} executes immediately, {@code false} submits a task to EventLoop
|
* @param currentThread If {@code true} executes immediately, {@code false} submits a task to EventLoop
|
||||||
*/
|
*/
|
||||||
public void sendRawPacketToServer(final ByteBuf packet, boolean currentThread) {
|
public void sendRawPacketToServer(final ByteBuf packet, boolean currentThread) {
|
||||||
@ -244,5 +244,7 @@ public class UserConnection {
|
|||||||
*
|
*
|
||||||
* @param packet Raw packet to be sent
|
* @param packet Raw packet to be sent
|
||||||
*/
|
*/
|
||||||
public void sendRawPacketToServer(ByteBuf packet) { sendRawPacketToServer(packet, false); }
|
public void sendRawPacketToServer(ByteBuf packet) {
|
||||||
|
sendRawPacketToServer(packet, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,7 @@ import us.myles.ViaVersion.api.Via;
|
|||||||
|
|
||||||
public class Entity1_14Types {
|
public class Entity1_14Types {
|
||||||
public static EntityType getTypeFromId(int typeID, boolean isObject) {
|
public static EntityType getTypeFromId(int typeID, boolean isObject) {
|
||||||
Optional<EntityType> type;
|
Optional<EntityType> type = isObject ? ObjectTypes.getPCEntity(typeID) : EntityType.findById(typeID);
|
||||||
|
|
||||||
if (isObject)
|
|
||||||
type = ObjectTypes.getPCEntity(typeID);
|
|
||||||
else
|
|
||||||
type = EntityType.findById(typeID);
|
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
||||||
|
@ -9,16 +9,16 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public class BaseChunk implements Chunk {
|
public class BaseChunk implements Chunk {
|
||||||
protected int x;
|
protected int x;
|
||||||
protected int z;
|
protected int z;
|
||||||
protected boolean groundUp;
|
protected boolean groundUp;
|
||||||
protected int bitmask;
|
protected int bitmask;
|
||||||
protected ChunkSection[] sections;
|
protected ChunkSection[] sections;
|
||||||
protected byte[] biomeData;
|
protected byte[] biomeData;
|
||||||
protected List<CompoundTag> blockEntities;
|
protected List<CompoundTag> blockEntities;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBiomeData() {
|
public boolean isBiomeData() {
|
||||||
return biomeData != null;
|
return biomeData != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class ChunkSection {
|
|||||||
*/
|
*/
|
||||||
public static final int LIGHT_LENGTH = 16 * 16 * 16 / 2; // size * size * size / 2 (nibble bit count)
|
public static final int LIGHT_LENGTH = 16 * 16 * 16 / 2; // size * size * size / 2 (nibble bit count)
|
||||||
@Getter
|
@Getter
|
||||||
private final List<Integer> palette = Lists.newArrayList();
|
private final List<Integer> palette = Lists.newArrayList();
|
||||||
private final int[] blocks;
|
private final int[] blocks;
|
||||||
private NibbleArray blockLight;
|
private NibbleArray blockLight;
|
||||||
private NibbleArray skyLight;
|
private NibbleArray skyLight;
|
||||||
@ -72,19 +72,19 @@ public class ChunkSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPaletteIndex(int idx, int index) {
|
public void setPaletteIndex(int idx, int index) {
|
||||||
blocks[idx] = index;
|
blocks[idx] = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPaletteIndex(int idx) {
|
public int getPaletteIndex(int idx) {
|
||||||
return blocks[idx];
|
return blocks[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a block state in the chunk
|
* Set a block state in the chunk
|
||||||
* This method will not update non-air blocks count
|
* This method will not update non-air blocks count
|
||||||
*
|
*
|
||||||
* @param idx Index
|
* @param idx Index
|
||||||
* @param id The raw or flat id of the block
|
* @param id The raw or flat id of the block
|
||||||
*/
|
*/
|
||||||
public void setFlatBlock(int idx, int id) {
|
public void setFlatBlock(int idx, int id) {
|
||||||
int index = palette.indexOf(id);
|
int index = palette.indexOf(id);
|
||||||
|
@ -13,6 +13,7 @@ import us.myles.ViaVersion.protocols.protocol1_11to1_10.Protocol1_11To1_10;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.Protocol1_12_1TO1_12;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.Protocol1_12_1TO1_12;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_12_2to1_12_1.Protocol1_12_2TO1_12_1;
|
import us.myles.ViaVersion.protocols.protocol1_12_2to1_12_1.Protocol1_12_2TO1_12_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||||
@ -21,7 +22,6 @@ import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_9_1.Protocol1_9TO1_9_1;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_9_1.Protocol1_9TO1_9_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -58,10 +58,10 @@ public class ProtocolRegistry {
|
|||||||
registerProtocol(new Protocol1_12_2TO1_12_1(), Collections.singletonList(ProtocolVersion.v1_12_2.getId()), ProtocolVersion.v1_12_1.getId());
|
registerProtocol(new Protocol1_12_2TO1_12_1(), Collections.singletonList(ProtocolVersion.v1_12_2.getId()), ProtocolVersion.v1_12_1.getId());
|
||||||
|
|
||||||
registerProtocol(new Protocol1_13To1_12_2(), Collections.singletonList(ProtocolVersion.v1_13.getId()), ProtocolVersion.v1_12_2.getId());
|
registerProtocol(new Protocol1_13To1_12_2(), Collections.singletonList(ProtocolVersion.v1_13.getId()), ProtocolVersion.v1_12_2.getId());
|
||||||
registerProtocol(new Protocol1_13_1To1_13(), Arrays.asList(ProtocolVersion.v1_13_1.getId()), ProtocolVersion.v1_13.getId());
|
registerProtocol(new Protocol1_13_1To1_13(), Arrays.asList(ProtocolVersion.v1_13_1.getId()), ProtocolVersion.v1_13.getId());
|
||||||
registerProtocol(new Protocol1_13_2To1_13_1(), Arrays.asList(ProtocolVersion.v1_13_2.getId()), ProtocolVersion.v1_13_1.getId());
|
registerProtocol(new Protocol1_13_2To1_13_1(), Arrays.asList(ProtocolVersion.v1_13_2.getId()), ProtocolVersion.v1_13_1.getId());
|
||||||
|
|
||||||
registerProtocol(new Protocol1_14To1_13_2(), Arrays.asList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_13_2.getId());
|
registerProtocol(new Protocol1_14To1_13_2(), Arrays.asList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_13_2.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,7 @@ public class ProtocolRegistry {
|
|||||||
* Base Protocols registered later have higher priority
|
* Base Protocols registered later have higher priority
|
||||||
* Only one base protocol will be added to pipeline
|
* Only one base protocol will be added to pipeline
|
||||||
*
|
*
|
||||||
* @param baseProtocol Base Protocol to register
|
* @param baseProtocol Base Protocol to register
|
||||||
* @param supportedProtocols Versions that baseProtocol supports
|
* @param supportedProtocols Versions that baseProtocol supports
|
||||||
*/
|
*/
|
||||||
public static void registerBaseProtocol(Protocol baseProtocol, Range<Integer> supportedProtocols) {
|
public static void registerBaseProtocol(Protocol baseProtocol, Range<Integer> supportedProtocols) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package us.myles.ViaVersion.api.type.types.minecraft;
|
package us.myles.ViaVersion.api.type.types.minecraft;
|
||||||
|
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
|
||||||
|
@ -8,107 +8,107 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ChunkSectionType1_13 extends Type<ChunkSection> {
|
public class ChunkSectionType1_13 extends Type<ChunkSection> {
|
||||||
|
|
||||||
public ChunkSectionType1_13() {
|
public ChunkSectionType1_13() {
|
||||||
super("Chunk Section Type", ChunkSection.class);
|
super("Chunk Section Type", ChunkSection.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkSection read(ByteBuf buffer) throws Exception {
|
public ChunkSection read(ByteBuf buffer) throws Exception {
|
||||||
ChunkSection chunkSection = new ChunkSection();
|
ChunkSection chunkSection = new ChunkSection();
|
||||||
List<Integer> palette = chunkSection.getPalette();
|
List<Integer> palette = chunkSection.getPalette();
|
||||||
palette.clear();
|
palette.clear();
|
||||||
|
|
||||||
// Reaad bits per block
|
// Reaad bits per block
|
||||||
int bitsPerBlock = buffer.readUnsignedByte();
|
int bitsPerBlock = buffer.readUnsignedByte();
|
||||||
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
||||||
|
|
||||||
if (bitsPerBlock == 0) {
|
if (bitsPerBlock == 0) {
|
||||||
bitsPerBlock = 14;
|
bitsPerBlock = 14;
|
||||||
}
|
}
|
||||||
if (bitsPerBlock < 4) {
|
if (bitsPerBlock < 4) {
|
||||||
bitsPerBlock = 4;
|
bitsPerBlock = 4;
|
||||||
}
|
}
|
||||||
if (bitsPerBlock > 8) {
|
if (bitsPerBlock > 8) {
|
||||||
bitsPerBlock = 14;
|
bitsPerBlock = 14;
|
||||||
}
|
}
|
||||||
int paletteLength = bitsPerBlock == 14 ? 0 : Type.VAR_INT.read(buffer);
|
int paletteLength = bitsPerBlock == 14 ? 0 : Type.VAR_INT.read(buffer);
|
||||||
// Read palette
|
// Read palette
|
||||||
for (int i = 0; i < paletteLength; i++) {
|
for (int i = 0; i < paletteLength; i++) {
|
||||||
palette.add(Type.VAR_INT.read(buffer));
|
palette.add(Type.VAR_INT.read(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read blocks
|
// Read blocks
|
||||||
long[] blockData = new long[Type.VAR_INT.read(buffer)];
|
long[] blockData = new long[Type.VAR_INT.read(buffer)];
|
||||||
if (blockData.length > 0) {
|
if (blockData.length > 0) {
|
||||||
for (int i = 0; i < blockData.length; i++) {
|
for (int i = 0; i < blockData.length; i++) {
|
||||||
blockData[i] = buffer.readLong();
|
blockData[i] = buffer.readLong();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
||||||
int bitIndex = i * bitsPerBlock;
|
int bitIndex = i * bitsPerBlock;
|
||||||
int startIndex = bitIndex / 64;
|
int startIndex = bitIndex / 64;
|
||||||
int endIndex = ((i + 1) * bitsPerBlock - 1) / 64;
|
int endIndex = ((i + 1) * bitsPerBlock - 1) / 64;
|
||||||
int startBitSubIndex = bitIndex % 64;
|
int startBitSubIndex = bitIndex % 64;
|
||||||
int val;
|
int val;
|
||||||
if (startIndex == endIndex) {
|
if (startIndex == endIndex) {
|
||||||
val = (int) (blockData[startIndex] >>> startBitSubIndex & maxEntryValue);
|
val = (int) (blockData[startIndex] >>> startBitSubIndex & maxEntryValue);
|
||||||
} else {
|
} else {
|
||||||
int endBitSubIndex = 64 - startBitSubIndex;
|
int endBitSubIndex = 64 - startBitSubIndex;
|
||||||
val = (int) ((blockData[startIndex] >>> startBitSubIndex | blockData[endIndex] << endBitSubIndex) & maxEntryValue);
|
val = (int) ((blockData[startIndex] >>> startBitSubIndex | blockData[endIndex] << endBitSubIndex) & maxEntryValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitsPerBlock == 14) {
|
if (bitsPerBlock == 14) {
|
||||||
chunkSection.setFlatBlock(i, val);
|
chunkSection.setFlatBlock(i, val);
|
||||||
} else {
|
} else {
|
||||||
chunkSection.setPaletteIndex(i, val);
|
chunkSection.setPaletteIndex(i, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunkSection;
|
return chunkSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
||||||
List<Integer> palette = chunkSection.getPalette();
|
List<Integer> palette = chunkSection.getPalette();
|
||||||
|
|
||||||
int bitsPerBlock = 4;
|
int bitsPerBlock = 4;
|
||||||
while (palette.size() > 1 << bitsPerBlock) {
|
while (palette.size() > 1 << bitsPerBlock) {
|
||||||
bitsPerBlock += 1;
|
bitsPerBlock += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitsPerBlock > 8) {
|
if (bitsPerBlock > 8) {
|
||||||
bitsPerBlock = 14;
|
bitsPerBlock = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
||||||
buffer.writeByte(bitsPerBlock);
|
buffer.writeByte(bitsPerBlock);
|
||||||
|
|
||||||
|
|
||||||
// Write pallet (or not)
|
// Write pallet (or not)
|
||||||
if (bitsPerBlock != 14) {
|
if (bitsPerBlock != 14) {
|
||||||
Type.VAR_INT.write(buffer, palette.size());
|
Type.VAR_INT.write(buffer, palette.size());
|
||||||
for (int mappedId : palette) {
|
for (int mappedId : palette) {
|
||||||
Type.VAR_INT.write(buffer, mappedId);
|
Type.VAR_INT.write(buffer, mappedId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = (int) Math.ceil(ChunkSection.SIZE * bitsPerBlock / 64.0);
|
int length = (int) Math.ceil(ChunkSection.SIZE * bitsPerBlock / 64.0);
|
||||||
Type.VAR_INT.write(buffer, length);
|
Type.VAR_INT.write(buffer, length);
|
||||||
long[] data = new long[length];
|
long[] data = new long[length];
|
||||||
for (int index = 0; index < ChunkSection.SIZE; index++) {
|
for (int index = 0; index < ChunkSection.SIZE; index++) {
|
||||||
int value = bitsPerBlock == 14 ? chunkSection.getFlatBlock(index) : chunkSection.getPaletteIndex(index);
|
int value = bitsPerBlock == 14 ? chunkSection.getFlatBlock(index) : chunkSection.getPaletteIndex(index);
|
||||||
int bitIndex = index * bitsPerBlock;
|
int bitIndex = index * bitsPerBlock;
|
||||||
int startIndex = bitIndex / 64;
|
int startIndex = bitIndex / 64;
|
||||||
int endIndex = ((index + 1) * bitsPerBlock - 1) / 64;
|
int endIndex = ((index + 1) * bitsPerBlock - 1) / 64;
|
||||||
int startBitSubIndex = bitIndex % 64;
|
int startBitSubIndex = bitIndex % 64;
|
||||||
data[startIndex] = data[startIndex] & ~(maxEntryValue << startBitSubIndex) | ((long) value & maxEntryValue) << startBitSubIndex;
|
data[startIndex] = data[startIndex] & ~(maxEntryValue << startBitSubIndex) | ((long) value & maxEntryValue) << startBitSubIndex;
|
||||||
if (startIndex != endIndex) {
|
if (startIndex != endIndex) {
|
||||||
int endBitSubIndex = 64 - startBitSubIndex;
|
int endBitSubIndex = 64 - startBitSubIndex;
|
||||||
data[endIndex] = data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & maxEntryValue) >> endBitSubIndex;
|
data[endIndex] = data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & maxEntryValue) >> endBitSubIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (long l : data) {
|
for (long l : data) {
|
||||||
buffer.writeLong(l);
|
buffer.writeLong(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,32 +12,32 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ChunkSectionType1_8 extends Type<ChunkSection> {
|
public class ChunkSectionType1_8 extends Type<ChunkSection> {
|
||||||
|
|
||||||
public ChunkSectionType1_8() {
|
public ChunkSectionType1_8() {
|
||||||
super("Chunk Section Type", ChunkSection.class);
|
super("Chunk Section Type", ChunkSection.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkSection read(ByteBuf buffer) throws Exception {
|
public ChunkSection read(ByteBuf buffer) throws Exception {
|
||||||
ChunkSection chunkSection = new ChunkSection();
|
ChunkSection chunkSection = new ChunkSection();
|
||||||
List<Integer> palette = chunkSection.getPalette();
|
List<Integer> palette = chunkSection.getPalette();
|
||||||
palette.clear();
|
palette.clear();
|
||||||
|
|
||||||
byte[] blockData = new byte[ChunkSection.SIZE * 2];
|
byte[] blockData = new byte[ChunkSection.SIZE * 2];
|
||||||
buffer.readBytes(blockData);
|
buffer.readBytes(blockData);
|
||||||
ShortBuffer blockBuf = ByteBuffer.wrap(blockData).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
|
ShortBuffer blockBuf = ByteBuffer.wrap(blockData).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
|
||||||
|
|
||||||
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
||||||
int mask = blockBuf.get();
|
int mask = blockBuf.get();
|
||||||
int type = mask >> 4;
|
int type = mask >> 4;
|
||||||
int data = mask & 0xF;
|
int data = mask & 0xF;
|
||||||
chunkSection.setBlock(i, type, data);
|
chunkSection.setBlock(i, type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunkSection;
|
return chunkSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,103 +8,103 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ChunkSectionType1_9 extends Type<ChunkSection> {
|
public class ChunkSectionType1_9 extends Type<ChunkSection> {
|
||||||
|
|
||||||
public ChunkSectionType1_9() {
|
public ChunkSectionType1_9() {
|
||||||
super("Chunk Section Type", ChunkSection.class);
|
super("Chunk Section Type", ChunkSection.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkSection read(ByteBuf buffer) throws Exception {
|
public ChunkSection read(ByteBuf buffer) throws Exception {
|
||||||
ChunkSection chunkSection = new ChunkSection();
|
ChunkSection chunkSection = new ChunkSection();
|
||||||
List<Integer> palette = chunkSection.getPalette();
|
List<Integer> palette = chunkSection.getPalette();
|
||||||
palette.clear();
|
palette.clear();
|
||||||
|
|
||||||
// Reaad bits per block
|
// Reaad bits per block
|
||||||
int bitsPerBlock = buffer.readUnsignedByte();
|
int bitsPerBlock = buffer.readUnsignedByte();
|
||||||
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
||||||
|
|
||||||
if (bitsPerBlock == 0) {
|
if (bitsPerBlock == 0) {
|
||||||
bitsPerBlock = 13;
|
bitsPerBlock = 13;
|
||||||
}
|
}
|
||||||
if (bitsPerBlock < 4) {
|
if (bitsPerBlock < 4) {
|
||||||
bitsPerBlock = 4;
|
bitsPerBlock = 4;
|
||||||
}
|
}
|
||||||
if (bitsPerBlock > 8) {
|
if (bitsPerBlock > 8) {
|
||||||
bitsPerBlock = 13;
|
bitsPerBlock = 13;
|
||||||
}
|
}
|
||||||
int paletteLength = Type.VAR_INT.read(buffer);
|
int paletteLength = Type.VAR_INT.read(buffer);
|
||||||
// Read palette
|
// Read palette
|
||||||
for (int i = 0; i < paletteLength; i++) {
|
for (int i = 0; i < paletteLength; i++) {
|
||||||
if (bitsPerBlock != 13) {
|
if (bitsPerBlock != 13) {
|
||||||
palette.add(Type.VAR_INT.read(buffer));
|
palette.add(Type.VAR_INT.read(buffer));
|
||||||
} else {
|
} else {
|
||||||
Type.VAR_INT.read(buffer);
|
Type.VAR_INT.read(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read blocks
|
// Read blocks
|
||||||
long[] blockData = new long[Type.VAR_INT.read(buffer)];
|
long[] blockData = new long[Type.VAR_INT.read(buffer)];
|
||||||
if (blockData.length > 0) {
|
if (blockData.length > 0) {
|
||||||
for (int i = 0; i < blockData.length; i++) {
|
for (int i = 0; i < blockData.length; i++) {
|
||||||
blockData[i] = buffer.readLong();
|
blockData[i] = buffer.readLong();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
for (int i = 0; i < ChunkSection.SIZE; i++) {
|
||||||
int bitIndex = i * bitsPerBlock;
|
int bitIndex = i * bitsPerBlock;
|
||||||
int startIndex = bitIndex / 64;
|
int startIndex = bitIndex / 64;
|
||||||
int endIndex = ((i + 1) * bitsPerBlock - 1) / 64;
|
int endIndex = ((i + 1) * bitsPerBlock - 1) / 64;
|
||||||
int startBitSubIndex = bitIndex % 64;
|
int startBitSubIndex = bitIndex % 64;
|
||||||
int val;
|
int val;
|
||||||
if (startIndex == endIndex) {
|
if (startIndex == endIndex) {
|
||||||
val = (int) (blockData[startIndex] >>> startBitSubIndex & maxEntryValue);
|
val = (int) (blockData[startIndex] >>> startBitSubIndex & maxEntryValue);
|
||||||
} else {
|
} else {
|
||||||
int endBitSubIndex = 64 - startBitSubIndex;
|
int endBitSubIndex = 64 - startBitSubIndex;
|
||||||
val = (int) ((blockData[startIndex] >>> startBitSubIndex | blockData[endIndex] << endBitSubIndex) & maxEntryValue);
|
val = (int) ((blockData[startIndex] >>> startBitSubIndex | blockData[endIndex] << endBitSubIndex) & maxEntryValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitsPerBlock == 13) {
|
if (bitsPerBlock == 13) {
|
||||||
chunkSection.setBlock(i, val >> 4, val & 0xF);
|
chunkSection.setBlock(i, val >> 4, val & 0xF);
|
||||||
} else {
|
} else {
|
||||||
chunkSection.setPaletteIndex(i, val);
|
chunkSection.setPaletteIndex(i, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunkSection;
|
return chunkSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
public void write(ByteBuf buffer, ChunkSection chunkSection) throws Exception {
|
||||||
List<Integer> palette = chunkSection.getPalette();
|
List<Integer> palette = chunkSection.getPalette();
|
||||||
|
|
||||||
int bitsPerBlock = 4;
|
int bitsPerBlock = 4;
|
||||||
while (palette.size() > 1 << bitsPerBlock) {
|
while (palette.size() > 1 << bitsPerBlock) {
|
||||||
bitsPerBlock += 1;
|
bitsPerBlock += 1;
|
||||||
}
|
}
|
||||||
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
long maxEntryValue = (1L << bitsPerBlock) - 1;
|
||||||
buffer.writeByte(bitsPerBlock);
|
buffer.writeByte(bitsPerBlock);
|
||||||
|
|
||||||
// Write pallet
|
// Write pallet
|
||||||
Type.VAR_INT.write(buffer, palette.size());
|
Type.VAR_INT.write(buffer, palette.size());
|
||||||
for (int mappedId : palette) {
|
for (int mappedId : palette) {
|
||||||
Type.VAR_INT.write(buffer, mappedId);
|
Type.VAR_INT.write(buffer, mappedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = (int) Math.ceil(ChunkSection.SIZE * bitsPerBlock / 64.0);
|
int length = (int) Math.ceil(ChunkSection.SIZE * bitsPerBlock / 64.0);
|
||||||
Type.VAR_INT.write(buffer, length);
|
Type.VAR_INT.write(buffer, length);
|
||||||
long[] data = new long[length];
|
long[] data = new long[length];
|
||||||
for (int index = 0; index < ChunkSection.SIZE; index++) {
|
for (int index = 0; index < ChunkSection.SIZE; index++) {
|
||||||
int value = chunkSection.getPaletteIndex(index);
|
int value = chunkSection.getPaletteIndex(index);
|
||||||
int bitIndex = index * bitsPerBlock;
|
int bitIndex = index * bitsPerBlock;
|
||||||
int startIndex = bitIndex / 64;
|
int startIndex = bitIndex / 64;
|
||||||
int endIndex = ((index + 1) * bitsPerBlock - 1) / 64;
|
int endIndex = ((index + 1) * bitsPerBlock - 1) / 64;
|
||||||
int startBitSubIndex = bitIndex % 64;
|
int startBitSubIndex = bitIndex % 64;
|
||||||
data[startIndex] = data[startIndex] & ~(maxEntryValue << startBitSubIndex) | ((long) value & maxEntryValue) << startBitSubIndex;
|
data[startIndex] = data[startIndex] & ~(maxEntryValue << startBitSubIndex) | ((long) value & maxEntryValue) << startBitSubIndex;
|
||||||
if (startIndex != endIndex) {
|
if (startIndex != endIndex) {
|
||||||
int endBitSubIndex = 64 - startBitSubIndex;
|
int endBitSubIndex = 64 - startBitSubIndex;
|
||||||
data[endIndex] = data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & maxEntryValue) >> endBitSubIndex;
|
data[endIndex] = data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & maxEntryValue) >> endBitSubIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (long l : data) {
|
for (long l : data) {
|
||||||
buffer.writeLong(l);
|
buffer.writeLong(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,24 +6,24 @@ import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13_2;
|
|||||||
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
import us.myles.ViaVersion.api.type.types.minecraft.MetaTypeTemplate;
|
||||||
|
|
||||||
public class Metadata1_13_2Type extends MetaTypeTemplate {
|
public class Metadata1_13_2Type extends MetaTypeTemplate {
|
||||||
@Override
|
@Override
|
||||||
public Metadata read(ByteBuf buffer) throws Exception {
|
public Metadata read(ByteBuf buffer) throws Exception {
|
||||||
short index = buffer.readUnsignedByte();
|
short index = buffer.readUnsignedByte();
|
||||||
|
|
||||||
if (index == 0xff) return null; //End of metadata
|
if (index == 0xff) return null; //End of metadata
|
||||||
MetaType1_13_2 type = MetaType1_13_2.byId(buffer.readByte());
|
MetaType1_13_2 type = MetaType1_13_2.byId(buffer.readByte());
|
||||||
|
|
||||||
return new Metadata(index, type, type.getType().read(buffer));
|
return new Metadata(index, type, type.getType().read(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, Metadata object) throws Exception {
|
public void write(ByteBuf buffer, Metadata object) throws Exception {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
buffer.writeByte(255);
|
buffer.writeByte(255);
|
||||||
} else {
|
} else {
|
||||||
buffer.writeByte(object.getId());
|
buffer.writeByte(object.getId());
|
||||||
buffer.writeByte(object.getMetaType().getTypeID());
|
buffer.writeByte(object.getMetaType().getTypeID());
|
||||||
object.getMetaType().getType().write(buffer, object.getValue());
|
object.getMetaType().getType().write(buffer, object.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,13 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Types1_13_2 {
|
public class Types1_13_2 {
|
||||||
/**
|
/**
|
||||||
* Metadata list type for 1.13
|
* Metadata list type for 1.13
|
||||||
*/
|
*/
|
||||||
public static final Type<List<Metadata>> METADATA_LIST = new MetadataList1_13_2Type();
|
public static final Type<List<Metadata>> METADATA_LIST = new MetadataList1_13_2Type();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata type for 1.13
|
* Metadata type for 1.13
|
||||||
*/
|
*/
|
||||||
public static final Type<Metadata> METADATA = new Metadata1_13_2Type();
|
public static final Type<Metadata> METADATA = new Metadata1_13_2Type();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class MetadataRewriter {
|
|||||||
public static void handleMetadata(int entityId, EntityType type, List<Metadata> metadatas, UserConnection connection) {
|
public static void handleMetadata(int entityId, EntityType type, List<Metadata> metadatas, UserConnection connection) {
|
||||||
for (Metadata metadata : new ArrayList<>(metadatas)) {
|
for (Metadata metadata : new ArrayList<>(metadatas)) {
|
||||||
try {
|
try {
|
||||||
if(metadata.getValue() instanceof Item) {
|
if (metadata.getValue() instanceof Item) {
|
||||||
// Apply rewrite
|
// Apply rewrite
|
||||||
EntityIdRewriter.toClientItem((Item) metadata.getValue());
|
EntityIdRewriter.toClientItem((Item) metadata.getValue());
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ public class TranslateRewriter {
|
|||||||
public static boolean toClient(JsonElement element, UserConnection user) {
|
public static boolean toClient(JsonElement element, UserConnection user) {
|
||||||
if (element instanceof JsonObject) {
|
if (element instanceof JsonObject) {
|
||||||
JsonObject obj = (JsonObject) element;
|
JsonObject obj = (JsonObject) element;
|
||||||
if(obj.has("translate")) {
|
if (obj.has("translate")) {
|
||||||
if(obj.get("translate").getAsString().equals("chat.type.achievement")) {
|
if (obj.get("translate").getAsString().equals("chat.type.achievement")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import us.myles.ViaVersion.api.type.types.version.Types1_13;
|
import us.myles.ViaVersion.api.type.types.version.Types1_13;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.MetadataRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.MetadataRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
|
||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
|
|
||||||
|
@ -14,69 +14,69 @@ import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.WorldPackets
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type;
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type;
|
||||||
|
|
||||||
public class Protocol1_13_2To1_13_1 extends Protocol {
|
public class Protocol1_13_2To1_13_1 extends Protocol {
|
||||||
public static final Particle1_13_2Type PARTICLE_TYPE = new Particle1_13_2Type();
|
public static final Particle1_13_2Type PARTICLE_TYPE = new Particle1_13_2Type();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
InventoryPackets.register(this);
|
InventoryPackets.register(this);
|
||||||
WorldPackets.register(this);
|
WorldPackets.register(this);
|
||||||
EntityPackets.register(this);
|
EntityPackets.register(this);
|
||||||
|
|
||||||
//Edit Book
|
//Edit Book
|
||||||
registerIncoming(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
registerIncoming(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM);
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM);
|
||||||
map(Type.BOOLEAN);
|
map(Type.BOOLEAN);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advancements
|
// Advancements
|
||||||
registerOutgoing(State.PLAY, 0x51, 0x51, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x51, 0x51, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
||||||
int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
|
int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
wrapper.passthrough(Type.STRING); // Identifier
|
wrapper.passthrough(Type.STRING); // Identifier
|
||||||
|
|
||||||
// Parent
|
// Parent
|
||||||
if (wrapper.passthrough(Type.BOOLEAN))
|
if (wrapper.passthrough(Type.BOOLEAN))
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
|
|
||||||
// Display data
|
// Display data
|
||||||
if (wrapper.passthrough(Type.BOOLEAN)) {
|
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||||
wrapper.passthrough(Type.STRING); // Title
|
wrapper.passthrough(Type.STRING); // Title
|
||||||
wrapper.passthrough(Type.STRING); // Description
|
wrapper.passthrough(Type.STRING); // Description
|
||||||
Item icon = wrapper.read(Type.FLAT_ITEM);
|
Item icon = wrapper.read(Type.FLAT_ITEM);
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, icon);
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, icon);
|
||||||
wrapper.passthrough(Type.VAR_INT); // Frame type
|
wrapper.passthrough(Type.VAR_INT); // Frame type
|
||||||
int flags = wrapper.passthrough(Type.INT); // Flags
|
int flags = wrapper.passthrough(Type.INT); // Flags
|
||||||
if ((flags & 1) != 0)
|
if ((flags & 1) != 0)
|
||||||
wrapper.passthrough(Type.STRING); // Background texture
|
wrapper.passthrough(Type.STRING); // Background texture
|
||||||
wrapper.passthrough(Type.FLOAT); // X
|
wrapper.passthrough(Type.FLOAT); // X
|
||||||
wrapper.passthrough(Type.FLOAT); // Y
|
wrapper.passthrough(Type.FLOAT); // Y
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.STRING_ARRAY); // Criteria
|
wrapper.passthrough(Type.STRING_ARRAY); // Criteria
|
||||||
|
|
||||||
int arrayLength = wrapper.passthrough(Type.VAR_INT);
|
int arrayLength = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int array = 0; array < arrayLength; array++) {
|
for (int array = 0; array < arrayLength; array++) {
|
||||||
wrapper.passthrough(Type.STRING_ARRAY); // String array
|
wrapper.passthrough(Type.STRING_ARRAY); // String array
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection userConnection) {
|
public void init(UserConnection userConnection) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,84 +14,84 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
// Spawn mob packet
|
// Spawn mob packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3, 0x3, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x3, 0x3, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.UUID); // 1 - Entity UUID
|
map(Type.UUID); // 1 - Entity UUID
|
||||||
map(Type.VAR_INT); // 2 - Entity Type
|
map(Type.VAR_INT); // 2 - Entity Type
|
||||||
map(Type.DOUBLE); // 3 - X
|
map(Type.DOUBLE); // 3 - X
|
||||||
map(Type.DOUBLE); // 4 - Y
|
map(Type.DOUBLE); // 4 - Y
|
||||||
map(Type.DOUBLE); // 5 - Z
|
map(Type.DOUBLE); // 5 - Z
|
||||||
map(Type.BYTE); // 6 - Yaw
|
map(Type.BYTE); // 6 - Yaw
|
||||||
map(Type.BYTE); // 7 - Pitch
|
map(Type.BYTE); // 7 - Pitch
|
||||||
map(Type.BYTE); // 8 - Head Pitch
|
map(Type.BYTE); // 8 - Head Pitch
|
||||||
map(Type.SHORT); // 9 - Velocity X
|
map(Type.SHORT); // 9 - Velocity X
|
||||||
map(Type.SHORT); // 10 - Velocity Y
|
map(Type.SHORT); // 10 - Velocity Y
|
||||||
map(Type.SHORT); // 11 - Velocity Z
|
map(Type.SHORT); // 11 - Velocity Z
|
||||||
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 12 - Metadata
|
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 12 - Metadata
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
||||||
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
||||||
metadata.setMetaType(MetaType1_13_2.Slot);
|
metadata.setMetaType(MetaType1_13_2.Slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn player packet
|
// Spawn player packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.UUID); // 1 - Player UUID
|
map(Type.UUID); // 1 - Player UUID
|
||||||
map(Type.DOUBLE); // 2 - X
|
map(Type.DOUBLE); // 2 - X
|
||||||
map(Type.DOUBLE); // 3 - Y
|
map(Type.DOUBLE); // 3 - Y
|
||||||
map(Type.DOUBLE); // 4 - Z
|
map(Type.DOUBLE); // 4 - Z
|
||||||
map(Type.BYTE); // 5 - Yaw
|
map(Type.BYTE); // 5 - Yaw
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 7 - Metadata
|
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 7 - Metadata
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
||||||
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
||||||
metadata.setMetaType(MetaType1_13_2.Slot);
|
metadata.setMetaType(MetaType1_13_2.Slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Metadata packet
|
// Metadata packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 1 - Metadata list
|
map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 1 - Metadata list
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) {
|
||||||
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
if (metadata.getMetaType() == MetaType1_13.Slot) {
|
||||||
metadata.setMetaType(MetaType1_13_2.Slot);
|
metadata.setMetaType(MetaType1_13_2.Slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,143 +9,143 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
|
|
||||||
public class InventoryPackets {
|
public class InventoryPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Outgoing packets
|
Outgoing packets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Set slot packet
|
// Set slot packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window items packet
|
// Window items packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x15, 0x15, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x15, 0x15, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.FLAT_ITEM_ARRAY, Type.FLAT_VAR_INT_ITEM_ARRAY); // 1 - Window Values
|
map(Type.FLAT_ITEM_ARRAY, Type.FLAT_VAR_INT_ITEM_ARRAY); // 1 - Window Values
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Plugin message
|
// Plugin message
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Channel
|
map(Type.STRING); // Channel
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
String channel = wrapper.get(Type.STRING, 0);
|
String channel = wrapper.get(Type.STRING, 0);
|
||||||
if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {
|
if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {
|
||||||
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
||||||
|
|
||||||
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
// Input Item
|
// Input Item
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
// Output Item
|
// Output Item
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
|
|
||||||
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
||||||
if (secondItem) {
|
if (secondItem) {
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
// Entity Equipment Packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.VAR_INT); // 1 - Slot ID
|
map(Type.VAR_INT); // 1 - Slot ID
|
||||||
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Item
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Item
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare Recipes
|
// Declare Recipes
|
||||||
protocol.registerOutgoing(State.PLAY, 0x54, 0x54, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x54, 0x54, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int recipesNo = wrapper.passthrough(Type.VAR_INT);
|
int recipesNo = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int i = 0; i < recipesNo; i++) {
|
for (int i = 0; i < recipesNo; i++) {
|
||||||
wrapper.passthrough(Type.STRING); // Id
|
wrapper.passthrough(Type.STRING); // Id
|
||||||
String type = wrapper.passthrough(Type.STRING);
|
String type = wrapper.passthrough(Type.STRING);
|
||||||
if (type.equals("crafting_shapeless")) {
|
if (type.equals("crafting_shapeless")) {
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
int ingredientsNo = wrapper.passthrough(Type.VAR_INT);
|
int ingredientsNo = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int i1 = 0; i1 < ingredientsNo; i1++) {
|
for (int i1 = 0; i1 < ingredientsNo; i1++) {
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
||||||
}
|
}
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
} else if (type.equals("crafting_shaped")) {
|
} else if (type.equals("crafting_shaped")) {
|
||||||
int ingredientsNo = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
int ingredientsNo = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
for (int i1 = 0; i1 < ingredientsNo; i1++) {
|
for (int i1 = 0; i1 < ingredientsNo; i1++) {
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
||||||
}
|
}
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
} else if (type.equals("smelting")) {
|
} else if (type.equals("smelting")) {
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
// Ingredient start
|
// Ingredient start
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_ITEM_ARRAY_VAR_INT));
|
||||||
// Ingredient end
|
// Ingredient end
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
wrapper.passthrough(Type.FLOAT); // EXP
|
wrapper.passthrough(Type.FLOAT); // EXP
|
||||||
wrapper.passthrough(Type.VAR_INT); // Cooking time
|
wrapper.passthrough(Type.VAR_INT); // Cooking time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Incoming packets
|
Incoming packets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Click window packet
|
// Click window packet
|
||||||
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot
|
map(Type.SHORT); // 1 - Slot
|
||||||
map(Type.BYTE); // 2 - Button
|
map(Type.BYTE); // 2 - Button
|
||||||
map(Type.SHORT); // 3 - Action number
|
map(Type.SHORT); // 3 - Action number
|
||||||
map(Type.VAR_INT); // 4 - Mode
|
map(Type.VAR_INT); // 4 - Mode
|
||||||
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 5 - Clicked Item
|
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 5 - Clicked Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Creative Inventory Action
|
// Creative Inventory Action
|
||||||
protocol.registerIncoming(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.SHORT); // 0 - Slot
|
map(Type.SHORT); // 0 - Slot
|
||||||
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 1 - Clicked Item
|
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 1 - Clicked Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,32 +9,32 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
|
|
||||||
public class WorldPackets {
|
public class WorldPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
//spawn particle
|
//spawn particle
|
||||||
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Particle ID
|
map(Type.INT); // 0 - Particle ID
|
||||||
map(Type.BOOLEAN); // 1 - Long Distance
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
map(Type.FLOAT); // 2 - X
|
map(Type.FLOAT); // 2 - X
|
||||||
map(Type.FLOAT); // 3 - Y
|
map(Type.FLOAT); // 3 - Y
|
||||||
map(Type.FLOAT); // 4 - Z
|
map(Type.FLOAT); // 4 - Z
|
||||||
map(Type.FLOAT); // 5 - Offset X
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
map(Type.FLOAT); // 6 - Offset Y
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
map(Type.FLOAT); // 7 - Offset Z
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
map(Type.FLOAT); // 8 - Particle Data
|
map(Type.FLOAT); // 8 - Particle Data
|
||||||
map(Type.INT); // 9 - Particle Count
|
map(Type.INT); // 9 - Particle Count
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int id = wrapper.get(Type.INT, 0);
|
int id = wrapper.get(Type.INT, 0);
|
||||||
if (id == 27) {
|
if (id == 27) {
|
||||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
wrapper.write(Type.FLAT_VAR_INT_ITEM, wrapper.read(Type.FLAT_ITEM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,27 +97,25 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
||||||
protected static EnumMap<ChatColor, String> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<ChatColor, String>(ChatColor.class) {{
|
protected static EnumMap<ChatColor, String> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<ChatColor, String>(ChatColor.class) {{
|
||||||
put(ChatColor.BLACK, ChatColor.COLOR_CHAR + "g");
|
put(ChatColor.BLACK, ChatColor.COLOR_CHAR + "g");
|
||||||
put(ChatColor.DARK_BLUE, ChatColor.COLOR_CHAR + "h");
|
put(ChatColor.DARK_BLUE, ChatColor.COLOR_CHAR + "h");
|
||||||
put(ChatColor.DARK_GREEN, ChatColor.COLOR_CHAR + "i");
|
put(ChatColor.DARK_GREEN, ChatColor.COLOR_CHAR + "i");
|
||||||
put(ChatColor.DARK_AQUA, ChatColor.COLOR_CHAR + "j");
|
put(ChatColor.DARK_AQUA, ChatColor.COLOR_CHAR + "j");
|
||||||
put(ChatColor.DARK_RED, ChatColor.COLOR_CHAR + "p");
|
put(ChatColor.DARK_RED, ChatColor.COLOR_CHAR + "p");
|
||||||
put(ChatColor.DARK_PURPLE, ChatColor.COLOR_CHAR + "q");
|
put(ChatColor.DARK_PURPLE, ChatColor.COLOR_CHAR + "q");
|
||||||
put(ChatColor.GOLD, ChatColor.COLOR_CHAR + "s");
|
put(ChatColor.GOLD, ChatColor.COLOR_CHAR + "s");
|
||||||
put(ChatColor.GRAY, ChatColor.COLOR_CHAR + "t");
|
put(ChatColor.GRAY, ChatColor.COLOR_CHAR + "t");
|
||||||
put(ChatColor.DARK_GRAY, ChatColor.COLOR_CHAR + "u");
|
put(ChatColor.DARK_GRAY, ChatColor.COLOR_CHAR + "u");
|
||||||
put(ChatColor.BLUE, ChatColor.COLOR_CHAR + "v");
|
put(ChatColor.BLUE, ChatColor.COLOR_CHAR + "v");
|
||||||
put(ChatColor.GREEN, ChatColor.COLOR_CHAR + "w");
|
put(ChatColor.GREEN, ChatColor.COLOR_CHAR + "w");
|
||||||
put(ChatColor.AQUA, ChatColor.COLOR_CHAR + "x");
|
put(ChatColor.AQUA, ChatColor.COLOR_CHAR + "x");
|
||||||
put(ChatColor.RED, ChatColor.COLOR_CHAR + "y");
|
put(ChatColor.RED, ChatColor.COLOR_CHAR + "y");
|
||||||
put(ChatColor.LIGHT_PURPLE, ChatColor.COLOR_CHAR + "z");
|
put(ChatColor.LIGHT_PURPLE, ChatColor.COLOR_CHAR + "z");
|
||||||
put(ChatColor.YELLOW, ChatColor.COLOR_CHAR + "!");
|
put(ChatColor.YELLOW, ChatColor.COLOR_CHAR + "!");
|
||||||
put(ChatColor.WHITE, ChatColor.COLOR_CHAR + "?");
|
put(ChatColor.WHITE, ChatColor.COLOR_CHAR + "?");
|
||||||
}};
|
}};
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MappingData.init();
|
MappingData.init();
|
||||||
|
@ -6,97 +6,93 @@ import com.google.common.base.Optional;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
// Constant type changes to stop depending on names (the EntityTypes1_13 will be auto-generated so some fields can be obfuscated)
|
|
||||||
public class EntityTypeRewriter {
|
public class EntityTypeRewriter {
|
||||||
private static Map<Integer, Integer> entityTypes = new ConcurrentHashMap<>();
|
private static Map<Integer, Integer> entityTypes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Generated by codename Bevet
|
registerEntity(1, 32); // item - ajl
|
||||||
|
registerEntity(2, 22); // xp_orb - abx
|
||||||
// Entities 1.12 -> 18w15a
|
registerEntity(3, 0); // area_effect_cloud - abp
|
||||||
regEnt(1, 32); // item - ajl
|
registerEntity(4, 15); // elder_guardian - aju
|
||||||
regEnt(2, 22); // xp_orb - abx
|
registerEntity(5, 84); // wither_skeleton - aku
|
||||||
regEnt(3, 0); // area_effect_cloud - abp
|
registerEntity(6, 71); // stray - akq
|
||||||
regEnt(4, 15); // elder_guardian - aju
|
registerEntity(7, 74); // egg - alz
|
||||||
regEnt(5, 84); // wither_skeleton - aku
|
registerEntity(8, 35); // leash_knot - ajb
|
||||||
regEnt(6, 71); // stray - akq
|
registerEntity(9, 49); // painting - ajd
|
||||||
regEnt(7, 74); // egg - alz
|
registerEntity(10, 2); // arrow - all
|
||||||
regEnt(8, 35); // leash_knot - ajb
|
registerEntity(11, 67); // snowball - alw
|
||||||
regEnt(9, 49); // painting - ajd
|
registerEntity(12, 34); // fireball - alq
|
||||||
regEnt(10, 2); // arrow - all
|
registerEntity(13, 65); // small_fireball - alv
|
||||||
regEnt(11, 67); // snowball - alw
|
registerEntity(14, 75); // ender_pearl - ama
|
||||||
regEnt(12, 34); // fireball - alq
|
registerEntity(15, 23); // eye_of_ender_signal - alo
|
||||||
regEnt(13, 65); // small_fireball - alv
|
registerEntity(16, 77); // potion - amc
|
||||||
regEnt(14, 75); // ender_pearl - ama
|
registerEntity(17, 76); // xp_bottle - amb
|
||||||
regEnt(15, 23); // eye_of_ender_signal - alo
|
registerEntity(18, 33); // item_frame - aja
|
||||||
regEnt(16, 77); // potion - amc
|
registerEntity(19, 85); // wither_skull - ame
|
||||||
regEnt(17, 76); // xp_bottle - amb
|
registerEntity(20, 55); // tnt - ajm
|
||||||
regEnt(18, 33); // item_frame - aja
|
registerEntity(21, 24); // falling_block - ajk
|
||||||
regEnt(19, 85); // wither_skull - ame
|
registerEntity(22, 25); // fireworks_rocket - alp
|
||||||
regEnt(20, 55); // tnt - ajm
|
registerEntity(23, 30); // husk - akc
|
||||||
regEnt(21, 24); // falling_block - ajk
|
registerEntity(24, 68); // spectral_arrow - alx
|
||||||
regEnt(22, 25); // fireworks_rocket - alp
|
registerEntity(25, 60); // shulker_bullet - alu
|
||||||
regEnt(23, 30); // husk - akc
|
registerEntity(26, 13); // dragon_fireball - alm
|
||||||
regEnt(24, 68); // spectral_arrow - alx
|
registerEntity(27, 89); // zombie_villager - akw
|
||||||
regEnt(25, 60); // shulker_bullet - alu
|
registerEntity(28, 63); // skeleton_horse - aht
|
||||||
regEnt(26, 13); // dragon_fireball - alm
|
registerEntity(29, 88); // zombie_horse - ahv
|
||||||
regEnt(27, 89); // zombie_villager - akw
|
registerEntity(30, 1); // armor_stand - aiy
|
||||||
regEnt(28, 63); // skeleton_horse - aht
|
registerEntity(31, 11); // donkey - aho
|
||||||
regEnt(29, 88); // zombie_horse - ahv
|
registerEntity(32, 46); // mule - ahs
|
||||||
regEnt(30, 1); // armor_stand - aiy
|
registerEntity(33, 20); // evocation_fangs - aln
|
||||||
regEnt(31, 11); // donkey - aho
|
registerEntity(34, 21); // evocation_illager - ajy
|
||||||
regEnt(32, 46); // mule - ahs
|
registerEntity(35, 78); // vex - akr
|
||||||
regEnt(33, 20); // evocation_fangs - aln
|
registerEntity(36, 81); // vindication_illager - aks
|
||||||
regEnt(34, 21); // evocation_illager - ajy
|
registerEntity(37, 31); // illusion_illager - akd
|
||||||
regEnt(35, 78); // vex - akr
|
registerEntity(40, 41); // commandblock_minecart - aml
|
||||||
regEnt(36, 81); // vindication_illager - aks
|
registerEntity(41, 5); // boat - ami
|
||||||
regEnt(37, 31); // illusion_illager - akd
|
registerEntity(42, 39); // minecart - amj
|
||||||
regEnt(40, 41); // commandblock_minecart - aml
|
registerEntity(43, 40); // chest_minecart - amk
|
||||||
regEnt(41, 5); // boat - ami
|
registerEntity(44, 42); // furnace_minecart - amm
|
||||||
regEnt(42, 39); // minecart - amj
|
registerEntity(45, 45); // tnt_minecart - amp
|
||||||
regEnt(43, 40); // chest_minecart - amk
|
registerEntity(46, 43); // hopper_minecart - amn
|
||||||
regEnt(44, 42); // furnace_minecart - amm
|
registerEntity(47, 44); // spawner_minecart - amo
|
||||||
regEnt(45, 45); // tnt_minecart - amp
|
registerEntity(50, 10); // creeper - ajs
|
||||||
regEnt(46, 43); // hopper_minecart - amn
|
registerEntity(51, 62); // skeleton - akm
|
||||||
regEnt(47, 44); // spawner_minecart - amo
|
registerEntity(52, 69); // spider - akp
|
||||||
regEnt(50, 10); // creeper - ajs
|
registerEntity(53, 27); // giant - aka
|
||||||
regEnt(51, 62); // skeleton - akm
|
registerEntity(54, 87); // zombie - akv
|
||||||
regEnt(52, 69); // spider - akp
|
registerEntity(55, 64); // slime - akn
|
||||||
regEnt(53, 27); // giant - aka
|
registerEntity(56, 26); // ghast - ajz
|
||||||
regEnt(54, 87); // zombie - akv
|
registerEntity(57, 53); // zombie_pigman - akh
|
||||||
regEnt(55, 64); // slime - akn
|
registerEntity(58, 18); // enderman - ajv
|
||||||
regEnt(56, 26); // ghast - ajz
|
registerEntity(59, 6); // cave_spider - ajr
|
||||||
regEnt(57, 53); // zombie_pigman - akh
|
registerEntity(60, 61); // silverfish - akl
|
||||||
regEnt(58, 18); // enderman - ajv
|
registerEntity(61, 4); // blaze - ajq
|
||||||
regEnt(59, 6); // cave_spider - ajr
|
registerEntity(62, 38); // magma_cube - ake
|
||||||
regEnt(60, 61); // silverfish - akl
|
registerEntity(63, 17); // ender_dragon - aic
|
||||||
regEnt(61, 4); // blaze - ajq
|
registerEntity(64, 83); // wither - aiw
|
||||||
regEnt(62, 38); // magma_cube - ake
|
registerEntity(65, 3); // bat - agl
|
||||||
regEnt(63, 17); // ender_dragon - aic
|
registerEntity(66, 82); // witch - akt
|
||||||
regEnt(64, 83); // wither - aiw
|
registerEntity(67, 19); // endermite - ajw
|
||||||
regEnt(65, 3); // bat - agl
|
registerEntity(68, 28); // guardian - akb
|
||||||
regEnt(66, 82); // witch - akt
|
registerEntity(69, 59); // shulker - akk
|
||||||
regEnt(67, 19); // endermite - ajw
|
registerEntity(200, 16); // ender_crystal - aib
|
||||||
regEnt(68, 28); // guardian - akb
|
registerEntity(90, 51); // pig - agy
|
||||||
regEnt(69, 59); // shulker - akk
|
registerEntity(91, 58); // sheep - ahd
|
||||||
regEnt(200, 16); // ender_crystal - aib
|
registerEntity(92, 9); // cow - ags
|
||||||
regEnt(90, 51); // pig - agy
|
registerEntity(93, 7); // chicken - agq
|
||||||
regEnt(91, 58); // sheep - ahd
|
registerEntity(94, 70); // squid - ahg
|
||||||
regEnt(92, 9); // cow - ags
|
registerEntity(95, 86); // wolf - ahl
|
||||||
regEnt(93, 7); // chicken - agq
|
registerEntity(96, 47); // mooshroom - agv
|
||||||
regEnt(94, 70); // squid - ahg
|
registerEntity(97, 66); // snowman - ahf
|
||||||
regEnt(95, 86); // wolf - ahl
|
registerEntity(98, 48); // ocelot - agw
|
||||||
regEnt(96, 47); // mooshroom - agv
|
registerEntity(99, 80); // villager_golem - ahj
|
||||||
regEnt(97, 66); // snowman - ahf
|
registerEntity(100, 29); // horse - ahp
|
||||||
regEnt(98, 48); // ocelot - agw
|
registerEntity(101, 56); // rabbit - ahb
|
||||||
regEnt(99, 80); // villager_golem - ahj
|
registerEntity(102, 54); // polar_bear - agz
|
||||||
regEnt(100, 29); // horse - ahp
|
registerEntity(103, 36); // llama - ahr
|
||||||
regEnt(101, 56); // rabbit - ahb
|
registerEntity(104, 37); // llama_spit - alr
|
||||||
regEnt(102, 54); // polar_bear - agz
|
registerEntity(105, 50); // parrot - agx
|
||||||
regEnt(103, 36); // llama - ahr
|
registerEntity(120, 79); // villager - ala
|
||||||
regEnt(104, 37); // llama_spit - alr
|
|
||||||
regEnt(105, 50); // parrot - agx
|
|
||||||
regEnt(120, 79); // villager - ala
|
|
||||||
|
|
||||||
|
|
||||||
// OBJECTS
|
// OBJECTS
|
||||||
@ -104,7 +100,7 @@ public class EntityTypeRewriter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void regEnt(int type1_12, int type1_13) {
|
private static void registerEntity(int type1_12, int type1_13) {
|
||||||
entityTypes.put(type1_12, type1_13);
|
entityTypes.put(type1_12, type1_13);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
// todo use int in Chunk?
|
// todo use int in Chunk?
|
||||||
biomeData[i] = (byte) input.readInt();;
|
biomeData[i] = (byte) input.readInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,32 +13,32 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MetadataRewriter {
|
public class MetadataRewriter {
|
||||||
|
|
||||||
public static void handleMetadata(int entityId, Entity1_14Types.EntityType type, List<Metadata> metadatas, UserConnection connection) {
|
public static void handleMetadata(int entityId, Entity1_14Types.EntityType type, List<Metadata> metadatas, UserConnection connection) {
|
||||||
for (Metadata metadata : new ArrayList<>(metadatas)) {
|
for (Metadata metadata : new ArrayList<>(metadatas)) {
|
||||||
try {
|
try {
|
||||||
// 1.13 changed item to flat item (no data)
|
// 1.13 changed item to flat item (no data)
|
||||||
if (metadata.getMetaType() == MetaType1_13_2.Slot) {
|
if (metadata.getMetaType() == MetaType1_13_2.Slot) {
|
||||||
InventoryPackets.toClient((Item) metadata.getValue());
|
InventoryPackets.toClient((Item) metadata.getValue());
|
||||||
} else if (metadata.getMetaType() == MetaType1_13_2.BlockID) {
|
} else if (metadata.getMetaType() == MetaType1_13_2.BlockID) {
|
||||||
// Convert to new block id
|
// Convert to new block id
|
||||||
int data = (int) metadata.getValue();
|
int data = (int) metadata.getValue();
|
||||||
metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data));
|
metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||||
}
|
}
|
||||||
if (type == null) continue;
|
if (type == null) continue;
|
||||||
if (type.isOrHasParent(Entity1_14Types.EntityType.MINECART_ABSTRACT) && metadata.getId() == 9) {
|
if (type.isOrHasParent(Entity1_14Types.EntityType.MINECART_ABSTRACT) && metadata.getId() == 9) {
|
||||||
// New block format
|
// New block format
|
||||||
int data = (int) metadata.getValue();
|
int data = (int) metadata.getValue();
|
||||||
metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data));
|
metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
metadatas.remove(metadata);
|
metadatas.remove(metadata);
|
||||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler");
|
Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler");
|
||||||
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,271 +15,271 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
|
|
||||||
public class Protocol1_14To1_13_2 extends Protocol {
|
public class Protocol1_14To1_13_2 extends Protocol {
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
InventoryPackets.register(this);
|
InventoryPackets.register(this);
|
||||||
EntityPackets.register(this);
|
EntityPackets.register(this);
|
||||||
WorldPackets.register(this);
|
WorldPackets.register(this);
|
||||||
PlayerPackets.register(this);
|
PlayerPackets.register(this);
|
||||||
|
|
||||||
// Sound Effect
|
// Sound Effect
|
||||||
registerOutgoing(State.PLAY, 0x4D, 0x4D, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x4D, 0x4D, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Sound Id
|
map(Type.VAR_INT); // Sound Id
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
wrapper.set(Type.VAR_INT, 0, getNewSoundId(wrapper.get(Type.VAR_INT, 0)));
|
wrapper.set(Type.VAR_INT, 0, getNewSoundId(wrapper.get(Type.VAR_INT, 0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerOutgoing(State.PLAY, 0x4E, 0x4F);
|
registerOutgoing(State.PLAY, 0x4E, 0x4F);
|
||||||
registerOutgoing(State.PLAY, 0x4F, 0x50);
|
registerOutgoing(State.PLAY, 0x4F, 0x50);
|
||||||
registerOutgoing(State.PLAY, 0x50, 0x51);
|
registerOutgoing(State.PLAY, 0x50, 0x51);
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x51, 0x52, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x51, 0x52, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
|
||||||
int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
|
int size = wrapper.passthrough(Type.VAR_INT); // Mapping size
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
wrapper.passthrough(Type.STRING); // Identifier
|
wrapper.passthrough(Type.STRING); // Identifier
|
||||||
|
|
||||||
// Parent
|
// Parent
|
||||||
if (wrapper.passthrough(Type.BOOLEAN))
|
if (wrapper.passthrough(Type.BOOLEAN))
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
|
|
||||||
// Display data
|
// Display data
|
||||||
if (wrapper.passthrough(Type.BOOLEAN)) {
|
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||||
wrapper.passthrough(Type.STRING); // Title
|
wrapper.passthrough(Type.STRING); // Title
|
||||||
wrapper.passthrough(Type.STRING); // Description
|
wrapper.passthrough(Type.STRING); // Description
|
||||||
InventoryPackets.toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Icon
|
InventoryPackets.toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Icon
|
||||||
wrapper.passthrough(Type.VAR_INT); // Frame type
|
wrapper.passthrough(Type.VAR_INT); // Frame type
|
||||||
int flags = wrapper.passthrough(Type.INT); // Flags
|
int flags = wrapper.passthrough(Type.INT); // Flags
|
||||||
if ((flags & 1) != 0)
|
if ((flags & 1) != 0)
|
||||||
wrapper.passthrough(Type.STRING); // Background texture
|
wrapper.passthrough(Type.STRING); // Background texture
|
||||||
wrapper.passthrough(Type.FLOAT); // X
|
wrapper.passthrough(Type.FLOAT); // X
|
||||||
wrapper.passthrough(Type.FLOAT); // Y
|
wrapper.passthrough(Type.FLOAT); // Y
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.STRING_ARRAY); // Criteria
|
wrapper.passthrough(Type.STRING_ARRAY); // Criteria
|
||||||
|
|
||||||
int arrayLength = wrapper.passthrough(Type.VAR_INT);
|
int arrayLength = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int array = 0; array < arrayLength; array++) {
|
for (int array = 0; array < arrayLength; array++) {
|
||||||
wrapper.passthrough(Type.STRING_ARRAY); // String array
|
wrapper.passthrough(Type.STRING_ARRAY); // String array
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x52, 0x53);
|
registerOutgoing(State.PLAY, 0x52, 0x53);
|
||||||
registerOutgoing(State.PLAY, 0x53, 0x54);
|
registerOutgoing(State.PLAY, 0x53, 0x54);
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x55, 0x56, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x55, 0x56, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int blockTagsSize = wrapper.passthrough(Type.VAR_INT); // block tags
|
int blockTagsSize = wrapper.passthrough(Type.VAR_INT); // block tags
|
||||||
for (int i = 0; i < blockTagsSize; i++) {
|
for (int i = 0; i < blockTagsSize; i++) {
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
Integer[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
|
Integer[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
|
||||||
for (int j = 0; j < blockIds.length; j++) {
|
for (int j = 0; j < blockIds.length; j++) {
|
||||||
blockIds[j] = getNewBlockId(blockIds[j]);
|
blockIds[j] = getNewBlockId(blockIds[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int itemTagsSize = wrapper.passthrough(Type.VAR_INT); // item tags
|
int itemTagsSize = wrapper.passthrough(Type.VAR_INT); // item tags
|
||||||
for (int i = 0; i < itemTagsSize; i++) {
|
for (int i = 0; i < itemTagsSize; i++) {
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
Integer[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
|
Integer[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
|
||||||
for (int j = 0; j < itemIds.length; j++) {
|
for (int j = 0; j < itemIds.length; j++) {
|
||||||
itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]);
|
itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int fluidTagsSize = wrapper.passthrough(Type.VAR_INT); // fluid tags
|
int fluidTagsSize = wrapper.passthrough(Type.VAR_INT); // fluid tags
|
||||||
for (int i = 0; i < fluidTagsSize; i++) {
|
for (int i = 0; i < fluidTagsSize; i++) {
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
wrapper.passthrough(Type.VAR_INT_ARRAY);
|
wrapper.passthrough(Type.VAR_INT_ARRAY);
|
||||||
}
|
}
|
||||||
wrapper.write(Type.VAR_INT, 0); // new unknown tags
|
wrapper.write(Type.VAR_INT, 0); // new unknown tags
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewSoundId(int id) {
|
public static int getNewSoundId(int id) {
|
||||||
// AUTO GENERATED - todo compact this?
|
// AUTO GENERATED - todo compact this?
|
||||||
if (id < 15) return id + 0; // 15 = block.beacon.activate
|
if (id < 15) return id + 0; // 15 = block.beacon.activate
|
||||||
if (id < 19) return id + 29; // 19 = block.brewing_stand.brew
|
if (id < 19) return id + 29; // 19 = block.brewing_stand.brew
|
||||||
if (id < 25) return id + 42; // 25 = block.chest.close
|
if (id < 25) return id + 42; // 25 = block.chest.close
|
||||||
if (id < 28) return id + 54; // 28 = block.chorus_flower.death
|
if (id < 28) return id + 54; // 28 = block.chorus_flower.death
|
||||||
if (id < 30) return id + 59; // 30 = block.wool.break
|
if (id < 30) return id + 59; // 30 = block.wool.break
|
||||||
if (id < 35) return id + 60; // 35 = block.comparator.click
|
if (id < 35) return id + 60; // 35 = block.comparator.click
|
||||||
if (id < 41) return id + 64; // 41 = block.dispenser.dispense
|
if (id < 41) return id + 64; // 41 = block.dispenser.dispense
|
||||||
if (id < 44) return id + 80; // 44 = block.enchantment_table.use
|
if (id < 44) return id + 80; // 44 = block.enchantment_table.use
|
||||||
if (id < 45) return id + 114; // 45 = block.end_gateway.spawn
|
if (id < 45) return id + 114; // 45 = block.end_gateway.spawn
|
||||||
if (id < 46) return id + 136; // 46 = block.end_portal.spawn
|
if (id < 46) return id + 136; // 46 = block.end_portal.spawn
|
||||||
if (id < 47) return id + 137; // 47 = block.end_portal_frame.fill
|
if (id < 47) return id + 137; // 47 = block.end_portal_frame.fill
|
||||||
if (id < 48) return id + 135; // 48 = block.ender_chest.close
|
if (id < 48) return id + 135; // 48 = block.ender_chest.close
|
||||||
if (id < 50) return id + 111; // 50 = block.fence_gate.close
|
if (id < 50) return id + 111; // 50 = block.fence_gate.close
|
||||||
if (id < 52) return id + 144; // 52 = block.fire.ambient
|
if (id < 52) return id + 144; // 52 = block.fire.ambient
|
||||||
if (id < 54) return id + 153; // 54 = block.furnace.fire_crackle
|
if (id < 54) return id + 153; // 54 = block.furnace.fire_crackle
|
||||||
if (id < 55) return id + 155; // 55 = block.glass.break
|
if (id < 55) return id + 155; // 55 = block.glass.break
|
||||||
if (id < 80) return id + 172; // 80 = block.iron_door.close
|
if (id < 80) return id + 172; // 80 = block.iron_door.close
|
||||||
if (id < 82) return id + 219; // 82 = block.iron_trapdoor.close
|
if (id < 82) return id + 219; // 82 = block.iron_trapdoor.close
|
||||||
if (id < 84) return id + 223; // 84 = block.ladder.break
|
if (id < 84) return id + 223; // 84 = block.ladder.break
|
||||||
if (id < 92) return id + 230; // 92 = block.lever.click
|
if (id < 92) return id + 230; // 92 = block.lever.click
|
||||||
if (id < 93) return id + 232; // 93 = block.metal.break
|
if (id < 93) return id + 232; // 93 = block.metal.break
|
||||||
if (id < 97) return id + 248; // 97 = block.metal.step
|
if (id < 97) return id + 248; // 97 = block.metal.step
|
||||||
if (id < 98) return id + 250; // 98 = block.metal_pressure_plate.click_off
|
if (id < 98) return id + 250; // 98 = block.metal_pressure_plate.click_off
|
||||||
if (id < 100) return id + 247; // 100 = block.note_block.basedrum
|
if (id < 100) return id + 247; // 100 = block.note_block.basedrum
|
||||||
if (id < 111) return id + 263; // 111 = block.piston.contract
|
if (id < 111) return id + 263; // 111 = block.piston.contract
|
||||||
if (id < 113) return id + 325; // 113 = block.portal.ambient
|
if (id < 113) return id + 325; // 113 = block.portal.ambient
|
||||||
if (id < 116) return id + 349; // 116 = block.pumpkin.carve
|
if (id < 116) return id + 349; // 116 = block.pumpkin.carve
|
||||||
if (id < 117) return id + 356; // 117 = block.redstone_torch.burnout
|
if (id < 117) return id + 356; // 117 = block.redstone_torch.burnout
|
||||||
if (id < 118) return id + 373; // 118 = block.sand.break
|
if (id < 118) return id + 373; // 118 = block.sand.break
|
||||||
if (id < 123) return id + 377; // 123 = block.shulker_box.close
|
if (id < 123) return id + 377; // 123 = block.shulker_box.close
|
||||||
if (id < 125) return id + 386; // 125 = block.slime_block.break
|
if (id < 125) return id + 386; // 125 = block.slime_block.break
|
||||||
if (id < 130) return id + 417; // 130 = block.snow.break
|
if (id < 130) return id + 417; // 130 = block.snow.break
|
||||||
if (id < 132) return id + 425; // 132 = block.snow.hit
|
if (id < 132) return id + 425; // 132 = block.snow.hit
|
||||||
if (id < 135) return id + 429; // 135 = block.stone.break
|
if (id < 135) return id + 429; // 135 = block.stone.break
|
||||||
if (id < 136) return id + 439; // 136 = block.stone.fall
|
if (id < 136) return id + 439; // 136 = block.stone.fall
|
||||||
if (id < 139) return id + 441; // 139 = block.stone.step
|
if (id < 139) return id + 441; // 139 = block.stone.step
|
||||||
if (id < 140) return id + 443; // 140 = block.stone_button.click_off
|
if (id < 140) return id + 443; // 140 = block.stone_button.click_off
|
||||||
if (id < 142) return id + 435; // 142 = block.stone_pressure_plate.click_off
|
if (id < 142) return id + 435; // 142 = block.stone_pressure_plate.click_off
|
||||||
if (id < 144) return id + 438; // 144 = block.tripwire.attach
|
if (id < 144) return id + 438; // 144 = block.tripwire.attach
|
||||||
if (id < 148) return id + 454; // 148 = block.water.ambient
|
if (id < 148) return id + 454; // 148 = block.water.ambient
|
||||||
if (id < 149) return id + 490; // 149 = block.lily_pad.place
|
if (id < 149) return id + 490; // 149 = block.lily_pad.place
|
||||||
if (id < 150) return id + 488; // 150 = block.wood.break
|
if (id < 150) return id + 488; // 150 = block.wood.break
|
||||||
if (id < 151) return id + 519; // 151 = block.wood.fall
|
if (id < 151) return id + 519; // 151 = block.wood.fall
|
||||||
if (id < 154) return id + 521; // 154 = block.wood.step
|
if (id < 154) return id + 521; // 154 = block.wood.step
|
||||||
if (id < 155) return id + 523; // 155 = block.wooden_button.click_off
|
if (id < 155) return id + 523; // 155 = block.wooden_button.click_off
|
||||||
if (id < 157) return id + 515; // 157 = block.wooden_pressure_plate.click_off
|
if (id < 157) return id + 515; // 157 = block.wooden_pressure_plate.click_off
|
||||||
if (id < 159) return id + 518; // 159 = block.wooden_door.close
|
if (id < 159) return id + 518; // 159 = block.wooden_door.close
|
||||||
if (id < 163) return id + 506; // 163 = enchant.thorns.hit
|
if (id < 163) return id + 506; // 163 = enchant.thorns.hit
|
||||||
if (id < 164) return id + 424; // 164 = entity.armor_stand.break
|
if (id < 164) return id + 424; // 164 = entity.armor_stand.break
|
||||||
if (id < 171) return id + -141; // 171 = entity.bat.ambient
|
if (id < 171) return id + -141; // 171 = entity.bat.ambient
|
||||||
if (id < 176) return id + -132; // 176 = entity.blaze.ambient
|
if (id < 176) return id + -132; // 176 = entity.blaze.ambient
|
||||||
if (id < 186) return id + -128; // 186 = entity.cat.ambient
|
if (id < 186) return id + -128; // 186 = entity.cat.ambient
|
||||||
if (id < 192) return id + -113; // 192 = entity.chicken.ambient
|
if (id < 192) return id + -113; // 192 = entity.chicken.ambient
|
||||||
if (id < 197) return id + -110; // 197 = entity.cod.ambient
|
if (id < 197) return id + -110; // 197 = entity.cod.ambient
|
||||||
if (id < 201) return id + -102; // 201 = entity.cow.ambient
|
if (id < 201) return id + -102; // 201 = entity.cow.ambient
|
||||||
if (id < 209) return id + -96; // 209 = entity.dolphin.ambient
|
if (id < 209) return id + -96; // 209 = entity.dolphin.ambient
|
||||||
if (id < 242) return id + -85; // 242 = entity.ender_dragon.ambient
|
if (id < 242) return id + -85; // 242 = entity.ender_dragon.ambient
|
||||||
if (id < 244) return id + -81; // 244 = entity.ender_dragon.flap
|
if (id < 244) return id + -81; // 244 = entity.ender_dragon.flap
|
||||||
if (id < 248) return id + -80; // 248 = entity.dragon_fireball.explode
|
if (id < 248) return id + -80; // 248 = entity.dragon_fireball.explode
|
||||||
if (id < 249) return id + -85; // 249 = entity.ender_eye.death
|
if (id < 249) return id + -85; // 249 = entity.ender_eye.death
|
||||||
if (id < 262) return id + -81; // 262 = entity.evoker.ambient
|
if (id < 262) return id + -81; // 262 = entity.evoker.ambient
|
||||||
if (id < 265) return id + -78; // 265 = entity.evoker.hurt
|
if (id < 265) return id + -78; // 265 = entity.evoker.hurt
|
||||||
if (id < 269) return id + -77; // 269 = entity.evoker_fangs.attack
|
if (id < 269) return id + -77; // 269 = entity.evoker_fangs.attack
|
||||||
if (id < 270) return id + -82; // 270 = entity.experience_bottle.throw
|
if (id < 270) return id + -82; // 270 = entity.experience_bottle.throw
|
||||||
if (id < 272) return id + -78; // 272 = entity.firework_rocket.blast
|
if (id < 272) return id + -78; // 272 = entity.firework_rocket.blast
|
||||||
if (id < 280) return id + -75; // 280 = entity.fish.swim
|
if (id < 280) return id + -75; // 280 = entity.fish.swim
|
||||||
if (id < 281) return id + -73; // 281 = entity.generic.big_fall
|
if (id < 281) return id + -73; // 281 = entity.generic.big_fall
|
||||||
if (id < 298) return id + -71; // 298 = entity.guardian.ambient
|
if (id < 298) return id + -71; // 298 = entity.guardian.ambient
|
||||||
if (id < 306) return id + -46; // 306 = entity.horse.ambient
|
if (id < 306) return id + -46; // 306 = entity.horse.ambient
|
||||||
if (id < 330) return id + -45; // 330 = entity.illusioner.ambient
|
if (id < 330) return id + -45; // 330 = entity.illusioner.ambient
|
||||||
if (id < 337) return id + -38; // 337 = entity.iron_golem.attack
|
if (id < 337) return id + -38; // 337 = entity.iron_golem.attack
|
||||||
if (id < 341) return id + -36; // 341 = entity.item.break
|
if (id < 341) return id + -36; // 341 = entity.item.break
|
||||||
if (id < 343) return id + -29; // 343 = entity.item_frame.add_item
|
if (id < 343) return id + -29; // 343 = entity.item_frame.add_item
|
||||||
if (id < 348) return id + -36; // 348 = entity.leash_knot.break
|
if (id < 348) return id + -36; // 348 = entity.leash_knot.break
|
||||||
if (id < 350) return id + -26; // 350 = entity.lightning_bolt.impact
|
if (id < 350) return id + -26; // 350 = entity.lightning_bolt.impact
|
||||||
if (id < 366) return id + -25; // 366 = entity.minecart.inside
|
if (id < 366) return id + -25; // 366 = entity.minecart.inside
|
||||||
if (id < 373) return id + -18; // 373 = entity.painting.break
|
if (id < 373) return id + -18; // 373 = entity.painting.break
|
||||||
if (id < 375) return id + 1; // 375 = entity.parrot.ambient
|
if (id < 375) return id + 1; // 375 = entity.parrot.ambient
|
||||||
if (id < 421) return id + 12; // 421 = entity.player.attack.crit
|
if (id < 421) return id + 12; // 421 = entity.player.attack.crit
|
||||||
if (id < 445) return id + 17; // 445 = entity.puffer_fish.ambient
|
if (id < 445) return id + 17; // 445 = entity.puffer_fish.ambient
|
||||||
if (id < 452) return id + 20; // 452 = entity.rabbit.ambient
|
if (id < 452) return id + 20; // 452 = entity.rabbit.ambient
|
||||||
if (id < 457) return id + 21; // 457 = entity.salmon.ambient
|
if (id < 457) return id + 21; // 457 = entity.salmon.ambient
|
||||||
if (id < 461) return id + 34; // 461 = entity.sheep.ambient
|
if (id < 461) return id + 34; // 461 = entity.sheep.ambient
|
||||||
if (id < 466) return id + 39; // 466 = entity.shulker.ambient
|
if (id < 466) return id + 39; // 466 = entity.shulker.ambient
|
||||||
if (id < 467) return id + 42; // 467 = entity.shulker.close
|
if (id < 467) return id + 42; // 467 = entity.shulker.close
|
||||||
if (id < 474) return id + 46; // 474 = entity.shulker_bullet.hit
|
if (id < 474) return id + 46; // 474 = entity.shulker_bullet.hit
|
||||||
if (id < 476) return id + 37; // 476 = entity.silverfish.ambient
|
if (id < 476) return id + 37; // 476 = entity.silverfish.ambient
|
||||||
if (id < 482) return id + 44; // 482 = entity.skeleton.hurt
|
if (id < 482) return id + 44; // 482 = entity.skeleton.hurt
|
||||||
if (id < 485) return id + 52; // 485 = entity.skeleton_horse.ambient
|
if (id < 485) return id + 52; // 485 = entity.skeleton_horse.ambient
|
||||||
if (id < 493) return id + 41; // 493 = entity.slime.attack
|
if (id < 493) return id + 41; // 493 = entity.slime.attack
|
||||||
if (id < 498) return id + 44; // 498 = entity.magma_cube.death_small
|
if (id < 498) return id + 44; // 498 = entity.magma_cube.death_small
|
||||||
if (id < 505) return id + 49; // 505 = entity.snow_golem.ambient
|
if (id < 505) return id + 49; // 505 = entity.snow_golem.ambient
|
||||||
if (id < 509) return id + 52; // 509 = entity.snowball.throw
|
if (id < 509) return id + 52; // 509 = entity.snowball.throw
|
||||||
if (id < 510) return id + 45; // 510 = entity.spider.ambient
|
if (id < 510) return id + 45; // 510 = entity.spider.ambient
|
||||||
if (id < 520) return id + 54; // 520 = entity.stray.ambient
|
if (id < 520) return id + 54; // 520 = entity.stray.ambient
|
||||||
if (id < 524) return id + 63; // 524 = entity.tnt.primed
|
if (id < 524) return id + 63; // 524 = entity.tnt.primed
|
||||||
if (id < 525) return id + 64; // 525 = entity.tropical_fish.ambient
|
if (id < 525) return id + 64; // 525 = entity.tropical_fish.ambient
|
||||||
if (id < 541) return id + 77; // 541 = entity.vex.ambient
|
if (id < 541) return id + 77; // 541 = entity.vex.ambient
|
||||||
if (id < 554) return id + 83; // 554 = entity.witch.ambient
|
if (id < 554) return id + 83; // 554 = entity.witch.ambient
|
||||||
if (id < 564) return id + 87; // 564 = entity.wither.spawn
|
if (id < 564) return id + 87; // 564 = entity.wither.spawn
|
||||||
if (id < 565) return id + 91; // 565 = entity.wither_skeleton.ambient
|
if (id < 565) return id + 91; // 565 = entity.wither_skeleton.ambient
|
||||||
if (id < 569) return id + 86; // 569 = entity.wolf.ambient
|
if (id < 569) return id + 86; // 569 = entity.wolf.ambient
|
||||||
if (id < 578) return id + 87; // 578 = entity.zombie.ambient
|
if (id < 578) return id + 87; // 578 = entity.zombie.ambient
|
||||||
if (id < 585) return id + 100; // 585 = entity.zombie.hurt
|
if (id < 585) return id + 100; // 585 = entity.zombie.hurt
|
||||||
if (id < 587) return id + 103; // 587 = entity.zombie.step
|
if (id < 587) return id + 103; // 587 = entity.zombie.step
|
||||||
if (id < 588) return id + 107; // 588 = entity.zombie_horse.ambient
|
if (id < 588) return id + 107; // 588 = entity.zombie_horse.ambient
|
||||||
if (id < 591) return id + 97; // 591 = entity.zombie_pigman.ambient
|
if (id < 591) return id + 97; // 591 = entity.zombie_pigman.ambient
|
||||||
if (id < 595) return id + 99; // 595 = entity.zombie_villager.ambient
|
if (id < 595) return id + 99; // 595 = entity.zombie_villager.ambient
|
||||||
if (id < 601) return id + 100; // 601 = item.armor.equip_chain
|
if (id < 601) return id + 100; // 601 = item.armor.equip_chain
|
||||||
if (id < 609) return id + -586; // 609 = item.axe.strip
|
if (id < 609) return id + -586; // 609 = item.axe.strip
|
||||||
if (id < 610) return id + -579; // 610 = item.bottle.empty
|
if (id < 610) return id + -579; // 610 = item.bottle.empty
|
||||||
if (id < 613) return id + -552; // 613 = item.bucket.empty
|
if (id < 613) return id + -552; // 613 = item.bucket.empty
|
||||||
if (id < 619) return id + -546; // 619 = item.chorus_fruit.teleport
|
if (id < 619) return id + -546; // 619 = item.chorus_fruit.teleport
|
||||||
if (id < 620) return id + -530; // 620 = item.elytra.flying
|
if (id < 620) return id + -530; // 620 = item.elytra.flying
|
||||||
if (id < 621) return id + -463; // 621 = item.firecharge.use
|
if (id < 621) return id + -463; // 621 = item.firecharge.use
|
||||||
if (id < 622) return id + -425; // 622 = item.flintandsteel.use
|
if (id < 622) return id + -425; // 622 = item.flintandsteel.use
|
||||||
if (id < 623) return id + -414; // 623 = item.hoe.till
|
if (id < 623) return id + -414; // 623 = item.hoe.till
|
||||||
if (id < 624) return id + -363; // 624 = item.shield.block
|
if (id < 624) return id + -363; // 624 = item.shield.block
|
||||||
if (id < 627) return id + -119; // 627 = item.totem.use
|
if (id < 627) return id + -119; // 627 = item.totem.use
|
||||||
if (id < 636) return id + -38; // 636 = music.creative
|
if (id < 636) return id + -38; // 636 = music.creative
|
||||||
if (id < 644) return id + -281; // 644 = music_disc.11
|
if (id < 644) return id + -281; // 644 = music_disc.11
|
||||||
if (id < 656) return id + -166; // 656 = ui.button.click
|
if (id < 656) return id + -166; // 656 = ui.button.click
|
||||||
if (id < 657) return id + -38; // 657 = ui.toast.challenge_complete
|
if (id < 657) return id + -38; // 657 = ui.toast.challenge_complete
|
||||||
if (id < 660) return id + -36; // 660 = weather.rain
|
if (id < 660) return id + -36; // 660 = weather.rain
|
||||||
return id + -21;
|
return id + -21;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockStateId(int id) {
|
public static int getNewBlockStateId(int id) {
|
||||||
if (id < 1121) return id;
|
if (id < 1121) return id;
|
||||||
else if (id < 3108) return id + 3;
|
else if (id < 3108) return id + 3;
|
||||||
else if (id < 3278) return id + 163;
|
else if (id < 3278) return id + 163;
|
||||||
else if (id < 3978) return id + 203;
|
else if (id < 3978) return id + 203;
|
||||||
else if (id < 3984) return id + 207;
|
else if (id < 3984) return id + 207;
|
||||||
else if (id < 3988) return id + 197;
|
else if (id < 3988) return id + 197;
|
||||||
else if (id < 5284) return id + 203;
|
else if (id < 5284) return id + 203;
|
||||||
else if (id < 7300) return id + 206;
|
else if (id < 7300) return id + 206;
|
||||||
else if (id < 8591) return id + 212;
|
else if (id < 8591) return id + 212;
|
||||||
else if (id < 8595) return id + 226;
|
else if (id < 8595) return id + 226;
|
||||||
else return id + 2192;
|
else return id + 2192;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockId(int id) {
|
public static int getNewBlockId(int id) {
|
||||||
// AUTO GENERATED
|
// AUTO GENERATED
|
||||||
if (id < 128) return id + 0; // 128 = minecraft:brown_mushroom
|
if (id < 128) return id + 0; // 128 = minecraft:brown_mushroom
|
||||||
if (id < 151) return id + 3; // 151 = minecraft:oak_door
|
if (id < 151) return id + 3; // 151 = minecraft:oak_door
|
||||||
if (id < 156) return id + 8; // 156 = minecraft:lever
|
if (id < 156) return id + 8; // 156 = minecraft:lever
|
||||||
if (id < 208) return id + 13; // 208 = minecraft:infested_stone
|
if (id < 208) return id + 13; // 208 = minecraft:infested_stone
|
||||||
if (id < 214) return id + 17; // 214 = minecraft:stone_bricks
|
if (id < 214) return id + 17; // 214 = minecraft:stone_bricks
|
||||||
if (id < 218) return id + 7; // 218 = minecraft:brown_mushroom_block
|
if (id < 218) return id + 7; // 218 = minecraft:brown_mushroom_block
|
||||||
if (id < 278) return id + 13; // 278 = minecraft:potted_red_mushroom
|
if (id < 278) return id + 13; // 278 = minecraft:potted_red_mushroom
|
||||||
if (id < 435) return id + 16; // 435 = minecraft:sandstone_slab
|
if (id < 435) return id + 16; // 435 = minecraft:sandstone_slab
|
||||||
if (id < 594) return id + 17; // 594 = minecraft:void_air
|
if (id < 594) return id + 17; // 594 = minecraft:void_air
|
||||||
if (id < 597) return id + 20; // 597 = minecraft:structure_block
|
if (id < 597) return id + 20; // 597 = minecraft:structure_block
|
||||||
return id + 59;
|
return id + 59;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection userConnection) {
|
public void init(UserConnection userConnection) {
|
||||||
userConnection.put(new EntityTracker(userConnection));
|
userConnection.put(new EntityTracker(userConnection));
|
||||||
if (!userConnection.has(ClientWorld.class))
|
if (!userConnection.has(ClientWorld.class))
|
||||||
userConnection.put(new ClientWorld(userConnection));
|
userConnection.put(new ClientWorld(userConnection));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,62 +6,62 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class EntityTypeRewriter {
|
public class EntityTypeRewriter {
|
||||||
private static Map<Integer, Integer> entityTypes = new HashMap<>();
|
private static Map<Integer, Integer> entityTypes = new HashMap<>();
|
||||||
private static Map<Integer, Integer> objectTypes = new HashMap<>();
|
private static Map<Integer, Integer> objectTypes = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
regEnt(74, 75); // egg
|
regEnt(74, 75); // egg
|
||||||
regEnt(75, 76); // ender_pearl
|
regEnt(75, 76); // ender_pearl
|
||||||
regEnt(76, 77); // experience_bottle
|
regEnt(76, 77); // experience_bottle
|
||||||
regEnt(93, 96); // fishing_bobber
|
regEnt(93, 96); // fishing_bobber
|
||||||
regEnt(80, 81); // iron_golem
|
regEnt(80, 81); // iron_golem
|
||||||
regEnt(91, 94); // lightning_bolt
|
regEnt(91, 94); // lightning_bolt
|
||||||
regEnt(50, 51); // parrot
|
regEnt(50, 51); // parrot
|
||||||
regEnt(90, 92); // phantom
|
regEnt(90, 92); // phantom
|
||||||
regEnt(51, 52); // pig
|
regEnt(51, 52); // pig
|
||||||
regEnt(92, 95); // player
|
regEnt(92, 95); // player
|
||||||
regEnt(54, 55); // polar_bear
|
regEnt(54, 55); // polar_bear
|
||||||
regEnt(77, 78); // potion
|
regEnt(77, 78); // potion
|
||||||
regEnt(52, 53); // pufferfish
|
regEnt(52, 53); // pufferfish
|
||||||
regEnt(56, 57); // rabbit
|
regEnt(56, 57); // rabbit
|
||||||
regEnt(57, 58); // salmon
|
regEnt(57, 58); // salmon
|
||||||
regEnt(58, 59); // sheep
|
regEnt(58, 59); // sheep
|
||||||
regEnt(59, 60); // shulker
|
regEnt(59, 60); // shulker
|
||||||
regEnt(60, 61); // shulker_bullet
|
regEnt(60, 61); // shulker_bullet
|
||||||
regEnt(61, 62); // silverfish
|
regEnt(61, 62); // silverfish
|
||||||
regEnt(62, 63); // skeleton
|
regEnt(62, 63); // skeleton
|
||||||
regEnt(63, 64); // skeleton_horse
|
regEnt(63, 64); // skeleton_horse
|
||||||
regEnt(64, 65); // slime
|
regEnt(64, 65); // slime
|
||||||
regEnt(65, 66); // small_fireball
|
regEnt(65, 66); // small_fireball
|
||||||
regEnt(66, 67); // snowgolem
|
regEnt(66, 67); // snowgolem
|
||||||
regEnt(67, 68); // snowball
|
regEnt(67, 68); // snowball
|
||||||
regEnt(68, 69); // spectral_arrow
|
regEnt(68, 69); // spectral_arrow
|
||||||
regEnt(69, 70); // spider
|
regEnt(69, 70); // spider
|
||||||
regEnt(70, 71); // squid
|
regEnt(70, 71); // squid
|
||||||
regEnt(71, 72); // stray
|
regEnt(71, 72); // stray
|
||||||
regEnt(55, 56); // tnt
|
regEnt(55, 56); // tnt
|
||||||
regEnt(94, 97); // trident
|
regEnt(94, 97); // trident
|
||||||
regEnt(72, 73); // tropical_fish
|
regEnt(72, 73); // tropical_fish
|
||||||
regEnt(73, 74); // turtle
|
regEnt(73, 74); // turtle
|
||||||
regEnt(78, 79); // vex
|
regEnt(78, 79); // vex
|
||||||
regEnt(79, 80); // villager
|
regEnt(79, 80); // villager
|
||||||
regEnt(81, 82); // vindicator
|
regEnt(81, 82); // vindicator
|
||||||
regEnt(82, 84); // witch
|
regEnt(82, 84); // witch
|
||||||
regEnt(83, 85); // wither
|
regEnt(83, 85); // wither
|
||||||
regEnt(84, 86); // wither_skeleton
|
regEnt(84, 86); // wither_skeleton
|
||||||
regEnt(85, 87); // wither_skull
|
regEnt(85, 87); // wither_skull
|
||||||
regEnt(86, 88); // wolf
|
regEnt(86, 88); // wolf
|
||||||
regEnt(87, 89); // zombie
|
regEnt(87, 89); // zombie
|
||||||
regEnt(88, 90); // zombie_horse
|
regEnt(88, 90); // zombie_horse
|
||||||
regEnt(53, 54); // zombie_pigman
|
regEnt(53, 54); // zombie_pigman
|
||||||
regEnt(89, 91); // zombie_villager
|
regEnt(89, 91); // zombie_villager
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void regEnt(int type1_13, int type1_14) {
|
private static void regEnt(int type1_13, int type1_14) {
|
||||||
entityTypes.put(type1_13, type1_14);
|
entityTypes.put(type1_13, type1_14);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<Integer> getNewId(int type1_13) {
|
public static Optional<Integer> getNewId(int type1_13) {
|
||||||
return Optional.fromNullable(entityTypes.get(type1_13));
|
return Optional.fromNullable(entityTypes.get(type1_13));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,163 +16,163 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
|
|||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
|
||||||
// Spawn entity
|
// Spawn entity
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0, 0x0, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x0, 0x0, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
map(Type.UUID); // 1 - UUID
|
map(Type.UUID); // 1 - UUID
|
||||||
map(Type.BYTE); // 2 - Type
|
map(Type.BYTE); // 2 - Type
|
||||||
map(Type.DOUBLE); // 3 - X
|
map(Type.DOUBLE); // 3 - X
|
||||||
map(Type.DOUBLE); // 4 - Y
|
map(Type.DOUBLE); // 4 - Y
|
||||||
map(Type.DOUBLE); // 5 - Z
|
map(Type.DOUBLE); // 5 - Z
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
map(Type.BYTE); // 7 - Yaw
|
map(Type.BYTE); // 7 - Yaw
|
||||||
map(Type.INT); // 8 - Data
|
map(Type.INT); // 8 - Data
|
||||||
|
|
||||||
// Track Entity
|
// Track Entity
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
byte type = wrapper.get(Type.BYTE, 0);
|
byte type = wrapper.get(Type.BYTE, 0);
|
||||||
Entity1_14Types.EntityType entType = Entity1_14Types.getTypeFromId(type, true);
|
Entity1_14Types.EntityType entType = Entity1_14Types.getTypeFromId(type, true);
|
||||||
|
|
||||||
if (entType != null) {
|
if (entType != null) {
|
||||||
if (entType.is(Entity1_14Types.EntityType.FALLING_BLOCK)) {
|
if (entType.is(Entity1_14Types.EntityType.FALLING_BLOCK)) {
|
||||||
int data = wrapper.get(Type.INT, 0);
|
int data = wrapper.get(Type.INT, 0);
|
||||||
wrapper.set(Type.INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(data));
|
wrapper.set(Type.INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Register Type ID
|
// Register Type ID
|
||||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn mob packet
|
// Spawn mob packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3, 0x3, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x3, 0x3, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.UUID); // 1 - Entity UUID
|
map(Type.UUID); // 1 - Entity UUID
|
||||||
map(Type.VAR_INT); // 2 - Entity Type
|
map(Type.VAR_INT); // 2 - Entity Type
|
||||||
map(Type.DOUBLE); // 3 - X
|
map(Type.DOUBLE); // 3 - X
|
||||||
map(Type.DOUBLE); // 4 - Y
|
map(Type.DOUBLE); // 4 - Y
|
||||||
map(Type.DOUBLE); // 5 - Z
|
map(Type.DOUBLE); // 5 - Z
|
||||||
map(Type.BYTE); // 6 - Yaw
|
map(Type.BYTE); // 6 - Yaw
|
||||||
map(Type.BYTE); // 7 - Pitch
|
map(Type.BYTE); // 7 - Pitch
|
||||||
map(Type.BYTE); // 8 - Head Pitch
|
map(Type.BYTE); // 8 - Head Pitch
|
||||||
map(Type.SHORT); // 9 - Velocity X
|
map(Type.SHORT); // 9 - Velocity X
|
||||||
map(Type.SHORT); // 10 - Velocity Y
|
map(Type.SHORT); // 10 - Velocity Y
|
||||||
map(Type.SHORT); // 11 - Velocity Z
|
map(Type.SHORT); // 11 - Velocity Z
|
||||||
map(Types1_13_2.METADATA_LIST); // 12 - Metadata
|
map(Types1_13_2.METADATA_LIST); // 12 - Metadata
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
int type = wrapper.get(Type.VAR_INT, 1);
|
int type = wrapper.get(Type.VAR_INT, 1);
|
||||||
|
|
||||||
type = EntityTypeRewriter.getNewId(type).or(type);
|
type = EntityTypeRewriter.getNewId(type).or(type);
|
||||||
|
|
||||||
Entity1_14Types.EntityType entType = Entity1_14Types.getTypeFromId(type, false);
|
Entity1_14Types.EntityType entType = Entity1_14Types.getTypeFromId(type, false);
|
||||||
|
|
||||||
wrapper.set(Type.VAR_INT, 1, type);
|
wrapper.set(Type.VAR_INT, 1, type);
|
||||||
|
|
||||||
// Register Type ID
|
// Register Type ID
|
||||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
||||||
|
|
||||||
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn painting
|
// Spawn painting
|
||||||
protocol.registerOutgoing(State.PLAY, 0x04, 0x04, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x04, 0x04, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.UUID);
|
map(Type.UUID);
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
map(Type.BYTE);
|
map(Type.BYTE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn player packet
|
// Spawn player packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.UUID); // 1 - Player UUID
|
map(Type.UUID); // 1 - Player UUID
|
||||||
map(Type.DOUBLE); // 2 - X
|
map(Type.DOUBLE); // 2 - X
|
||||||
map(Type.DOUBLE); // 3 - Y
|
map(Type.DOUBLE); // 3 - Y
|
||||||
map(Type.DOUBLE); // 4 - Z
|
map(Type.DOUBLE); // 4 - Z
|
||||||
map(Type.BYTE); // 5 - Yaw
|
map(Type.BYTE); // 5 - Yaw
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
map(Types1_13_2.METADATA_LIST); // 7 - Metadata
|
map(Types1_13_2.METADATA_LIST); // 7 - Metadata
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
|
||||||
Entity1_14Types.EntityType entType = Entity1_14Types.EntityType.PLAYER;
|
Entity1_14Types.EntityType entType = Entity1_14Types.EntityType.PLAYER;
|
||||||
// Register Type ID
|
// Register Type ID
|
||||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
||||||
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use bed
|
// Use bed
|
||||||
protocol.registerOutgoing(State.PLAY, 0x33, 0x33, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x33, 0x33, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
// Destroy entities
|
||||||
protocol.registerOutgoing(State.PLAY, 0x35, 0x35, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x35, 0x35, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT_ARRAY); // 0 - Entity IDS
|
map(Type.VAR_INT_ARRAY); // 0 - Entity IDS
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0))
|
for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0))
|
||||||
wrapper.user().get(EntityTracker.class).removeEntity(entity);
|
wrapper.user().get(EntityTracker.class).removeEntity(entity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Metadata packet
|
// Metadata packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Types1_13_2.METADATA_LIST); // 1 - Metadata list
|
map(Types1_13_2.METADATA_LIST); // 1 - Metadata list
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
|
||||||
Optional<Entity1_14Types.EntityType> type = wrapper.user().get(EntityTracker.class).get(entityId);
|
Optional<Entity1_14Types.EntityType> type = wrapper.user().get(EntityTracker.class).get(entityId);
|
||||||
MetadataRewriter.handleMetadata(entityId, type.orNull(), wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
MetadataRewriter.handleMetadata(entityId, type.orNull(), wrapper.get(Types1_13_2.METADATA_LIST, 0), wrapper.user());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,234 +10,234 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
|
|
||||||
public class InventoryPackets {
|
public class InventoryPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Outgoing packets
|
Outgoing packets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Set slot packet
|
// Set slot packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot ID
|
map(Type.SHORT); // 1 - Slot ID
|
||||||
map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
map(Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window items packet
|
// Window items packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x15, 0x15, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x15, 0x15, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.FLAT_VAR_INT_ITEM_ARRAY); // 1 - Window Values
|
map(Type.FLAT_VAR_INT_ITEM_ARRAY); // 1 - Window Values
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
Item[] stacks = wrapper.get(Type.FLAT_VAR_INT_ITEM_ARRAY, 0);
|
Item[] stacks = wrapper.get(Type.FLAT_VAR_INT_ITEM_ARRAY, 0);
|
||||||
for (Item stack : stacks) toClient(stack);
|
for (Item stack : stacks) toClient(stack);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Plugin message
|
// Plugin message
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Channel
|
map(Type.STRING); // Channel
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
String channel = wrapper.get(Type.STRING, 0);
|
String channel = wrapper.get(Type.STRING, 0);
|
||||||
if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {
|
if (channel.equals("minecraft:trader_list") || channel.equals("trader_list")) {
|
||||||
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
||||||
|
|
||||||
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
// Input Item
|
// Input Item
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
// Output Item
|
// Output Item
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
|
|
||||||
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
||||||
if (secondItem) {
|
if (secondItem) {
|
||||||
// Second Item
|
// Second Item
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
// Entity Equipment Packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
map(Type.VAR_INT); // 1 - Slot ID
|
map(Type.VAR_INT); // 1 - Slot ID
|
||||||
map(Type.FLAT_VAR_INT_ITEM); // 2 - Item
|
map(Type.FLAT_VAR_INT_ITEM); // 2 - Item
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
toClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare Recipes
|
// Declare Recipes
|
||||||
protocol.registerOutgoing(State.PLAY, 0x54, 0x55, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x54, 0x55, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int size = wrapper.passthrough(Type.VAR_INT);
|
int size = wrapper.passthrough(Type.VAR_INT);
|
||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
String id = wrapper.read(Type.STRING); // Recipe Identifier
|
String id = wrapper.read(Type.STRING); // Recipe Identifier
|
||||||
String type = wrapper.read(Type.STRING);
|
String type = wrapper.read(Type.STRING);
|
||||||
if (type.equals("crafting_special_banneraddpattern")) {
|
if (type.equals("crafting_special_banneraddpattern")) {
|
||||||
deleted++;
|
deleted++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wrapper.write(Type.STRING, id);
|
wrapper.write(Type.STRING, id);
|
||||||
wrapper.write(Type.STRING, type);
|
wrapper.write(Type.STRING, type);
|
||||||
|
|
||||||
if (type.equals("crafting_shapeless")) {
|
if (type.equals("crafting_shapeless")) {
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
int ingredientsNo = wrapper.passthrough(Type.VAR_INT);
|
int ingredientsNo = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int j = 0; j < ingredientsNo; j++) {
|
for (int j = 0; j < ingredientsNo; j++) {
|
||||||
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
for (Item item : items) toClient(item);
|
for (Item item : items) toClient(item);
|
||||||
}
|
}
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
||||||
} else if (type.equals("crafting_shaped")) {
|
} else if (type.equals("crafting_shaped")) {
|
||||||
int ingredientsNo = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
int ingredientsNo = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
for (int j = 0; j < ingredientsNo; j++) {
|
for (int j = 0; j < ingredientsNo; j++) {
|
||||||
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
for (Item item : items) toClient(item);
|
for (Item item : items) toClient(item);
|
||||||
}
|
}
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
||||||
} else if (type.equals("smelting")) {
|
} else if (type.equals("smelting")) {
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
for (Item item : items) toClient(item);
|
for (Item item : items) toClient(item);
|
||||||
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
wrapper.passthrough(Type.FLOAT); // EXP
|
wrapper.passthrough(Type.FLOAT); // EXP
|
||||||
wrapper.passthrough(Type.VAR_INT); // Cooking time
|
wrapper.passthrough(Type.VAR_INT); // Cooking time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.set(Type.VAR_INT, 0, size - deleted);
|
wrapper.set(Type.VAR_INT, 0, size - deleted);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Incoming packets
|
Incoming packets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Click window packet
|
// Click window packet
|
||||||
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
map(Type.SHORT); // 1 - Slot
|
map(Type.SHORT); // 1 - Slot
|
||||||
map(Type.BYTE); // 2 - Button
|
map(Type.BYTE); // 2 - Button
|
||||||
map(Type.SHORT); // 3 - Action number
|
map(Type.SHORT); // 3 - Action number
|
||||||
map(Type.VAR_INT); // 4 - Mode
|
map(Type.VAR_INT); // 4 - Mode
|
||||||
map(Type.FLAT_VAR_INT_ITEM); // 5 - Clicked Item
|
map(Type.FLAT_VAR_INT_ITEM); // 5 - Clicked Item
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
toServer(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
toServer(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Creative Inventory Action
|
// Creative Inventory Action
|
||||||
protocol.registerIncoming(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.SHORT); // 0 - Slot
|
map(Type.SHORT); // 0 - Slot
|
||||||
map(Type.FLAT_VAR_INT_ITEM); // 1 - Clicked Item
|
map(Type.FLAT_VAR_INT_ITEM); // 1 - Clicked Item
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
toServer(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
toServer(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
item.setId((short) getNewItemId(item.getId()));
|
item.setId((short) getNewItemId(item.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewItemId(int id) {
|
public static int getNewItemId(int id) {
|
||||||
if (id < 108) return id;
|
if (id < 108) return id;
|
||||||
else if (id < 119) return id + 3;
|
else if (id < 119) return id + 3;
|
||||||
else if (id < 460) return id + 4;
|
else if (id < 460) return id + 4;
|
||||||
else if (id < 542) return id + 43;
|
else if (id < 542) return id + 43;
|
||||||
else if (id < 561) return id + 48;
|
else if (id < 561) return id + 48;
|
||||||
else if (id < 593) return id + 49;
|
else if (id < 593) return id + 49;
|
||||||
else if (id < 657) return id + 53;
|
else if (id < 657) return id + 53;
|
||||||
else if (id < 662) return id + 54;
|
else if (id < 662) return id + 54;
|
||||||
else if (id < 665) return id + 55;
|
else if (id < 665) return id + 55;
|
||||||
else return id + 56;
|
else return id + 56;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toServer(Item item) {
|
public static void toServer(Item item) {
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
item.setId((short) getOldItemId(item.getId()));
|
item.setId((short) getOldItemId(item.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getOldItemId(int id) {
|
public static int getOldItemId(int id) {
|
||||||
if (id < 108) return id;
|
if (id < 108) return id;
|
||||||
else if (id < 111) return 1;
|
else if (id < 111) return 1;
|
||||||
else if (id < 122) return id - 3;
|
else if (id < 122) return id - 3;
|
||||||
else if (id < 123) return 1;
|
else if (id < 123) return 1;
|
||||||
else if (id < 464) return id - 4;
|
else if (id < 464) return id - 4;
|
||||||
else if (id < 503) return 1;
|
else if (id < 503) return 1;
|
||||||
else if (id < 585) return id - 43;
|
else if (id < 585) return id - 43;
|
||||||
else if (id < 590) return 1;
|
else if (id < 590) return 1;
|
||||||
else if (id < 609) return id - 48;
|
else if (id < 609) return id - 48;
|
||||||
else if (id < 610) return 1;
|
else if (id < 610) return 1;
|
||||||
else if (id < 642) return id - 49;
|
else if (id < 642) return id - 49;
|
||||||
else if (id < 646) return 1;
|
else if (id < 646) return 1;
|
||||||
else if (id < 710) return id - 53;
|
else if (id < 710) return id - 53;
|
||||||
else if (id < 711) return 1;
|
else if (id < 711) return 1;
|
||||||
else if (id < 716) return id - 54;
|
else if (id < 716) return id - 54;
|
||||||
else if (id < 717) return 1;
|
else if (id < 717) return 1;
|
||||||
else if (id < 720) return id - 55;
|
else if (id < 720) return id - 55;
|
||||||
else if (id < 721) return 1;
|
else if (id < 721) return 1;
|
||||||
else if (id < 846) return id - 56;
|
else if (id < 846) return id - 56;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,65 +7,65 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
|
|
||||||
public class PlayerPackets {
|
public class PlayerPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
|
||||||
// Open Sign Editor
|
// Open Sign Editor
|
||||||
protocol.registerOutgoing(State.PLAY, 0x2C, 0x2C, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x2C, 0x2C, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Query Block NBT
|
// Query Block NBT
|
||||||
protocol.registerIncoming(State.PLAY, 0x01, 0x01, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x01, 0x01, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Player Digging
|
// Player Digging
|
||||||
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
map(Type.BYTE);
|
map(Type.BYTE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Command Block
|
// Update Command Block
|
||||||
protocol.registerIncoming(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Structure Block
|
// Update Structure Block
|
||||||
protocol.registerIncoming(State.PLAY, 0x25, 0x25, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x25, 0x25, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Sign
|
// Update Sign
|
||||||
protocol.registerIncoming(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Player Block Placement
|
// Player Block Placement
|
||||||
protocol.registerIncoming(State.PLAY, 0x29, 0x29, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x29, 0x29, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,252 +18,252 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
|||||||
|
|
||||||
public class WorldPackets {
|
public class WorldPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
|
||||||
// Block break animation
|
// Block break animation
|
||||||
protocol.registerOutgoing(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
map(Type.BYTE);
|
map(Type.BYTE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update block entity
|
// Update block entity
|
||||||
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Action
|
// Block Action
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14); // Location
|
map(Type.POSITION, Type.POSITION1_14); // Location
|
||||||
map(Type.UNSIGNED_BYTE); // Action id
|
map(Type.UNSIGNED_BYTE); // Action id
|
||||||
map(Type.UNSIGNED_BYTE); // Action param
|
map(Type.UNSIGNED_BYTE); // Action param
|
||||||
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
|
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
|
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Change
|
// Block Change
|
||||||
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int id = wrapper.get(Type.VAR_INT, 0);
|
int id = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
|
||||||
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(id));
|
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Multi Block Change
|
// Multi Block Change
|
||||||
protocol.registerOutgoing(State.PLAY, 0xF, 0xF, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0xF, 0xF, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
map(Type.INT); // 1 - Chunk Z
|
map(Type.INT); // 1 - Chunk Z
|
||||||
map(Type.BLOCK_CHANGE_RECORD_ARRAY); // 2 - Records
|
map(Type.BLOCK_CHANGE_RECORD_ARRAY); // 2 - Records
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
// Convert ids
|
// Convert ids
|
||||||
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
||||||
int id = record.getBlockId();
|
int id = record.getBlockId();
|
||||||
record.setBlockId(Protocol1_14To1_13_2.getNewBlockStateId(id));
|
record.setBlockId(Protocol1_14To1_13_2.getNewBlockStateId(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Chunk
|
//Chunk
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
||||||
Chunk chunk = wrapper.read(new Chunk1_13Type(clientWorld));
|
Chunk chunk = wrapper.read(new Chunk1_13Type(clientWorld));
|
||||||
wrapper.write(new Chunk1_14Type(clientWorld), chunk);
|
wrapper.write(new Chunk1_14Type(clientWorld), chunk);
|
||||||
|
|
||||||
for (ChunkSection section : chunk.getSections()) {
|
for (ChunkSection section : chunk.getSections()) {
|
||||||
if (section == null) continue;
|
if (section == null) continue;
|
||||||
boolean hasBlock = false;
|
boolean hasBlock = false;
|
||||||
for (int i = 0; i < section.getPalette().size(); i++) {
|
for (int i = 0; i < section.getPalette().size(); i++) {
|
||||||
int old = section.getPalette().get(i);
|
int old = section.getPalette().get(i);
|
||||||
if (!hasBlock && !(old == 0 || old == 8591 || old == 8592)) { // air, void_air, cave_air
|
if (!hasBlock && !(old == 0 || old == 8591 || old == 8592)) { // air, void_air, cave_air
|
||||||
hasBlock = true;
|
hasBlock = true;
|
||||||
}
|
}
|
||||||
int newId = Protocol1_14To1_13_2.getNewBlockStateId(old);
|
int newId = Protocol1_14To1_13_2.getNewBlockStateId(old);
|
||||||
section.getPalette().set(i, newId);
|
section.getPalette().set(i, newId);
|
||||||
}
|
}
|
||||||
if (!hasBlock) {
|
if (!hasBlock) {
|
||||||
section.setNonAirBlocksCount(0);
|
section.setNonAirBlocksCount(0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int nonAirBlockCount = 0;
|
int nonAirBlockCount = 0;
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
int id = section.getFlatBlock(x, y, z);
|
int id = section.getFlatBlock(x, y, z);
|
||||||
if (id == 0 || id == 8591 || id == 8592) {
|
if (id == 0 || id == 8591 || id == 8592) {
|
||||||
nonAirBlockCount++;
|
nonAirBlockCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section.setNonAirBlocksCount(nonAirBlockCount);
|
section.setNonAirBlocksCount(nonAirBlockCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketWrapper lightPacket = wrapper.create(0x57);
|
PacketWrapper lightPacket = wrapper.create(0x57);
|
||||||
lightPacket.write(Type.VAR_INT, chunk.getX());
|
lightPacket.write(Type.VAR_INT, chunk.getX());
|
||||||
lightPacket.write(Type.VAR_INT, chunk.getZ());
|
lightPacket.write(Type.VAR_INT, chunk.getZ());
|
||||||
int skyLightMask = 0;
|
int skyLightMask = 0;
|
||||||
int blockLightMask = 0;
|
int blockLightMask = 0;
|
||||||
for (int i = 0; i < chunk.getSections().length; i++) {
|
for (int i = 0; i < chunk.getSections().length; i++) {
|
||||||
ChunkSection sec = chunk.getSections()[i];
|
ChunkSection sec = chunk.getSections()[i];
|
||||||
if (sec == null) continue;
|
if (sec == null) continue;
|
||||||
if (sec.hasSkyLight()) {
|
if (sec.hasSkyLight()) {
|
||||||
skyLightMask |= (1 << (i + 1));
|
skyLightMask |= (1 << (i + 1));
|
||||||
}
|
}
|
||||||
blockLightMask |= (1 << (i + 1));
|
blockLightMask |= (1 << (i + 1));
|
||||||
}
|
}
|
||||||
lightPacket.write(Type.VAR_INT, skyLightMask);
|
lightPacket.write(Type.VAR_INT, skyLightMask);
|
||||||
lightPacket.write(Type.VAR_INT, blockLightMask);
|
lightPacket.write(Type.VAR_INT, blockLightMask);
|
||||||
for (ChunkSection section : chunk.getSections()) {
|
for (ChunkSection section : chunk.getSections()) {
|
||||||
if (section == null || !section.hasSkyLight()) continue;
|
if (section == null || !section.hasSkyLight()) continue;
|
||||||
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
||||||
section.writeSkyLight(buf);
|
section.writeSkyLight(buf);
|
||||||
byte[] data = new byte[buf.readableBytes()];
|
byte[] data = new byte[buf.readableBytes()];
|
||||||
buf.readBytes(data);
|
buf.readBytes(data);
|
||||||
buf.release();
|
buf.release();
|
||||||
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
||||||
}
|
}
|
||||||
for (ChunkSection section : chunk.getSections()) {
|
for (ChunkSection section : chunk.getSections()) {
|
||||||
if (section == null) continue;
|
if (section == null) continue;
|
||||||
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
||||||
section.writeBlockLight(buf);
|
section.writeBlockLight(buf);
|
||||||
byte[] data = new byte[buf.readableBytes()];
|
byte[] data = new byte[buf.readableBytes()];
|
||||||
buf.readBytes(data);
|
buf.readBytes(data);
|
||||||
buf.release();
|
buf.release();
|
||||||
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
||||||
}
|
}
|
||||||
lightPacket.send(Protocol1_14To1_13_2.class);
|
lightPacket.send(Protocol1_14To1_13_2.class);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Effect packet
|
// Effect packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Effect Id
|
map(Type.INT); // Effect Id
|
||||||
map(Type.POSITION, Type.POSITION1_14); // Location
|
map(Type.POSITION, Type.POSITION1_14); // Location
|
||||||
map(Type.INT); // Data
|
map(Type.INT); // Data
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int id = wrapper.get(Type.INT, 0);
|
int id = wrapper.get(Type.INT, 0);
|
||||||
int data = wrapper.get(Type.INT, 1);
|
int data = wrapper.get(Type.INT, 1);
|
||||||
if (id == 1010) { // Play record
|
if (id == 1010) { // Play record
|
||||||
wrapper.set(Type.INT, 1, data = InventoryPackets.getNewItemId(data));
|
wrapper.set(Type.INT, 1, data = InventoryPackets.getNewItemId(data));
|
||||||
} else if (id == 2001) { // Block break + block break sound
|
} else if (id == 2001) { // Block break + block break sound
|
||||||
wrapper.set(Type.INT, 1, data = Protocol1_14To1_13_2.getNewBlockStateId(data));
|
wrapper.set(Type.INT, 1, data = Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//spawn particle
|
//spawn particle
|
||||||
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Particle ID
|
map(Type.INT); // 0 - Particle ID
|
||||||
map(Type.BOOLEAN); // 1 - Long Distance
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
map(Type.FLOAT); // 2 - X
|
map(Type.FLOAT); // 2 - X
|
||||||
map(Type.FLOAT); // 3 - Y
|
map(Type.FLOAT); // 3 - Y
|
||||||
map(Type.FLOAT); // 4 - Z
|
map(Type.FLOAT); // 4 - Z
|
||||||
map(Type.FLOAT); // 5 - Offset X
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
map(Type.FLOAT); // 6 - Offset Y
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
map(Type.FLOAT); // 7 - Offset Z
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
map(Type.FLOAT); // 8 - Particle Data
|
map(Type.FLOAT); // 8 - Particle Data
|
||||||
map(Type.INT); // 9 - Particle Count
|
map(Type.INT); // 9 - Particle Count
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int id = wrapper.get(Type.INT, 0);
|
int id = wrapper.get(Type.INT, 0);
|
||||||
if (id == 3 || id == 20) {
|
if (id == 3 || id == 20) {
|
||||||
int data = wrapper.passthrough(Type.VAR_INT);
|
int data = wrapper.passthrough(Type.VAR_INT);
|
||||||
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(data));
|
wrapper.set(Type.VAR_INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||||
} else if (id == 27) {
|
} else if (id == 27) {
|
||||||
InventoryPackets.toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
InventoryPackets.toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//join game
|
//join game
|
||||||
protocol.registerOutgoing(State.PLAY, 0x25, 0x25, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x25, 0x25, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Entity ID
|
map(Type.INT); // 0 - Entity ID
|
||||||
map(Type.UNSIGNED_BYTE); // 1 - Gamemode
|
map(Type.UNSIGNED_BYTE); // 1 - Gamemode
|
||||||
map(Type.INT); // 2 - Dimension
|
map(Type.INT); // 2 - Dimension
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
// Store the player
|
// Store the player
|
||||||
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
|
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
|
||||||
int dimensionId = wrapper.get(Type.INT, 1);
|
int dimensionId = wrapper.get(Type.INT, 1);
|
||||||
clientChunks.setEnvironment(dimensionId);
|
clientChunks.setEnvironment(dimensionId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//respawn
|
//respawn
|
||||||
protocol.registerOutgoing(State.PLAY, 0x38, 0x38, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x38, 0x38, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Dimension ID
|
map(Type.INT); // 0 - Dimension ID
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
||||||
int dimensionId = wrapper.get(Type.INT, 0);
|
int dimensionId = wrapper.get(Type.INT, 0);
|
||||||
clientWorld.setEnvironment(dimensionId);
|
clientWorld.setEnvironment(dimensionId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn position
|
// Spawn position
|
||||||
protocol.registerOutgoing(State.PLAY, 0x49, 0x49, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x49, 0x49, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,25 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class EntityTracker extends StoredObject {
|
public class EntityTracker extends StoredObject {
|
||||||
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public EntityTracker(UserConnection user) {
|
public EntityTracker(UserConnection user) {
|
||||||
super(user);
|
super(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEntity(int entityId) {
|
public void removeEntity(int entityId) {
|
||||||
clientEntityTypes.remove(entityId);
|
clientEntityTypes.remove(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntity(int entityId, Entity1_14Types.EntityType type) {
|
public void addEntity(int entityId, Entity1_14Types.EntityType type) {
|
||||||
clientEntityTypes.put(entityId, type);
|
clientEntityTypes.put(entityId, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(int entityId) {
|
public boolean has(int entityId) {
|
||||||
return clientEntityTypes.containsKey(entityId);
|
return clientEntityTypes.containsKey(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Entity1_14Types.EntityType> get(int id) {
|
public Optional<Entity1_14Types.EntityType> get(int id) {
|
||||||
return Optional.fromNullable(clientEntityTypes.get(id));
|
return Optional.fromNullable(clientEntityTypes.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,90 +19,90 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Chunk1_14Type extends PartialType<Chunk, ClientWorld> {
|
public class Chunk1_14Type extends PartialType<Chunk, ClientWorld> {
|
||||||
|
|
||||||
public Chunk1_14Type(ClientWorld param) {
|
public Chunk1_14Type(ClientWorld param) {
|
||||||
super(param, Chunk.class);
|
super(param, Chunk.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk read(ByteBuf input, ClientWorld world) throws Exception {
|
public Chunk read(ByteBuf input, ClientWorld world) throws Exception {
|
||||||
int chunkX = input.readInt();
|
int chunkX = input.readInt();
|
||||||
int chunkZ = input.readInt();
|
int chunkZ = input.readInt();
|
||||||
|
|
||||||
boolean groundUp = input.readBoolean();
|
boolean groundUp = input.readBoolean();
|
||||||
int primaryBitmask = Type.VAR_INT.read(input);
|
int primaryBitmask = Type.VAR_INT.read(input);
|
||||||
Type.VAR_INT.read(input);
|
Type.VAR_INT.read(input);
|
||||||
|
|
||||||
BitSet usedSections = new BitSet(16);
|
BitSet usedSections = new BitSet(16);
|
||||||
ChunkSection[] sections = new ChunkSection[16];
|
ChunkSection[] sections = new ChunkSection[16];
|
||||||
// Calculate section count from bitmask
|
// Calculate section count from bitmask
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if ((primaryBitmask & (1 << i)) != 0) {
|
if ((primaryBitmask & (1 << i)) != 0) {
|
||||||
usedSections.set(i);
|
usedSections.set(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read sections
|
// Read sections
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (!usedSections.get(i)) continue; // Section not set
|
if (!usedSections.get(i)) continue; // Section not set
|
||||||
short nonAirBlocksCount = input.readShort();
|
short nonAirBlocksCount = input.readShort();
|
||||||
ChunkSection section = Types1_13.CHUNK_SECTION.read(input);
|
ChunkSection section = Types1_13.CHUNK_SECTION.read(input);
|
||||||
section.setNonAirBlocksCount(nonAirBlocksCount);
|
section.setNonAirBlocksCount(nonAirBlocksCount);
|
||||||
sections[i] = section;
|
sections[i] = section;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] biomeData = groundUp ? new byte[256] : null;
|
byte[] biomeData = groundUp ? new byte[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
biomeData[i] = (byte) input.readInt();
|
biomeData[i] = (byte) input.readInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));
|
List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));
|
||||||
|
|
||||||
// Read all the remaining bytes (workaround for #681)
|
// Read all the remaining bytes (workaround for #681)
|
||||||
if (input.readableBytes() > 0) {
|
if (input.readableBytes() > 0) {
|
||||||
byte[] array = Type.REMAINING_BYTES.read(input);
|
byte[] array = Type.REMAINING_BYTES.read(input);
|
||||||
if (Via.getManager().isDebug()) {
|
if (Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Found " + array.length + " more bytes than expected while reading the chunk: " + chunkX + "/" + chunkZ);
|
Via.getPlatform().getLogger().warning("Found " + array.length + " more bytes than expected while reading the chunk: " + chunkX + "/" + chunkZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseChunk(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, nbtData);
|
return new BaseChunk(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, nbtData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf output, ClientWorld world, Chunk chunk) throws Exception {
|
public void write(ByteBuf output, ClientWorld world, Chunk chunk) throws Exception {
|
||||||
output.writeInt(chunk.getX());
|
output.writeInt(chunk.getX());
|
||||||
output.writeInt(chunk.getZ());
|
output.writeInt(chunk.getZ());
|
||||||
|
|
||||||
output.writeBoolean(chunk.isGroundUp());
|
output.writeBoolean(chunk.isGroundUp());
|
||||||
Type.VAR_INT.write(output, chunk.getBitmask());
|
Type.VAR_INT.write(output, chunk.getBitmask());
|
||||||
|
|
||||||
ByteBuf buf = output.alloc().buffer();
|
ByteBuf buf = output.alloc().buffer();
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
ChunkSection section = chunk.getSections()[i];
|
ChunkSection section = chunk.getSections()[i];
|
||||||
if (section == null) continue; // Section not set
|
if (section == null) continue; // Section not set
|
||||||
buf.writeShort(section.getNonAirBlocksCount());
|
buf.writeShort(section.getNonAirBlocksCount());
|
||||||
Types1_13.CHUNK_SECTION.write(buf, section);
|
Types1_13.CHUNK_SECTION.write(buf, section);
|
||||||
}
|
}
|
||||||
buf.readerIndex(0);
|
buf.readerIndex(0);
|
||||||
Type.VAR_INT.write(output, buf.readableBytes() + (chunk.isBiomeData() ? 256 * 4 : 0));
|
Type.VAR_INT.write(output, buf.readableBytes() + (chunk.isBiomeData() ? 256 * 4 : 0));
|
||||||
output.writeBytes(buf);
|
output.writeBytes(buf);
|
||||||
buf.release(); // release buffer
|
buf.release(); // release buffer
|
||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
for (byte value : chunk.getBiomeData()) {
|
for (byte value : chunk.getBiomeData()) {
|
||||||
output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :)
|
output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Block Entities
|
// Write Block Entities
|
||||||
Type.NBT_ARRAY.write(output, chunk.getBlockEntities().toArray(new CompoundTag[0]));
|
Type.NBT_ARRAY.write(output, chunk.getBlockEntities().toArray(new CompoundTag[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Type> getBaseClass() {
|
public Class<? extends Type> getBaseClass() {
|
||||||
return BaseChunkType.class;
|
return BaseChunkType.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk1_8;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
@ -16,7 +17,6 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk1_8;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.CommandBlockProvider;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.CommandBlockProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds.Effect;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds.Effect;
|
||||||
|
@ -258,7 +258,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
} else {
|
} else {
|
||||||
wrapper.write(Type.BYTE, (byte) 3);
|
wrapper.write(Type.BYTE, (byte) 3);
|
||||||
}
|
}
|
||||||
wrapper.write(Type.STRING_ARRAY, new String[] {getUser().get(ProtocolInfo.class).getUsername()});
|
wrapper.write(Type.STRING_ARRAY, new String[]{getUser().get(ProtocolInfo.class).getUsername()});
|
||||||
} else {
|
} else {
|
||||||
wrapper.write(Type.BYTE, (byte) 1); // remove team
|
wrapper.write(Type.BYTE, (byte) 1); // remove team
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk1_8;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||||
import us.myles.ViaVersion.api.type.PartialType;
|
import us.myles.ViaVersion.api.type.PartialType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
@ -12,7 +13,6 @@ import us.myles.ViaVersion.api.type.types.version.Types1_8;
|
|||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4;
|
import us.myles.ViaVersion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk1_8;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>viaversion-jar</name>
|
<name>viaversion-jar</name>
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>viaversion-parent</name>
|
<name>viaversion-parent</name>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.6.1-SNAPSHOT</version>
|
<version>1.6.1-18w43c</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -42,7 +42,8 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<!-- We only run lombok and not sponge in-built mcmod.info generator due to issues with multiversion -->
|
<!-- We only run lombok and not sponge in-built mcmod.info generator due to issues with multiversion -->
|
||||||
<annotationProcessors>
|
<annotationProcessors>
|
||||||
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
|
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
|
||||||
|
</annotationProcessor>
|
||||||
</annotationProcessors>
|
</annotationProcessors>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -17,7 +17,6 @@ import org.spongepowered.api.plugin.PluginContainer;
|
|||||||
import org.spongepowered.api.scheduler.Task;
|
import org.spongepowered.api.scheduler.Task;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.ViaAPI;
|
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||||
import us.myles.ViaVersion.api.configuration.ConfigurationProvider;
|
import us.myles.ViaVersion.api.configuration.ConfigurationProvider;
|
||||||
import us.myles.ViaVersion.api.platform.TaskId;
|
import us.myles.ViaVersion.api.platform.TaskId;
|
||||||
@ -32,10 +31,8 @@ import us.myles.ViaVersion.util.GsonUtil;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@Plugin(id = "viaversion",
|
@Plugin(id = "viaversion",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren