Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-08 13:52:51 +02:00
Use packet type constants for automated channel mapping
Dieser Commit ist enthalten in:
Ursprung
d334a202e7
Commit
5ff7767353
@ -1,43 +1,30 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Matsv
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package nl.matsv.viabackwards.api;
|
package nl.matsv.viabackwards.api;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.protocol.ServerboundPacketType;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
public abstract class BackwardsProtocol extends Protocol {
|
public abstract class BackwardsProtocol<C1 extends ClientboundPacketType, C2 extends ClientboundPacketType, S1 extends ServerboundPacketType, S2 extends ServerboundPacketType>
|
||||||
|
extends Protocol<C1, C2, S1, S2> {
|
||||||
|
|
||||||
protected BackwardsProtocol() {
|
protected BackwardsProtocol() {
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BackwardsProtocol(boolean hasMappingDataToLoad) {
|
protected BackwardsProtocol(boolean hasMappingDataToLoad) {
|
||||||
super(hasMappingDataToLoad);
|
super(hasMappingDataToLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void out(State state, int oldPacketID, int newPacketID) {
|
protected BackwardsProtocol(@Nullable Class<C1> oldClientboundPacketEnum, @Nullable Class<C2> clientboundPacketEnum,
|
||||||
this.registerOutgoing(state, oldPacketID, newPacketID, null);
|
@Nullable Class<S1> oldServerboundPacketEnum, @Nullable Class<S2> serverboundPacketEnum) {
|
||||||
|
super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void out(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
|
protected BackwardsProtocol(@Nullable Class<C1> oldClientboundPacketEnum, @Nullable Class<C2> clientboundPacketEnum,
|
||||||
this.registerOutgoing(state, oldPacketID, newPacketID, packetRemapper);
|
@Nullable Class<S1> oldServerboundPacketEnum, @Nullable Class<S2> serverboundPacketEnum, boolean hasMappingDatatToLoad) {
|
||||||
}
|
super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum, hasMappingDatatToLoad);
|
||||||
|
|
||||||
public void in(State state, int oldPacketID, int newPacketID) {
|
|
||||||
this.registerIncoming(state, oldPacketID, newPacketID, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void in(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
|
|
||||||
this.registerIncoming(state, oldPacketID, newPacketID, packetRemapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@ package nl.matsv.viabackwards.api.data;
|
|||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import nl.matsv.viabackwards.utils.Block;
|
import nl.matsv.viabackwards.utils.Block;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
|
||||||
public class MappedLegacyBlockItem {
|
public class MappedLegacyBlockItem {
|
||||||
@ -12,7 +13,7 @@ public class MappedLegacyBlockItem {
|
|||||||
private final Block block;
|
private final Block block;
|
||||||
private BlockEntityHandler blockEntityHandler;
|
private BlockEntityHandler blockEntityHandler;
|
||||||
|
|
||||||
public MappedLegacyBlockItem(int id, short data, String name, boolean block) {
|
public MappedLegacyBlockItem(int id, short data, @Nullable String name, boolean block) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.name = name != null ? ChatColor.RESET + name : null;
|
this.name = name != null ? ChatColor.RESET + name : null;
|
||||||
@ -43,11 +44,12 @@ public class MappedLegacyBlockItem {
|
|||||||
return blockEntityHandler != null;
|
return blockEntityHandler != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public BlockEntityHandler getBlockEntityHandler() {
|
public BlockEntityHandler getBlockEntityHandler() {
|
||||||
return blockEntityHandler;
|
return blockEntityHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockEntityHandler(BlockEntityHandler blockEntityHandler) {
|
public void setBlockEntityHandler(@Nullable BlockEntityHandler blockEntityHandler) {
|
||||||
this.blockEntityHandler = blockEntityHandler;
|
this.blockEntityHandler = blockEntityHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nl.matsv.viabackwards.api.data;
|
package nl.matsv.viabackwards.api.data;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.data.Mappings;
|
import us.myles.ViaVersion.api.data.Mappings;
|
||||||
import us.myles.viaversion.libs.gson.JsonArray;
|
import us.myles.viaversion.libs.gson.JsonArray;
|
||||||
import us.myles.viaversion.libs.gson.JsonElement;
|
import us.myles.viaversion.libs.gson.JsonElement;
|
||||||
@ -31,6 +32,7 @@ public class VBSoundMappings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getNewId(String oldId) {
|
public String getNewId(String oldId) {
|
||||||
return namedSoundMappings.get(oldId);
|
return namedSoundMappings.get(oldId);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ package nl.matsv.viabackwards.api.entities.meta;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
|
||||||
@ -78,6 +79,7 @@ public class MetaHandlerEvent {
|
|||||||
/**
|
/**
|
||||||
* May be null, use {@link #createMeta(Metadata)} for adding metadata.
|
* May be null, use {@link #createMeta(Metadata)} for adding metadata.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public List<Metadata> getExtraData() {
|
public List<Metadata> getExtraData() {
|
||||||
return extraData;
|
return extraData;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
package nl.matsv.viabackwards.api.entities.meta;
|
package nl.matsv.viabackwards.api.entities.meta;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.entities.EntityType;
|
import us.myles.ViaVersion.api.entities.EntityType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ public class MetaHandlerSettings {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(MetaHandler handler) {
|
public void handle(@Nullable MetaHandler handler) {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ public class MetaHandlerSettings {
|
|||||||
return filterIndex;
|
return filterIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public MetaHandler getHandler() {
|
public MetaHandler getHandler() {
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
package nl.matsv.viabackwards.api.entities.storage;
|
package nl.matsv.viabackwards.api.entities.storage;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
|
||||||
public class EntityData {
|
public class EntityData {
|
||||||
@ -46,6 +47,7 @@ public class EntityData {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getMobName() {
|
public String getMobName() {
|
||||||
return mobName;
|
return mobName;
|
||||||
}
|
}
|
||||||
@ -54,6 +56,7 @@ public class EntityData {
|
|||||||
return replacementId;
|
return replacementId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public MetaCreator getDefaultMeta() {
|
public MetaCreator getDefaultMeta() {
|
||||||
return defaultMeta;
|
return defaultMeta;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
package nl.matsv.viabackwards.api.entities.storage;
|
package nl.matsv.viabackwards.api.entities.storage;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.data.StoredObject;
|
import us.myles.ViaVersion.api.data.StoredObject;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.entities.EntityType;
|
import us.myles.ViaVersion.api.entities.EntityType;
|
||||||
@ -29,6 +30,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
trackers.put(protocol, new ProtocolEntityTracker());
|
trackers.put(protocol, new ProtocolEntityTracker());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public ProtocolEntityTracker get(BackwardsProtocol protocol) {
|
public ProtocolEntityTracker get(BackwardsProtocol protocol) {
|
||||||
return trackers.get(protocol);
|
return trackers.get(protocol);
|
||||||
}
|
}
|
||||||
@ -44,11 +46,13 @@ public class EntityTracker extends StoredObject {
|
|||||||
entityMap.remove(id);
|
entityMap.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public EntityType getEntityType(int id) {
|
public EntityType getEntityType(int id) {
|
||||||
StoredEntity storedEntity = entityMap.get(id);
|
StoredEntity storedEntity = entityMap.get(id);
|
||||||
return storedEntity != null ? storedEntity.getType() : null;
|
return storedEntity != null ? storedEntity.getType() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public StoredEntity getEntity(int id) {
|
public StoredEntity getEntity(int id) {
|
||||||
return entityMap.get(id);
|
return entityMap.get(id);
|
||||||
}
|
}
|
||||||
@ -71,6 +75,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
* @param <T> The type of the class you want to get.
|
* @param <T> The type of the class you want to get.
|
||||||
* @return The requested object
|
* @return The requested object
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public <T extends EntityStorage> T get(Class<T> objectClass) {
|
public <T extends EntityStorage> T get(Class<T> objectClass) {
|
||||||
return (T) storedObjects.get(objectClass);
|
return (T) storedObjects.get(objectClass);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
package nl.matsv.viabackwards.api.entities.storage;
|
package nl.matsv.viabackwards.api.entities.storage;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -37,6 +38,7 @@ public class MetaStorage {
|
|||||||
this.metaDataList.add(data);
|
this.metaDataList.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Metadata get(int index) {
|
public Metadata get(int index) {
|
||||||
for (Metadata meta : this.metaDataList) {
|
for (Metadata meta : this.metaDataList) {
|
||||||
if (index == meta.getId()) {
|
if (index == meta.getId()) {
|
||||||
|
@ -8,10 +8,10 @@ import us.myles.ViaVersion.api.entities.EntityType;
|
|||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
|||||||
super(protocol, displayType, 2);
|
super(protocol, displayType, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSpawnTrackerWithData(int oldPacketId, int newPacketId, EntityType fallingBlockType, IdRewriteFunction blockStateRewriter) {
|
public void registerSpawnTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType, IdRewriteFunction blockStateRewriter) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -49,8 +49,8 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSpawnTracker(int oldPacketId, int newPacketId) {
|
public void registerSpawnTracker(ClientboundPacketType packetType) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -77,8 +77,8 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
|||||||
/**
|
/**
|
||||||
* Helper method to handle a metadata list packet and its full initial meta rewrite.
|
* Helper method to handle a metadata list packet and its full initial meta rewrite.
|
||||||
*/
|
*/
|
||||||
protected void registerMetadataRewriter(int oldPacketId, int newPacketId, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
protected void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
||||||
getProtocol().registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -108,7 +108,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerMetadataRewriter(int oldPacketId, int newPacketId, Type<List<Metadata>> metaType) {
|
protected void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> metaType) {
|
||||||
registerMetadataRewriter(oldPacketId, newPacketId, null, metaType);
|
registerMetadataRewriter(packetType, null, metaType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import nl.matsv.viabackwards.api.entities.storage.EntityData;
|
|||||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
||||||
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
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.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
@ -16,11 +17,11 @@ import us.myles.ViaVersion.api.entities.EntityType;
|
|||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.exception.CancelException;
|
import us.myles.ViaVersion.exception.CancelException;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
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;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -66,6 +67,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
return entityTypes.containsKey(type);
|
return entityTypes.containsKey(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
protected EntityData getEntityData(EntityType type) {
|
protected EntityData getEntityData(EntityType type) {
|
||||||
return entityTypes.get(type);
|
return entityTypes.get(type);
|
||||||
}
|
}
|
||||||
@ -192,8 +194,8 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
return storage;
|
return storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRespawn(int oldPacketId, int newPacketId) {
|
public void registerRespawn(ClientboundPacketType packetType) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT);
|
map(Type.INT);
|
||||||
@ -205,8 +207,8 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerJoinGame(int oldPacketId, int newPacketId, EntityType playerType) {
|
public void registerJoinGame(ClientboundPacketType packetType, EntityType playerType) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Entity ID
|
map(Type.INT); // 0 - Entity ID
|
||||||
@ -224,8 +226,8 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
/**
|
/**
|
||||||
* Helper method to handle player, painting, or xp orb trackers without meta changes.
|
* Helper method to handle player, painting, or xp orb trackers without meta changes.
|
||||||
*/
|
*/
|
||||||
protected void registerExtraTracker(int oldId, int newId, EntityType entityType, Type intType) {
|
protected void registerExtraTracker(ClientboundPacketType packetType, EntityType entityType, Type intType) {
|
||||||
getProtocol().registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(intType); // 0 - Entity id
|
map(intType); // 0 - Entity id
|
||||||
@ -234,20 +236,12 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerExtraTracker(int packetId, EntityType entityType, Type intType) {
|
protected void registerExtraTracker(ClientboundPacketType packetType, EntityType entityType) {
|
||||||
registerExtraTracker(packetId, packetId, entityType, intType);
|
registerExtraTracker(packetType, entityType, Type.VAR_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerExtraTracker(int oldId, int newId, EntityType entityType) {
|
protected void registerEntityDestroy(ClientboundPacketType packetType) {
|
||||||
registerExtraTracker(oldId, newId, entityType, Type.VAR_INT);
|
getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
}
|
|
||||||
|
|
||||||
protected void registerExtraTracker(int packetId, EntityType entityType) {
|
|
||||||
registerExtraTracker(packetId, entityType, Type.VAR_INT);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void registerEntityDestroy(int oldPacketId, int newPacketId) {
|
|
||||||
getProtocol().registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT_ARRAY_PRIMITIVE); // 0 - Entity ids
|
map(Type.VAR_INT_ARRAY_PRIMITIVE); // 0 - Entity ids
|
||||||
@ -261,10 +255,6 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerEntityDestroy(int packetId) {
|
|
||||||
registerEntityDestroy(packetId, packetId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ONLY TRACKS, DOESN'T REWRITE IDS
|
// ONLY TRACKS, DOESN'T REWRITE IDS
|
||||||
protected PacketHandler getTrackerHandler(Type intType, int typeIndex) {
|
protected PacketHandler getTrackerHandler(Type intType, int typeIndex) {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
|
@ -2,6 +2,7 @@ package nl.matsv.viabackwards.api.rewriters;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import nl.matsv.viabackwards.api.data.MappedItem;
|
import nl.matsv.viabackwards.api.data.MappedItem;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
@ -14,19 +15,21 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
|||||||
private final MappedItemFunction mappedItemFunction;
|
private final MappedItemFunction mappedItemFunction;
|
||||||
private final TranslatableRewriter translatableRewriter;
|
private final TranslatableRewriter translatableRewriter;
|
||||||
|
|
||||||
protected ItemRewriter(T protocol, TranslatableRewriter translatableRewriter, IdRewriteFunction oldRewriter, IdRewriteFunction newRewriter, MappedItemFunction mappedItemFunction) {
|
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter,
|
||||||
|
@Nullable IdRewriteFunction oldRewriter, @Nullable IdRewriteFunction newRewriter, MappedItemFunction mappedItemFunction) {
|
||||||
super(protocol, oldRewriter, newRewriter, true);
|
super(protocol, oldRewriter, newRewriter, true);
|
||||||
this.translatableRewriter = translatableRewriter;
|
this.translatableRewriter = translatableRewriter;
|
||||||
this.mappedItemFunction = mappedItemFunction;
|
this.mappedItemFunction = mappedItemFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemRewriter(T protocol, TranslatableRewriter translatableRewriter, MappedItemFunction mappedItemFunction) {
|
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter, MappedItemFunction mappedItemFunction) {
|
||||||
super(protocol, true);
|
super(protocol, true);
|
||||||
this.translatableRewriter = translatableRewriter;
|
this.translatableRewriter = translatableRewriter;
|
||||||
this.mappedItemFunction = mappedItemFunction;
|
this.mappedItemFunction = mappedItemFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public Item handleItemToClient(Item item) {
|
public Item handleItemToClient(Item item) {
|
||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
|
|
||||||
@ -94,6 +97,7 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface MappedItemFunction {
|
public interface MappedItemFunction {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
MappedItem get(int id);
|
MappedItem get(int id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package nl.matsv.viabackwards.api.rewriters;
|
package nl.matsv.viabackwards.api.rewriters;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||||
import us.myles.viaversion.libs.opennbt.conversion.builtin.CompoundTagConverter;
|
import us.myles.viaversion.libs.opennbt.conversion.builtin.CompoundTagConverter;
|
||||||
@ -17,7 +18,7 @@ public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Rewr
|
|||||||
protected final String nbtTagName;
|
protected final String nbtTagName;
|
||||||
protected final boolean jsonNameFormat;
|
protected final boolean jsonNameFormat;
|
||||||
|
|
||||||
protected ItemRewriterBase(T protocol, IdRewriteFunction toClientRewriter, IdRewriteFunction toServerRewriter, boolean jsonNameFormat) {
|
protected ItemRewriterBase(T protocol, @Nullable IdRewriteFunction toClientRewriter, @Nullable IdRewriteFunction toServerRewriter, boolean jsonNameFormat) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
this.toClientRewriter = toClientRewriter;
|
this.toClientRewriter = toClientRewriter;
|
||||||
this.toServerRewriter = toServerRewriter;
|
this.toServerRewriter = toServerRewriter;
|
||||||
@ -29,6 +30,7 @@ public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Rewr
|
|||||||
this(protocol, null, null, jsonNameFormat);
|
this(protocol, null, null, jsonNameFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Item handleItemToClient(Item item) {
|
public Item handleItemToClient(Item item) {
|
||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
if (toClientRewriter != null) {
|
if (toClientRewriter != null) {
|
||||||
@ -37,6 +39,7 @@ public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Rewr
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Item handleItemToServer(Item item) {
|
public Item handleItemToServer(Item item) {
|
||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import nl.matsv.viabackwards.api.data.MappedLegacyBlockItem;
|
|||||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors;
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors;
|
||||||
import nl.matsv.viabackwards.utils.Block;
|
import nl.matsv.viabackwards.utils.Block;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
@ -75,7 +76,7 @@ public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> exten
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LegacyBlockItemRewriter(T protocol, IdRewriteFunction oldRewriter, IdRewriteFunction newRewriter) {
|
protected LegacyBlockItemRewriter(T protocol, @Nullable IdRewriteFunction oldRewriter, @Nullable IdRewriteFunction newRewriter) {
|
||||||
super(protocol, oldRewriter, newRewriter, false);
|
super(protocol, oldRewriter, newRewriter, false);
|
||||||
replacementData = LEGACY_MAPPINGS.get(protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
replacementData = LEGACY_MAPPINGS.get(protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
||||||
}
|
}
|
||||||
@ -85,6 +86,7 @@ public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public Item handleItemToClient(Item item) {
|
public Item handleItemToClient(Item item) {
|
||||||
if (item == null) return null;
|
if (item == null) return null;
|
||||||
|
|
||||||
@ -138,6 +140,7 @@ public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> exten
|
|||||||
return (b.getId() << 4 | (b.getData() & 15));
|
return (b.getId() << 4 | (b.getData() & 15));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public Block handleBlock(int blockId, int data) {
|
public Block handleBlock(int blockId, int data) {
|
||||||
MappedLegacyBlockItem settings = replacementData.get(blockId);
|
MappedLegacyBlockItem settings = replacementData.get(blockId);
|
||||||
if (settings == null || !settings.isBlock()) return null;
|
if (settings == null || !settings.isBlock()) return null;
|
||||||
|
@ -10,7 +10,7 @@ public class LegacyEnchantmentRewriter {
|
|||||||
private final String nbtTagName;
|
private final String nbtTagName;
|
||||||
private Set<Short> hideLevelForEnchants;
|
private Set<Short> hideLevelForEnchants;
|
||||||
|
|
||||||
public LegacyEnchantmentRewriter(final String nbtTagName) {
|
public LegacyEnchantmentRewriter(String nbtTagName) {
|
||||||
this.nbtTagName = nbtTagName;
|
this.nbtTagName = nbtTagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,14 +5,15 @@ import nl.matsv.viabackwards.api.BackwardsProtocol;
|
|||||||
import nl.matsv.viabackwards.api.entities.storage.EntityData;
|
import nl.matsv.viabackwards.api.entities.storage.EntityData;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.EntityObjectData;
|
import nl.matsv.viabackwards.api.entities.storage.EntityObjectData;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
import nl.matsv.viabackwards.api.entities.storage.MetaStorage;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import us.myles.ViaVersion.api.entities.EntityType;
|
import us.myles.ViaVersion.api.entities.EntityType;
|
||||||
import us.myles.ViaVersion.api.entities.ObjectType;
|
import us.myles.ViaVersion.api.entities.ObjectType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,12 +37,13 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
|||||||
return entData;
|
return entData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
protected EntityData getObjectData(ObjectType type) {
|
protected EntityData getObjectData(ObjectType type) {
|
||||||
return objectTypes.get(type);
|
return objectTypes.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerMetadataRewriter(int oldPacketId, int newPacketId, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
protected void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
||||||
getProtocol().registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -59,8 +61,8 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerMetadataRewriter(int oldPacketId, int newPacketId, Type<List<Metadata>> metaType) {
|
protected void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> metaType) {
|
||||||
registerMetadataRewriter(oldPacketId, newPacketId, null, metaType);
|
registerMetadataRewriter(packetType, null, metaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PacketHandler getMobSpawnRewriter(Type<List<Metadata>> metaType) {
|
protected PacketHandler getMobSpawnRewriter(Type<List<Metadata>> metaType) {
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
package nl.matsv.viabackwards.api.rewriters;
|
package nl.matsv.viabackwards.api.rewriters;
|
||||||
|
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
public abstract class RecipeRewriter {
|
public abstract class RecipeRewriter {
|
||||||
|
|
||||||
protected final ItemRewriterBase rewriter;
|
protected final ItemRewriterBase rewriter;
|
||||||
|
|
||||||
protected RecipeRewriter(final ItemRewriterBase rewriter) {
|
protected RecipeRewriter(ItemRewriterBase rewriter) {
|
||||||
this.rewriter = rewriter;
|
this.rewriter = rewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void handle(PacketWrapper wrapper, String type) throws Exception;
|
public abstract void handle(PacketWrapper wrapper, String type) throws Exception;
|
||||||
|
|
||||||
public void registerDefaultHandler(int oldId, int newId) {
|
public void registerDefaultHandler(ClientboundPacketType packetType) {
|
||||||
rewriter.getProtocol().registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
rewriter.getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package nl.matsv.viabackwards.api.rewriters;
|
package nl.matsv.viabackwards.api.rewriters;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
|||||||
this(protocol, idRewriter, null);
|
this(protocol, idRewriter, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerNamedSound(int oldId, int newId) {
|
public void registerNamedSound(ClientboundPacketType packetType) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Sound identifier
|
map(Type.STRING); // Sound identifier
|
||||||
@ -40,8 +40,8 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerStopSound(int oldId, int newId) {
|
public void registerStopSound(ClientboundPacketType packetType) {
|
||||||
protocol.registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -3,6 +3,7 @@ package nl.matsv.viabackwards.api.rewriters;
|
|||||||
import nl.matsv.viabackwards.ViaBackwards;
|
import nl.matsv.viabackwards.ViaBackwards;
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
@ -46,7 +47,7 @@ public class TranslatableRewriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerPing() {
|
public void registerPing() {
|
||||||
protocol.out(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
|
protocol.registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||||
@ -54,8 +55,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDisconnect(int oldId, int newId) {
|
public void registerDisconnect(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||||
@ -63,8 +64,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerChatMessage(int oldId, int newId) {
|
public void registerChatMessage(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||||
@ -72,8 +73,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBossBar(int oldId, int newId) {
|
public void registerBossBar(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UUID);
|
map(Type.UUID);
|
||||||
@ -88,8 +89,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerLegacyOpenWindow(int oldId, int newId) {
|
public void registerLegacyOpenWindow(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Id
|
map(Type.UNSIGNED_BYTE); // Id
|
||||||
@ -99,8 +100,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerOpenWindow(int oldId, int newId) {
|
public void registerOpenWindow(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Id
|
map(Type.VAR_INT); // Id
|
||||||
@ -110,8 +111,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerCombatEvent(int oldId, int newId) {
|
public void registerCombatEvent(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -125,8 +126,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTitle(int oldId, int newId) {
|
public void registerTitle(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -139,8 +140,8 @@ public class TranslatableRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerPlayerList(int oldId, int newId) {
|
public void registerTabList(ClientboundPacketType packetType) {
|
||||||
protocol.out(State.PLAY, oldId, newId, new PacketRemapper() {
|
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -18,12 +18,19 @@ import nl.matsv.viabackwards.protocol.protocol1_10to1_11.packets.PlayerPackets1_
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.packets.SoundPackets1_11;
|
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.packets.SoundPackets1_11;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.storage.WindowTracker;
|
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.storage.WindowTracker;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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_10To1_11 extends BackwardsProtocol {
|
public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||||
|
|
||||||
private EntityPackets1_11 entityPackets; // Required for the item rewriter
|
private EntityPackets1_11 entityPackets; // Required for the item rewriter
|
||||||
private BlockItemPackets1_11 blockItemPackets;
|
private BlockItemPackets1_11 blockItemPackets;
|
||||||
|
|
||||||
|
public Protocol1_10To1_11() {
|
||||||
|
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
(entityPackets = new EntityPackets1_11(this)).register();
|
(entityPackets = new EntityPackets1_11(this)).register();
|
||||||
@ -35,15 +42,18 @@ public class Protocol1_10To1_11 extends BackwardsProtocol {
|
|||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
if (!user.has(WindowTracker.class))
|
if (!user.has(WindowTracker.class)) {
|
||||||
user.put(new WindowTracker(user));
|
user.put(new WindowTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
@ -29,9 +29,10 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_11to1_10.EntityIdRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_11to1_10.EntityIdRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||||
@ -53,8 +54,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
|
|
||||||
// Set slot packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SET_SLOT, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x16, 0x16, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE); // 0 - Window ID
|
map(Type.BYTE); // 0 - Window ID
|
||||||
@ -81,8 +81,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window items packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.WINDOW_ITEMS, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x14, 0x14, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
@ -113,11 +112,10 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM);
|
||||||
itemRewriter.registerEntityEquipment(Type.ITEM, 0x3C, 0x3C);
|
|
||||||
|
|
||||||
// Plugin message Packet -> Trading
|
// Plugin message Packet -> Trading
|
||||||
protocol.registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Channel
|
map(Type.STRING); // 0 - Channel
|
||||||
@ -134,8 +132,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output 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.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second 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
|
||||||
@ -147,8 +146,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click window packet
|
protocol.registerIncoming(ServerboundPackets1_9_3.CLICK_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x07, 0x07, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
@ -177,15 +175,11 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Creative Inventory Action
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_9_3.CREATIVE_INVENTORY_ACTION, Type.ITEM);
|
||||||
itemRewriter.registerCreativeInvAction(Type.ITEM, 0x18, 0x18);
|
|
||||||
|
|
||||||
/* Block packets */
|
protocol.registerOutgoing(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
|
||||||
// Chunk packet
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -211,11 +205,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Block Change Packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.BLOCK_CHANGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Block Position
|
map(Type.POSITION); // 0 - Block Position
|
||||||
@ -229,11 +221,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Multi Block Change Packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
@ -249,11 +239,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Update Block Entity
|
protocol.registerOutgoing(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Position
|
map(Type.POSITION); // 0 - Position
|
||||||
@ -277,8 +265,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open window packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.OPEN_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x13, 0x13, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
@ -308,8 +295,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close Window Packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.CLOSE_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x12, 0x12, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
// Inventory tracking
|
// Inventory tracking
|
||||||
@ -325,8 +311,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Close Window Incoming Packet
|
protocol.registerIncoming(ServerboundPackets1_9_3.CLOSE_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
// Inventory tracking
|
// Inventory tracking
|
||||||
|
@ -28,7 +28,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x21, 0x21, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.EFFECT, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT);
|
map(Type.INT);
|
||||||
@ -63,8 +63,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -102,14 +101,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_EXPERIENCE_ORB, Entity1_11Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_11Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_GLOBAL_ENTITY, Entity1_11Types.EntityType.WEATHER);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_11Types.EntityType.WEATHER);
|
|
||||||
|
|
||||||
// Spawn Mob
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -162,17 +157,11 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_PAINTING, Entity1_11Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x04, Entity1_11Types.EntityType.PAINTING);
|
registerJoinGame(ClientboundPackets1_9_3.JOIN_GAME, Entity1_11Types.EntityType.PLAYER);
|
||||||
|
registerRespawn(ClientboundPackets1_9_3.RESPAWN);
|
||||||
|
|
||||||
// Join game
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
registerJoinGame(0x23, 0x23, Entity1_11Types.EntityType.PLAYER);
|
|
||||||
|
|
||||||
// Respawn Packet
|
|
||||||
registerRespawn(0x33, 0x33);
|
|
||||||
|
|
||||||
// Spawn Player
|
|
||||||
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
|
||||||
@ -188,14 +177,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
registerEntityDestroy(ClientboundPackets1_9_3.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x30);
|
registerMetadataRewriter(ClientboundPackets1_9_3.ENTITY_METADATA, Types1_9.METADATA_LIST);
|
||||||
|
|
||||||
// Metadata packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.ENTITY_STATUS, new PacketRemapper() {
|
||||||
registerMetadataRewriter(0x39, 0x39, Types1_9.METADATA_LIST);
|
|
||||||
|
|
||||||
// Entity Status
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1B, 0x1B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Entity ID
|
map(Type.INT); // 0 - Entity ID
|
||||||
|
@ -16,11 +16,12 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
|
|
||||||
public class PlayerPackets1_11 {
|
public class PlayerPackets1_11 {
|
||||||
private static final ValueTransformer<Short, Float> toNewFloat = new ValueTransformer<Short, Float>(Type.FLOAT) {
|
private static final ValueTransformer<Short, Float> TO_NEW_FLOAT = new ValueTransformer<Short, Float>(Type.FLOAT) {
|
||||||
@Override
|
@Override
|
||||||
public Float transform(PacketWrapper wrapper, Short inputValue) throws Exception {
|
public Float transform(PacketWrapper wrapper, Short inputValue) throws Exception {
|
||||||
return inputValue / 15f;
|
return inputValue / 15f;
|
||||||
@ -28,10 +29,7 @@ public class PlayerPackets1_11 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public void register(Protocol1_10To1_11 protocol) {
|
public void register(Protocol1_10To1_11 protocol) {
|
||||||
/* Outgoing packets */
|
protocol.registerOutgoing(ClientboundPackets1_9_3.TITLE, new PacketRemapper() {
|
||||||
|
|
||||||
// Title packet
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x45, 0x45, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Action
|
map(Type.VAR_INT); // 0 - Action
|
||||||
@ -57,44 +55,35 @@ public class PlayerPackets1_11 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action > 2)
|
if (action > 2) {
|
||||||
wrapper.set(Type.VAR_INT, 0, action - 1); // Move everything one position down
|
wrapper.set(Type.VAR_INT, 0, action - 1); // Move everything one position down
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Collect item packet
|
protocol.registerOutgoing(ClientboundPackets1_9_3.COLLECT_ITEM, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x48, 0x48, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Collected entity id
|
map(Type.VAR_INT); // 0 - Collected entity id
|
||||||
map(Type.VAR_INT); // 1 - Collector entity id
|
map(Type.VAR_INT); // 1 - Collector entity id
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> wrapper.read(Type.VAR_INT)); // Ignore item pickup count
|
||||||
@Override
|
|
||||||
public void handle(PacketWrapper packetWrapper) throws Exception {
|
|
||||||
packetWrapper.read(Type.VAR_INT); // Ignore pickup item count
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Incoming packets */
|
|
||||||
|
|
||||||
// Block placement packet
|
protocol.registerIncoming(ServerboundPackets1_9_3.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x1C, 0x1C, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Location
|
map(Type.POSITION); // 0 - Location
|
||||||
map(Type.VAR_INT); // 1 - Face
|
map(Type.VAR_INT); // 1 - Face
|
||||||
map(Type.VAR_INT); // 2 - Hand
|
map(Type.VAR_INT); // 2 - Hand
|
||||||
|
|
||||||
map(Type.UNSIGNED_BYTE, toNewFloat);
|
map(Type.UNSIGNED_BYTE, TO_NEW_FLOAT);
|
||||||
map(Type.UNSIGNED_BYTE, toNewFloat);
|
map(Type.UNSIGNED_BYTE, TO_NEW_FLOAT);
|
||||||
map(Type.UNSIGNED_BYTE, toNewFloat);
|
map(Type.UNSIGNED_BYTE, TO_NEW_FLOAT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import us.myles.ViaVersion.api.PacketWrapper;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
|
||||||
public class SoundPackets1_11 extends LegacySoundRewriter<Protocol1_10To1_11> {
|
public class SoundPackets1_11 extends LegacySoundRewriter<Protocol1_10To1_11> {
|
||||||
|
|
||||||
@ -26,8 +26,7 @@ public class SoundPackets1_11 extends LegacySoundRewriter<Protocol1_10To1_11> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Named sound effect
|
protocol.registerOutgoing(ClientboundPackets1_9_3.NAMED_SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Sound name
|
map(Type.STRING); // 0 - Sound name
|
||||||
@ -40,8 +39,7 @@ public class SoundPackets1_11 extends LegacySoundRewriter<Protocol1_10To1_11> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sound effect
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x46, 0x46, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Sound name
|
map(Type.VAR_INT); // 0 - Sound name
|
||||||
|
@ -13,32 +13,49 @@ package nl.matsv.viabackwards.protocol.protocol1_11_1to1_12;
|
|||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.*;
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.BlockItemPackets1_12;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.ChatPackets1_12;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.EntityPackets1_12;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets.SoundPackets1_12;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ServerboundPackets1_12;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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_11_1To1_12 extends BackwardsProtocol {
|
public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
|
||||||
|
|
||||||
private EntityPackets1_12 entityPackets;
|
private EntityPackets1_12 entityPackets;
|
||||||
private BlockItemPackets1_12 blockItemPackets;
|
private BlockItemPackets1_12 blockItemPackets;
|
||||||
|
|
||||||
|
public Protocol1_11_1To1_12() {
|
||||||
|
super(ClientboundPackets1_12.class, ClientboundPackets1_9_3.class, ServerboundPackets1_12.class, ServerboundPackets1_9_3.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
new ChangedPacketIds1_12(this).register();
|
|
||||||
(entityPackets = new EntityPackets1_12(this)).register();
|
(entityPackets = new EntityPackets1_12(this)).register();
|
||||||
(blockItemPackets = new BlockItemPackets1_12(this)).register();
|
(blockItemPackets = new BlockItemPackets1_12(this)).register();
|
||||||
new SoundPackets1_12(this).register();
|
new SoundPackets1_12(this).register();
|
||||||
new ChatPackets1_12(this).register();
|
new ChatPackets1_12(this).register();
|
||||||
|
|
||||||
|
cancelOutgoing(ClientboundPackets1_12.ADVANCEMENTS);
|
||||||
|
cancelOutgoing(ClientboundPackets1_12.UNLOCK_RECIPES);
|
||||||
|
cancelOutgoing(ClientboundPackets1_12.SELECT_ADVANCEMENTS_TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
user.put(new ShoulderTracker(user));
|
user.put(new ShoulderTracker(user));
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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 BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1To1_12> {
|
public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1To1_12> {
|
||||||
@ -34,7 +35,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_12.MAP_DATA, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -54,6 +55,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
if (columns <= 0) return;
|
if (columns <= 0) return;
|
||||||
|
|
||||||
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
wrapper.passthrough(Type.BYTE); //X
|
wrapper.passthrough(Type.BYTE); //X
|
||||||
wrapper.passthrough(Type.BYTE); //Z
|
wrapper.passthrough(Type.BYTE); //Z
|
||||||
@ -73,17 +75,12 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
|
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
|
|
||||||
// Set slot packet
|
itemRewriter.registerSetSlot(ClientboundPackets1_12.SET_SLOT, Type.ITEM);
|
||||||
itemRewriter.registerSetSlot(Type.ITEM, 0x16, 0x16);
|
itemRewriter.registerWindowItems(ClientboundPackets1_12.WINDOW_ITEMS, Type.ITEM_ARRAY);
|
||||||
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_12.ENTITY_EQUIPMENT, Type.ITEM);
|
||||||
// Window items packet
|
|
||||||
itemRewriter.registerWindowItems(Type.ITEM_ARRAY, 0x14, 0x14);
|
|
||||||
|
|
||||||
// Entity Equipment Packet
|
|
||||||
itemRewriter.registerEntityEquipment(Type.ITEM, 0x3E, 0x3C);
|
|
||||||
|
|
||||||
// Plugin message Packet -> Trading
|
// Plugin message Packet -> Trading
|
||||||
protocol.registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_12.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Channel
|
map(Type.STRING); // 0 - Channel
|
||||||
@ -113,8 +110,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click window packet
|
protocol.registerIncoming(ServerboundPackets1_9_3.CLICK_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x08, 0x07, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||||
@ -144,22 +140,18 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
confirm.sendToServer(Protocol1_11_1To1_12.class, true, true);
|
confirm.sendToServer(Protocol1_11_1To1_12.class, true, true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
Item item = wrapper.get(Type.ITEM, 0);
|
Item item = wrapper.get(Type.ITEM, 0);
|
||||||
handleItemToServer(item);
|
handleItemToServer(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Creative Inventory Action
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_9_3.CREATIVE_INVENTORY_ACTION, Type.ITEM);
|
||||||
itemRewriter.registerCreativeInvAction(Type.ITEM, 0x1B, 0x18);
|
|
||||||
|
|
||||||
/* Block packets */
|
protocol.registerOutgoing(ClientboundPackets1_12.CHUNK_DATA, new PacketRemapper() {
|
||||||
|
|
||||||
// Chunk packet
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -176,8 +168,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Change Packet
|
protocol.registerOutgoing(ClientboundPackets1_12.BLOCK_CHANGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Block Position
|
map(Type.POSITION); // 0 - Block Position
|
||||||
@ -193,8 +184,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Multi Block Change Packet
|
protocol.registerOutgoing(ClientboundPackets1_12.MULTI_BLOCK_CHANGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
@ -212,8 +202,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Block Entity
|
protocol.registerOutgoing(ClientboundPackets1_12.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Position
|
map(Type.POSITION); // 0 - Position
|
||||||
@ -240,8 +229,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Client Status
|
protocol.registerIncoming(ServerboundPackets1_9_3.CLIENT_STATUS, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x04, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Action ID
|
map(Type.VAR_INT); // Action ID
|
||||||
@ -250,9 +238,10 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
// Open Inventory
|
// Open Inventory
|
||||||
if (wrapper.get(Type.VAR_INT, 0) == 2)
|
if (wrapper.get(Type.VAR_INT, 0) == 2) {
|
||||||
wrapper.cancel(); // TODO is this replaced by something else?
|
wrapper.cancel(); // TODO is this replaced by something else?
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Matsv
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.packets;
|
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.rewriters.Rewriter;
|
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12;
|
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
public class ChangedPacketIds1_12 extends Rewriter<Protocol1_11_1To1_12> {
|
|
||||||
|
|
||||||
public ChangedPacketIds1_12(Protocol1_11_1To1_12 protocol) {
|
|
||||||
super(protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void registerPackets() {
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x25, 0x28); // Entity
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x25); // Entity Relative Move
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x27, 0x26); // Entity Look and Relative Move
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x28, 0x27); // Entity Look
|
|
||||||
|
|
||||||
protocol.cancelOutgoing(State.PLAY, 0x30); // Unlock Recipes
|
|
||||||
|
|
||||||
// 0x31 -> 0x30 Destroy Entities handled in EntityPackets1_12.java
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x32, 0x31); // Remove Entity Effect
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x33, 0x32); // Resource Pack Send
|
|
||||||
// 0x34 -> 0x33 Respawn handled in EntityPackets1_12.java
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x35, 0x34); // Entity Head Look
|
|
||||||
|
|
||||||
protocol.cancelOutgoing(State.PLAY, 0x36); // Advancement Progress
|
|
||||||
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x37, 0x35); // World Border
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x38, 0x36); //Camera
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x39, 0x37); // Held Item Change (ClientBound)
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3A, 0x38); // Display Scoreboard
|
|
||||||
// 0x3B -> 0x39 Entity Metadata handled in EntityPackets1_12.java
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3C, 0x3A); // Attach Entity
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3D, 0x3B); // Entity Velocity
|
|
||||||
// 0x3E -> 0x3C Entity Equipment handled in BlockItemPackets1_12.java
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3D); // Set Experience
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x40, 0x3E); // Update Health
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x41, 0x3F); // ScoreBoard Objective
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x42, 0x40); // Set Passengers
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x43, 0x41); // Teams
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x44, 0x42); // Update Score
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x45, 0x43); // Spawn Position
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x46, 0x44); // Time Update
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x47, 0x45); // Title
|
|
||||||
// 0x48 -> 0x46 Sound Effect handled in SoundPackets1_12.java
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x49, 0x47); // Player List Header And Footer
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x4A, 0x48); // Collect Item
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x4B, 0x49); // Entity Teleport
|
|
||||||
|
|
||||||
protocol.cancelOutgoing(State.PLAY, 0x4C); // Advancements
|
|
||||||
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x4E, 0x4B); // Entity Effect
|
|
||||||
|
|
||||||
// New incoming packet 0x01 - Prepare Crafting Grid
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x02, 0x01); // Tab-Complete (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x03, 0x02); // Chat Message (Serverbound)
|
|
||||||
// 0x04->0x03 Client Status handled in BlockItemPackets1_12.java
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x05, 0x04); // Client Settings
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x06, 0x05); // Confirm Transaction (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x07, 0x06); // Enchant Item
|
|
||||||
// 0x08 -> 0x07 Click Window handled in BlockItemPackets1_12.java
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x09, 0x08); // Close Window (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0A, 0x09); // Plugin message (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0B, 0x0A); // Use Entity
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0C, 0x0B); // Keep Alive (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0D, 0x0F); // Player
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0E, 0x0C); // Player Position
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0F, 0x0D); // Player Position And Look (ServerBound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x10, 0x0E); // Player Look
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x11, 0x10); // Vehicle Move
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x12, 0x11); // Steer Boat
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x13, 0x12); // Player Abilities (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x14, 0x13); // Player Digging
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x15, 0x14); // Entity Action
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x16, 0x15); // Steer Vehicle
|
|
||||||
// New incoming packet 0x17 - Crafting Book Data
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x18, 0x16); // Resource Pack Status
|
|
||||||
// New incoming packet 0x19 - Advancement Tab
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1A, 0x17); // Held Item Change (Serverbound)
|
|
||||||
// 0x1B -> 0x18 Creative Inventory Action handled in BlockItemPackets.java
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1C, 0x19); // Update Sign
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1D, 0x1A); // Animatin (Serverbound)
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1E, 0x1B); // Spectate
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1F, 0x1C); // Player Block Placement
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x20, 0x1D); // Use Item
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ import nl.matsv.viabackwards.protocol.protocol1_11_1to1_12.data.AdvancementTrans
|
|||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
import us.myles.ViaVersion.util.GsonUtil;
|
import us.myles.ViaVersion.util.GsonUtil;
|
||||||
import us.myles.viaversion.libs.gson.JsonElement;
|
import us.myles.viaversion.libs.gson.JsonElement;
|
||||||
import us.myles.viaversion.libs.gson.JsonObject;
|
import us.myles.viaversion.libs.gson.JsonObject;
|
||||||
@ -32,8 +32,7 @@ public class ChatPackets1_12 extends Rewriter<Protocol1_11_1To1_12> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Chat Message (ClientBound)
|
protocol.registerOutgoing(ClientboundPackets1_12.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Json Data
|
map(Type.STRING); // 0 - Json Data
|
||||||
@ -42,10 +41,10 @@ public class ChatPackets1_12 extends Rewriter<Protocol1_11_1To1_12> {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
try {
|
try {
|
||||||
JsonObject object = GsonUtil.getJsonParser().parse(wrapper.get(Type.STRING, 0)).getAsJsonObject();
|
JsonObject object = GsonUtil.getJsonParser().parse(wrapper.get(Type.STRING, 0)).getAsJsonObject();
|
||||||
|
|
||||||
// Skip if the root doesn't contain translate
|
// Skip if the root doesn't contain translate
|
||||||
if (object.has("translate"))
|
if (object.has("translate")) {
|
||||||
handleTranslations(object);
|
handleTranslations(object);
|
||||||
|
}
|
||||||
|
|
||||||
ChatItemRewriter.toClient(object, wrapper.user());
|
ChatItemRewriter.toClient(object, wrapper.user());
|
||||||
wrapper.set(Type.STRING, 0, object.toString());
|
wrapper.set(Type.STRING, 0, object.toString());
|
||||||
|
@ -25,7 +25,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_12;
|
import us.myles.ViaVersion.api.type.types.version.Types1_12;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -38,8 +38,7 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_12.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -67,8 +66,9 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
int data = objectData >> 12 & 15;
|
int data = objectData >> 12 & 15;
|
||||||
|
|
||||||
Block block = getProtocol().getBlockItemPackets().handleBlock(objType, data);
|
Block block = getProtocol().getBlockItemPackets().handleBlock(objType, data);
|
||||||
if (block == null)
|
if (block == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
||||||
}
|
}
|
||||||
@ -77,14 +77,10 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_12.SPAWN_EXPERIENCE_ORB, Entity1_12Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_12Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_12.SPAWN_GLOBAL_ENTITY, Entity1_12Types.EntityType.WEATHER);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_12.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_12Types.EntityType.WEATHER);
|
|
||||||
|
|
||||||
// Spawn Mob
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -109,11 +105,9 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
registerExtraTracker(ClientboundPackets1_12.SPAWN_PAINTING, Entity1_12Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x04, Entity1_12Types.EntityType.PAINTING);
|
|
||||||
|
|
||||||
// Spawn Player
|
protocol.registerOutgoing(ClientboundPackets1_12.SPAWN_PLAYER, 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
|
||||||
@ -129,8 +123,7 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Join game
|
protocol.registerOutgoing(ClientboundPackets1_12.JOIN_GAME, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Entity ID
|
map(Type.INT); // 0 - Entity ID
|
||||||
@ -165,17 +158,11 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Respawn Packet
|
registerRespawn(ClientboundPackets1_12.RESPAWN);
|
||||||
registerRespawn(0x34, 0x33);
|
registerEntityDestroy(ClientboundPackets1_12.DESTROY_ENTITIES);
|
||||||
|
registerMetadataRewriter(ClientboundPackets1_12.ENTITY_METADATA, Types1_12.METADATA_LIST);
|
||||||
|
|
||||||
// Destroy entities
|
protocol.registerOutgoing(ClientboundPackets1_12.ENTITY_PROPERTIES, new PacketRemapper() {
|
||||||
registerEntityDestroy(0x31, 0x30);
|
|
||||||
|
|
||||||
// Metadata packet
|
|
||||||
registerMetadataRewriter(0x3B, 0x39, Types1_12.METADATA_LIST);
|
|
||||||
|
|
||||||
// Entity Properties
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x4D, 0x4A, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
|
@ -16,7 +16,7 @@ import us.myles.ViaVersion.api.PacketWrapper;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
|
|
||||||
public class SoundPackets1_12 extends LegacySoundRewriter<Protocol1_11_1To1_12> {
|
public class SoundPackets1_12 extends LegacySoundRewriter<Protocol1_11_1To1_12> {
|
||||||
|
|
||||||
@ -26,8 +26,7 @@ public class SoundPackets1_12 extends LegacySoundRewriter<Protocol1_11_1To1_12>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Named sound effect
|
protocol.registerOutgoing(ClientboundPackets1_12.NAMED_SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Sound name
|
map(Type.STRING); // 0 - Sound name
|
||||||
@ -40,8 +39,7 @@ public class SoundPackets1_12 extends LegacySoundRewriter<Protocol1_11_1To1_12>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sound effect
|
protocol.registerOutgoing(ClientboundPackets1_12.SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x48, 0x46, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Sound name
|
map(Type.VAR_INT); // 0 - Sound name
|
||||||
@ -57,13 +55,15 @@ public class SoundPackets1_12 extends LegacySoundRewriter<Protocol1_11_1To1_12>
|
|||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int oldId = wrapper.get(Type.VAR_INT, 0);
|
int oldId = wrapper.get(Type.VAR_INT, 0);
|
||||||
int newId = handleSounds(oldId);
|
int newId = handleSounds(oldId);
|
||||||
if (newId == -1)
|
if (newId == -1) {
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
else {
|
return;
|
||||||
if (hasPitch(oldId))
|
|
||||||
wrapper.set(Type.FLOAT, 1, handlePitch(oldId));
|
|
||||||
wrapper.set(Type.VAR_INT, 0, newId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasPitch(oldId)) {
|
||||||
|
wrapper.set(Type.FLOAT, 1, handlePitch(oldId));
|
||||||
|
}
|
||||||
|
wrapper.set(Type.VAR_INT, 0, newId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,18 @@ import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.EntityPackets1_11_1;
|
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.EntityPackets1_11_1;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.ItemPackets1_11_1;
|
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.packets.ItemPackets1_11_1;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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_11To1_11_1 extends BackwardsProtocol {
|
public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||||
|
|
||||||
private EntityPackets1_11_1 entityPackets;
|
private EntityPackets1_11_1 entityPackets;
|
||||||
|
|
||||||
|
public Protocol1_11To1_11_1() {
|
||||||
|
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
(entityPackets = new EntityPackets1_11_1(this)).register();
|
(entityPackets = new EntityPackets1_11_1(this)).register();
|
||||||
@ -29,12 +36,14 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol {
|
|||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
@ -17,7 +17,7 @@ import us.myles.ViaVersion.api.entities.EntityType;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
|
||||||
public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11_1> {
|
public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11_1> {
|
||||||
|
|
||||||
@ -27,8 +27,7 @@ public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -47,14 +46,10 @@ public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_EXPERIENCE_ORB, Entity1_11Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_11Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_GLOBAL_ENTITY, Entity1_11Types.EntityType.WEATHER);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_11Types.EntityType.WEATHER);
|
|
||||||
|
|
||||||
// Spawn Mob
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -79,17 +74,11 @@ public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_PAINTING, Entity1_11Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x04, Entity1_11Types.EntityType.PAINTING);
|
registerJoinGame(ClientboundPackets1_9_3.JOIN_GAME, Entity1_11Types.EntityType.PLAYER);
|
||||||
|
registerRespawn(ClientboundPackets1_9_3.RESPAWN);
|
||||||
|
|
||||||
// Join game
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
registerJoinGame(0x23, 0x23, Entity1_11Types.EntityType.PLAYER);
|
|
||||||
|
|
||||||
// Respawn Packet
|
|
||||||
registerRespawn(0x33, 0x33);
|
|
||||||
|
|
||||||
// Spawn Player
|
|
||||||
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
|
||||||
@ -105,11 +94,8 @@ public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
registerEntityDestroy(ClientboundPackets1_9_3.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x30);
|
registerMetadataRewriter(ClientboundPackets1_9_3.ENTITY_METADATA, Types1_9.METADATA_LIST);
|
||||||
|
|
||||||
// Metadata packet
|
|
||||||
registerMetadataRewriter(0x39, 0x39, Types1_9.METADATA_LIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,8 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||||
|
|
||||||
@ -36,17 +37,12 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<Protocol1_11To1_1
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
|
|
||||||
// Set slot packet
|
itemRewriter.registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM);
|
||||||
itemRewriter.registerSetSlot(Type.ITEM, 0x16, 0x16);
|
itemRewriter.registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM_ARRAY);
|
||||||
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM);
|
||||||
// Window items packet
|
|
||||||
itemRewriter.registerWindowItems(Type.ITEM_ARRAY, 0x14, 0x14);
|
|
||||||
|
|
||||||
// Entity Equipment Packet
|
|
||||||
itemRewriter.registerEntityEquipment(Type.ITEM, 0x3C, 0x3C);
|
|
||||||
|
|
||||||
// Plugin message Packet -> Trading
|
// Plugin message Packet -> Trading
|
||||||
protocol.registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Channel
|
map(Type.STRING); // 0 - Channel
|
||||||
@ -63,8 +59,9 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<Protocol1_11To1_1
|
|||||||
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output 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.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second 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
|
||||||
@ -76,18 +73,16 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<Protocol1_11To1_1
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click window packet
|
itemRewriter.registerClickWindow(ServerboundPackets1_9_3.CLICK_WINDOW, Type.ITEM);
|
||||||
itemRewriter.registerClickWindow(Type.ITEM, 0x07, 0x07);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_9_3.CREATIVE_INVENTORY_ACTION, Type.ITEM);
|
||||||
|
|
||||||
// Creative Inventory Action
|
|
||||||
itemRewriter.registerCreativeInvAction(Type.ITEM, 0x18, 0x18);
|
|
||||||
|
|
||||||
// Handle item metadata
|
// Handle item metadata
|
||||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||||
Metadata data = e.getData();
|
Metadata data = e.getData();
|
||||||
|
|
||||||
if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item
|
if (data.getMetaType().getType().equals(Type.ITEM)) { // Is Item
|
||||||
data.setValue(handleItemToClient((Item) data.getValue()));
|
data.setValue(handleItemToClient((Item) data.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
@ -16,14 +16,18 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
|
|
||||||
|
public class Protocol1_12_1To1_12_2 extends BackwardsProtocol<ClientboundPackets1_12_1, ClientboundPackets1_12_1, ServerboundPackets1_12_1, ServerboundPackets1_12_1> {
|
||||||
|
|
||||||
|
public Protocol1_12_1To1_12_2() {
|
||||||
|
super(ClientboundPackets1_12_1.class, ClientboundPackets1_12_1.class, ServerboundPackets1_12_1.class, ServerboundPackets1_12_1.class);
|
||||||
|
}
|
||||||
|
|
||||||
public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Outgoing
|
registerOutgoing(ClientboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
|
||||||
// 0x1f - Keep alive
|
|
||||||
registerOutgoing(State.PLAY, 0x1f, 0x1f, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -37,9 +41,7 @@ public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Incoming
|
registerIncoming(ServerboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
|
||||||
// 0xb - Keep alive
|
|
||||||
registerIncoming(State.PLAY, 0xb, 0xb, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016 Matsv
|
* Copyright (c) 2016 Matsv
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software withregisterOutgoing restriction, including withregisterOutgoing limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHregisterOutgoing WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, registerOutgoing OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13;
|
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13;
|
||||||
@ -24,19 +24,24 @@ import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBl
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage;
|
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.PlayerPositionStorage1_13;
|
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.PlayerPositionStorage1_13;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.TabCompleteStorage;
|
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.TabCompleteStorage;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
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_13to1_12_2.ServerboundPackets1_13;
|
||||||
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;
|
||||||
import us.myles.viaversion.libs.gson.JsonObject;
|
import us.myles.viaversion.libs.gson.JsonObject;
|
||||||
|
|
||||||
public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_12_1, ServerboundPackets1_13, ServerboundPackets1_12_1> {
|
||||||
|
|
||||||
private BlockItemPackets1_13 blockItemPackets;
|
private BlockItemPackets1_13 blockItemPackets;
|
||||||
|
|
||||||
|
public Protocol1_12_2To1_13() {
|
||||||
|
super(ClientboundPackets1_13.class, ClientboundPackets1_12_1.class, ServerboundPackets1_13.class, ServerboundPackets1_12_1.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
executeAsyncAfterLoaded(Protocol1_13To1_12_2.class, () -> {
|
executeAsyncAfterLoaded(Protocol1_13To1_12_2.class, () -> {
|
||||||
@ -55,123 +60,60 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
translatableRewriter.registerBossBar(0x0C, 0x0C);
|
translatableRewriter.registerBossBar(ClientboundPackets1_13.BOSSBAR);
|
||||||
translatableRewriter.registerChatMessage(0x0E, 0x0F);
|
translatableRewriter.registerChatMessage(ClientboundPackets1_13.CHAT_MESSAGE);
|
||||||
translatableRewriter.registerLegacyOpenWindow(0x14, 0x13);
|
translatableRewriter.registerLegacyOpenWindow(ClientboundPackets1_13.OPEN_WINDOW);
|
||||||
translatableRewriter.registerDisconnect(0x1B, 0x1A);
|
translatableRewriter.registerDisconnect(ClientboundPackets1_13.DISCONNECT);
|
||||||
translatableRewriter.registerCombatEvent(0x2F, 0x2D);
|
translatableRewriter.registerCombatEvent(ClientboundPackets1_13.COMBAT_EVENT);
|
||||||
translatableRewriter.registerTitle(0x4B, 0x48);
|
translatableRewriter.registerTitle(ClientboundPackets1_13.TITLE);
|
||||||
translatableRewriter.registerPlayerList(0x4E, 0x4A);
|
translatableRewriter.registerTabList(ClientboundPackets1_13.TAB_LIST);
|
||||||
|
|
||||||
(blockItemPackets = new BlockItemPackets1_13(this)).register();
|
(blockItemPackets = new BlockItemPackets1_13(this)).register();
|
||||||
new EntityPackets1_13(this).register();
|
new EntityPackets1_13(this).register();
|
||||||
new PlayerPacket1_13(this).register();
|
new PlayerPacket1_13(this).register();
|
||||||
new SoundPackets1_13(this).register();
|
new SoundPackets1_13(this).register();
|
||||||
|
|
||||||
// Thanks to https://wiki.vg/index.php?title=Pre-release_protocol&oldid=14150
|
cancelOutgoing(ClientboundPackets1_13.DECLARE_COMMANDS); //TODO
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.NBT_QUERY);
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.CRAFT_RECIPE_RESPONSE);
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.UNLOCK_RECIPES);
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.ADVANCEMENTS);
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.DECLARE_RECIPES); //TODO ?
|
||||||
|
cancelOutgoing(ClientboundPackets1_13.TAGS);
|
||||||
|
|
||||||
out(State.PLAY, 0x11, -1, cancel()); // Declare Commands TODO NEW
|
cancelIncoming(ServerboundPackets1_12_1.CRAFT_RECIPE_REQUEST);
|
||||||
out(State.PLAY, 0x12, 0x11); // Confirm Transaction (clientbound)
|
cancelIncoming(ServerboundPackets1_12_1.RECIPE_BOOK_DATA);
|
||||||
out(State.PLAY, 0x13, 0x12); // Close Window (clientbound)
|
|
||||||
out(State.PLAY, 0x1C, 0x1B); // Entity Status
|
|
||||||
out(State.PLAY, 0x1D, -1, cancel()); // NBT Query Response (client won't send a request, so the server should not answer)
|
|
||||||
out(State.PLAY, 0x1E, 0x1C); // Explosion
|
|
||||||
out(State.PLAY, 0x20, 0x1E); // Change Game State
|
|
||||||
out(State.PLAY, 0x21, 0x1F); // Keep Alive (clientbound)
|
|
||||||
out(State.PLAY, 0x27, 0x25); // Entity
|
|
||||||
out(State.PLAY, 0x28, 0x26); // Entity Relative Move
|
|
||||||
out(State.PLAY, 0x29, 0x27); // Entity Look And Relative Move
|
|
||||||
out(State.PLAY, 0x2A, 0x28); // Entity Look
|
|
||||||
out(State.PLAY, 0x2B, 0x29); // Vehicle Move (clientbound)
|
|
||||||
out(State.PLAY, 0x2C, 0x2A); // Open Sign Editor
|
|
||||||
out(State.PLAY, 0x2D, 0x2B, cancel()); // Craft Recipe Response TODO MODIFIED
|
|
||||||
out(State.PLAY, 0x2E, 0x2C); // Player Abilities (clientbound)
|
|
||||||
out(State.PLAY, 0x33, 0x30); // Use Bed
|
|
||||||
out(State.PLAY, 0x34, 0x31, cancel()); // Unlock Recipes TODO MODIFIED
|
|
||||||
out(State.PLAY, 0x36, 0x33); // Remove Entity Effect
|
|
||||||
out(State.PLAY, 0x37, 0x34); // Resource Pack Send
|
|
||||||
out(State.PLAY, 0x39, 0x36); // Entity Head Look
|
|
||||||
out(State.PLAY, 0x3A, 0x37); // Select Advancement Tab
|
|
||||||
out(State.PLAY, 0x3B, 0x38); // World Border
|
|
||||||
out(State.PLAY, 0x3C, 0x39); // Camera
|
|
||||||
out(State.PLAY, 0x3D, 0x3A); // Held Item Change (clientbound)
|
|
||||||
out(State.PLAY, 0x3E, 0x3B); // Display Scoreboard
|
|
||||||
out(State.PLAY, 0x40, 0x3D); // Attach Entity
|
|
||||||
out(State.PLAY, 0x41, 0x3E); // Entity Velocity
|
|
||||||
out(State.PLAY, 0x43, 0x40); // Set Experience
|
|
||||||
out(State.PLAY, 0x44, 0x41); // Update Health
|
|
||||||
out(State.PLAY, 0x46, 0x43); // Set Passengers
|
|
||||||
out(State.PLAY, 0x48, 0x45); // Update Score
|
|
||||||
out(State.PLAY, 0x49, 0x46); // Spawn Position
|
|
||||||
out(State.PLAY, 0x4A, 0x47); // Time Update
|
|
||||||
out(State.PLAY, 0x4F, 0x4B); // Collect Item
|
|
||||||
out(State.PLAY, 0x50, 0x4C); // Entity Teleport
|
|
||||||
out(State.PLAY, 0x51, 0x4D, cancel()); // Advancements
|
|
||||||
out(State.PLAY, 0x52, 0x4E); // Entity Properties
|
|
||||||
out(State.PLAY, 0x53, 0x4F); // Entity Effect
|
|
||||||
out(State.PLAY, 0x54, -1, cancel()); // Declare Recipes TODO NEW
|
|
||||||
out(State.PLAY, 0x55, -1, cancel()); // Tags (the client won't need this)
|
|
||||||
|
|
||||||
in(State.PLAY, 0x06, 0x05); // Confirm Transaction (serverbound)
|
|
||||||
in(State.PLAY, 0x07, 0x06); // Enchant Item
|
|
||||||
in(State.PLAY, 0x09, 0x08); // Close Window (serverbound)
|
|
||||||
in(State.PLAY, 0x0D, 0x0A); // Use Entity
|
|
||||||
in(State.PLAY, 0x0E, 0x0B); // Keep Alive (serverbound)
|
|
||||||
in(State.PLAY, 0x0F, 0x0C); // Player
|
|
||||||
in(State.PLAY, 0x12, 0x0F); // Player Look
|
|
||||||
in(State.PLAY, 0x14, 0x11); // Steer Boat
|
|
||||||
in(State.PLAY, 0x16, 0x12, cancel()); // Craft Recipe Request TODO MODIFIED
|
|
||||||
in(State.PLAY, 0x17, 0x13); // Player Abilities (serverbound)
|
|
||||||
in(State.PLAY, 0x18, 0x14); // Player Digging
|
|
||||||
in(State.PLAY, 0x19, 0x15); // Entity Action
|
|
||||||
in(State.PLAY, 0x1A, 0x16); // Steer Vehicle
|
|
||||||
in(State.PLAY, 0x1B, 0x17, cancel()); // Recipe Book Data TODO MODIFIED
|
|
||||||
in(State.PLAY, 0x1D, 0x18); // Resource Pack Status
|
|
||||||
in(State.PLAY, 0x1E, 0x19); // Advancement Tab
|
|
||||||
//in(State.PLAY, 0x1F, -1); // Select Trade (the client won't send this)
|
|
||||||
//in(State.PLAY, 0x20, -1); // Set Beacon Effect (the client won't send this)
|
|
||||||
in(State.PLAY, 0x21, 0x1A); // Held Item Change (serverbound)
|
|
||||||
in(State.PLAY, 0x26, 0x1C); // Update Sign
|
|
||||||
in(State.PLAY, 0x27, 0x1D); // Animation (serverbound)
|
|
||||||
in(State.PLAY, 0x28, 0x1E); // Spectate
|
|
||||||
in(State.PLAY, 0x29, 0x1F); // Player Block Placement
|
|
||||||
in(State.PLAY, 0x2A, 0x20); // Use Item
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
|
||||||
// Register Block Storage
|
// Register Block Storage
|
||||||
if (!user.has(BackwardsBlockStorage.class))
|
if (!user.has(BackwardsBlockStorage.class)) {
|
||||||
user.put(new BackwardsBlockStorage(user));
|
user.put(new BackwardsBlockStorage(user));
|
||||||
|
}
|
||||||
// Register Block Storage
|
// Register Block Storage
|
||||||
if (!user.has(TabCompleteStorage.class))
|
if (!user.has(TabCompleteStorage.class)) {
|
||||||
user.put(new TabCompleteStorage(user));
|
user.put(new TabCompleteStorage(user));
|
||||||
|
}
|
||||||
|
|
||||||
if (ViaBackwards.getConfig().isFix1_13FacePlayer() && !user.has(PlayerPositionStorage1_13.class)) {
|
if (ViaBackwards.getConfig().isFix1_13FacePlayer() && !user.has(PlayerPositionStorage1_13.class)) {
|
||||||
user.put(new PlayerPositionStorage1_13(user));
|
user.put(new PlayerPositionStorage1_13(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketRemapper cancel() {
|
|
||||||
return new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
handler(PacketWrapper::cancel);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockItemPackets1_13 getBlockItemPackets() {
|
public BlockItemPackets1_13 getBlockItemPackets() {
|
||||||
return blockItemPackets;
|
return blockItemPackets;
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
|
||||||
@ -93,8 +94,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Set Cooldown
|
protocol.registerOutgoing(ClientboundPackets1_13.COOLDOWN, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x18, 0x17, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -116,8 +116,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Action
|
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_ACTION, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // Location
|
map(Type.POSITION); // Location
|
||||||
@ -156,8 +155,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Block Entity
|
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Position
|
map(Type.POSITION); // 0 - Position
|
||||||
@ -185,8 +183,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unload chunk
|
protocol.registerOutgoing(ClientboundPackets1_13.UNLOAD_CHUNK, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1F, 0x1D, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -208,7 +205,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Block Change
|
// Block Change
|
||||||
protocol.out(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_CHANGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Position
|
map(Type.POSITION); // 0 - Position
|
||||||
@ -233,7 +230,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Multi Block Change
|
// Multi Block Change
|
||||||
protocol.out(State.PLAY, 0x0F, 0x10, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_13.MULTI_BLOCK_CHANGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
@ -269,8 +266,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
|
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
|
|
||||||
// Windows Items
|
protocol.registerOutgoing(ClientboundPackets1_13.WINDOW_ITEMS, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x15, 0x14, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE);
|
map(Type.UNSIGNED_BYTE);
|
||||||
@ -280,8 +276,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set Slot
|
protocol.registerOutgoing(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x17, 0x16, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.BYTE);
|
map(Type.BYTE);
|
||||||
@ -292,13 +287,10 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Chunk packet
|
protocol.registerOutgoing(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x22, 0x20, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
|
||||||
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
|
||||||
|
|
||||||
Chunk1_9_3_4Type type_old = new Chunk1_9_3_4Type(clientWorld);
|
Chunk1_9_3_4Type type_old = new Chunk1_9_3_4Type(clientWorld);
|
||||||
@ -405,14 +397,11 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
|
|
||||||
wrapper.write(type_old, chunk);
|
wrapper.write(type_old, chunk);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Effect
|
protocol.registerOutgoing(ClientboundPackets1_13.EFFECT, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x23, 0x21, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Effect Id
|
map(Type.INT); // Effect Id
|
||||||
@ -436,8 +425,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Map
|
protocol.registerOutgoing(ClientboundPackets1_13.MAP_DATA, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x26, 0x24, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -468,8 +456,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment
|
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_EQUIPMENT, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x42, 0x3F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -480,8 +467,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window Property
|
protocol.registerOutgoing(ClientboundPackets1_13.WINDOW_PROPERTY, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x16, 0x15, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Window Id
|
map(Type.UNSIGNED_BYTE); // Window Id
|
||||||
@ -499,8 +485,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Set Creative Slot
|
protocol.registerIncoming(ServerboundPackets1_12_1.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
|
||||||
protocol.in(State.PLAY, 0x24, 0x1B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.SHORT);
|
map(Type.SHORT);
|
||||||
@ -510,8 +495,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click Window
|
protocol.registerIncoming(ServerboundPackets1_12_1.CLICK_WINDOW, new PacketRemapper() {
|
||||||
protocol.in(State.PLAY, 0x08, 0x07, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE);
|
map(Type.UNSIGNED_BYTE);
|
||||||
|
@ -22,8 +22,9 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import us.myles.ViaVersion.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_12;
|
import us.myles.ViaVersion.api.type.types.version.Types1_12;
|
||||||
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.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -35,8 +36,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Player Position And Look (clientbound)
|
protocol.registerOutgoing(ClientboundPackets1_13.PLAYER_POSITION, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x32, 0x2F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.DOUBLE);
|
map(Type.DOUBLE);
|
||||||
@ -65,8 +65,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -115,14 +114,10 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_13.SPAWN_EXPERIENCE_ORB, Entity1_13Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_13Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_13.SPAWN_GLOBAL_ENTITY, Entity1_13Types.EntityType.LIGHTNING_BOLT);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_13Types.EntityType.LIGHTNING_BOLT);
|
|
||||||
|
|
||||||
//Spawn Mob
|
|
||||||
protocol.out(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -161,8 +156,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Player
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -178,8 +172,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PAINTING, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x04, 0x04, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -197,11 +190,9 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Join game
|
registerJoinGame(ClientboundPackets1_13.JOIN_GAME, Entity1_13Types.EntityType.PLAYER);
|
||||||
registerJoinGame(0x25, 0x23, Entity1_13Types.EntityType.PLAYER);
|
|
||||||
|
|
||||||
// Respawn Packet
|
protocol.registerOutgoing(ClientboundPackets1_13.RESPAWN, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x38, 0x35, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Dimension ID
|
map(Type.INT); // 0 - Dimension ID
|
||||||
@ -211,14 +202,11 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy Entities Packet
|
registerEntityDestroy(ClientboundPackets1_13.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x35, 0x32);
|
registerMetadataRewriter(ClientboundPackets1_13.ENTITY_METADATA, Types1_13.METADATA_LIST, Types1_12.METADATA_LIST);
|
||||||
|
|
||||||
// Entity Metadata packet
|
|
||||||
registerMetadataRewriter(0x3F, 0x3C, Types1_13.METADATA_LIST, Types1_12.METADATA_LIST);
|
|
||||||
|
|
||||||
// Face Player (new packet)
|
// Face Player (new packet)
|
||||||
protocol.out(State.PLAY, 0x31, -1, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_13.FACE_PLAYER, null, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -243,7 +231,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
positionAndLook.write(Type.DOUBLE, 0D);
|
positionAndLook.write(Type.DOUBLE, 0D);
|
||||||
positionAndLook.write(Type.DOUBLE, 0D);
|
positionAndLook.write(Type.DOUBLE, 0D);
|
||||||
|
|
||||||
//TODO properly cache and calculate head position
|
//TODO properly cache and calculate head position?
|
||||||
EntityPositionHandler.writeFacingDegrees(positionAndLook, positionStorage.getX(),
|
EntityPositionHandler.writeFacingDegrees(positionAndLook, positionStorage.getX(),
|
||||||
anchor == 1 ? positionStorage.getY() + 1.62 : positionStorage.getY(),
|
anchor == 1 ? positionStorage.getY() + 1.62 : positionStorage.getY(),
|
||||||
positionStorage.getZ(), x, y, z);
|
positionStorage.getZ(), x, y, z);
|
||||||
@ -266,13 +254,9 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
handler(wrapper -> wrapper.user().get(PlayerPositionStorage1_13.class).setCoordinates(wrapper, false));
|
handler(wrapper -> wrapper.user().get(PlayerPositionStorage1_13.class).setCoordinates(wrapper, false));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
protocol.in(State.PLAY, 0x10, 0x0D, movementRemapper); // Player Position
|
protocol.registerIncoming(ServerboundPackets1_12_1.PLAYER_POSITION, movementRemapper); // Player Position
|
||||||
protocol.in(State.PLAY, 0x11, 0x0E, movementRemapper); // Player Position And Look (serverbound)
|
protocol.registerIncoming(ServerboundPackets1_12_1.PLAYER_POSITION_AND_ROTATION, movementRemapper); // Player Position And Look (serverbound)
|
||||||
protocol.in(State.PLAY, 0x13, 0x10, movementRemapper); // Vehicle Move (serverbound)
|
protocol.registerIncoming(ServerboundPackets1_12_1.VEHICLE_MOVE, movementRemapper); // Vehicle Move (serverbound)
|
||||||
} else {
|
|
||||||
protocol.in(State.PLAY, 0x10, 0x0D); // Player Position
|
|
||||||
protocol.in(State.PLAY, 0x11, 0x0E); // Player Position And Look (serverbound)
|
|
||||||
protocol.in(State.PLAY, 0x13, 0x10); // Vehicle Move (serverbound)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,9 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
|||||||
import us.myles.ViaVersion.api.remapper.ValueCreator;
|
import us.myles.ViaVersion.api.remapper.ValueCreator;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -35,7 +37,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Login Plugin Request
|
// Login Plugin Request
|
||||||
protocol.out(State.LOGIN, 0x04, -1, new PacketRemapper() {
|
protocol.registerOutgoing(State.LOGIN, 0x04, -1, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -54,8 +56,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Plugin Message
|
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x19, 0x18, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -100,12 +101,12 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
if (oldChannel.equals("REGISTER") || oldChannel.equals("UNREGISTER")) {
|
if (oldChannel.equals("REGISTER") || oldChannel.equals("UNREGISTER")) {
|
||||||
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
||||||
List<String> rewrittenChannels = new ArrayList<>();
|
List<String> rewrittenChannels = new ArrayList<>();
|
||||||
for (int i = 0; i < channels.length; i++) {
|
for (String s : channels) {
|
||||||
String rewritten = InventoryPackets.getOldPluginChannelId(channels[i]);
|
String rewritten = InventoryPackets.getOldPluginChannelId(s);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
|
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
|
wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
|
||||||
@ -116,8 +117,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Particle
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x24, 0x22, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Particle ID
|
map(Type.INT); // 0 - Particle ID
|
||||||
@ -130,7 +130,6 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
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 {
|
||||||
@ -147,8 +146,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Player List Item
|
protocol.registerOutgoing(ClientboundPackets1_13.PLAYER_INFO, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x30, 0x2E, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -192,8 +190,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Scoreboard Objective
|
protocol.registerOutgoing(ClientboundPackets1_13.SCOREBOARD_OBJECTIVE, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x45, 0x42, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING);
|
map(Type.STRING);
|
||||||
@ -215,8 +212,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Teams
|
protocol.registerOutgoing(ClientboundPackets1_13.TEAMS, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x47, 0x44, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING);
|
map(Type.STRING);
|
||||||
@ -274,8 +270,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tab-Complete (clientbound)
|
protocol.registerOutgoing(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x10, 0x0E, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -311,13 +306,10 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tab-Complete (serverbound)
|
protocol.registerIncoming(ServerboundPackets1_12_1.TAB_COMPLETE, new PacketRemapper() {
|
||||||
protocol.in(State.PLAY, 0x05, 0x01, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
|
||||||
TabCompleteStorage storage = wrapper.user().get(TabCompleteStorage.class);
|
TabCompleteStorage storage = wrapper.user().get(TabCompleteStorage.class);
|
||||||
int id = ThreadLocalRandom.current().nextInt();
|
int id = ThreadLocalRandom.current().nextInt();
|
||||||
wrapper.write(Type.VAR_INT, id);
|
wrapper.write(Type.VAR_INT, id);
|
||||||
@ -350,28 +342,28 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
storage.lastId = id;
|
storage.lastId = id;
|
||||||
storage.lastAssumeCommand = assumeCommand;
|
storage.lastAssumeCommand = assumeCommand;
|
||||||
storage.lastRequest = command;
|
storage.lastRequest = command;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Plugin Message
|
protocol.registerIncoming(ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
protocol.in(State.PLAY, 0x0A, 0x09, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
|
||||||
String channel = wrapper.read(Type.STRING);
|
String channel = wrapper.read(Type.STRING);
|
||||||
if (channel.equals("MC|BSign") || channel.equals("MC|BEdit")) {
|
switch (channel) {
|
||||||
|
case "MC|BSign":
|
||||||
|
case "MC|BEdit":
|
||||||
wrapper.setId(0x0B);
|
wrapper.setId(0x0B);
|
||||||
Item book = wrapper.read(Type.ITEM);
|
Item book = wrapper.read(Type.ITEM);
|
||||||
wrapper.write(Type.FLAT_ITEM, getProtocol().getBlockItemPackets().handleItemToServer(book));
|
wrapper.write(Type.FLAT_ITEM, getProtocol().getBlockItemPackets().handleItemToServer(book));
|
||||||
boolean signing = channel.equals("MC|BSign");
|
boolean signing = channel.equals("MC|BSign");
|
||||||
wrapper.write(Type.BOOLEAN, signing);
|
wrapper.write(Type.BOOLEAN, signing);
|
||||||
} else if (channel.equals("MC|ItemName")) {
|
break;
|
||||||
|
case "MC|ItemName":
|
||||||
wrapper.setId(0x1C);
|
wrapper.setId(0x1C);
|
||||||
} else if (channel.equals("MC|AdvCmd")) {
|
break;
|
||||||
|
case "MC|AdvCmd":
|
||||||
byte type = wrapper.read(Type.BYTE);
|
byte type = wrapper.read(Type.BYTE);
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
//Information from https://wiki.vg/index.php?title=Plugin_channels&oldid=14089
|
//Information from https://wiki.vg/index.php?title=Plugin_channels&oldid=14089
|
||||||
@ -389,7 +381,8 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
} else {
|
} else {
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
}
|
}
|
||||||
} else if (channel.equals("MC|AutoCmd")) {
|
break;
|
||||||
|
case "MC|AutoCmd": {
|
||||||
wrapper.setId(0x22);
|
wrapper.setId(0x22);
|
||||||
|
|
||||||
int x = wrapper.read(Type.INT);
|
int x = wrapper.read(Type.INT);
|
||||||
@ -400,6 +393,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
|
|
||||||
wrapper.passthrough(Type.STRING); //Command
|
wrapper.passthrough(Type.STRING); //Command
|
||||||
|
|
||||||
|
|
||||||
byte flags = 0;
|
byte flags = 0;
|
||||||
if (wrapper.read(Type.BOOLEAN)) flags |= 0x01; //Track Output
|
if (wrapper.read(Type.BOOLEAN)) flags |= 0x01; //Track Output
|
||||||
|
|
||||||
@ -412,7 +406,9 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
if (wrapper.read(Type.BOOLEAN)) flags |= 0x04; //Automatic
|
if (wrapper.read(Type.BOOLEAN)) flags |= 0x04; //Automatic
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, flags);
|
wrapper.write(Type.BYTE, flags);
|
||||||
} else if (channel.equals("MC|Struct")) {
|
break;
|
||||||
|
}
|
||||||
|
case "MC|Struct": {
|
||||||
wrapper.setId(0x25);
|
wrapper.setId(0x25);
|
||||||
int x = wrapper.read(Type.INT);
|
int x = wrapper.read(Type.INT);
|
||||||
int y = wrapper.read(Type.INT);
|
int y = wrapper.read(Type.INT);
|
||||||
@ -423,34 +419,52 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
int modeId = mode.equals("SAVE") ? 0 : mode.equals("LOAD") ? 1 : mode.equals("CORNER") ? 2 : 3;
|
int modeId = mode.equals("SAVE") ? 0 : mode.equals("LOAD") ? 1 : mode.equals("CORNER") ? 2 : 3;
|
||||||
wrapper.write(Type.VAR_INT, modeId);
|
wrapper.write(Type.VAR_INT, modeId);
|
||||||
wrapper.passthrough(Type.STRING); //Name
|
wrapper.passthrough(Type.STRING); //Name
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset X
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset X
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset Y
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset Y
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset Z
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Offset Z
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size X
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size X
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size Y
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size Y
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size Z
|
wrapper.write(Type.BYTE, wrapper.read(Type.INT).byteValue()); //Size Z
|
||||||
|
|
||||||
String mirror = wrapper.read(Type.STRING);
|
String mirror = wrapper.read(Type.STRING);
|
||||||
int mirrorId = mode.equals("NONE") ? 0 : mode.equals("LEFT_RIGHT") ? 1 : 2;
|
int mirrorId = mode.equals("NONE") ? 0 : mode.equals("LEFT_RIGHT") ? 1 : 2;
|
||||||
String rotation = wrapper.read(Type.STRING);
|
String rotation = wrapper.read(Type.STRING);
|
||||||
int rotationId = mode.equals("NONE") ? 0 : mode.equals("CLOCKWISE_90") ? 1 : mode.equals("CLOCKWISE_180") ? 2 : 3;
|
int rotationId = mode.equals("NONE") ? 0 : mode.equals("CLOCKWISE_90") ? 1 : mode.equals("CLOCKWISE_180") ? 2 : 3;
|
||||||
wrapper.passthrough(Type.STRING); //Metadata
|
wrapper.passthrough(Type.STRING); //Metadata
|
||||||
|
|
||||||
byte flags = 0;
|
byte flags = 0;
|
||||||
if (wrapper.read(Type.BOOLEAN)) flags |= 0x01; //Ignore entities
|
if (wrapper.read(Type.BOOLEAN)) flags |= 0x01; //Ignore entities
|
||||||
if (wrapper.read(Type.BOOLEAN)) flags |= 0x02; //Show air
|
if (wrapper.read(Type.BOOLEAN)) flags |= 0x02; //Show air
|
||||||
if (wrapper.read(Type.BOOLEAN)) flags |= 0x04; //Show bounding box
|
if (wrapper.read(Type.BOOLEAN)) flags |= 0x04; //Show bounding box
|
||||||
wrapper.passthrough(Type.FLOAT); //Integrity
|
wrapper.passthrough(Type.FLOAT); //Integrity
|
||||||
|
|
||||||
wrapper.passthrough(Type.VAR_LONG); //Seed
|
wrapper.passthrough(Type.VAR_LONG); //Seed
|
||||||
|
|
||||||
wrapper.write(Type.BYTE, flags);
|
wrapper.write(Type.BYTE, flags);
|
||||||
} else if (channel.equals("MC|Beacon")) {
|
break;
|
||||||
|
}
|
||||||
|
case "MC|Beacon":
|
||||||
wrapper.setId(0x20);
|
wrapper.setId(0x20);
|
||||||
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Primary Effect
|
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Primary Effect
|
||||||
|
|
||||||
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Secondary Effect
|
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Secondary Effect
|
||||||
} else if (channel.equals("MC|TrSel")) {
|
|
||||||
|
break;
|
||||||
|
case "MC|TrSel":
|
||||||
wrapper.setId(0x1F);
|
wrapper.setId(0x1F);
|
||||||
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Slot
|
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Slot
|
||||||
} else if (channel.equals("MC|PickItem")) {
|
|
||||||
|
break;
|
||||||
|
case "MC|PickItem":
|
||||||
wrapper.setId(0x15);
|
wrapper.setId(0x15);
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
String newChannel = InventoryPackets.getNewPluginChannelId(channel);
|
String newChannel = InventoryPackets.getNewPluginChannelId(channel);
|
||||||
if (newChannel == null) {
|
if (newChannel == null) {
|
||||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
@ -464,12 +478,12 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
if (newChannel.equals("minecraft:register") || newChannel.equals("minecraft:unregister")) {
|
if (newChannel.equals("minecraft:register") || newChannel.equals("minecraft:unregister")) {
|
||||||
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
||||||
List<String> rewrittenChannels = new ArrayList<>();
|
List<String> rewrittenChannels = new ArrayList<>();
|
||||||
for (int i = 0; i < channels.length; i++) {
|
for (String s : channels) {
|
||||||
String rewritten = InventoryPackets.getNewPluginChannelId(channels[i]);
|
String rewritten = InventoryPackets.getNewPluginChannelId(s);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
|
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!rewrittenChannels.isEmpty()) {
|
if (!rewrittenChannels.isEmpty()) {
|
||||||
@ -479,14 +493,13 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Statistics
|
protocol.registerOutgoing(ClientboundPackets1_13.STATISTICS, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x07, 0x07, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -527,9 +540,10 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
wrapper.passthrough(Type.VAR_INT); // value
|
wrapper.passthrough(Type.VAR_INT); // value
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSize != size)
|
if (newSize != size) {
|
||||||
wrapper.set(Type.VAR_INT, 0, newSize);
|
wrapper.set(Type.VAR_INT, 0, newSize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,8 @@ import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.NamedSoundMappin
|
|||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||||
private static final String[] SOUND_SOURCES = {"master", "music", "record", "weather", "block", "hostile", "neutral", "player", "ambient", "voice"};
|
private static final String[] SOUND_SOURCES = {"master", "music", "record", "weather", "block", "hostile", "neutral", "player", "ambient", "voice"};
|
||||||
@ -19,8 +20,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Named Sound Event
|
protocol.registerOutgoing(ClientboundPackets1_13.NAMED_SOUND, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x1A, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING);
|
map(Type.STRING);
|
||||||
@ -36,8 +36,8 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Stop Sound
|
// Stop Sound -> Plugin Message
|
||||||
protocol.out(State.PLAY, 0x4C, 0x18, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_13.STOP_SOUND, ClientboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -66,8 +66,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sound Effect
|
protocol.registerOutgoing(ClientboundPackets1_13.SOUND, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x4D, 0x49, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
|
@ -1,83 +1,20 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Matsv
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
|
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.ServerboundPackets1_12;
|
||||||
|
|
||||||
|
public class Protocol1_12To1_12_1 extends BackwardsProtocol<ClientboundPackets1_12_1, ClientboundPackets1_12, ServerboundPackets1_12_1, ServerboundPackets1_12> {
|
||||||
|
|
||||||
|
public Protocol1_12To1_12_1() {
|
||||||
|
super(ClientboundPackets1_12_1.class, ClientboundPackets1_12.class, ServerboundPackets1_12_1.class, ServerboundPackets1_12.class);
|
||||||
|
}
|
||||||
|
|
||||||
public class Protocol1_12To1_12_1 extends BackwardsProtocol {
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
cancelOutgoing(State.PLAY, 0x2B); //TODO
|
cancelOutgoing(ClientboundPackets1_12_1.CRAFT_RECIPE_RESPONSE);
|
||||||
registerOutgoing(State.PLAY, 0x2c, 0x2b);
|
cancelIncoming(ServerboundPackets1_12.PREPARE_CRAFTING_GRID);
|
||||||
registerOutgoing(State.PLAY, 0x2d, 0x2c);
|
|
||||||
registerOutgoing(State.PLAY, 0x2e, 0x2d);
|
|
||||||
registerOutgoing(State.PLAY, 0x2f, 0x2e);
|
|
||||||
registerOutgoing(State.PLAY, 0x30, 0x2f);
|
|
||||||
registerOutgoing(State.PLAY, 0x31, 0x30);
|
|
||||||
registerOutgoing(State.PLAY, 0x32, 0x31);
|
|
||||||
registerOutgoing(State.PLAY, 0x33, 0x32);
|
|
||||||
registerOutgoing(State.PLAY, 0x34, 0x33);
|
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x34);
|
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x35);
|
|
||||||
registerOutgoing(State.PLAY, 0x37, 0x36);
|
|
||||||
registerOutgoing(State.PLAY, 0x38, 0x37);
|
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x38);
|
|
||||||
registerOutgoing(State.PLAY, 0x3a, 0x39);
|
|
||||||
registerOutgoing(State.PLAY, 0x3b, 0x3a);
|
|
||||||
registerOutgoing(State.PLAY, 0x3c, 0x3b);
|
|
||||||
registerOutgoing(State.PLAY, 0x3d, 0x3c);
|
|
||||||
registerOutgoing(State.PLAY, 0x3e, 0x3d);
|
|
||||||
registerOutgoing(State.PLAY, 0x3f, 0x3e);
|
|
||||||
registerOutgoing(State.PLAY, 0x40, 0x3f);
|
|
||||||
registerOutgoing(State.PLAY, 0x41, 0x40);
|
|
||||||
registerOutgoing(State.PLAY, 0x42, 0x41);
|
|
||||||
registerOutgoing(State.PLAY, 0x43, 0x42);
|
|
||||||
registerOutgoing(State.PLAY, 0x44, 0x43);
|
|
||||||
registerOutgoing(State.PLAY, 0x45, 0x44);
|
|
||||||
registerOutgoing(State.PLAY, 0x46, 0x45);
|
|
||||||
registerOutgoing(State.PLAY, 0x47, 0x46);
|
|
||||||
registerOutgoing(State.PLAY, 0x48, 0x47);
|
|
||||||
registerOutgoing(State.PLAY, 0x49, 0x48);
|
|
||||||
registerOutgoing(State.PLAY, 0x4a, 0x49);
|
|
||||||
registerOutgoing(State.PLAY, 0x4b, 0x4a);
|
|
||||||
registerOutgoing(State.PLAY, 0x4c, 0x4b);
|
|
||||||
registerOutgoing(State.PLAY, 0x4d, 0x4c);
|
|
||||||
registerOutgoing(State.PLAY, 0x4e, 0x4d);
|
|
||||||
registerOutgoing(State.PLAY, 0x4f, 0x4e);
|
|
||||||
|
|
||||||
cancelIncoming(State.PLAY, 0x01); //TODO
|
|
||||||
registerIncoming(State.PLAY, 0x1, 0x2);
|
|
||||||
registerIncoming(State.PLAY, 0x2, 0x3);
|
|
||||||
registerIncoming(State.PLAY, 0x3, 0x4);
|
|
||||||
registerIncoming(State.PLAY, 0x4, 0x5);
|
|
||||||
registerIncoming(State.PLAY, 0x5, 0x6);
|
|
||||||
registerIncoming(State.PLAY, 0x6, 0x7);
|
|
||||||
registerIncoming(State.PLAY, 0x7, 0x8);
|
|
||||||
registerIncoming(State.PLAY, 0x8, 0x9);
|
|
||||||
registerIncoming(State.PLAY, 0x9, 0xa);
|
|
||||||
registerIncoming(State.PLAY, 0xa, 0xb);
|
|
||||||
registerIncoming(State.PLAY, 0xb, 0xc);
|
|
||||||
registerIncoming(State.PLAY, 0xc, 0xd);
|
|
||||||
registerIncoming(State.PLAY, 0xd, 0xe);
|
|
||||||
registerIncoming(State.PLAY, 0xe, 0xf);
|
|
||||||
registerIncoming(State.PLAY, 0xf, 0x10);
|
|
||||||
registerIncoming(State.PLAY, 0x10, 0x11);
|
|
||||||
registerIncoming(State.PLAY, 0x11, 0x12);
|
|
||||||
// New incoming 0x12 - No sent by client, sad :(
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,18 @@ import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets.EntityPacke
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets.InventoryPackets1_13_2;
|
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets.InventoryPackets1_13_2;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets.WorldPackets1_13_2;
|
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets.WorldPackets1_13_2;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
|
|
||||||
public class Protocol1_13_1To1_13_2 extends BackwardsProtocol {
|
public class Protocol1_13_1To1_13_2 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_13, ServerboundPackets1_13, ServerboundPackets1_13> {
|
||||||
|
|
||||||
|
public Protocol1_13_1To1_13_2() {
|
||||||
|
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
@ -20,16 +24,14 @@ public class Protocol1_13_1To1_13_2 extends BackwardsProtocol {
|
|||||||
WorldPackets1_13_2.register(this);
|
WorldPackets1_13_2.register(this);
|
||||||
EntityPackets1_13_2.register(this);
|
EntityPackets1_13_2.register(this);
|
||||||
|
|
||||||
//Edit Book
|
registerIncoming(ServerboundPackets1_13.EDIT_BOOK, 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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advancements
|
registerOutgoing(ClientboundPackets1_13.ADVANCEMENTS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x51, 0x51, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -71,9 +73,4 @@ public class Protocol1_13_1To1_13_2 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.Protocol1_13_1To1_13_2;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13_2;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13_2;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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.api.type.types.version.Types1_13_2;
|
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
public class EntityPackets1_13_2 {
|
public class EntityPackets1_13_2 {
|
||||||
|
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol1_13_1To1_13_2 protocol) {
|
||||||
// Spawn mob packet
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, 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
|
||||||
@ -47,8 +46,7 @@ public class EntityPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn player packet
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, 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
|
||||||
@ -73,8 +71,7 @@ public class EntityPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Metadata packet
|
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_METADATA, 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
|
||||||
|
@ -1,21 +1,17 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.Protocol1_13_1To1_13_2;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
|
|
||||||
public class InventoryPackets1_13_2 {
|
public class InventoryPackets1_13_2 {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol1_13_1To1_13_2 protocol) {
|
||||||
/*
|
protocol.registerOutgoing(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
||||||
Outgoing packets
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Set slot packet
|
|
||||||
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
|
||||||
@ -24,8 +20,7 @@ public class InventoryPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window items packet
|
protocol.registerOutgoing(ClientboundPackets1_13.WINDOW_ITEMS, 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
|
||||||
@ -33,8 +28,7 @@ public class InventoryPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Plugin message
|
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, 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
|
||||||
@ -67,8 +61,7 @@ public class InventoryPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_EQUIPMENT, 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
|
||||||
@ -77,8 +70,7 @@ public class InventoryPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare Recipes
|
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x54, 0x54, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -117,12 +109,7 @@ public class InventoryPackets1_13_2 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
protocol.registerIncoming(ServerboundPackets1_13.CLICK_WINDOW, new PacketRemapper() {
|
||||||
Incoming packets
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Click window packet
|
|
||||||
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
|
||||||
@ -132,17 +119,14 @@ public class InventoryPackets1_13_2 {
|
|||||||
map(Type.VAR_INT); // 4 - Mode
|
map(Type.VAR_INT); // 4 - Mode
|
||||||
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 5 - Clicked Item
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 5 - Clicked Item
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Creative Inventory Action
|
protocol.registerIncoming(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, 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_ITEM, Type.FLAT_VAR_INT_ITEM); // 1 - Clicked Item
|
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 1 - Clicked Item
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
package nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_13_1to1_13_2.Protocol1_13_1To1_13_2;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
public class WorldPackets1_13_2 {
|
public class WorldPackets1_13_2 {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol1_13_1To1_13_2 protocol) {
|
||||||
//spawn particle
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PARTICLE, 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
|
||||||
|
@ -15,27 +15,34 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
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;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||||
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_13_2To1_14 extends BackwardsProtocol {
|
public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_13, ServerboundPackets1_14, ServerboundPackets1_13> {
|
||||||
|
|
||||||
private BlockItemPackets1_14 blockItemPackets;
|
private BlockItemPackets1_14 blockItemPackets;
|
||||||
private EntityPackets1_14 entityPackets;
|
private EntityPackets1_14 entityPackets;
|
||||||
|
|
||||||
|
public Protocol1_13_2To1_14() {
|
||||||
|
super(ClientboundPackets1_14.class, ClientboundPackets1_13.class, ServerboundPackets1_14.class, ServerboundPackets1_13.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
executeAsyncAfterLoaded(Protocol1_14To1_13_2.class, BackwardsMappings::init);
|
executeAsyncAfterLoaded(Protocol1_14To1_13_2.class, BackwardsMappings::init);
|
||||||
|
|
||||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||||
translatableRewriter.registerBossBar(0x0C, 0x0C);
|
translatableRewriter.registerBossBar(ClientboundPackets1_14.BOSSBAR);
|
||||||
translatableRewriter.registerChatMessage(0x0E, 0x0E);
|
translatableRewriter.registerChatMessage(ClientboundPackets1_14.CHAT_MESSAGE);
|
||||||
translatableRewriter.registerCombatEvent(0x32, 0x2F);
|
translatableRewriter.registerCombatEvent(ClientboundPackets1_14.COMBAT_EVENT);
|
||||||
translatableRewriter.registerDisconnect(0x1A, 0x1B);
|
translatableRewriter.registerDisconnect(ClientboundPackets1_14.DISCONNECT);
|
||||||
translatableRewriter.registerPlayerList(0x53, 0x4E);
|
translatableRewriter.registerTabList(ClientboundPackets1_14.TAB_LIST);
|
||||||
translatableRewriter.registerTitle(0x4F, 0x4B);
|
translatableRewriter.registerTitle(ClientboundPackets1_14.TITLE);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
|
|
||||||
blockItemPackets = new BlockItemPackets1_14(this, translatableRewriter);
|
blockItemPackets = new BlockItemPackets1_14(this, translatableRewriter);
|
||||||
@ -45,45 +52,11 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
new PlayerPackets1_14(this).register();
|
new PlayerPackets1_14(this).register();
|
||||||
new SoundPackets1_14(this).register();
|
new SoundPackets1_14(this).register();
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x15, 0x16);
|
cancelOutgoing(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
|
||||||
registerOutgoing(State.PLAY, 0x18, 0x19);
|
cancelOutgoing(ClientboundPackets1_14.UPDATE_VIEW_DISTANCE);
|
||||||
registerOutgoing(State.PLAY, 0x54, 0x1D);
|
cancelOutgoing(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING);
|
||||||
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
|
||||||
registerOutgoing(State.PLAY, 0x20, 0x21);
|
|
||||||
registerOutgoing(State.PLAY, 0x2B, 0x27);
|
|
||||||
registerOutgoing(State.PLAY, 0x2C, 0x2B);
|
|
||||||
registerOutgoing(State.PLAY, 0x30, 0x2D);
|
|
||||||
registerOutgoing(State.PLAY, 0x31, 0x2E);
|
|
||||||
registerOutgoing(State.PLAY, 0x33, 0x30);
|
|
||||||
registerOutgoing(State.PLAY, 0x34, 0x31);
|
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x32);
|
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x34);
|
|
||||||
registerOutgoing(State.PLAY, 0x38, 0x36);
|
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x37);
|
|
||||||
registerOutgoing(State.PLAY, 0x3B, 0x39);
|
|
||||||
registerOutgoing(State.PLAY, 0x3C, 0x3A);
|
|
||||||
registerOutgoing(State.PLAY, 0x3D, 0x3B);
|
|
||||||
registerOutgoing(State.PLAY, 0x3E, 0x3C);
|
|
||||||
registerOutgoing(State.PLAY, 0x3F, 0x3D);
|
|
||||||
registerOutgoing(State.PLAY, 0x42, 0x3E);
|
|
||||||
registerOutgoing(State.PLAY, 0x44, 0x40);
|
|
||||||
registerOutgoing(State.PLAY, 0x45, 0x41);
|
|
||||||
registerOutgoing(State.PLAY, 0x47, 0x43);
|
|
||||||
registerOutgoing(State.PLAY, 0x48, 0x44);
|
|
||||||
registerOutgoing(State.PLAY, 0x49, 0x45);
|
|
||||||
registerOutgoing(State.PLAY, 0x4A, 0x46);
|
|
||||||
registerOutgoing(State.PLAY, 0x4B, 0x47);
|
|
||||||
registerOutgoing(State.PLAY, 0x4C, 0x48);
|
|
||||||
registerOutgoing(State.PLAY, 0x4E, 0x4A);
|
|
||||||
registerOutgoing(State.PLAY, 0x55, 0x4F);
|
|
||||||
|
|
||||||
// Update View Position
|
registerOutgoing(ClientboundPackets1_14.ADVANCEMENTS, new PacketRemapper() { // c
|
||||||
cancelOutgoing(State.PLAY, 0x40);
|
|
||||||
|
|
||||||
// Update View Distance
|
|
||||||
cancelOutgoing(State.PLAY, 0x41);
|
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x57, 0x51, new PacketRemapper() { // c
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -124,13 +97,9 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x58, 0x52); // c
|
registerOutgoing(ClientboundPackets1_14.TAGS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x59, 0x53); // c
|
|
||||||
|
|
||||||
// Tags
|
|
||||||
registerOutgoing(State.PLAY, 0x5B, 0x55, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() { // c
|
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 {
|
||||||
@ -175,9 +144,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerOutgoing(ClientboundPackets1_14.UPDATE_LIGHT, null, new PacketRemapper() {
|
||||||
// Light update
|
|
||||||
out(State.PLAY, 0x24, -1, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -231,51 +198,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Incomming
|
|
||||||
|
|
||||||
//Unknown packet added in 19w11a - 0x02
|
|
||||||
registerIncoming(State.PLAY, 0x03, 0x02); // r
|
|
||||||
registerIncoming(State.PLAY, 0x04, 0x03); // r
|
|
||||||
registerIncoming(State.PLAY, 0x05, 0x04); // r
|
|
||||||
registerIncoming(State.PLAY, 0x06, 0x05); // r
|
|
||||||
registerIncoming(State.PLAY, 0x07, 0x06); // r
|
|
||||||
registerIncoming(State.PLAY, 0x08, 0x07); // r
|
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x0A, 0x09); // r
|
|
||||||
registerIncoming(State.PLAY, 0x0B, 0x0A); // r
|
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x0D, 0x0C); // r
|
|
||||||
registerIncoming(State.PLAY, 0x0E, 0x0D); // r
|
|
||||||
//Unknown packet added in 19w11a - 0x0F
|
|
||||||
registerIncoming(State.PLAY, 0x0F, 0x0E); // r
|
|
||||||
registerIncoming(State.PLAY, 0x11, 0x10); // r
|
|
||||||
registerIncoming(State.PLAY, 0x12, 0x11); // r
|
|
||||||
registerIncoming(State.PLAY, 0x13, 0x12); // r
|
|
||||||
registerIncoming(State.PLAY, 0x14, 0x0F); // r
|
|
||||||
registerIncoming(State.PLAY, 0x15, 0x13); // r
|
|
||||||
registerIncoming(State.PLAY, 0x16, 0x14); // r
|
|
||||||
registerIncoming(State.PLAY, 0x17, 0x15); // r
|
|
||||||
registerIncoming(State.PLAY, 0x18, 0x16); // r
|
|
||||||
registerIncoming(State.PLAY, 0x19, 0x17); // r
|
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x1B, 0x19); // r
|
|
||||||
registerIncoming(State.PLAY, 0x1C, 0x1A); // r
|
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x1E, 0x1C); // r
|
|
||||||
registerIncoming(State.PLAY, 0x1F, 0x1D); // r
|
|
||||||
registerIncoming(State.PLAY, 0x20, 0x1E); // r
|
|
||||||
registerIncoming(State.PLAY, 0x21, 0x1F); // r
|
|
||||||
registerIncoming(State.PLAY, 0x22, 0x20); // r
|
|
||||||
registerIncoming(State.PLAY, 0x23, 0x21); // r
|
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x25, 0x23); // r
|
|
||||||
|
|
||||||
// registerIncoming(State.PLAY, 0x29, 0x27); // r
|
|
||||||
registerIncoming(State.PLAY, 0x2A, 0x27); // r
|
|
||||||
registerIncoming(State.PLAY, 0x2B, 0x28); // r
|
|
||||||
registerIncoming(State.PLAY, 0x2D, 0x2A); // r
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockStateId(int id) {
|
public static int getNewBlockStateId(int id) {
|
||||||
@ -297,23 +219,25 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
|
||||||
if (!user.has(ChunkLightStorage.class))
|
if (!user.has(ChunkLightStorage.class)) {
|
||||||
user.put(new ChunkLightStorage(user));
|
user.put(new ChunkLightStorage(user));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public BlockItemPackets1_14 getBlockItemPackets() {
|
public BlockItemPackets1_14 getBlockItemPackets() {
|
||||||
return blockItemPackets;
|
return blockItemPackets;
|
||||||
|
@ -8,7 +8,7 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
|
|
||||||
public class RecipeRewriter1_14 extends RecipeRewriter {
|
public class RecipeRewriter1_14 extends RecipeRewriter {
|
||||||
|
|
||||||
public RecipeRewriter1_14(final ItemRewriterBase rewriter) {
|
public RecipeRewriter1_14(ItemRewriterBase rewriter) {
|
||||||
super(rewriter);
|
super(rewriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,11 @@ import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
|||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||||
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;
|
||||||
@ -54,18 +56,16 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Edit Book
|
protocol.registerIncoming(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x0C, 0x0B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open window
|
protocol.registerOutgoing(ClientboundPackets1_14.OPEN_WINDOW, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x2E, 0x14, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() { // c
|
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 {
|
||||||
@ -156,10 +156,10 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Horse window
|
// Horse window -> Open Window
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1F, 0x14, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_14.OPEN_HORSE_WINDOW, ClientboundPackets1_13.OPEN_WINDOW, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() { // c
|
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 {
|
||||||
@ -176,17 +176,12 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13_2To1_14::getNewBlockStateId, Protocol1_13_2To1_14::getNewBlockId);
|
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13_2To1_14::getNewBlockStateId, Protocol1_13_2To1_14::getNewBlockId);
|
||||||
|
|
||||||
// Set cooldown
|
itemRewriter.registerSetCooldown(ClientboundPackets1_14.COOLDOWN, BlockItemPackets1_14::getOldItemId);
|
||||||
itemRewriter.registerSetCooldown(0x17, 0x18, BlockItemPackets1_14::getOldItemId);
|
itemRewriter.registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
|
itemRewriter.registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Window items packet
|
// Trade List -> Plugin Message
|
||||||
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x14, 0x15);
|
protocol.registerOutgoing(ClientboundPackets1_14.TRADE_LIST, ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
|
|
||||||
// Set slot packet
|
|
||||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x16, 0x17);
|
|
||||||
|
|
||||||
// Trade list
|
|
||||||
protocol.out(State.PLAY, 0x27, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -234,8 +229,8 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Book open
|
// Open Book -> Plugin Message
|
||||||
protocol.registerOutgoing(State.PLAY, 0x2D, 0x19, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_14.OPEN_BOOK, ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -248,8 +243,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_EQUIPMENT, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x46, 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
|
||||||
@ -286,8 +280,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare Recipes
|
protocol.registerOutgoing(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() { // c
|
||||||
protocol.registerOutgoing(State.PLAY, 0x5A, 0x54, new PacketRemapper() { // c
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -334,18 +327,11 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
Incoming packets
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Click window packet
|
itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x08);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Creative Inventory Action
|
protocol.registerOutgoing(ClientboundPackets1_14.BLOCK_BREAK_ANIMATION, new PacketRemapper() {
|
||||||
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x24);
|
|
||||||
|
|
||||||
// Block break animation
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x08, 0x08, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -354,16 +340,14 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update block entity
|
protocol.registerOutgoing(ClientboundPackets1_14.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Action
|
protocol.registerOutgoing(ClientboundPackets1_14.BLOCK_ACTION, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION); // Location
|
map(Type.POSITION1_14, Type.POSITION); // Location
|
||||||
@ -379,8 +363,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Change
|
protocol.registerOutgoing(ClientboundPackets1_14.BLOCK_CHANGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0xB, 0xB, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
@ -396,11 +379,9 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Multi Block Change
|
blockRewriter.registerMultiBlockChange(ClientboundPackets1_14.MULTI_BLOCK_CHANGE);
|
||||||
blockRewriter.registerMultiBlockChange(0xF, 0xF);
|
|
||||||
|
|
||||||
//Explosion
|
protocol.registerOutgoing(ClientboundPackets1_14.EXPLOSION, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1C, 0x1E, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.FLOAT); // X
|
map(Type.FLOAT); // X
|
||||||
@ -423,8 +404,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Chunk
|
protocol.registerOutgoing(ClientboundPackets1_14.CHUNK_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x21, 0x22, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -477,8 +457,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unload chunk
|
protocol.registerOutgoing(ClientboundPackets1_14.UNLOAD_CHUNK, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1D, 0x1F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -492,8 +471,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Effect packet
|
protocol.registerOutgoing(ClientboundPackets1_14.EFFECT, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x23, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Effect Id
|
map(Type.INT); // Effect Id
|
||||||
@ -514,12 +492,10 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn particle
|
blockRewriter.registerSpawnParticle(ClientboundPackets1_14.SPAWN_PARTICLE, 3, 23, 32,
|
||||||
blockRewriter.registerSpawnParticle(Type.FLOAT, 0x23, 0x24, 3, 23, 32,
|
EntityPackets1_14::getOldParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM, Type.FLOAT);
|
||||||
EntityPackets1_14::getOldParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM);
|
|
||||||
|
|
||||||
//Map Data
|
protocol.registerOutgoing(ClientboundPackets1_14.MAP_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -529,8 +505,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn position
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_POSITION, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x4D, 0x49, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
|
@ -27,7 +27,7 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
import us.myles.ViaVersion.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
|
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
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 EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14> {
|
public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14> {
|
||||||
@ -55,8 +55,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
positionHandler = new EntityPositionHandler(this, EntityPositionStorage1_14.class, EntityPositionStorage1_14::new);
|
positionHandler = new EntityPositionHandler(this, EntityPositionStorage1_14.class, EntityPositionStorage1_14::new);
|
||||||
|
|
||||||
// Entity status
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_STATUS, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1B, 0x1C, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -81,8 +80,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity teleport
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_TELEPORT, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x56, 0x50, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -93,7 +91,6 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity relative move + Entity look and relative move
|
|
||||||
PacketRemapper relativeMoveHandler = new PacketRemapper() {
|
PacketRemapper relativeMoveHandler = new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -112,11 +109,10 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
protocol.registerOutgoing(State.PLAY, 0x28, 0x28, relativeMoveHandler);
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_POSITION, relativeMoveHandler);
|
||||||
protocol.registerOutgoing(State.PLAY, 0x29, 0x29, relativeMoveHandler);
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_POSITION_AND_ROTATION, relativeMoveHandler);
|
||||||
|
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -187,8 +183,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn mob packet
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -232,8 +227,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
getProtocol().registerOutgoing(ClientboundPackets1_14.SPAWN_EXPERIENCE_ORB, new PacketRemapper() {
|
||||||
getProtocol().registerOutgoing(State.PLAY, 0x01, 0x01, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -244,8 +238,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Global Object
|
getProtocol().registerOutgoing(ClientboundPackets1_14.SPAWN_GLOBAL_ENTITY, new PacketRemapper() {
|
||||||
getProtocol().registerOutgoing(State.PLAY, 0x02, 0x02, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -257,8 +250,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn painting
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_PAINTING, 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);
|
||||||
@ -272,8 +264,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn player packet
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_PLAYER, 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
|
||||||
@ -290,14 +281,10 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
registerEntityDestroy(ClientboundPackets1_14.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x37, 0x35);
|
registerMetadataRewriter(ClientboundPackets1_14.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_13_2.METADATA_LIST);
|
||||||
|
|
||||||
// Entity Metadata packet
|
protocol.registerOutgoing(ClientboundPackets1_14.JOIN_GAME, new PacketRemapper() {
|
||||||
registerMetadataRewriter(0x43, 0x3F, Types1_14.METADATA_LIST, Types1_13_2.METADATA_LIST);
|
|
||||||
|
|
||||||
// Join game
|
|
||||||
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
|
||||||
@ -319,8 +306,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Respawn
|
protocol.registerOutgoing(ClientboundPackets1_14.RESPAWN, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3A, 0x38, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Dimension ID
|
map(Type.INT); // 0 - Dimension ID
|
||||||
@ -332,7 +318,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
|||||||
int dimensionId = wrapper.get(Type.INT, 0);
|
int dimensionId = wrapper.get(Type.INT, 0);
|
||||||
clientWorld.setEnvironment(dimensionId);
|
clientWorld.setEnvironment(dimensionId);
|
||||||
|
|
||||||
wrapper.write(Type.UNSIGNED_BYTE, (short) 0); // todo - do we need to store it from difficulty packet?
|
wrapper.write(Type.UNSIGNED_BYTE, (short) 0); // Difficulty
|
||||||
wrapper.user().get(ChunkLightStorage.class).clear();
|
wrapper.user().get(ChunkLightStorage.class).clear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,8 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
|
||||||
public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
||||||
|
|
||||||
@ -17,8 +18,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Server Difficulty
|
protocol.registerOutgoing(ClientboundPackets1_14.SERVER_DIFFICULTY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0D, 0x0D, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE);
|
map(Type.UNSIGNED_BYTE);
|
||||||
@ -26,25 +26,20 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open Sign Editor
|
protocol.registerOutgoing(ClientboundPackets1_14.OPEN_SIGN_EDITOR, new PacketRemapper() { // c
|
||||||
protocol.registerOutgoing(State.PLAY, 0x2F, 0x2C, new PacketRemapper() { // c
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14, Type.POSITION);
|
map(Type.POSITION1_14, Type.POSITION);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
protocol.registerIncoming(ServerboundPackets1_13.QUERY_BLOCK_NBT, new PacketRemapper() {
|
||||||
// Query Block NBT
|
|
||||||
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.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
protocol.registerIncoming(ServerboundPackets1_13.PLAYER_DIGGING, new PacketRemapper() {
|
||||||
// Player Digging
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x1A, 0x18, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -53,8 +48,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Recipe Book Data
|
protocol.registerIncoming(ServerboundPackets1_13.RECIPE_BOOK_DATA, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x1D, 0x1B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -81,32 +75,26 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Command Block
|
protocol.registerIncoming(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x24, 0x22, new PacketRemapper() {
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
protocol.registerIncoming(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
protocol.registerIncoming(ServerboundPackets1_13.UPDATE_SIGN, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
map(Type.POSITION, Type.POSITION1_14);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update Structure Block
|
protocol.registerIncoming(ServerboundPackets1_13.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x28, 0x25, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update Sign
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x29, 0x26, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.POSITION, Type.POSITION1_14);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Player Block Placement
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x2C, 0x29, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
|
@ -10,7 +10,7 @@ import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.storage.EntityPositio
|
|||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
|
||||||
public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
SoundRewriter soundRewriter = new SoundRewriter(protocol,
|
SoundRewriter soundRewriter = new SoundRewriter(protocol,
|
||||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||||
soundRewriter.registerSound(0x51, 0x4D);
|
soundRewriter.registerSound(ClientboundPackets1_14.SOUND);
|
||||||
soundRewriter.registerNamedSound(0x19, 0x1A);
|
soundRewriter.registerNamedSound(ClientboundPackets1_14.NAMED_SOUND);
|
||||||
soundRewriter.registerStopSound(0x52, 0x4C);
|
soundRewriter.registerStopSound(ClientboundPackets1_14.STOP_SOUND);
|
||||||
|
|
||||||
// Entity Sound Effect
|
// Entity Sound Effect
|
||||||
protocol.registerOutgoing(State.PLAY, 0x50, -1, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_14.ENTITY_SOUND, null, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -13,10 +13,15 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
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_13To1_13_1 extends BackwardsProtocol {
|
public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_13, ServerboundPackets1_13, ServerboundPackets1_13> {
|
||||||
|
|
||||||
|
public Protocol1_13To1_13_1() {
|
||||||
|
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
@ -25,16 +30,15 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
WorldPackets1_13_1.register(this);
|
WorldPackets1_13_1.register(this);
|
||||||
|
|
||||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||||
translatableRewriter.registerChatMessage(0x0E, 0x0E);
|
translatableRewriter.registerChatMessage(ClientboundPackets1_13.CHAT_MESSAGE);
|
||||||
translatableRewriter.registerLegacyOpenWindow(0x14, 0x14);
|
translatableRewriter.registerLegacyOpenWindow(ClientboundPackets1_13.OPEN_WINDOW);
|
||||||
translatableRewriter.registerCombatEvent(0x2F, 0x2F);
|
translatableRewriter.registerCombatEvent(ClientboundPackets1_13.COMBAT_EVENT);
|
||||||
translatableRewriter.registerDisconnect(0x1B, 0x1B);
|
translatableRewriter.registerDisconnect(ClientboundPackets1_13.DISCONNECT);
|
||||||
translatableRewriter.registerPlayerList(0x4E, 0x4E);
|
translatableRewriter.registerTabList(ClientboundPackets1_13.TAB_LIST);
|
||||||
translatableRewriter.registerTitle(0x4B, 0x4B);
|
translatableRewriter.registerTitle(ClientboundPackets1_13.TITLE);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
|
|
||||||
//Tab complete
|
registerIncoming(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
|
||||||
registerIncoming(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
@ -48,8 +52,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Edit Book
|
registerIncoming(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
|
||||||
registerIncoming(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.FLAT_ITEM);
|
map(Type.FLAT_ITEM);
|
||||||
@ -64,8 +67,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tab complete
|
registerOutgoing(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Transaction id
|
map(Type.VAR_INT); // Transaction id
|
||||||
@ -91,8 +93,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Boss bar
|
registerOutgoing(ClientboundPackets1_13.BOSSBAR, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UUID);
|
map(Type.UUID);
|
||||||
@ -117,9 +118,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerOutgoing(ClientboundPackets1_13.ADVANCEMENTS, new PacketRemapper() {
|
||||||
// Advancements
|
|
||||||
registerOutgoing(State.PLAY, 0x51, 0x51, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -161,8 +160,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tags
|
registerOutgoing(ClientboundPackets1_13.TAGS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x55, 0x55, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
|
@ -14,7 +14,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
|
||||||
public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13_1> {
|
public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13_1> {
|
||||||
|
|
||||||
@ -24,8 +24,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.out(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -62,14 +61,10 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_13.SPAWN_EXPERIENCE_ORB, Entity1_13Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_13Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_13.SPAWN_GLOBAL_ENTITY, Entity1_13Types.EntityType.LIGHTNING_BOLT);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_13Types.EntityType.LIGHTNING_BOLT);
|
|
||||||
|
|
||||||
// Spawn Mob
|
|
||||||
protocol.out(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
|
||||||
@ -105,8 +100,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn player packet
|
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
protocol.out(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
|
||||||
@ -122,20 +116,11 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
registerExtraTracker(ClientboundPackets1_13.SPAWN_PAINTING, Entity1_13Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x04, Entity1_13Types.EntityType.PAINTING);
|
registerJoinGame(ClientboundPackets1_13.JOIN_GAME, Entity1_13Types.EntityType.PLAYER);
|
||||||
|
registerRespawn(ClientboundPackets1_13.RESPAWN);
|
||||||
// Join Game
|
registerEntityDestroy(ClientboundPackets1_13.DESTROY_ENTITIES);
|
||||||
registerJoinGame(0x25, 0x25, Entity1_13Types.EntityType.PLAYER);
|
registerMetadataRewriter(ClientboundPackets1_13.ENTITY_METADATA, Types1_13.METADATA_LIST);
|
||||||
|
|
||||||
// Respawn
|
|
||||||
registerRespawn(0x38, 0x38);
|
|
||||||
|
|
||||||
// Destroy entities
|
|
||||||
registerEntityDestroy(0x35);
|
|
||||||
|
|
||||||
// Entity Metadata packet
|
|
||||||
registerMetadataRewriter(0x3F, 0x3F, Types1_13.METADATA_LIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,24 +7,19 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||||
|
|
||||||
public class InventoryPackets1_13_1 {
|
public class InventoryPackets1_13_1 {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets1_13_1::toClient, InventoryPackets1_13_1::toServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets1_13_1::toClient, InventoryPackets1_13_1::toServer);
|
||||||
|
|
||||||
// Set cooldown
|
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN, InventoryPackets1_13_1::getOldItemId);
|
||||||
itemRewriter.registerSetCooldown(0x18, 0x18, InventoryPackets1_13_1::getOldItemId);
|
itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_ITEM_ARRAY);
|
||||||
|
itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_ITEM);
|
||||||
|
|
||||||
// Window items packet
|
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
itemRewriter.registerWindowItems(Type.FLAT_ITEM_ARRAY, 0x15, 0x15);
|
|
||||||
|
|
||||||
// Set slot packet
|
|
||||||
itemRewriter.registerSetSlot(Type.FLAT_ITEM, 0x17, 0x17);
|
|
||||||
|
|
||||||
// Plugin Message
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -60,14 +55,9 @@ public class InventoryPackets1_13_1 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_ITEM);
|
||||||
itemRewriter.registerEntityEquipment(Type.FLAT_ITEM, 0x42, 0x42);
|
itemRewriter.registerClickWindow(ServerboundPackets1_13.CLICK_WINDOW, Type.FLAT_ITEM);
|
||||||
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, Type.FLAT_ITEM);
|
||||||
// Click window packet
|
|
||||||
itemRewriter.registerClickWindow(Type.FLAT_ITEM, 0x08, 0x08);
|
|
||||||
|
|
||||||
// Creative Inventory Action
|
|
||||||
itemRewriter.registerCreativeInvAction(Type.FLAT_ITEM, 0x24, 0x24);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
|
@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||||
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;
|
||||||
|
|
||||||
@ -18,8 +18,7 @@ public class WorldPackets1_13_1 {
|
|||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13To1_13_1::getNewBlockStateId, Protocol1_13To1_13_1::getNewBlockId);
|
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13To1_13_1::getNewBlockStateId, Protocol1_13To1_13_1::getNewBlockId);
|
||||||
|
|
||||||
// Chunk
|
protocol.registerOutgoing(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -40,19 +39,10 @@ public class WorldPackets1_13_1 {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Action
|
blockRewriter.registerBlockAction(ClientboundPackets1_13.BLOCK_ACTION);
|
||||||
blockRewriter.registerBlockAction(0x0A, 0x0A);
|
blockRewriter.registerBlockChange(ClientboundPackets1_13.BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerMultiBlockChange(ClientboundPackets1_13.MULTI_BLOCK_CHANGE);
|
||||||
// Block Change
|
blockRewriter.registerEffect(ClientboundPackets1_13.EFFECT, 1010, 2001, InventoryPackets1_13_1::getOldItemId);
|
||||||
blockRewriter.registerBlockChange(0xB, 0xB);
|
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27, InventoryPackets1_13_1::toClient, Type.FLAT_ITEM, Type.FLOAT);
|
||||||
|
|
||||||
// Multi Block Change
|
|
||||||
blockRewriter.registerMultiBlockChange(0xF, 0xF);
|
|
||||||
|
|
||||||
// Effect packet
|
|
||||||
blockRewriter.registerEffect(0x23, 0x23, 1010, 2001, InventoryPackets1_13_1::getOldItemId);
|
|
||||||
|
|
||||||
// Spawn particle
|
|
||||||
blockRewriter.registerSpawnParticle(Type.FLOAT, 0x24, 0x24, 3, 20, 27, InventoryPackets1_13_1::toClient, Type.FLAT_ITEM);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_14_1to1_14_2;
|
package nl.matsv.viabackwards.protocol.protocol1_14_1to1_14_2;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
|
||||||
public class Protocol1_14_1To1_14_2 extends BackwardsProtocol {
|
public class Protocol1_14_1To1_14_2 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
@Override
|
public Protocol1_14_1To1_14_2() {
|
||||||
protected void registerPackets() {
|
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,21 @@ package nl.matsv.viabackwards.protocol.protocol1_14_2to1_14_3;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
|
||||||
public class Protocol1_14_2To1_14_3 extends BackwardsProtocol {
|
public class Protocol1_14_2To1_14_3 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
|
public Protocol1_14_2To1_14_3() {
|
||||||
|
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Trade list
|
registerOutgoing(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x27, 0x27, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -44,8 +47,7 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare recipes
|
registerOutgoing(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x5A, 0x5A, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -66,30 +68,51 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol {
|
|||||||
wrapper.write(Type.STRING, fullType);
|
wrapper.write(Type.STRING, fullType);
|
||||||
wrapper.write(Type.STRING, id);
|
wrapper.write(Type.STRING, id);
|
||||||
|
|
||||||
if (type.equals("crafting_shapeless")) {
|
switch (type) {
|
||||||
|
case "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++) {
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
}
|
}
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);// Result
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);// Result
|
||||||
} else if (type.equals("crafting_shaped")) {
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "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++) {
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
}
|
}
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);// Result
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);// Result
|
||||||
} else if (type.equals("stonecutting")) {
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "stonecutting":
|
||||||
wrapper.passthrough(Type.STRING); // Group?
|
wrapper.passthrough(Type.STRING); // Group?
|
||||||
|
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
|
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM); // Result
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM); // Result
|
||||||
} else if (type.equals("smelting") || type.equals("blasting") || type.equals("campfire_cooking") || type.equals("smoking")) {
|
|
||||||
|
break;
|
||||||
|
case "smelting":
|
||||||
|
case "blasting":
|
||||||
|
case "campfire_cooking":
|
||||||
|
case "smoking":
|
||||||
wrapper.passthrough(Type.STRING); // Group
|
wrapper.passthrough(Type.STRING); // Group
|
||||||
|
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT); // Ingredients
|
||||||
|
|
||||||
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);
|
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
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +122,4 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,22 @@ package nl.matsv.viabackwards.protocol.protocol1_14_3to1_14_4;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
|
||||||
public class Protocol1_14_3To1_14_4 extends BackwardsProtocol {
|
public class Protocol1_14_3To1_14_4 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
|
public Protocol1_14_3To1_14_4() {
|
||||||
|
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Acknowledge Player Digging - added in pre4
|
// Acknowledge Player Digging - added in pre4
|
||||||
registerOutgoing(State.PLAY, 0x5C, 0x0B, new PacketRemapper() {
|
registerOutgoing(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION1_14);
|
map(Type.POSITION1_14);
|
||||||
@ -21,13 +25,14 @@ public class Protocol1_14_3To1_14_4 extends BackwardsProtocol {
|
|||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
int status = wrapper.read(Type.VAR_INT);
|
int status = wrapper.read(Type.VAR_INT);
|
||||||
boolean allGood = wrapper.read(Type.BOOLEAN);
|
boolean allGood = wrapper.read(Type.BOOLEAN);
|
||||||
if (allGood && status == 0) wrapper.cancel();
|
if (allGood && status == 0) {
|
||||||
|
wrapper.cancel();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trade list
|
registerOutgoing(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x27, 0x27, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -54,8 +59,4 @@ public class Protocol1_14_3To1_14_4 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,26 +16,33 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||||
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_14_4To1_15 extends BackwardsProtocol {
|
public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_15, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
private BlockItemPackets1_15 blockItemPackets;
|
private BlockItemPackets1_15 blockItemPackets;
|
||||||
|
|
||||||
|
public Protocol1_14_4To1_15() {
|
||||||
|
super(ClientboundPackets1_15.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, BackwardsMappings::init);
|
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, BackwardsMappings::init);
|
||||||
|
|
||||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||||
translatableRewriter.registerBossBar(0x0D, 0x0C);
|
translatableRewriter.registerBossBar(ClientboundPackets1_15.BOSSBAR);
|
||||||
translatableRewriter.registerChatMessage(0x0F, 0x0E);
|
translatableRewriter.registerChatMessage(ClientboundPackets1_15.CHAT_MESSAGE);
|
||||||
translatableRewriter.registerCombatEvent(0x33, 0x32);
|
translatableRewriter.registerCombatEvent(ClientboundPackets1_15.COMBAT_EVENT);
|
||||||
translatableRewriter.registerDisconnect(0x1B, 0x1A);
|
translatableRewriter.registerDisconnect(ClientboundPackets1_15.DISCONNECT);
|
||||||
translatableRewriter.registerOpenWindow(0x2F, 0x2E);
|
translatableRewriter.registerOpenWindow(ClientboundPackets1_15.OPEN_WINDOW);
|
||||||
translatableRewriter.registerPlayerList(0x54, 0x53);
|
translatableRewriter.registerTabList(ClientboundPackets1_15.TAB_LIST);
|
||||||
translatableRewriter.registerTitle(0x50, 0x4F);
|
translatableRewriter.registerTitle(ClientboundPackets1_15.TITLE);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
|
|
||||||
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
|
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
|
||||||
@ -43,13 +50,13 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
|
|||||||
|
|
||||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||||
soundRewriter.registerSound(0x52, 0x51);
|
soundRewriter.registerSound(ClientboundPackets1_15.SOUND);
|
||||||
soundRewriter.registerSound(0x51, 0x50);
|
soundRewriter.registerSound(ClientboundPackets1_15.ENTITY_SOUND);
|
||||||
soundRewriter.registerNamedSound(0x1A, 0x19);
|
soundRewriter.registerNamedSound(ClientboundPackets1_15.NAMED_SOUND);
|
||||||
soundRewriter.registerStopSound(0x53, 0x52);
|
soundRewriter.registerStopSound(ClientboundPackets1_15.STOP_SOUND);
|
||||||
|
|
||||||
// Explosion - manually send an explosion sound
|
// Explosion - manually send an explosion sound
|
||||||
registerOutgoing(State.PLAY, 0x1D, 0x1C, new PacketRemapper() {
|
registerOutgoing(ClientboundPackets1_15.EXPLOSION, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.FLOAT); // x
|
map(Type.FLOAT); // x
|
||||||
@ -73,8 +80,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advancements
|
registerOutgoing(ClientboundPackets1_15.ADVANCEMENTS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x58, 0x57, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -113,8 +119,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tags
|
registerOutgoing(ClientboundPackets1_15.TAGS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x5C, 0x5B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -158,58 +163,6 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x09, 0x08);
|
|
||||||
registerOutgoing(State.PLAY, 0x0A, 0x09);
|
|
||||||
registerOutgoing(State.PLAY, 0x0E, 0x0D);
|
|
||||||
registerOutgoing(State.PLAY, 0x11, 0x10);
|
|
||||||
registerOutgoing(State.PLAY, 0x12, 0x11);
|
|
||||||
registerOutgoing(State.PLAY, 0x13, 0x12);
|
|
||||||
registerOutgoing(State.PLAY, 0x14, 0x13);
|
|
||||||
registerOutgoing(State.PLAY, 0x16, 0x15);
|
|
||||||
registerOutgoing(State.PLAY, 0x19, 0x18);
|
|
||||||
registerOutgoing(State.PLAY, 0x1C, 0x1B);
|
|
||||||
registerOutgoing(State.PLAY, 0x1E, 0x1D);
|
|
||||||
registerOutgoing(State.PLAY, 0x20, 0x1F);
|
|
||||||
registerOutgoing(State.PLAY, 0x21, 0x20);
|
|
||||||
registerOutgoing(State.PLAY, 0x25, 0x24);
|
|
||||||
registerOutgoing(State.PLAY, 0x27, 0x26);
|
|
||||||
registerOutgoing(State.PLAY, 0x29, 0x28);
|
|
||||||
registerOutgoing(State.PLAY, 0x2A, 0x29);
|
|
||||||
registerOutgoing(State.PLAY, 0x2B, 0x2A);
|
|
||||||
registerOutgoing(State.PLAY, 0x2C, 0x2B);
|
|
||||||
registerOutgoing(State.PLAY, 0x2D, 0x2C);
|
|
||||||
registerOutgoing(State.PLAY, 0x2E, 0x2D);
|
|
||||||
registerOutgoing(State.PLAY, 0x30, 0x2F);
|
|
||||||
registerOutgoing(State.PLAY, 0x31, 0x30);
|
|
||||||
registerOutgoing(State.PLAY, 0x32, 0x31);
|
|
||||||
registerOutgoing(State.PLAY, 0x34, 0x33);
|
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x34);
|
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x35);
|
|
||||||
registerOutgoing(State.PLAY, 0x37, 0x36);
|
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x38);
|
|
||||||
registerOutgoing(State.PLAY, 0x3A, 0x39);
|
|
||||||
registerOutgoing(State.PLAY, 0x3C, 0x3B);
|
|
||||||
registerOutgoing(State.PLAY, 0x3D, 0x3C);
|
|
||||||
registerOutgoing(State.PLAY, 0x3E, 0x3D);
|
|
||||||
registerOutgoing(State.PLAY, 0x3F, 0x3E);
|
|
||||||
registerOutgoing(State.PLAY, 0x40, 0x3F);
|
|
||||||
registerOutgoing(State.PLAY, 0x41, 0x40);
|
|
||||||
registerOutgoing(State.PLAY, 0x42, 0x41);
|
|
||||||
registerOutgoing(State.PLAY, 0x43, 0x42);
|
|
||||||
registerOutgoing(State.PLAY, 0x45, 0x44);
|
|
||||||
registerOutgoing(State.PLAY, 0x46, 0x45);
|
|
||||||
registerOutgoing(State.PLAY, 0x48, 0x47);
|
|
||||||
registerOutgoing(State.PLAY, 0x4A, 0x49);
|
|
||||||
registerOutgoing(State.PLAY, 0x4B, 0x4A);
|
|
||||||
registerOutgoing(State.PLAY, 0x4C, 0x4B);
|
|
||||||
registerOutgoing(State.PLAY, 0x4D, 0x4C);
|
|
||||||
registerOutgoing(State.PLAY, 0x4E, 0x4D);
|
|
||||||
registerOutgoing(State.PLAY, 0x4F, 0x4E);
|
|
||||||
registerOutgoing(State.PLAY, 0x55, 0x54);
|
|
||||||
registerOutgoing(State.PLAY, 0x56, 0x55);
|
|
||||||
registerOutgoing(State.PLAY, 0x57, 0x56);
|
|
||||||
registerOutgoing(State.PLAY, 0x5A, 0x59);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockStateId(int id) {
|
public static int getNewBlockStateId(int id) {
|
||||||
|
@ -8,7 +8,7 @@ import us.myles.ViaVersion.api.type.Type;
|
|||||||
|
|
||||||
public class RecipeRewriter1_15 extends RecipeRewriter1_14 {
|
public class RecipeRewriter1_15 extends RecipeRewriter1_14 {
|
||||||
|
|
||||||
public RecipeRewriter1_15(final ItemRewriterBase rewriter) {
|
public RecipeRewriter1_15(ItemRewriterBase rewriter) {
|
||||||
super(rewriter);
|
super(rewriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
|||||||
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||||
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;
|
||||||
@ -32,28 +33,20 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_14_4To1_15::getNewBlockStateId, Protocol1_14_4To1_15::getNewBlockId);
|
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_14_4To1_15::getNewBlockStateId, Protocol1_14_4To1_15::getNewBlockId);
|
||||||
|
|
||||||
// Declare Recipes
|
new RecipeRewriter1_15(this).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES);
|
||||||
new RecipeRewriter1_15(this).registerDefaultHandler(0x5B, 0x5A);
|
|
||||||
|
|
||||||
// Edit Book
|
protocol.registerIncoming(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
|
||||||
protocol.registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set cooldown
|
itemRewriter.registerSetCooldown(ClientboundPackets1_15.COOLDOWN, BlockItemPackets1_15::getOldItemId);
|
||||||
itemRewriter.registerSetCooldown(0x18, 0x17, BlockItemPackets1_15::getOldItemId);
|
itemRewriter.registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
|
itemRewriter.registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Window items packet
|
protocol.registerOutgoing(ClientboundPackets1_15.TRADE_LIST, new PacketRemapper() {
|
||||||
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x15, 0x14);
|
|
||||||
|
|
||||||
// Set slot packet
|
|
||||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x16);
|
|
||||||
|
|
||||||
// Trade list
|
|
||||||
protocol.out(State.PLAY, 0x28, 0x27, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -92,29 +85,16 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_15.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||||
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x46);
|
itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Click window packet
|
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_15.ACKNOWLEDGE_PLAYER_DIGGING);
|
||||||
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);
|
blockRewriter.registerBlockAction(ClientboundPackets1_15.BLOCK_ACTION);
|
||||||
|
blockRewriter.registerBlockChange(ClientboundPackets1_15.BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerMultiBlockChange(ClientboundPackets1_15.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
// Creative Inventory Action
|
protocol.registerOutgoing(ClientboundPackets1_15.CHUNK_DATA, new PacketRemapper() {
|
||||||
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x26);
|
|
||||||
|
|
||||||
// Acknowledge player digging
|
|
||||||
blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x5C);
|
|
||||||
|
|
||||||
// Block Action
|
|
||||||
blockRewriter.registerBlockAction(0x0B, 0x0A);
|
|
||||||
|
|
||||||
// Block Change
|
|
||||||
blockRewriter.registerBlockChange(0x0C, 0x0B);
|
|
||||||
|
|
||||||
// Multi Block Change
|
|
||||||
blockRewriter.registerMultiBlockChange(0x10, 0x0F);
|
|
||||||
|
|
||||||
// Chunk
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x21, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -161,11 +141,9 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Effect packet
|
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001, BlockItemPackets1_15::getOldItemId);
|
||||||
blockRewriter.registerEffect(0x23, 0x22, 1010, 2001, BlockItemPackets1_15::getOldItemId);
|
|
||||||
|
|
||||||
// Spawn particle
|
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x24, 0x23, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Particle ID
|
map(Type.INT); // 0 - Particle ID
|
||||||
|
@ -17,7 +17,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
|||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -29,8 +29,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Update health
|
protocol.registerOutgoing(ClientboundPackets1_15.UPDATE_HEALTH, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x49, 0x48, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -46,8 +45,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Change game state
|
protocol.registerOutgoing(ClientboundPackets1_15.GAME_EVENT, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1F, 0x1E, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE);
|
map(Type.UNSIGNED_BYTE);
|
||||||
@ -60,11 +58,9 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Object
|
registerSpawnTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_15Types.EntityType.FALLING_BLOCK, Protocol1_14_4To1_15::getNewBlockStateId);
|
||||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_15Types.EntityType.FALLING_BLOCK, Protocol1_14_4To1_15::getNewBlockStateId);
|
|
||||||
|
|
||||||
// Spawn mob packet
|
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_MOB, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -90,8 +86,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Respawn
|
protocol.registerOutgoing(ClientboundPackets1_15.RESPAWN, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3B, 0x3A, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT);
|
map(Type.INT);
|
||||||
@ -100,8 +95,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Join Game
|
protocol.registerOutgoing(ClientboundPackets1_15.JOIN_GAME, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x25, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Entity ID
|
map(Type.INT); // 0 - Entity ID
|
||||||
@ -122,17 +116,11 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_15.SPAWN_EXPERIENCE_ORB, Entity1_15Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_15Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, Entity1_15Types.EntityType.LIGHTNING_BOLT);
|
||||||
|
registerExtraTracker(ClientboundPackets1_15.SPAWN_PAINTING, Entity1_15Types.EntityType.PAINTING);
|
||||||
|
|
||||||
// Spawn Global Object
|
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_15Types.EntityType.LIGHTNING_BOLT);
|
|
||||||
|
|
||||||
// Spawn painting
|
|
||||||
registerExtraTracker(0x04, Entity1_15Types.EntityType.PAINTING);
|
|
||||||
|
|
||||||
// Spawn player packet
|
|
||||||
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
|
||||||
@ -148,14 +136,11 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
registerEntityDestroy(ClientboundPackets1_15.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x38, 0x37);
|
registerMetadataRewriter(ClientboundPackets1_15.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||||
|
|
||||||
// Entity Metadata packet
|
|
||||||
registerMetadataRewriter(0x44, 0x43, Types1_14.METADATA_LIST);
|
|
||||||
|
|
||||||
// Attributes (get rid of generic.flyingSpeed for the Bee remap)
|
// Attributes (get rid of generic.flyingSpeed for the Bee remap)
|
||||||
protocol.registerOutgoing(State.PLAY, 0x59, 0x58, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_15.ENTITY_PROPERTIES, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT);
|
map(Type.VAR_INT);
|
||||||
|
@ -4,8 +4,15 @@ import nl.matsv.viabackwards.api.BackwardsProtocol;
|
|||||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_14to1_14_1.packets.EntityPackets1_14_1;
|
import nl.matsv.viabackwards.protocol.protocol1_14to1_14_1.packets.EntityPackets1_14_1;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
|
|
||||||
public class Protocol1_14To1_14_1 extends BackwardsProtocol {
|
public class Protocol1_14To1_14_1 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
|
public Protocol1_14To1_14_1() {
|
||||||
|
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
@ -15,8 +22,9 @@ public class Protocol1_14To1_14_1 extends BackwardsProtocol {
|
|||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
@ -10,7 +10,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
|
|
||||||
public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14_1> {
|
public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14_1> {
|
||||||
|
|
||||||
@ -20,15 +20,14 @@ public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
registerExtraTracker(0x01, Entity1_14Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_14.SPAWN_EXPERIENCE_ORB, Entity1_14Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x02, Entity1_14Types.EntityType.LIGHTNING_BOLT);
|
registerExtraTracker(ClientboundPackets1_14.SPAWN_GLOBAL_ENTITY, Entity1_14Types.EntityType.LIGHTNING_BOLT);
|
||||||
registerExtraTracker(0x04, Entity1_14Types.EntityType.PAINTING);
|
registerExtraTracker(ClientboundPackets1_14.SPAWN_PAINTING, Entity1_14Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x05, Entity1_14Types.EntityType.PLAYER);
|
registerExtraTracker(ClientboundPackets1_14.SPAWN_PLAYER, Entity1_14Types.EntityType.PLAYER);
|
||||||
registerExtraTracker(0x25, Entity1_14Types.EntityType.PLAYER, Type.INT); // Join game
|
registerExtraTracker(ClientboundPackets1_14.JOIN_GAME, Entity1_14Types.EntityType.PLAYER, Type.INT);
|
||||||
registerEntityDestroy(0x37);
|
registerEntityDestroy(ClientboundPackets1_14.DESTROY_ENTITIES);
|
||||||
|
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -39,8 +38,7 @@ public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Mob
|
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID
|
map(Type.VAR_INT); // 0 - Entity ID
|
||||||
@ -74,7 +72,7 @@ public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Entity Metadata
|
// Entity Metadata
|
||||||
registerMetadataRewriter(0x43, 0x43, Types1_14.METADATA_LIST);
|
registerMetadataRewriter(ClientboundPackets1_14.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,14 +2,12 @@ package nl.matsv.viabackwards.protocol.protocol1_15_1to1_15_2;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
|
|
||||||
public class Protocol1_15_1To1_15_2 extends BackwardsProtocol {
|
public class Protocol1_15_1To1_15_2 extends BackwardsProtocol<ClientboundPackets1_15, ClientboundPackets1_15, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
@Override
|
public Protocol1_15_1To1_15_2() {
|
||||||
protected void registerPackets() {
|
super(ClientboundPackets1_15.class, ClientboundPackets1_15.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,35 +14,42 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
|||||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
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_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||||
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;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_16, ClientboundPackets1_15, ServerboundPackets1_16, ServerboundPackets1_14> {
|
||||||
|
|
||||||
private BlockItemPackets1_16 blockItemPackets;
|
private BlockItemPackets1_16 blockItemPackets;
|
||||||
private TranslatableRewriter translatableRewriter;
|
private TranslatableRewriter translatableRewriter;
|
||||||
|
|
||||||
|
public Protocol1_15_2To1_16() {
|
||||||
|
super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, BackwardsMappings::init);
|
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, BackwardsMappings::init);
|
||||||
|
|
||||||
translatableRewriter = new TranslatableRewriter1_16(this);
|
translatableRewriter = new TranslatableRewriter1_16(this);
|
||||||
translatableRewriter.registerBossBar(0x0C, 0x0D);
|
translatableRewriter.registerBossBar(ClientboundPackets1_16.BOSSBAR);
|
||||||
translatableRewriter.registerCombatEvent(0x32, 0x33);
|
translatableRewriter.registerCombatEvent(ClientboundPackets1_16.COMBAT_EVENT);
|
||||||
translatableRewriter.registerDisconnect(0x1A, 0x1B);
|
translatableRewriter.registerDisconnect(ClientboundPackets1_16.DISCONNECT);
|
||||||
translatableRewriter.registerPlayerList(0x53, 0x54);
|
translatableRewriter.registerTabList(ClientboundPackets1_16.TAB_LIST);
|
||||||
translatableRewriter.registerTitle(0x4F, 0x50);
|
translatableRewriter.registerTitle(ClientboundPackets1_16.TITLE);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
|
|
||||||
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
||||||
EntityPackets1_16 entityPackets = new EntityPackets1_16(this);
|
EntityPackets1_16 entityPackets = new EntityPackets1_16(this);
|
||||||
entityPackets.register();
|
entityPackets.register();
|
||||||
|
|
||||||
// Chat Message
|
registerOutgoing(ClientboundPackets1_16.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x0E, 0x0F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
||||||
@ -51,8 +58,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open Window
|
registerOutgoing(ClientboundPackets1_16.OPEN_WINDOW, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x2E, 0x2F, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // Window Id
|
map(Type.VAR_INT); // Window Id
|
||||||
@ -71,10 +77,10 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
|
|
||||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||||
soundRewriter.registerSound(0x50, 0x51);
|
soundRewriter.registerSound(ClientboundPackets1_16.SOUND);
|
||||||
soundRewriter.registerSound(0x51, 0x52);
|
soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
|
||||||
soundRewriter.registerNamedSound(0x10, 0x1A);
|
soundRewriter.registerNamedSound(ClientboundPackets1_16.NAMED_SOUND);
|
||||||
soundRewriter.registerStopSound(0x52, 0x53);
|
soundRewriter.registerStopSound(ClientboundPackets1_16.STOP_SOUND);
|
||||||
|
|
||||||
// Login success
|
// Login success
|
||||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||||
@ -88,8 +94,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advancements
|
registerOutgoing(ClientboundPackets1_16.ADVANCEMENTS, new PacketRemapper() {
|
||||||
registerOutgoing(State.PLAY, 0x57, 0x58, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -125,89 +130,12 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tags
|
|
||||||
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> {
|
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> {
|
||||||
Integer oldId = MappingData.oldToNewItems.inverse().get(id);
|
Integer oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||||
return oldId != null ? oldId : -1;
|
return oldId != null ? oldId : -1;
|
||||||
}, entityPackets::getOldEntityId).register(0x5B, 0x5C);
|
}, entityPackets::getOldEntityId).register(ClientboundPackets1_16.TAGS);
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x05, 0x06);
|
cancelIncoming(ServerboundPackets1_14.UPDATE_JIGSAW_BLOCK);
|
||||||
registerOutgoing(State.PLAY, 0x06, 0x07);
|
|
||||||
registerOutgoing(State.PLAY, 0x08, 0x09);
|
|
||||||
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
|
||||||
registerOutgoing(State.PLAY, 0x0D, 0x0E);
|
|
||||||
registerOutgoing(State.PLAY, 0x11, 0x12);
|
|
||||||
registerOutgoing(State.PLAY, 0x12, 0x13);
|
|
||||||
registerOutgoing(State.PLAY, 0x13, 0x14);
|
|
||||||
registerOutgoing(State.PLAY, 0x18, 0x19);
|
|
||||||
registerOutgoing(State.PLAY, 0x19, 0x1A);
|
|
||||||
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
|
||||||
registerOutgoing(State.PLAY, 0x1C, 0x1D);
|
|
||||||
registerOutgoing(State.PLAY, 0x1D, 0x1E);
|
|
||||||
registerOutgoing(State.PLAY, 0x1E, 0x1F);
|
|
||||||
registerOutgoing(State.PLAY, 0x1F, 0x20);
|
|
||||||
registerOutgoing(State.PLAY, 0x20, 0x21);
|
|
||||||
registerOutgoing(State.PLAY, 0x24, 0x25);
|
|
||||||
registerOutgoing(State.PLAY, 0x26, 0x27);
|
|
||||||
registerOutgoing(State.PLAY, 0x28, 0x29);
|
|
||||||
registerOutgoing(State.PLAY, 0x29, 0x2A);
|
|
||||||
registerOutgoing(State.PLAY, 0x2A, 0x2B);
|
|
||||||
registerOutgoing(State.PLAY, 0x2B, 0x2C);
|
|
||||||
registerOutgoing(State.PLAY, 0x2C, 0x2D);
|
|
||||||
registerOutgoing(State.PLAY, 0x2D, 0x2E);
|
|
||||||
registerOutgoing(State.PLAY, 0x2F, 0x30);
|
|
||||||
registerOutgoing(State.PLAY, 0x30, 0x31);
|
|
||||||
registerOutgoing(State.PLAY, 0x31, 0x32);
|
|
||||||
registerOutgoing(State.PLAY, 0x33, 0x34);
|
|
||||||
registerOutgoing(State.PLAY, 0x34, 0x35);
|
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x36);
|
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x37);
|
|
||||||
registerOutgoing(State.PLAY, 0x38, 0x39);
|
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
|
||||||
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
|
||||||
registerOutgoing(State.PLAY, 0x3C, 0x3D);
|
|
||||||
registerOutgoing(State.PLAY, 0x3D, 0x3E);
|
|
||||||
registerOutgoing(State.PLAY, 0x3E, 0x3F);
|
|
||||||
registerOutgoing(State.PLAY, 0x3F, 0x40);
|
|
||||||
registerOutgoing(State.PLAY, 0x40, 0x41);
|
|
||||||
registerOutgoing(State.PLAY, 0x41, 0x42);
|
|
||||||
registerOutgoing(State.PLAY, 0x42, 0x4E);
|
|
||||||
registerOutgoing(State.PLAY, 0x4E, 0x4F);
|
|
||||||
registerOutgoing(State.PLAY, 0x54, 0x55);
|
|
||||||
registerOutgoing(State.PLAY, 0x55, 0x56);
|
|
||||||
registerOutgoing(State.PLAY, 0x56, 0x57);
|
|
||||||
registerOutgoing(State.PLAY, 0x59, 0x5A);
|
|
||||||
|
|
||||||
cancelIncoming(State.PLAY, 0x27); // Set jigsaw
|
|
||||||
registerIncoming(State.PLAY, 0x10, 0x0F);
|
|
||||||
registerIncoming(State.PLAY, 0x11, 0x10);
|
|
||||||
registerIncoming(State.PLAY, 0x12, 0x11);
|
|
||||||
registerIncoming(State.PLAY, 0x13, 0x12);
|
|
||||||
registerIncoming(State.PLAY, 0x14, 0x13);
|
|
||||||
registerIncoming(State.PLAY, 0x15, 0x14);
|
|
||||||
registerIncoming(State.PLAY, 0x16, 0x15);
|
|
||||||
registerIncoming(State.PLAY, 0x17, 0x16);
|
|
||||||
registerIncoming(State.PLAY, 0x18, 0x17);
|
|
||||||
registerIncoming(State.PLAY, 0x19, 0x18);
|
|
||||||
registerIncoming(State.PLAY, 0x1A, 0x19);
|
|
||||||
registerIncoming(State.PLAY, 0x1B, 0x1A);
|
|
||||||
registerIncoming(State.PLAY, 0x1C, 0x1B);
|
|
||||||
registerIncoming(State.PLAY, 0x1D, 0x1C);
|
|
||||||
registerIncoming(State.PLAY, 0x1E, 0x1D);
|
|
||||||
registerIncoming(State.PLAY, 0x1F, 0x1E);
|
|
||||||
registerIncoming(State.PLAY, 0x20, 0x1F);
|
|
||||||
registerIncoming(State.PLAY, 0x21, 0x20);
|
|
||||||
registerIncoming(State.PLAY, 0x22, 0x21);
|
|
||||||
registerIncoming(State.PLAY, 0x23, 0x22);
|
|
||||||
registerIncoming(State.PLAY, 0x24, 0x23);
|
|
||||||
registerIncoming(State.PLAY, 0x25, 0x24);
|
|
||||||
registerIncoming(State.PLAY, 0x26, 0x25);
|
|
||||||
registerIncoming(State.PLAY, 0x29, 0x28);
|
|
||||||
registerIncoming(State.PLAY, 0x2A, 0x29);
|
|
||||||
registerIncoming(State.PLAY, 0x2B, 0x2A);
|
|
||||||
registerIncoming(State.PLAY, 0x2C, 0x2B);
|
|
||||||
registerIncoming(State.PLAY, 0x2D, 0x2C);
|
|
||||||
registerIncoming(State.PLAY, 0x2E, 0x2D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockStateId(int id) {
|
public static int getNewBlockStateId(int id) {
|
||||||
@ -230,10 +158,12 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
if (!user.has(EntityTracker.class))
|
}
|
||||||
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ import nl.matsv.viabackwards.api.rewriters.ItemRewriterBase;
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
public class RecipeRewriter1_16 extends RecipeRewriter1_15 {
|
public class RecipeRewriter1_16 extends RecipeRewriter1_15 {
|
||||||
|
|
||||||
@ -14,9 +14,9 @@ public class RecipeRewriter1_16 extends RecipeRewriter1_15 {
|
|||||||
super(rewriter);
|
super(rewriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(int oldId, int newId) {
|
public void register(ClientboundPacketType packetType) {
|
||||||
// Remove new smithing type, only in this handler
|
// Remove new smithing type, only in this handler
|
||||||
rewriter.getProtocol().registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
rewriter.getProtocol().registerOutgoing(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -3,7 +3,6 @@ package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets;
|
|||||||
import nl.matsv.viabackwards.ViaBackwards;
|
import nl.matsv.viabackwards.ViaBackwards;
|
||||||
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
|
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.RecipeRewriter1_16;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.RecipeRewriter1_16;
|
||||||
@ -15,8 +14,9 @@ import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
|||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.UUIDIntArrayType;
|
import us.myles.ViaVersion.api.type.types.UUIDIntArrayType;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type;
|
||||||
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;
|
||||||
@ -43,20 +43,13 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_15_2To1_16::getNewBlockStateId, Protocol1_15_2To1_16::getNewBlockId);
|
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_15_2To1_16::getNewBlockStateId, Protocol1_15_2To1_16::getNewBlockId);
|
||||||
|
|
||||||
// Declare Recipes
|
new RecipeRewriter1_16(this).register(ClientboundPackets1_16.DECLARE_RECIPES);
|
||||||
new RecipeRewriter1_16(this).register(0x5A, 0x5B);
|
|
||||||
|
|
||||||
// Set cooldown
|
itemRewriter.registerSetCooldown(ClientboundPackets1_16.COOLDOWN, BlockItemPackets1_16::getOldItemId);
|
||||||
itemRewriter.registerSetCooldown(0x17, 0x18, BlockItemPackets1_16::getOldItemId);
|
itemRewriter.registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
|
itemRewriter.registerSetSlot(ClientboundPackets1_16.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Window items packet
|
protocol.registerOutgoing(ClientboundPackets1_16.TRADE_LIST, new PacketRemapper() {
|
||||||
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x14, 0x15);
|
|
||||||
|
|
||||||
// Set slot packet
|
|
||||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x16, 0x17);
|
|
||||||
|
|
||||||
// Trade list
|
|
||||||
protocol.out(State.PLAY, 0x27, 0x28, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -92,23 +85,13 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Entity Equipment Packet
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_16.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||||
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47);
|
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING);
|
||||||
|
blockRewriter.registerBlockAction(ClientboundPackets1_16.BLOCK_ACTION);
|
||||||
|
blockRewriter.registerBlockChange(ClientboundPackets1_16.BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerMultiBlockChange(ClientboundPackets1_16.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
// Acknowledge player digging
|
protocol.registerOutgoing(ClientboundPackets1_16.CHUNK_DATA, new PacketRemapper() {
|
||||||
blockRewriter.registerAcknowledgePlayerDigging(0x07, 0x08);
|
|
||||||
|
|
||||||
// Block Action
|
|
||||||
blockRewriter.registerBlockAction(0x0A, 0x0B);
|
|
||||||
|
|
||||||
// Block Change
|
|
||||||
blockRewriter.registerBlockChange(0x0B, 0x0C);
|
|
||||||
|
|
||||||
// Multi Block Change
|
|
||||||
blockRewriter.registerMultiBlockChange(0x0F, 0x10);
|
|
||||||
|
|
||||||
// Chunk
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x21, 0x22, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
@ -177,15 +160,11 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Effect packet
|
blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001, BlockItemPackets1_16::getOldItemId);
|
||||||
blockRewriter.registerEffect(0x22, 0x23, 1010, 2001, BlockItemPackets1_16::getOldItemId);
|
blockRewriter.registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, 3, 23, 32,
|
||||||
|
BlockItemPackets1_16::getNewParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||||
|
|
||||||
// Spawn particle
|
protocol.registerOutgoing(ClientboundPackets1_16.WINDOW_PROPERTY, new PacketRemapper() {
|
||||||
blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x23, 0x24, 3, 23, 32,
|
|
||||||
BlockItemPackets1_16::getNewParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM);
|
|
||||||
|
|
||||||
// Window Property
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x15, 0x16, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Window id
|
map(Type.UNSIGNED_BYTE); // Window id
|
||||||
@ -205,14 +184,10 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click window packet
|
itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
itemRewriter.registerClickWindow(Type.FLAT_VAR_INT_ITEM, 0x09, 0x09);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_14.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
// Creative Inventory Action
|
protocol.registerIncoming(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
|
||||||
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x27, 0x26);
|
|
||||||
|
|
||||||
// Edit Book
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
|
@ -17,7 +17,7 @@ import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
|||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||||
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 EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||||
@ -43,14 +43,10 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Spawn Object
|
registerSpawnTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
||||||
registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
registerSpawnTracker(ClientboundPackets1_16.SPAWN_MOB);
|
||||||
|
|
||||||
// Spawn mob packet
|
protocol.registerOutgoing(ClientboundPackets1_16.RESPAWN, new PacketRemapper() {
|
||||||
registerSpawnTracker(0x02, 0x03);
|
|
||||||
|
|
||||||
// Respawn
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x3A, 0x3B, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(dimensionTransformer); // Dimension Type
|
map(dimensionTransformer); // Dimension Type
|
||||||
@ -71,8 +67,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Join Game
|
protocol.registerOutgoing(ClientboundPackets1_16.JOIN_GAME, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x25, 0x26, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Entity ID
|
map(Type.INT); // Entity ID
|
||||||
@ -102,25 +97,14 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_16.SPAWN_EXPERIENCE_ORB, Entity1_16Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_16Types.EntityType.EXPERIENCE_ORB);
|
|
||||||
|
|
||||||
// F Spawn Global Object, it is no longer with us :(
|
// F Spawn Global Object, it is no longer with us :(
|
||||||
|
registerExtraTracker(ClientboundPackets1_16.SPAWN_PAINTING, Entity1_16Types.EntityType.PAINTING);
|
||||||
|
registerExtraTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16Types.EntityType.PLAYER);
|
||||||
|
registerEntityDestroy(ClientboundPackets1_16.DESTROY_ENTITIES);
|
||||||
|
registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||||
|
|
||||||
// Spawn painting
|
protocol.registerOutgoing(ClientboundPackets1_16.ENTITY_PROPERTIES, new PacketRemapper() {
|
||||||
registerExtraTracker(0x03, 0x04, Entity1_16Types.EntityType.PAINTING);
|
|
||||||
|
|
||||||
// Spawn player packet
|
|
||||||
registerExtraTracker(0x04, 0x05, Entity1_16Types.EntityType.PLAYER);
|
|
||||||
|
|
||||||
// Destroy entities
|
|
||||||
registerEntityDestroy(0x37, 0x38);
|
|
||||||
|
|
||||||
// Entity Metadata packet
|
|
||||||
registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST);
|
|
||||||
|
|
||||||
// Entity Properties
|
|
||||||
protocol.out(State.PLAY, 0x58, 0x59, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
@ -2,14 +2,12 @@ package nl.matsv.viabackwards.protocol.protocol1_15to1_15_1;
|
|||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||||
|
|
||||||
public class Protocol1_15To1_15_1 extends BackwardsProtocol {
|
public class Protocol1_15To1_15_1 extends BackwardsProtocol<ClientboundPackets1_15, ClientboundPackets1_15, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||||
|
|
||||||
@Override
|
public Protocol1_15To1_15_1() {
|
||||||
protected void registerPackets() {
|
super(ClientboundPackets1_15.class, ClientboundPackets1_15.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(UserConnection userConnection) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,31 +13,48 @@ package nl.matsv.viabackwards.protocol.protocol1_9_4to1_10;
|
|||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.BlockItemPackets1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.BlockItemPackets1_10;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.ChangedPackets1_10;
|
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.EntityPackets1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.EntityPackets1_10;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.SoundPackets1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets.SoundPackets1_10;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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_9_4To1_10 extends BackwardsProtocol {
|
public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||||
|
|
||||||
private EntityPackets1_10 entityPackets; // Required for the item rewriter
|
private EntityPackets1_10 entityPackets; // Required for the item rewriter
|
||||||
private BlockItemPackets1_10 blockItemPackets;
|
private BlockItemPackets1_10 blockItemPackets;
|
||||||
|
|
||||||
|
public Protocol1_9_4To1_10() {
|
||||||
|
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
|
||||||
|
}
|
||||||
|
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
new ChangedPackets1_10().register(this);
|
|
||||||
new SoundPackets1_10(this).register();
|
new SoundPackets1_10(this).register();
|
||||||
(entityPackets = new EntityPackets1_10(this)).register();
|
(entityPackets = new EntityPackets1_10(this)).register();
|
||||||
(blockItemPackets = new BlockItemPackets1_10(this)).register();
|
(blockItemPackets = new BlockItemPackets1_10(this)).register();
|
||||||
|
|
||||||
|
registerIncoming(ServerboundPackets1_9_3.RESOURCE_PACK_STATUS, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING, Type.NOTHING); // 0 - Hash
|
||||||
|
map(Type.VAR_INT); // 1 - Result
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
if (!user.has(ClientWorld.class))
|
if (!user.has(ClientWorld.class)) {
|
||||||
user.put(new ClientWorld(user));
|
user.put(new ClientWorld(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Register EntityTracker if it doesn't exist yet.
|
// Register EntityTracker if it doesn't exist yet.
|
||||||
if (!user.has(EntityTracker.class))
|
if (!user.has(EntityTracker.class)) {
|
||||||
user.put(new EntityTracker(user));
|
user.put(new EntityTracker(user));
|
||||||
|
}
|
||||||
|
|
||||||
// Init protocol in EntityTracker
|
// Init protocol in EntityTracker
|
||||||
user.get(EntityTracker.class).initProtocol(this);
|
user.get(EntityTracker.class).initProtocol(this);
|
||||||
|
@ -21,8 +21,9 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||||
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 BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4To1_10> {
|
public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4To1_10> {
|
||||||
@ -35,17 +36,13 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||||
|
|
||||||
// Set slot packet
|
itemRewriter.registerSetSlot(ClientboundPackets1_9_3.SET_SLOT, Type.ITEM);
|
||||||
itemRewriter.registerSetSlot(Type.ITEM, 0x16, 0x16);
|
itemRewriter.registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS, Type.ITEM_ARRAY);
|
||||||
|
|
||||||
// Window items packet
|
|
||||||
itemRewriter.registerWindowItems(Type.ITEM_ARRAY, 0x14, 0x14);
|
|
||||||
|
|
||||||
// Entity Equipment Packet
|
// Entity Equipment Packet
|
||||||
itemRewriter.registerEntityEquipment(Type.ITEM, 0x3C, 0x3C);
|
itemRewriter.registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM);
|
||||||
|
|
||||||
// Plugin message Packet -> Trading
|
protocol.registerOutgoing(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Channel
|
map(Type.STRING); // 0 - Channel
|
||||||
@ -62,8 +59,9 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Output 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.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second Item
|
wrapper.write(Type.ITEM, handleItemToClient(wrapper.read(Type.ITEM))); // Second 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
|
||||||
@ -75,16 +73,10 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click window packet
|
itemRewriter.registerClickWindow(ServerboundPackets1_9_3.CLICK_WINDOW, Type.ITEM);
|
||||||
itemRewriter.registerClickWindow(Type.ITEM, 0x07, 0x07);
|
itemRewriter.registerCreativeInvAction(ServerboundPackets1_9_3.CREATIVE_INVENTORY_ACTION, Type.ITEM);
|
||||||
|
|
||||||
// Creative Inventory Action
|
protocol.registerOutgoing(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
|
||||||
itemRewriter.registerCreativeInvAction(Type.ITEM, 0x18, 0x18);
|
|
||||||
|
|
||||||
|
|
||||||
/* Block packets */
|
|
||||||
// Chunk packet
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -99,11 +91,10 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Block Change Packet
|
// Block Change Packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0B, 0x0B, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.BLOCK_CHANGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.POSITION); // 0 - Block Position
|
map(Type.POSITION); // 0 - Block Position
|
||||||
@ -117,11 +108,10 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Multi Block Change Packet
|
// Multi Block Change Packet
|
||||||
protocol.registerOutgoing(State.PLAY, 0x10, 0x10, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
@ -137,8 +127,7 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Rewrite metadata items
|
// Rewrite metadata items
|
||||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||||
@ -151,7 +140,7 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Particle
|
// Particle
|
||||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT);
|
map(Type.INT);
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 Matsv
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.packets;
|
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
|
||||||
import us.myles.ViaVersion.packets.State;
|
|
||||||
|
|
||||||
public class ChangedPackets1_10 {
|
|
||||||
|
|
||||||
public void register(BackwardsProtocol protocol) {
|
|
||||||
/* ServerBound packets */
|
|
||||||
|
|
||||||
// ResourcePack status
|
|
||||||
protocol.registerIncoming(State.PLAY, 0x16, 0x16, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.STRING, Type.NOTHING); // 0 - Hash
|
|
||||||
map(Type.VAR_INT); // 1 - Result
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,7 +27,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -39,8 +39,7 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Spawn Object
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x00, 0x00, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -78,14 +77,10 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Experience Orb
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_EXPERIENCE_ORB, Entity1_10Types.EntityType.EXPERIENCE_ORB);
|
||||||
registerExtraTracker(0x01, Entity1_10Types.EntityType.EXPERIENCE_ORB);
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_GLOBAL_ENTITY, Entity1_10Types.EntityType.WEATHER);
|
||||||
|
|
||||||
// Spawn Global Entity
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
|
||||||
registerExtraTracker(0x02, Entity1_10Types.EntityType.WEATHER);
|
|
||||||
|
|
||||||
// Spawn Mob
|
|
||||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity id
|
map(Type.VAR_INT); // 0 - Entity id
|
||||||
@ -138,17 +133,11 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spawn Painting
|
registerExtraTracker(ClientboundPackets1_9_3.SPAWN_PAINTING, Entity1_10Types.EntityType.PAINTING);
|
||||||
registerExtraTracker(0x04, Entity1_10Types.EntityType.PAINTING);
|
registerJoinGame(ClientboundPackets1_9_3.JOIN_GAME, Entity1_10Types.EntityType.PLAYER);
|
||||||
|
registerRespawn(ClientboundPackets1_9_3.RESPAWN);
|
||||||
|
|
||||||
// Join game
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SPAWN_PLAYER, new PacketRemapper() {
|
||||||
registerJoinGame(0x23, 0x23, Entity1_10Types.EntityType.PLAYER);
|
|
||||||
|
|
||||||
// Respawn Packet
|
|
||||||
registerRespawn(0x33, 0x33);
|
|
||||||
|
|
||||||
// Spawn Player
|
|
||||||
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
|
||||||
@ -164,11 +153,8 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Destroy entities
|
registerEntityDestroy(ClientboundPackets1_9_3.DESTROY_ENTITIES);
|
||||||
registerEntityDestroy(0x30);
|
registerMetadataRewriter(ClientboundPackets1_9_3.ENTITY_METADATA, Types1_9.METADATA_LIST);
|
||||||
|
|
||||||
// Metadata packet
|
|
||||||
registerMetadataRewriter(0x39, 0x39, Types1_9.METADATA_LIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
|
|
||||||
public class SoundPackets1_10 extends LegacySoundRewriter<Protocol1_9_4To1_10> {
|
public class SoundPackets1_10 extends LegacySoundRewriter<Protocol1_9_4To1_10> {
|
||||||
protected static ValueTransformer<Float, Short> toOldPitch = new ValueTransformer<Float, Short>(Type.UNSIGNED_BYTE) {
|
protected static ValueTransformer<Float, Short> toOldPitch = new ValueTransformer<Float, Short>(Type.UNSIGNED_BYTE) {
|
||||||
@ -32,8 +32,7 @@ public class SoundPackets1_10 extends LegacySoundRewriter<Protocol1_9_4To1_10> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
// Named sound effect
|
protocol.registerOutgoing(ClientboundPackets1_9_3.NAMED_SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // 0 - Sound name
|
map(Type.STRING); // 0 - Sound name
|
||||||
@ -46,8 +45,7 @@ public class SoundPackets1_10 extends LegacySoundRewriter<Protocol1_9_4To1_10> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sound effect
|
protocol.registerOutgoing(ClientboundPackets1_9_3.SOUND, new PacketRemapper() {
|
||||||
protocol.registerOutgoing(State.PLAY, 0x46, 0x46, new PacketRemapper() {
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Sound name
|
map(Type.VAR_INT); // 0 - Sound name
|
||||||
@ -63,13 +61,15 @@ public class SoundPackets1_10 extends LegacySoundRewriter<Protocol1_9_4To1_10> {
|
|||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int oldId = wrapper.get(Type.VAR_INT, 0);
|
int oldId = wrapper.get(Type.VAR_INT, 0);
|
||||||
int newId = handleSounds(oldId);
|
int newId = handleSounds(oldId);
|
||||||
if (newId == -1)
|
if (newId == -1) {
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
else {
|
return;
|
||||||
if (hasPitch(oldId))
|
|
||||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) Math.round(handlePitch(oldId) * 63.5F));
|
|
||||||
wrapper.set(Type.VAR_INT, 0, newId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasPitch(oldId)) {
|
||||||
|
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) Math.round(handlePitch(oldId) * 63.5F));
|
||||||
|
}
|
||||||
|
wrapper.set(Type.VAR_INT, 0, newId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
8
pom.xml
8
pom.xml
@ -57,5 +57,13 @@
|
|||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JetBrains Annotations -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>19.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren