Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Small cleanup
Dieser Commit ist enthalten in:
Ursprung
93e92ffc82
Commit
0acec719b1
@ -23,7 +23,7 @@ import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacke
|
|||||||
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||||
import com.viaversion.viaversion.util.SerializerVersion;
|
import com.viaversion.viaversion.util.SerializerVersion;
|
||||||
|
|
||||||
public final class ComponentRewriter1_99 extends ComponentRewriter<ClientboundPacket1_21> {
|
final class ComponentRewriter1_99 extends ComponentRewriter<ClientboundPacket1_21> {
|
||||||
|
|
||||||
public ComponentRewriter1_99(final Protocol1_99To_98 protocol) {
|
public ComponentRewriter1_99(final Protocol1_99To_98 protocol) {
|
||||||
super(protocol, ReadType.NBT);
|
super(protocol, ReadType.NBT);
|
||||||
|
@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
|||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||||
import com.viaversion.viaversion.api.rewriter.ComponentRewriter;
|
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_21_2;
|
import com.viaversion.viaversion.api.type.types.version.Types1_21_2;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5;
|
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ServerboundConfigurationPackets1_20_5;
|
||||||
@ -34,6 +33,7 @@ import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundConfi
|
|||||||
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21;
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPacket1_21;
|
||||||
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21;
|
import com.viaversion.viaversion.protocols.v1_20_5to1_21.packet.ClientboundPackets1_21;
|
||||||
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.ParticleRewriter;
|
import com.viaversion.viaversion.rewriter.ParticleRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
@ -55,7 +55,7 @@ final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1_21, Cl
|
|||||||
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
||||||
private final ParticleRewriter<ClientboundPacket1_21> particleRewriter = new ParticleRewriter<>(this, /*Types1_OLD.PARTICLE,*/ Types1_21_2.PARTICLE);
|
private final ParticleRewriter<ClientboundPacket1_21> particleRewriter = new ParticleRewriter<>(this, /*Types1_OLD.PARTICLE,*/ Types1_21_2.PARTICLE);
|
||||||
private final TagRewriter<ClientboundPacket1_21> tagRewriter = new TagRewriter<>(this);
|
private final TagRewriter<ClientboundPacket1_21> tagRewriter = new TagRewriter<>(this);
|
||||||
private final ComponentRewriter1_99 componentRewriter = new ComponentRewriter1_99(this);
|
private final ComponentRewriter<ClientboundPacket1_21> componentRewriter = new ComponentRewriter1_99(this);
|
||||||
|
|
||||||
public Protocol1_99To_98() {
|
public Protocol1_99To_98() {
|
||||||
// Passing the class types into the super constructor is needed for automatic packet type id remapping, but can otherwise be omitted
|
// Passing the class types into the super constructor is needed for automatic packet type id remapping, but can otherwise be omitted
|
||||||
@ -166,7 +166,7 @@ final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPacket1_21, Cl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ComponentRewriter getComponentRewriter() {
|
public ComponentRewriter<ClientboundPacket1_21> getComponentRewriter() {
|
||||||
return componentRewriter;
|
return componentRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_21_2;
|
|||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||||
import com.viaversion.viaversion.api.rewriter.ComponentRewriter;
|
|
||||||
import com.viaversion.viaversion.api.type.Types;
|
import com.viaversion.viaversion.api.type.Types;
|
||||||
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
|
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_21_2;
|
import com.viaversion.viaversion.api.type.types.version.Types1_21_2;
|
||||||
@ -45,6 +44,7 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacke
|
|||||||
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPacket1_21_2;
|
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPacket1_21_2;
|
||||||
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPackets1_21_2;
|
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ServerboundPackets1_21_2;
|
||||||
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
import com.viaversion.viaversion.rewriter.AttributeRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.ParticleRewriter;
|
import com.viaversion.viaversion.rewriter.ParticleRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
@ -60,7 +60,7 @@ public final class Protocol1_21_2To1_21_4 extends AbstractProtocol<ClientboundPa
|
|||||||
private final BlockItemPacketRewriter1_21_4 itemRewriter = new BlockItemPacketRewriter1_21_4(this);
|
private final BlockItemPacketRewriter1_21_4 itemRewriter = new BlockItemPacketRewriter1_21_4(this);
|
||||||
private final ParticleRewriter<ClientboundPacket1_21_2> particleRewriter = new ParticleRewriter1_21_4(this);
|
private final ParticleRewriter<ClientboundPacket1_21_2> particleRewriter = new ParticleRewriter1_21_4(this);
|
||||||
private final TagRewriter<ClientboundPacket1_21_2> tagRewriter = new TagRewriter<>(this);
|
private final TagRewriter<ClientboundPacket1_21_2> tagRewriter = new TagRewriter<>(this);
|
||||||
private final ComponentRewriter1_21_4 componentRewriter = new ComponentRewriter1_21_4(this);
|
private final ComponentRewriter<ClientboundPacket1_21_2> componentRewriter = new ComponentRewriter1_21_4(this);
|
||||||
|
|
||||||
public Protocol1_21_2To1_21_4() {
|
public Protocol1_21_2To1_21_4() {
|
||||||
super(ClientboundPacket1_21_2.class, ClientboundPacket1_21_2.class, ServerboundPacket1_21_2.class, ServerboundPacket1_21_4.class);
|
super(ClientboundPacket1_21_2.class, ClientboundPacket1_21_2.class, ServerboundPacket1_21_2.class, ServerboundPacket1_21_4.class);
|
||||||
@ -221,7 +221,7 @@ public final class Protocol1_21_2To1_21_4 extends AbstractProtocol<ClientboundPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ComponentRewriter getComponentRewriter() {
|
public ComponentRewriter<ClientboundPacket1_21_2> getComponentRewriter() {
|
||||||
return componentRewriter;
|
return componentRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public final class EntityPacketRewriter1_21_4 extends EntityRewriter<Clientbound
|
|||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerTrackerWithData1_19(ClientboundPackets1_21_2.ADD_ENTITY, EntityTypes1_21_2.FALLING_BLOCK);
|
registerTrackerWithData1_19(ClientboundPackets1_21_2.ADD_ENTITY, EntityTypes1_21_2.FALLING_BLOCK);
|
||||||
registerSetEntityData(ClientboundPackets1_21_2.SET_ENTITY_DATA, Types1_21_2.ENTITY_DATA_LIST, Types1_21_4.ENTITY_DATA_LIST); // Specify old and new entity data list if changed
|
registerSetEntityData(ClientboundPackets1_21_2.SET_ENTITY_DATA, Types1_21_2.ENTITY_DATA_LIST, Types1_21_4.ENTITY_DATA_LIST);
|
||||||
registerRemoveEntities(ClientboundPackets1_21_2.REMOVE_ENTITIES);
|
registerRemoveEntities(ClientboundPackets1_21_2.REMOVE_ENTITIES);
|
||||||
|
|
||||||
final RegistryDataRewriter registryDataRewriter = new RegistryDataRewriter(protocol) {
|
final RegistryDataRewriter registryDataRewriter = new RegistryDataRewriter(protocol) {
|
||||||
@ -117,14 +117,14 @@ public final class EntityPacketRewriter1_21_4 extends EntityRewriter<Clientbound
|
|||||||
registerBlockStateHandler(EntityTypes1_21_2.ABSTRACT_MINECART, 11);
|
registerBlockStateHandler(EntityTypes1_21_2.ABSTRACT_MINECART, 11);
|
||||||
|
|
||||||
filter().type(EntityTypes1_21_2.CREAKING_TRANSIENT).addIndex(18); // Is tearing down
|
filter().type(EntityTypes1_21_2.CREAKING_TRANSIENT).addIndex(18); // Is tearing down
|
||||||
filter().type(EntityTypes1_21_2.SALMON).index(17).handler((data, event) -> {
|
filter().type(EntityTypes1_21_2.SALMON).index(17).handler((event, data) -> {
|
||||||
final String type = event.value();
|
final String type = data.value();
|
||||||
final int typeId = switch (type) {
|
final int typeId = switch (type) {
|
||||||
case "small" -> 0;
|
case "small" -> 0;
|
||||||
case "large" -> 2;
|
case "large" -> 2;
|
||||||
default -> 1; // medium
|
default -> 1; // medium
|
||||||
};
|
};
|
||||||
event.setTypeAndValue(Types1_21_4.ENTITY_DATA_TYPES.varIntType, typeId);
|
data.setTypeAndValue(Types1_21_4.ENTITY_DATA_TYPES.varIntType, typeId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren