Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
24w11a
Dieser Commit ist enthalten in:
Ursprung
a453163822
Commit
e1f2f151c9
@ -27,6 +27,7 @@ import com.viaversion.viaversion.api.data.Int2IntMapMappings;
|
||||
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||
import com.viaversion.viaversion.api.data.entity.TrackedEntity;
|
||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
@ -210,12 +211,13 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
|
||||
}
|
||||
|
||||
public void registerMetaTypeHandler1_20_3(
|
||||
@Nullable MetaType itemType,
|
||||
@Nullable MetaType blockStateType,
|
||||
@Nullable MetaType optionalBlockStateType,
|
||||
@Nullable MetaType particleType,
|
||||
@Nullable MetaType componentType,
|
||||
@Nullable MetaType optionalComponentType
|
||||
@Nullable MetaType itemType,
|
||||
@Nullable MetaType blockStateType,
|
||||
@Nullable MetaType optionalBlockStateType,
|
||||
@Nullable MetaType particleType,
|
||||
@Nullable MetaType particlesType,
|
||||
@Nullable MetaType componentType,
|
||||
@Nullable MetaType optionalComponentType
|
||||
) {
|
||||
filter().handler((event, meta) -> {
|
||||
MetaType type = meta.metaType();
|
||||
@ -231,6 +233,11 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
|
||||
}
|
||||
} else if (type == particleType) {
|
||||
rewriteParticle(meta.value());
|
||||
} else if (type == particlesType) {
|
||||
Particle[] particles = meta.value();
|
||||
for (final Particle particle : particles) {
|
||||
rewriteParticle(particle);
|
||||
}
|
||||
} else if (type == optionalComponentType || type == componentType) {
|
||||
protocol.getTranslatableRewriter().processTag(meta.value());
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class SoundRewriter<C extends ClientboundPacketType> extends com.viaversi
|
||||
}
|
||||
|
||||
if (mappedId != soundEventHolder.id()) {
|
||||
soundEventHolder = new Holder<>(mappedId);
|
||||
soundEventHolder = Holder.of(mappedId);
|
||||
}
|
||||
|
||||
wrapper.write(Type.SOUND_EVENT, soundEventHolder);
|
||||
@ -128,7 +128,7 @@ public class SoundRewriter<C extends ClientboundPacketType> extends com.viaversi
|
||||
final String mappedIdentifier = protocol.getMappingData().getMappedNamedSound(soundEvent.identifier());
|
||||
if (mappedIdentifier != null) {
|
||||
if (!mappedIdentifier.isEmpty()) {
|
||||
return new Holder<>(soundEvent.withIdentifier(mappedIdentifier));
|
||||
return Holder.of(soundEvent.withIdentifier(mappedIdentifier));
|
||||
}
|
||||
wrapper.cancel();
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
// TODO Trim storage in registry sending
|
||||
// TODO also for banners?
|
||||
super.registerPackets();
|
||||
|
||||
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
|
||||
|
@ -166,7 +166,7 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
|
||||
if (item == null) return null;
|
||||
|
||||
// Convert to structured item first
|
||||
final Item structuredItem = vvProtocol.getItemRewriter().toStructuredItem(item, false);
|
||||
final Item structuredItem = vvProtocol.getItemRewriter().toStructuredItem(item);
|
||||
return super.handleItemToServer(structuredItem);
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.Protocol1_20_
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.RegistryDataStorage;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.storage.SecureChatStorage;
|
||||
import com.viaversion.viaversion.api.data.entity.DimensionData;
|
||||
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.entities.EntityTypes1_20_5;
|
||||
@ -34,7 +35,9 @@ import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import com.viaversion.viaversion.data.entity.DimensionDataImpl;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.AttributeMappings;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.data.Attributes1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPacket1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||
@ -79,9 +82,14 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
protected void register() {
|
||||
handler(wrapper -> {
|
||||
final String registryKey = Key.stripMinecraftNamespace(wrapper.read(Type.STRING));
|
||||
final RegistryEntry[] entries = wrapper.read(Type.REGISTRY_ENTRY_ARRAY);
|
||||
// TODO Track banner pattern/material ids
|
||||
if (registryKey.equals("wolf_variant") || registryKey.equals("banner_pattern") || registryKey.equals("banner_material")) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
// Track data
|
||||
final RegistryEntry[] entries = wrapper.read(Type.REGISTRY_ENTRY_ARRAY);
|
||||
final RegistryDataStorage registryDataStorage = wrapper.user().get(RegistryDataStorage.class);
|
||||
if (registryKey.equals("worldgen/biome")) {
|
||||
tracker(wrapper.user()).setBiomesSent(entries.length);
|
||||
@ -109,6 +117,15 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
final RegistryEntry entry = entries[i];
|
||||
Preconditions.checkNotNull(entry.tag(), "Server unexpectedly sent null registry data entry for " + entry.key());
|
||||
|
||||
if (registryKey.equals("trim_pattern")) {
|
||||
final CompoundTag patternTag = (CompoundTag) entry.tag();
|
||||
final StringTag templateItem = patternTag.getStringTag("template_item");
|
||||
if (Protocol1_20_5To1_20_3.MAPPINGS.itemId(templateItem.getValue()) == -1) {
|
||||
// Skip new items
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
final CompoundTag entryCompoundTag = new CompoundTag();
|
||||
entryCompoundTag.putString("name", entry.key());
|
||||
entryCompoundTag.putInt("id", i);
|
||||
@ -154,6 +171,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
wrapper.user().get(SecureChatStorage.class).setEnforcesSecureChat(enforcesSecureChat);
|
||||
});
|
||||
handler(worldDataTrackerHandlerByKey()); // Tracks world height and name for chunk data and entity (un)tracking
|
||||
handler(playerTrackerHandler());
|
||||
}
|
||||
});
|
||||
|
||||
@ -183,19 +201,23 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_5.ENTITY_PROPERTIES, wrapper -> {
|
||||
wrapper.passthrough(Type.VAR_INT); // Entity ID
|
||||
final int entityId = wrapper.passthrough(Type.VAR_INT);
|
||||
final int size = wrapper.passthrough(Type.VAR_INT);
|
||||
int newSize = size;
|
||||
for (int i = 0; i < size; i++) {
|
||||
// From a registry int ID to a string
|
||||
int id = protocol.getMappingData().getAttributeMappings().getNewId(wrapper.read(Type.VAR_INT));
|
||||
final String attribute = AttributeMappings.attribute(id);
|
||||
if ("horse.jump_strength".equals(attribute)) {
|
||||
// Jump strength only applies to horses in old versions
|
||||
id = -1;
|
||||
final int attributeId = wrapper.read(Type.VAR_INT);
|
||||
final String attribute = Attributes1_20_5.idToKey(attributeId);
|
||||
int mappedId = protocol.getMappingData().getAttributeMappings().getNewId(attributeId);
|
||||
if ("generic.jump_strength".equals(attribute)) {
|
||||
final EntityType type = tracker(wrapper.user()).entityType(entityId);
|
||||
if (type == null || !type.isOrHasParent(EntityTypes1_20_5.HORSE)) {
|
||||
// Jump strength only applies to horses in old versions
|
||||
mappedId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (id == -1) {
|
||||
if (mappedId == -1) {
|
||||
// Remove new attributes from the list
|
||||
newSize--;
|
||||
|
||||
@ -227,25 +249,38 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().mapMetaType(typeId -> {
|
||||
if (typeId == Types1_20_5.META_TYPES.particlesType.typeId()) {
|
||||
return Types1_20_5.META_TYPES.particlesType;
|
||||
}
|
||||
|
||||
int id = typeId;
|
||||
if (typeId >= Types1_20_5.META_TYPES.wolfVariantType.typeId()) {
|
||||
id--;
|
||||
}
|
||||
if (typeId >= Types1_20_5.META_TYPES.armadilloState.typeId()) {
|
||||
id--;
|
||||
}
|
||||
if (typeId >= Types1_20_5.META_TYPES.wolfVariantType.typeId()) {
|
||||
if (typeId >= Types1_20_5.META_TYPES.particlesType.typeId()) {
|
||||
id--;
|
||||
}
|
||||
return Types1_20_3.META_TYPES.byId(id);
|
||||
});
|
||||
|
||||
registerMetaTypeHandler1_20_3(
|
||||
Types1_20_3.META_TYPES.itemType,
|
||||
Types1_20_3.META_TYPES.blockStateType,
|
||||
Types1_20_3.META_TYPES.optionalBlockStateType,
|
||||
Types1_20_3.META_TYPES.particleType,
|
||||
Types1_20_3.META_TYPES.componentType,
|
||||
Types1_20_3.META_TYPES.optionalComponentType
|
||||
Types1_20_3.META_TYPES.itemType,
|
||||
Types1_20_3.META_TYPES.blockStateType,
|
||||
Types1_20_3.META_TYPES.optionalBlockStateType,
|
||||
Types1_20_3.META_TYPES.particleType,
|
||||
null,
|
||||
Types1_20_3.META_TYPES.componentType,
|
||||
Types1_20_3.META_TYPES.optionalComponentType
|
||||
);
|
||||
|
||||
filter().type(EntityTypes1_20_5.LIVINGENTITY).index(10).handler((event, meta) -> {
|
||||
final Particle[] particles = meta.value();
|
||||
meta.setTypeAndValue(Types1_20_3.META_TYPES.varIntType, 0); // TODO
|
||||
});
|
||||
|
||||
filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||
final int blockState = meta.value();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
@ -256,6 +291,14 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
filter().type(EntityTypes1_20_5.WOLF).removeIndex(22); // Wolf variant
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewriteParticle(final Particle particle) {
|
||||
super.rewriteParticle(particle);
|
||||
if (particle.id() == protocol.getMappingData().getParticleMappings().mappedId("entity_effect")) {
|
||||
particle.removeArgument(0); // rgb
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMappingDataLoaded() {
|
||||
mapTypes();
|
||||
|
Binäre Datei nicht angezeigt.
@ -1,4 +1,4 @@
|
||||
projectVersion=4.10.0-24w10a-SNAPSHOT
|
||||
projectVersion=4.10.0-24w11a-SNAPSHOT
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=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
|
||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "4.10.0-24w10a-SNAPSHOT"
|
||||
viaver = "4.10.0-24w11a-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
@ -99,7 +99,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
Types1_20_5.META_TYPES.blockStateType,
|
||||
Types1_20_5.META_TYPES.optionalBlockStateType,
|
||||
Types1_20_5.META_TYPES.particleType,
|
||||
Types1_20_5.META_TYPES.componentType,
|
||||
null, Types1_20_5.META_TYPES.componentType,
|
||||
Types1_20_5.META_TYPES.optionalComponentType
|
||||
);
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren