mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-18 16:17:45 +01:00
24w20a
This commit is contained in:
parent
e9d142e2ec
commit
1a24ce6d87
@ -32,6 +32,7 @@ import com.viaversion.viaversion.api.minecraft.data.StructuredDataContainer;
|
||||
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.item.data.Enchantments;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_21;
|
||||
@ -78,6 +79,13 @@ public final class BlockItemPacketRewriter1_21 extends BackwardsStructuredItemRe
|
||||
registerLevelParticles1_20_5(ClientboundPackets1_20_5.LEVEL_PARTICLES, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
|
||||
registerExplosion(ClientboundPackets1_20_5.EXPLODE, Types1_21.PARTICLE, Types1_20_5.PARTICLE);
|
||||
|
||||
protocol.registerServerbound(ServerboundPackets1_20_5.USE_ITEM, wrapper -> {
|
||||
wrapper.passthrough(Types.VAR_INT); // Hand
|
||||
wrapper.passthrough(Types.VAR_INT); // Sequence
|
||||
wrapper.write(Types.FLOAT, 0f); // Y rotation
|
||||
wrapper.write(Types.FLOAT, 0f); // X rotation
|
||||
});
|
||||
|
||||
new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.UPDATE_RECIPES);
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,13 @@ import com.viaversion.nbt.tag.Tag;
|
||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||
import com.viaversion.viabackwards.protocol.v1_21to1_20_5.Protocol1_21To1_20_5;
|
||||
import com.viaversion.viabackwards.protocol.v1_21to1_20_5.storage.EnchantmentsPaintingsStorage;
|
||||
import com.viaversion.viaversion.api.minecraft.Holder;
|
||||
import com.viaversion.viaversion.api.minecraft.PaintingVariant;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
||||
import com.viaversion.viaversion.api.minecraft.WolfVariant;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
@ -46,8 +50,8 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
super(protocol, Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType, Types1_20_5.ENTITY_DATA_TYPES.booleanType);
|
||||
|
||||
for (int i = 0; i < Paintings1_20_5.PAINTINGS.length; i++) {
|
||||
final Paintings1_20_5.PaintingVariant painting = Paintings1_20_5.PAINTINGS[i];
|
||||
oldPaintings.put(painting.key(), new PaintingData(painting, i));
|
||||
final PaintingVariant painting = Paintings1_20_5.PAINTINGS[i];
|
||||
oldPaintings.put(painting.assetId(), new PaintingData(painting, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +134,7 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
|
||||
final CompoundTag tag = (CompoundTag) entry.tag();
|
||||
for (int j = 0; j < Paintings1_20_5.PAINTINGS.length; j++) {
|
||||
final Paintings1_20_5.PaintingVariant painting = Paintings1_20_5.PAINTINGS[j];
|
||||
final PaintingVariant painting = Paintings1_20_5.PAINTINGS[j];
|
||||
if (painting.width() == tag.getInt("width") && painting.height() == tag.getInt("height")) {
|
||||
mappings[i] = j;
|
||||
break;
|
||||
@ -142,6 +146,28 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().handler((event, data) -> {
|
||||
final EntityDataType type = data.dataType();
|
||||
if (type == Types1_21.ENTITY_DATA_TYPES.wolfVariantType) {
|
||||
final Holder<WolfVariant> variant = data.value();
|
||||
if (variant.hasId()) {
|
||||
data.setTypeAndValue(Types1_20_5.ENTITY_DATA_TYPES.wolfVariantType, variant);
|
||||
} else {
|
||||
event.cancel();
|
||||
}
|
||||
} else if (type == Types1_21.ENTITY_DATA_TYPES.paintingVariantType) {
|
||||
final Holder<PaintingVariant> variant = data.value();
|
||||
if (variant.hasId()) {
|
||||
final EnchantmentsPaintingsStorage storage = event.user().get(EnchantmentsPaintingsStorage.class);
|
||||
final int mappedId = storage.mappedPainting(variant.id());
|
||||
data.setTypeAndValue(Types1_20_5.ENTITY_DATA_TYPES.paintingVariantType, mappedId);
|
||||
} else {
|
||||
event.cancel();
|
||||
}
|
||||
} else {
|
||||
data.setDataType(Types1_20_5.ENTITY_DATA_TYPES.byId(type.typeId()));
|
||||
}
|
||||
});
|
||||
filter().mapDataType(Types1_20_5.ENTITY_DATA_TYPES::byId);
|
||||
|
||||
registerMetaTypeHandler1_20_3(
|
||||
@ -154,15 +180,9 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType
|
||||
);
|
||||
|
||||
filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.paintingVariantType).handler((event, meta) -> {
|
||||
final EnchantmentsPaintingsStorage storage = event.user().get(EnchantmentsPaintingsStorage.class);
|
||||
final int id = meta.value();
|
||||
meta.setValue(storage.mappedPainting(id));
|
||||
});
|
||||
|
||||
filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> {
|
||||
final int blockState = meta.value();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, data) -> {
|
||||
final int blockState = data.value();
|
||||
data.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
}
|
||||
|
||||
@ -171,13 +191,6 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
|
||||
return EntityTypes1_20_5.getTypeFromId(type);
|
||||
}
|
||||
|
||||
private static final class PaintingData {
|
||||
private final Paintings1_20_5.PaintingVariant painting;
|
||||
private final int id;
|
||||
|
||||
private PaintingData(final Paintings1_20_5.PaintingVariant painting, final int id) {
|
||||
this.painting = painting;
|
||||
this.id = id;
|
||||
}
|
||||
private record PaintingData(PaintingVariant painting, int id) {
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
projectVersion=5.0.0-24w19b-SNAPSHOT
|
||||
projectVersion=5.0.0-24w20a-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
|
||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "5.0.0-24w19b-SNAPSHOT"
|
||||
viaver = "5.0.0-24w20a-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
Loading…
Reference in New Issue
Block a user