mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-28 13:05:25 +01:00
1.21-pre4
This commit is contained in:
parent
3d656d411d
commit
d007beaeec
@ -84,7 +84,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
|
||||
public static final ProtocolVersion v1_20_2 = register(764, "1.20.2");
|
||||
public static final ProtocolVersion v1_20_3 = register(765, "1.20.3-1.20.4", new SubVersionRange("1.20", 3, 4));
|
||||
public static final ProtocolVersion v1_20_5 = register(766, "1.20.5-1.20.6", new SubVersionRange("1.20", 5, 6));
|
||||
public static final ProtocolVersion v1_21 = register(767, 201, "1.21");
|
||||
public static final ProtocolVersion v1_21 = register(767, 202, "1.21");
|
||||
public static final ProtocolVersion unknown = new ProtocolVersion(VersionType.SPECIAL, -1, -1, "UNKNOWN", null);
|
||||
|
||||
public static ProtocolVersion register(int version, String name) {
|
||||
|
@ -412,13 +412,12 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
Types1_20_5.ENTITY_DATA_TYPES.blockStateType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.optionalBlockStateType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.particleType,
|
||||
null
|
||||
null,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.componentType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType
|
||||
);
|
||||
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
|
||||
|
||||
filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.componentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value()));
|
||||
filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value()));
|
||||
|
||||
filter().type(EntityTypes1_20_5.LIVING_ENTITY).index(10).handler((event, meta) -> {
|
||||
final int effectColor = meta.value();
|
||||
if (effectColor == 0) {
|
||||
|
@ -38,7 +38,6 @@ import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StructuredItemRewriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class BlockItemPacketRewriter1_21 extends StructuredItemRewriter<ClientboundPacket1_20_5, ServerboundPacket1_20_5, Protocol1_20_5To1_21> {
|
||||
|
||||
@ -108,9 +107,9 @@ public final class BlockItemPacketRewriter1_21 extends StructuredItemRewriter<Cl
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Item handleItemToClient(final UserConnection connection, @Nullable final Item item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
public Item handleItemToClient(final UserConnection connection, final Item item) {
|
||||
if (item.isEmpty()) {
|
||||
return item;
|
||||
}
|
||||
|
||||
super.handleItemToClient(connection, item);
|
||||
@ -132,9 +131,9 @@ public final class BlockItemPacketRewriter1_21 extends StructuredItemRewriter<Cl
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Item handleItemToServer(final UserConnection connection, @Nullable final Item item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
public Item handleItemToServer(final UserConnection connection, final Item item) {
|
||||
if (item.isEmpty()) {
|
||||
return item;
|
||||
}
|
||||
|
||||
super.handleItemToServer(connection, item);
|
||||
|
@ -143,7 +143,9 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
Types1_21.ENTITY_DATA_TYPES.blockStateType,
|
||||
Types1_21.ENTITY_DATA_TYPES.optionalBlockStateType,
|
||||
Types1_21.ENTITY_DATA_TYPES.particleType,
|
||||
Types1_21.ENTITY_DATA_TYPES.particlesType
|
||||
Types1_21.ENTITY_DATA_TYPES.particlesType,
|
||||
Types1_21.ENTITY_DATA_TYPES.componentType,
|
||||
Types1_21.ENTITY_DATA_TYPES.optionalComponentType
|
||||
);
|
||||
|
||||
filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
|
||||
|
@ -21,6 +21,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.ListTag;
|
||||
import com.viaversion.nbt.tag.NumberTag;
|
||||
import com.viaversion.nbt.tag.Tag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.data.Int2IntMapMappings;
|
||||
@ -32,9 +33,9 @@ import com.viaversion.viaversion.api.data.entity.TrackedEntity;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
@ -191,6 +192,10 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
registerEntityDataTypeHandler(itemType, null, blockStateType, particleType, null);
|
||||
}
|
||||
|
||||
public void registerEntityDataTypeHandler(@Nullable EntityDataType itemType, @Nullable EntityDataType blockStateType, @Nullable EntityDataType optionalBlockStateType, @Nullable EntityDataType particleType, @Nullable EntityDataType particlesType) {
|
||||
registerEntityDataTypeHandler(itemType, blockStateType, optionalBlockStateType, particleType, particlesType, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an entity data handler to rewrite, item, block, and particle ids stored in entity data.
|
||||
*
|
||||
@ -199,8 +204,12 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
* @param optionalBlockStateType optional block state data type if needed
|
||||
* @param particleType particle data type if needed
|
||||
* @param particlesType particles data type if needed
|
||||
* @param componentType component data type if needed
|
||||
* @param optionalComponentType optional component data type if needed
|
||||
*/
|
||||
public void registerEntityDataTypeHandler(@Nullable EntityDataType itemType, @Nullable EntityDataType blockStateType, @Nullable EntityDataType optionalBlockStateType, @Nullable EntityDataType particleType, @Nullable EntityDataType particlesType) {
|
||||
public void registerEntityDataTypeHandler(@Nullable EntityDataType itemType, @Nullable EntityDataType blockStateType, @Nullable EntityDataType optionalBlockStateType,
|
||||
@Nullable EntityDataType particleType, @Nullable EntityDataType particlesType,
|
||||
@Nullable EntityDataType componentType, @Nullable EntityDataType optionalComponentType) {
|
||||
filter().handler((event, data) -> {
|
||||
final EntityDataType type = data.dataType();
|
||||
if (type == itemType) {
|
||||
@ -220,6 +229,9 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
for (final Particle particle : particles) {
|
||||
rewriteParticle(event.user(), particle);
|
||||
}
|
||||
} else if (type == componentType || type == optionalComponentType) {
|
||||
final Tag component = data.value();
|
||||
protocol.getComponentRewriter().processTag(event.user(), component);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||
projectVersion=5.0.0-1.21-pre3-SNAPSHOT
|
||||
projectVersion=5.0.0-1.21-pre4-SNAPSHOT
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9
|
||||
|
@ -95,7 +95,9 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
Types1_20_5.ENTITY_DATA_TYPES.blockStateType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.optionalBlockStateType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.particleType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.particlesType
|
||||
Types1_20_5.ENTITY_DATA_TYPES.particlesType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.componentType,
|
||||
Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType
|
||||
);
|
||||
// Minecarts are special
|
||||
registerBlockStateHandler(EntityTypes1_20_5.ABSTRACT_MINECART, 11);
|
||||
|
Loading…
Reference in New Issue
Block a user