Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-25 07:40:08 +01:00
More work on 21w37a
Dieser Commit ist enthalten in:
Ursprung
3054b758df
Commit
87ad6bd2b1
@ -18,11 +18,17 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.EntityPackets1_18;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||
|
||||
@ -38,6 +44,21 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
protected void registerPackets() {
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_17_1.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_17_1.ENTITY_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_17_1.STOP_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_17_1.NAMED_SOUND);
|
||||
|
||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_17_1.TAGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, Entity1_17Types.PLAYER)); //TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,6 +39,7 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17T
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_18> {
|
||||
@ -140,7 +141,9 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
|
||||
tag.put("id", new StringTag(id));
|
||||
}
|
||||
|
||||
final Chunk chunk = new BaseChunk(oldChunk.getX(), oldChunk.getZ(), true, false, null,
|
||||
final BitSet mask = new BitSet(oldChunk.getSections().length);
|
||||
mask.set(0, oldChunk.getSections().length);
|
||||
final Chunk chunk = new BaseChunk(oldChunk.getX(), oldChunk.getZ(), true, false, mask,
|
||||
oldChunk.getSections(), biomeData, oldChunk.getHeightMap(), blockEntityTags);
|
||||
wrapper.write(new Chunk1_17Type(tracker.currentWorldSectionHeight()), chunk);
|
||||
|
||||
|
@ -26,9 +26,12 @@ import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.FloatTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18> {
|
||||
|
||||
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||
@ -56,14 +59,20 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
|
||||
map(Type.NBT); // Dimension registry
|
||||
map(Type.NBT); // Current dimension data
|
||||
map(Type.STRING); // World
|
||||
handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT));
|
||||
//handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT)); //TODO
|
||||
handler(worldDataTrackerHandler(1));
|
||||
handler(wrapper -> {
|
||||
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
final ListTag biomes = biomeRegistry.get("value");
|
||||
for (final Tag biome : biomes) {
|
||||
for (final Tag biome : new ArrayList<>(biomes.getValue())) {
|
||||
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
|
||||
final StringTag category = biomeCompound.get("category");
|
||||
if (category.getValue().equals("mountain")) {
|
||||
biomes.remove(biome);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The client just needs something
|
||||
biomeCompound.put("depth", new FloatTag(0.125F));
|
||||
biomeCompound.put("scale", new FloatTag(0.05F));
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren