3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00
Dieser Commit ist enthalten in:
KennyTV 2020-11-12 21:47:46 +01:00
Ursprung 6e011f9297
Commit 56c80fb5c3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
12 geänderte Dateien mit 139 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-all</artifactId> <artifactId>viabackwards-all</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-bukkit</artifactId> <artifactId>viabackwards-bukkit</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-bungee</artifactId> <artifactId>viabackwards-bungee</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-core</artifactId> <artifactId>viabackwards-core</artifactId>

Datei anzeigen

@ -35,7 +35,7 @@ public class BackwardsMappings extends MappingData {
if (diffMappings != null) { if (diffMappings != null) {
JsonObject diffItems = diffMappings.getAsJsonObject("items"); JsonObject diffItems = diffMappings.getAsJsonObject("items");
if (diffItems != null) { if (diffItems != null) {
backwardsItemMappings = VBMappingDataLoader.loadItemMappings(oldMappings.getAsJsonObject("items"), newMappings.getAsJsonObject("items"), diffItems); backwardsItemMappings = VBMappingDataLoader.loadItemMappings(oldMappings.getAsJsonObject("items"), newMappings.getAsJsonObject("items"), diffItems, true);
} }
JsonObject diffSounds = diffMappings.getAsJsonObject("sounds"); JsonObject diffSounds = diffMappings.getAsJsonObject("sounds");

Datei anzeigen

@ -2,8 +2,11 @@ package nl.matsv.viabackwards.protocol.protocol1_16_4to1_17;
import nl.matsv.viabackwards.api.BackwardsProtocol; import nl.matsv.viabackwards.api.BackwardsProtocol;
import nl.matsv.viabackwards.api.data.BackwardsMappings; import nl.matsv.viabackwards.api.data.BackwardsMappings;
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
import nl.matsv.viabackwards.api.rewriters.SoundRewriter; import nl.matsv.viabackwards.api.rewriters.SoundRewriter;
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17; import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17;
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets.EntityPackets1_17;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter; import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter; import us.myles.ViaVersion.api.rewriters.TagRewriter;
@ -15,6 +18,7 @@ import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> { public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true); public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true);
private BlockItemPackets1_17 blockItemPackets;
public Protocol1_16_4To1_17() { public Protocol1_16_4To1_17() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class); super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
@ -24,7 +28,10 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
protected void registerPackets() { protected void registerPackets() {
executeAsyncAfterLoaded(Protocol1_17To1_16_4.class, MAPPINGS::load); executeAsyncAfterLoaded(Protocol1_17To1_16_4.class, MAPPINGS::load);
new BlockItemPackets1_17(this, null).register(); blockItemPackets = new BlockItemPackets1_17(this, null);
blockItemPackets.register();
new EntityPackets1_17(this).register();
SoundRewriter soundRewriter = new SoundRewriter(this); SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND); soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
@ -45,6 +52,35 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
}); });
} }
}); });
registerOutgoing(ClientboundPackets1_16_2.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.BYTE);
wrapper.write(Type.BOOLEAN, true); // Tracking position
wrapper.passthrough(Type.BOOLEAN);
boolean hasMarkers = wrapper.read(Type.BOOLEAN);
if (!hasMarkers) {
wrapper.write(Type.VAR_INT, 0); // Array size
}
});
}
});
}
@Override
public void init(UserConnection user) {
if (!user.has(EntityTracker.class)) {
user.put(new EntityTracker(user));
}
user.get(EntityTracker.class).initProtocol(this);
}
public BlockItemPackets1_17 getBlockItemPackets() {
return blockItemPackets;
} }
@Override @Override

Datei anzeigen

@ -0,0 +1,75 @@
package nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets;
import nl.matsv.viabackwards.api.rewriters.EntityRewriter;
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
import us.myles.ViaVersion.api.entities.Entity1_16_2Types;
import us.myles.ViaVersion.api.entities.EntityType;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.Particle;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.viaversion.libs.gson.JsonElement;
public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
public EntityPackets1_17(Protocol1_16_4To1_17 protocol) {
super(protocol);
}
@Override
protected void registerPackets() {
registerSpawnTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_16_2.SPAWN_MOB);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EntityType.EXPERIENCE_ORB);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST);
protocol.registerOutgoing(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
}
});
}
@Override
protected void registerRewrites() {
registerMetaHandler().handle(e -> {
Metadata meta = e.getData();
MetaType type = meta.getMetaType();
if (type == MetaType1_14.Slot) {
meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue()));
} else if (type == MetaType1_14.BlockID) {
meta.setValue(protocol.getMappingData().getNewBlockStateId((int) meta.getValue()));
} else if (type == MetaType1_14.OptChat) {
JsonElement text = meta.getCastedValue();
if (text != null) {
//protocol.getTranslatableRewriter().processText(text); //TODO
}
} else if (type == MetaType1_14.PARTICLE) {
rewriteParticle((Particle) meta.getValue());
}
return meta;
});
registerMetaHandler().filter(7).removed(); // Ticks frozen
registerMetaHandler().handle(meta -> {
if (meta.getIndex() > 7) {
meta.getData().setId(meta.getIndex() - 1);
}
return meta.getData();
});
}
@Override
protected EntityType getTypeFromId(int typeId) {
return Entity1_16_2Types.getTypeFromId(typeId);
}
}

Datei anzeigen

@ -2,6 +2,10 @@
"blockstates": { "blockstates": {
"minecraft:dirt_path": "minecraft:grass_path", "minecraft:dirt_path": "minecraft:grass_path",
"minecraft:cauldron": "minecraft:cauldron[level=0]", "minecraft:cauldron": "minecraft:cauldron[level=0]",
"minecraft:powder_snow_cauldron[level=1]": "minecraft:cauldron[level=1]",
"minecraft:powder_snow_cauldron[level=2]": "minecraft:cauldron[level=2]",
"minecraft:powder_snow_cauldron[level=3]": "minecraft:cauldron[level=3]",
"minecraft:powder_snow": "minecraft:snow_block",
"minecraft:water_cauldron[level=1]": "minecraft:cauldron[level=1]", "minecraft:water_cauldron[level=1]": "minecraft:cauldron[level=1]",
"minecraft:water_cauldron[level=2]": "minecraft:cauldron[level=2]", "minecraft:water_cauldron[level=2]": "minecraft:cauldron[level=2]",
"minecraft:water_cauldron[level=3]": "minecraft:cauldron[level=3]", "minecraft:water_cauldron[level=3]": "minecraft:cauldron[level=3]",
@ -791,6 +795,10 @@
"minecraft:lightning_rod": { "minecraft:lightning_rod": {
"id": "minecraft:end_rod", "id": "minecraft:end_rod",
"name": "1.17 Lightning Rod" "name": "1.17 Lightning Rod"
},
"minecraft:powder_snow_bucket": {
"id": "minecraft:milk_bucket",
"name": "1.17 Powder Snow Bucket"
} }
}, },
"sounds": { "sounds": {
@ -837,9 +845,17 @@
"block.tuff.place": "", "block.tuff.place": "",
"block.tuff.hit": "", "block.tuff.hit": "",
"block.tuff.fall": "", "block.tuff.fall": "",
"small_flame": "" "item.bucket.empty_powder_snow": "",
"item.bucket.fill_powder_snow": "",
"entity.player.hurt_freeze": "",
"block.powder_snow.break": "",
"block.powder_snow.fall": "",
"block.powder_snow.hit": "",
"block.powder_snow.place": "",
"block.powder_snow.step": ""
}, },
"particles": { "particles": {
"small_flame": "flame" "small_flame": "flame",
"snowflake": "cloud"
} }
} }

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-fabric</artifactId> <artifactId>viabackwards-fabric</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<description>Allow older clients to join newer server versions.</description> <description>Allow older clients to join newer server versions.</description>

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-sponge</artifactId> <artifactId>viabackwards-sponge</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent> <parent>
<artifactId>viabackwards-parent</artifactId> <artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId> <groupId>nl.matsv</groupId>
<version>3.3.0-20w45a</version> <version>3.3.0-20w46a</version>
</parent> </parent>
<artifactId>viabackwards-velocity</artifactId> <artifactId>viabackwards-velocity</artifactId>