mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-26 03:55:28 +01:00
23w07a
This commit is contained in:
parent
1faf1f3f49
commit
1376312449
@ -54,6 +54,7 @@ public enum Entity1_19_4Types implements EntityType {
|
||||
BLOCK_DISPLAY(DISPLAY),
|
||||
ITEM_DISPLAY(DISPLAY),
|
||||
TEXT_DISPLAY(DISPLAY),
|
||||
INTERACTION(ENTITY),
|
||||
|
||||
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
|
||||
ENDER_DRAGON(ABSTRACT_INSENTIENT),
|
||||
@ -82,6 +83,7 @@ public enum Entity1_19_4Types implements EntityType {
|
||||
FOX(ABSTRACT_ANIMAL),
|
||||
FROG(ABSTRACT_ANIMAL),
|
||||
GOAT(ABSTRACT_ANIMAL),
|
||||
SNIFFER(ABSTRACT_ANIMAL),
|
||||
|
||||
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
|
||||
CAT(ABSTRACT_TAMEABLE_ANIMAL),
|
||||
|
@ -53,11 +53,12 @@ public final class MetaTypes1_19_4 extends AbstractMetaTypes {
|
||||
public final MetaType frogVariantType = add(22, Type.VAR_INT);
|
||||
public final MetaType optionalGlobalPosition = add(23, Type.OPTIONAL_GLOBAL_POSITION);
|
||||
public final MetaType paintingVariantType = add(24, Type.VAR_INT);
|
||||
public final MetaType vectorType = add(25, Type.VECTOR3F);
|
||||
public final MetaType quaternionType = add(26, Type.QUATERNION);
|
||||
public final MetaType snifferState = add(25, Type.VAR_INT);
|
||||
public final MetaType vectorType = add(26, Type.VECTOR3F);
|
||||
public final MetaType quaternionType = add(27, Type.QUATERNION);
|
||||
|
||||
public MetaTypes1_19_4(final ParticleType particleType) {
|
||||
super(27);
|
||||
super(28);
|
||||
this.particleType = add(17, particleType);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class ProtocolVersion {
|
||||
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
||||
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
||||
public static final ProtocolVersion v1_19_3 = register(761, "1.19.3");
|
||||
public static final ProtocolVersion v1_19_4 = register(762, 118, "1.19.4");
|
||||
public static final ProtocolVersion v1_19_4 = register(762, 119, "1.19.4");
|
||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||
|
||||
public static ProtocolVersion register(int version, String name) {
|
||||
|
@ -50,7 +50,7 @@ public class ParticleType extends Type<Particle> {
|
||||
}
|
||||
|
||||
public ParticleTypeFiller filler(final Protocol<?, ?, ?, ?> protocol, final boolean useMappedNames) {
|
||||
return this.new ParticleTypeFiller(protocol, useMappedNames);
|
||||
return new ParticleTypeFiller(protocol, useMappedNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,11 +26,13 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_4;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
|
||||
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
||||
import java.util.List;
|
||||
|
||||
public final class Types1_19_4 {
|
||||
|
||||
public static final MetaTypes1_19_4 META_TYPES = new MetaTypes1_19_4(Types1_19_3.PARTICLE);
|
||||
public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading
|
||||
public static final MetaTypes1_19_4 META_TYPES = new MetaTypes1_19_4(PARTICLE);
|
||||
public static final Type<Metadata> METADATA = new MetadataType(META_TYPES);
|
||||
public static final Type<List<Metadata>> METADATA_LIST = new MetaListType(METADATA);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.data;
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
@ -17,22 +17,31 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_4Types;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_19_4;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data.MappingData;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets.EntityPackets;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets.InventoryPackets;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPackets1_19_3, ClientboundPackets1_19_4, ServerboundPackets1_19_3, ServerboundPackets1_19_4> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingData();
|
||||
private final EntityPackets entityRewriter = new EntityPackets(this);
|
||||
private final InventoryPackets itemRewriter = new InventoryPackets(this);
|
||||
|
||||
public Protocol1_19_4To1_19_3() {
|
||||
super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_4.class);
|
||||
@ -40,10 +49,14 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
//TODO Damage events
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
final CommandRewriter<ClientboundPackets1_19_3> commandRewriter = new CommandRewriter<ClientboundPackets1_19_3>(this) {
|
||||
final SoundRewriter<ClientboundPackets1_19_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_19_3.ENTITY_SOUND);
|
||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_19_3.SOUND);
|
||||
|
||||
new CommandRewriter<ClientboundPackets1_19_3>(this) {
|
||||
@Override
|
||||
public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception {
|
||||
if (argumentType.equals("minecraft:time")) {
|
||||
@ -53,13 +66,35 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPa
|
||||
super.handleArgument(wrapper, argumentType);
|
||||
}
|
||||
}
|
||||
};
|
||||
commandRewriter.registerDeclareCommands1_19(ClientboundPackets1_19_3.DECLARE_COMMANDS);
|
||||
|
||||
}.registerDeclareCommands1_19(ClientboundPackets1_19_3.DECLARE_COMMANDS);
|
||||
|
||||
registerClientbound(ClientboundPackets1_19_3.SERVER_DATA, wrapper -> {
|
||||
JsonElement element = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||
if (element == null) {
|
||||
element = new JsonObject();
|
||||
}
|
||||
wrapper.write(Type.COMPONENT, element);
|
||||
|
||||
final String iconBase64 = wrapper.read(Type.OPTIONAL_STRING);
|
||||
final byte[] iconBytes = iconBase64 != null ? Base64.getDecoder().decode(iconBase64.substring("data:image/png;base64,".length()).getBytes(StandardCharsets.UTF_8)) : null;
|
||||
wrapper.write(Type.OPTIONAL_BYTE_ARRAY_PRIMITIVE, iconBytes);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMappingDataLoaded() {
|
||||
Entity1_19_4Types.initialize(this);
|
||||
Types1_19_4.PARTICLE.filler(this)
|
||||
.reader("block", ParticleType.Readers.BLOCK)
|
||||
.reader("block_marker", ParticleType.Readers.BLOCK)
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
entityRewriter.onMappingDataLoaded();
|
||||
}
|
||||
|
||||
@ -72,4 +107,14 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPa
|
||||
public MappingData getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryPackets getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2023 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.rewriter.RecipeRewriter1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ServerboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
|
||||
public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_19_3, ServerboundPackets1_19_4, Protocol1_19_4To1_19_3> {
|
||||
|
||||
public InventoryPackets(final Protocol1_19_4To1_19_3 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
final BlockRewriter<ClientboundPackets1_19_3> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_19_3.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_19_3.BLOCK_CHANGE);
|
||||
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_3.MULTI_BLOCK_CHANGE);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_19_3.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerChunkData1_19(ClientboundPackets1_19_3.CHUNK_DATA, Chunk1_18Type::new);
|
||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_19_3.BLOCK_ENTITY_DATA);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_19_3.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_19_3.WINDOW_ITEMS);
|
||||
registerSetSlot1_17_1(ClientboundPackets1_19_3.SET_SLOT);
|
||||
registerAdvancements(ClientboundPackets1_19_3.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||
registerEntityEquipmentArray(ClientboundPackets1_19_3.ENTITY_EQUIPMENT);
|
||||
registerTradeList1_19(ClientboundPackets1_19_3.TRADE_LIST);
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_19_3.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_19(ClientboundPackets1_19_3.SPAWN_PARTICLE);
|
||||
registerCreativeInvAction(ServerboundPackets1_19_4.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_19_4.CLICK_WINDOW);
|
||||
|
||||
new RecipeRewriter1_19_3<ClientboundPackets1_19_3>(protocol) {
|
||||
@Override
|
||||
public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception {
|
||||
super.handleCraftingShaped(wrapper);
|
||||
wrapper.write(Type.BOOLEAN, true); // Show notification
|
||||
}
|
||||
}.register(ClientboundPackets1_19_3.DECLARE_RECIPES);
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
|
||||
public class CommandRewriter1_19_3<C extends ClientboundPacketType> extends CommandRewriter<C> {
|
||||
public class CommandRewriter1_19_4<C extends ClientboundPacketType> extends CommandRewriter<C> {
|
||||
|
||||
public CommandRewriter1_19_3(Protocol<C, ?, ?, ?> protocol) {
|
||||
public CommandRewriter1_19_4(Protocol<C, ?, ?, ?> protocol) {
|
||||
super(protocol);
|
||||
this.parserHandlers.put("minecraft:time", wrapper -> wrapper.passthrough(Type.INT)); // Minimum
|
||||
}
|
@ -15,13 +15,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.data;
|
||||
package com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.data.RecipeRewriter1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.rewriter.RecipeRewriter1_19_3;
|
||||
|
||||
public class RecipeRewriter1_19_4<C extends ClientboundPacketType> extends RecipeRewriter1_19_3<C> {
|
||||
|
@ -21,12 +21,12 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.provider.AckSequenceProvider;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.rewriter.RecipeRewriter;
|
||||
|
||||
public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_18, ServerboundPackets1_19, Protocol1_19To1_18_2> {
|
||||
|
||||
@ -122,7 +122,7 @@ public final class InventoryPackets extends ItemRewriter<ClientboundPackets1_18,
|
||||
}
|
||||
});
|
||||
|
||||
new RecipeRewriter1_16<>(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||
new RecipeRewriter<>(protocol).register(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||
}
|
||||
|
||||
private PacketHandler sequenceHandler() {
|
||||
|
@ -31,17 +31,17 @@ public class RecipeRewriter<C extends ClientboundPacketType> {
|
||||
protected final Protocol<C, ?, ?, ?> protocol;
|
||||
protected final Map<String, RecipeConsumer> recipeHandlers = new HashMap<>();
|
||||
|
||||
public RecipeRewriter(Protocol<C, ?, ?, ?> protocol) {
|
||||
public RecipeRewriter(final Protocol<C, ?, ?, ?> protocol) {
|
||||
this.protocol = protocol;
|
||||
recipeHandlers.put("crafting_shapeless", this::handleCraftingShapeless);
|
||||
recipeHandlers.put("crafting_shaped", this::handleCraftingShaped);
|
||||
recipeHandlers.put("smelting", this::handleSmelting);
|
||||
|
||||
// Added in 1.14
|
||||
recipeHandlers.put("stonecutting", this::handleStonecutting);
|
||||
recipeHandlers.put("blasting", this::handleSmelting);
|
||||
recipeHandlers.put("smoking", this::handleSmelting);
|
||||
recipeHandlers.put("campfire_cooking", this::handleSmelting);
|
||||
recipeHandlers.put("stonecutting", this::handleStonecutting);
|
||||
|
||||
// Added in 1.16
|
||||
recipeHandlers.put("smithing", this::handleSmithing);
|
||||
@ -99,7 +99,7 @@ public class RecipeRewriter<C extends ClientboundPacketType> {
|
||||
}
|
||||
|
||||
public void handleStonecutting(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
wrapper.passthrough(Type.STRING); // Group
|
||||
handleIngredient(wrapper);
|
||||
rewrite(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Result
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public class SoundRewriter<C extends ClientboundPacketType> {
|
||||
});
|
||||
}
|
||||
|
||||
// Not for entity sounds
|
||||
public void register1_19_3Sound(C packetType) {
|
||||
protocol.registerClientbound(packetType, wrapper -> {
|
||||
final int soundId = wrapper.read(Type.VAR_INT);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||
projectVersion=4.6.0-23w06a-SNAPSHOT
|
||||
projectVersion=4.6.0-23w07a-SNAPSHOT
|
||||
|
||||
# Gradle properties
|
||||
org.gradle.daemon=true
|
||||
|
Loading…
Reference in New Issue
Block a user