3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 23:30:17 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-03-16 22:16:22 +01:00
Ursprung 422f2b699b
Commit 15a5e6f710
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
9 geänderte Dateien mit 369 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -58,7 +58,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform { public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "4.2.0"; String MINIMUM_VV_VERSION = "4.3.0";
String IMPL_VERSION = "$IMPL_VERSION"; String IMPL_VERSION = "$IMPL_VERSION";
/** /**
@ -111,9 +111,9 @@ public interface ViaBackwardsPlatform {
protocolManager.registerProtocol(new Protocol1_17To1_17_1(), ProtocolVersion.v1_17, ProtocolVersion.v1_17_1); protocolManager.registerProtocol(new Protocol1_17To1_17_1(), ProtocolVersion.v1_17, ProtocolVersion.v1_17_1);
protocolManager.registerProtocol(new Protocol1_17_1To1_18(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_18); protocolManager.registerProtocol(new Protocol1_17_1To1_18(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_18);
//protocolManager.registerProtocol(new Protocol1_18To1_18_2(), ProtocolVersion.v1_18, ProtocolVersion.v1_18_2); //TODO protocolManager.registerProtocol(new Protocol1_18To1_18_2(), ProtocolVersion.v1_18, ProtocolVersion.v1_18_2);
protocolManager.registerProtocol(new Protocol1_18_2To1_19(), ProtocolVersion.v1_18, ProtocolVersion.v1_19); protocolManager.registerProtocol(new Protocol1_18_2To1_19(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_19);
} }
/** /**

Datei anzeigen

@ -154,6 +154,11 @@ public class BackwardsMappings extends MappingDataBase {
} }
public @Nullable String mappedEntityName(String entityName) { public @Nullable String mappedEntityName(String entityName) {
if (entityNames == null) {
ViaBackwards.getPlatform().getLogger().severe("No entity mappings found when requesting them for " + entityName);
new Exception().printStackTrace();
return null;
}
return entityNames.get(entityName); return entityNames.get(entityName);
} }

Datei anzeigen

@ -17,27 +17,32 @@
*/ */
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19; package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.api.data.BackwardsMappings;
import com.viaversion.viabackwards.api.rewriters.SoundRewriter; import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.data.BackwardsMappings;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.BlockItemPackets1_19; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.BlockItemPackets1_19;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.EntityPackets1_19; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.EntityPackets1_19;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.BlockAckStorage;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.rewriter.EntityRewriter; import com.viaversion.viaversion.api.rewriter.EntityRewriter;
import com.viaversion.viaversion.api.rewriter.ItemRewriter; import com.viaversion.viaversion.api.rewriter.ItemRewriter;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
import com.viaversion.viaversion.rewriter.CommandRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.rewriter.TagRewriter;
public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_17, ServerboundPackets1_17> { public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_17, ServerboundPackets1_17> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.19", "1.18", Protocol1_19To1_18_2.class, true); public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this); private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this); private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this); private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
@ -51,6 +56,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
//TODO block entity update, chunk? //TODO block entity update, chunk?
executeAsyncAfterLoaded(Protocol1_19To1_18_2.class, MAPPINGS::load); executeAsyncAfterLoaded(Protocol1_19To1_18_2.class, MAPPINGS::load);
//TODO update translation mappings
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.CHAT_MESSAGE); translatableRewriter.registerComponentPacket(ClientboundPackets1_19.CHAT_MESSAGE);
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR); translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR);
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT); translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT);
@ -74,10 +80,51 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
new TagRewriter(this).registerGeneric(ClientboundPackets1_19.TAGS); new TagRewriter(this).registerGeneric(ClientboundPackets1_19.TAGS);
new StatisticsRewriter(this).register(ClientboundPackets1_19.STATISTICS); new StatisticsRewriter(this).register(ClientboundPackets1_19.STATISTICS);
final CommandRewriter commandRewriter = new CommandRewriter(this);
registerClientbound(ClientboundPackets1_19.DECLARE_COMMANDS, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
final int size = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < size; i++) {
final byte flags = wrapper.passthrough(Type.BYTE);
wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE); // Children indices
if ((flags & 0x08) != 0) {
wrapper.passthrough(Type.VAR_INT); // Redirect node index
}
final int nodeType = flags & 0x03;
if (nodeType == 1 || nodeType == 2) { // Literal/argument node
wrapper.passthrough(Type.STRING); // Name
}
if (nodeType == 2) { // Argument node
final int argumentTypeId = wrapper.read(Type.VAR_INT);
String argumentType = MAPPINGS.argumentType(argumentTypeId);
if (argumentType == null) {
ViaBackwards.getPlatform().getLogger().warning("Unknown command argument type id: " + argumentTypeId);
argumentType = "minecraft:no";
}
wrapper.write(Type.STRING, argumentType);
commandRewriter.handleArgument(wrapper, argumentType);
if ((flags & 0x10) != 0) {
wrapper.passthrough(Type.STRING); // Suggestion type
}
}
}
wrapper.passthrough(Type.VAR_INT); // Root node index
});
}
});
} }
@Override @Override
public void init(final UserConnection user) { public void init(final UserConnection user) {
user.put(new BlockAckStorage());
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER)); addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
} }

Datei anzeigen

@ -0,0 +1,49 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2022 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.data;
import com.viaversion.viaversion.libs.gson.JsonArray;
import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.libs.gson.JsonObject;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
private String[] argumentTypes;
public BackwardsMappings() {
super("1.19", "1.18", Protocol1_19To1_18_2.class, true);
}
@Override
protected void loadExtras(final JsonObject oldMappings, final JsonObject newMappings, @Nullable final JsonObject diffMappings) {
super.loadExtras(oldMappings, newMappings, diffMappings);
int i = 0;
final JsonArray types = oldMappings.getAsJsonArray("argumenttypes");
this.argumentTypes = new String[types.size()];
for (final JsonElement element : types) {
final String id = element.getAsString();
this.argumentTypes[i++] = id;
}
}
public @Nullable String argumentType(final int argumentTypeId) {
return argumentTypeId >= 0 && argumentTypeId < argumentTypes.length ? argumentTypes[argumentTypeId] : null;
}
}

Datei anzeigen

@ -19,16 +19,19 @@ package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets;
import com.viaversion.viabackwards.api.rewriters.ItemRewriter; import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.BlockAckStorage;
import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette; import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
@ -54,7 +57,6 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
registerAdvancements(ClientboundPackets1_19.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM); registerAdvancements(ClientboundPackets1_19.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM); registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_19.ACKNOWLEDGE_PLAYER_DIGGING);
blockRewriter.registerBlockAction(ClientboundPackets1_19.BLOCK_ACTION); blockRewriter.registerBlockAction(ClientboundPackets1_19.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_19.BLOCK_CHANGE); blockRewriter.registerBlockChange(ClientboundPackets1_19.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19.MULTI_BLOCK_CHANGE); blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19.MULTI_BLOCK_CHANGE);
@ -88,10 +90,33 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
} }
}); });
protocol.registerClientbound(ClientboundPackets1_19.BLOCK_CHANGED_ACK, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.read(Type.VAR_INT); // Sequence
// The server only sends one a tick
/*final BlockAckStorage storage = wrapper.user().get(BlockAckStorage.class);
BlockAckStorage.BlockAction action;
while ((action = storage.poll()) != null) {
final PacketWrapper ackPacket = wrapper.create(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING);
ackPacket.write(Type.POSITION1_14, blockPosition);
ackPacket.write(Type.VAR_INT, action.action());
ackPacket.write(Type.VAR_INT, (int) action.action());
ackPacket.write(Type.BOOLEAN, true); // Approved
ackPacket.send(Protocol1_18_2To1_19.class);
}*/
wrapper.cancel();
});
}
});
protocol.registerClientbound(ClientboundPackets1_19.SPAWN_PARTICLE, new PacketRemapper() { protocol.registerClientbound(ClientboundPackets1_19.SPAWN_PARTICLE, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.INT); // Particle id map(Type.VAR_INT, Type.INT); // Particle id
map(Type.BOOLEAN); // Override limiter map(Type.BOOLEAN); // Override limiter
map(Type.DOUBLE); // X map(Type.DOUBLE); // X
map(Type.DOUBLE); // Y map(Type.DOUBLE); // Y
@ -142,5 +167,43 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
}); });
} }
}); });
// The server does nothing but track the sequence, so we can just set it as 0
protocol.registerServerbound(ServerboundPackets1_17.PLAYER_DIGGING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Action
map(Type.POSITION1_14); // Block position
map(Type.UNSIGNED_BYTE); // Direction
create(Type.VAR_INT, 0); // Sequence
handler(wrapper -> {
final int action = wrapper.get(Type.VAR_INT, 0);
if (action < 3) {
final BlockAckStorage storage = wrapper.user().get(BlockAckStorage.class);
storage.add(wrapper.get(Type.POSITION1_14, 0), action, wrapper.get(Type.UNSIGNED_BYTE, 0));
}
});
}
});
protocol.registerServerbound(ServerboundPackets1_17.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Hand
map(Type.POSITION1_14); // Block position
map(Type.VAR_INT); // Direction
map(Type.FLOAT); // X
map(Type.FLOAT); // Y
map(Type.FLOAT); // Z
map(Type.BOOLEAN); // Inside
create(Type.VAR_INT, 0); // Sequence
}
});
protocol.registerServerbound(ServerboundPackets1_17.USE_ITEM, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Hand
create(Type.VAR_INT, 0); // Sequence
}
});
} }
} }

Datei anzeigen

@ -24,11 +24,17 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.metadata.MetaType; import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle; import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_14;
import com.viaversion.viaversion.api.type.types.version.Types1_18; import com.viaversion.viaversion.api.type.types.version.Types1_18;
import com.viaversion.viaversion.api.type.types.version.Types1_19; import com.viaversion.viaversion.api.type.types.version.Types1_19;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
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_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19> { public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19> {
@ -80,6 +86,18 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
map(Type.VAR_INT); // Chunk radius map(Type.VAR_INT); // Chunk radius
map(Type.VAR_INT); // Read simulation distance map(Type.VAR_INT); // Read simulation distance
handler(worldDataTrackerHandler(1)); 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.getValue()) {
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
biomeCompound.put("category", new StringTag("none"));
}
// Track amount of biomes sent
tracker(wrapper.user()).setBiomesSent(biomes.size());
});
} }
}); });
@ -120,7 +138,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
} else if (type == Types1_18.META_TYPES.poseType) { } else if (type == Types1_18.META_TYPES.poseType) {
final int pose = meta.value(); final int pose = meta.value();
if (pose >= 8) { if (pose >= 8) {
// Roaring, sniffing, emerging, digging -> standing // Croaking, using_tongue, roaring, sniffing, emerging, digging -> standing -> standing
meta.setValue(0); meta.setValue(0);
} }
} }
@ -129,9 +147,23 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null, Types1_18.META_TYPES.optionalComponentType); registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null, Types1_18.META_TYPES.optionalComponentType);
mapTypes(Entity1_19Types.values(), Entity1_17Types.class); mapTypes(Entity1_19Types.values(), Entity1_17Types.class);
filter().type(Entity1_19Types.WARDEN).cancel(16); // Anger
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName(); filter().filterFamily(Entity1_19Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
});
filter().type(Entity1_19Types.FROG).cancel(16); // Age
filter().type(Entity1_19Types.FROG).cancel(17); // Anger
mapEntityTypeWithData(Entity1_19Types.FROG, Entity1_19Types.PUFFERFISH).jsonName().spawnMetadata(storage -> {
storage.add(new Metadata(17, Types1_14.META_TYPES.varIntType, 2)); // Puff state
}).jsonName();
mapEntityTypeWithData(Entity1_19Types.TADPOLE, Entity1_19Types.PUFFERFISH).jsonName();
//TODO experimental snapshot
/*filter().type(Entity1_19Types.WARDEN).cancel(16); // Anger
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName();*/
} }
@Override @Override

Datei anzeigen

@ -0,0 +1,67 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2022 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.api.minecraft.Position;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.LinkedList;
import java.util.Queue;
public final class BlockAckStorage implements StorableObject {
private final Queue<BlockAction> actions = new LinkedList<>();
public void add(final Position position, final int action, final short direction) {
actions.add(new BlockAction(position, (byte) action, direction));
// Some actions may be left unacknowledged by modded servers
if (actions.size() > 100) {
actions.poll();
}
}
public @Nullable BlockAction poll() {
return actions.poll();
}
public static final class BlockAction {
private final Position position;
private final byte action;
private final short direction;
public BlockAction(final Position position, final byte action, final short direction) {
this.position = position;
this.action = action;
this.direction = direction;
}
public Position position() {
return position;
}
public byte action() {
return action;
}
public short direction() {
return direction;
}
}
}

Datei anzeigen

@ -2,11 +2,42 @@
"blockstates": { "blockstates": {
"minecraft:sculk": "minecraft:black_concrete_powder", "minecraft:sculk": "minecraft:black_concrete_powder",
"minecraft:sculk_vein": "minecraft:glow_lichen[", "minecraft:sculk_vein": "minecraft:glow_lichen[",
"minecraft:sculk_catalyst[bloom=true]": "minecraft:end_stone", "minecraft:sculk_catalyst": "minecraft:end_stone",
"minecraft:sculk_catalyst[bloom=false]": "minecraft:end_stone", "minecraft:sculk_shrieker[shrieking=true,waterlogged=true]": "minecraft:end_portal_frame[eye=true,facing=north]",
"minecraft:sculk_shrieker[shrieking=true]": "minecraft:end_portal_frame[eye=true,facing=north]", "minecraft:sculk_shrieker[shrieking=true,waterlogged=false]": "minecraft:end_portal_frame[eye=true,facing=north]",
"minecraft:sculk_shrieker[shrieking=false]": "minecraft:end_portal_frame[eye=false,facing=north]", "minecraft:sculk_shrieker[shrieking=false,waterlogged=true]": "minecraft:end_portal_frame[eye=false,facing=north]",
"minecraft:reinforced_deepslate": "minecraft:obsidian" "minecraft:sculk_shrieker[shrieking=false,waterlogged=false]": "minecraft:end_portal_frame[eye=false,facing=north]",
"minecraft:reinforced_deepslate": "minecraft:obsidian",
"minecraft:mangrove_planks": "minecraft:acacia_planks",
"minecraft:stripped_mangrove_log": "minecraft:stripped_acacia_log[",
"minecraft:stripped_mangrove_wood": "minecraft:stripped_acacia_wood[",
"minecraft:mangrove_wood": "minecraft:acacia_wood[",
"minecraft:mangrove_log": "minecraft:acacia_log[",
"minecraft:mangrove_leaves": "minecraft:acacia_leaves[",
"minecraft:mangrove_sign": "minecraft:acacia_sign[",
"minecraft:mangrove_wall_sign": "minecraft:acacia_wall_sign[",
"minecraft:mangrove_pressure_plate": "minecraft:acacia_pressure_plate[",
"minecraft:mangrove_trapdoor": "minecraft:acacia_trapdoor[",
"minecraft:mangrove_button": "minecraft:acacia_button[",
"minecraft:mangrove_stairs": "minecraft:acacia_stairs[",
"minecraft:mangrove_slab": "minecraft:acacia_slab[",
"minecraft:mangrove_fence_gate": "minecraft:acacia_fence_gate[",
"minecraft:mangrove_fence": "minecraft:acacia_fence[",
"minecraft:mangrove_door": "minecraft:acacia_door[",
"minecraft:mud_bricks": "minecraft:bricks",
"minecraft:packed_mud": "minecraft:bricks",
"minecraft:mud_brick_stairs": "minecraft:brick_stairs[",
"minecraft:mud_brick_slab": "minecraft:brick_slab[",
"minecraft:mud_brick_wall": "minecraft:brick_wall[",
"minecraft:muddy_mangrove_roots": "minecraft:coarse_dirt",
"minecraft:mud": "minecraft:coarse_dirt",
"minecraft:mangrove_propagule": "minecraft:fern",
"minecraft:mangrove_roots": "minecraft:oak_wood[axis=y]",
"minecraft:ochre_froglight": "minecraft:sea_lantern",
"minecraft:verdant_froglight": "minecraft:sea_lantern",
"minecraft:pearlescent_froglight": "minecraft:sea_lantern",
"minecraft:potted_mangrove_propagule": "minecraft:potted_acacia_sapling",
"minecraft:frogspawn": "minecraft:air"
}, },
"sounds": { "sounds": {
"music.overworld.deep_dark": "", "music.overworld.deep_dark": "",
@ -52,7 +83,59 @@
"entity.warden.dig": "", "entity.warden.dig": "",
"entity.warden.nearby_closest": "", "entity.warden.nearby_closest": "",
"entity.warden.nearby_closer": "", "entity.warden.nearby_closer": "",
"entity.warden.nearby_close": "" "entity.warden.nearby_close": "",
"item.bucket.empty_tadpole": "",
"item.bucket.fill_tadpole": "",
"block.froglight.break": "",
"block.froglight.fall": "",
"block.froglight.hit": "",
"block.froglight.place": "",
"block.froglight.step": "",
"block.frogspawn.step": "",
"block.frogspawn.break": "",
"block.frogspawn.fall": "",
"block.frogspawn.hatch": "",
"block.frogspawn.hit": "",
"block.frogspawn.place": "",
"entity.frog.ambient": "",
"entity.frog.death": "",
"entity.frog.eat": "",
"entity.frog.hurt": "",
"entity.frog.lay_spawn": "",
"entity.frog.long_jump": "",
"entity.frog.step": "",
"entity.frog.tounge": "",
"block.mangrove_roots.break": "",
"block.mangrove_roots.fall": "",
"block.mangrove_roots.hit": "",
"block.mangrove_roots.place": "",
"block.mangrove_roots.step": "",
"block.mud.break": "",
"block.mud.fall": "",
"block.mud.hit": "",
"block.mud.place": "",
"block.mud.step": "",
"block.mud_bricks.break": "",
"block.mud_bricks.fall": "",
"block.mud_bricks.hit": "",
"block.mud_bricks.place": "",
"block.mud_bricks.step": "",
"block.muddy_mangrove_roots.break": "",
"block.muddy_mangrove_roots.fall": "",
"block.muddy_mangrove_roots.hit": "",
"block.muddy_mangrove_roots.place": "",
"block.muddy_mangrove_roots.step": "",
"block.packed_mud.break": "",
"block.packed_mud.fall": "",
"block.packed_mud.hit": "",
"block.packed_mud.place": "",
"block.packed_mud.step": "",
"entity.tadpole.death": "",
"entity.tadpole.eat": "",
"entity.tadpole.flop": "",
"entity.tadpole.grow_up": "",
"entity.tadpole.hurt": "",
"entity.tadpole.step": ""
}, },
"items": { "items": {
"minecraft:warden_spawn_egg": { "minecraft:warden_spawn_egg": {
@ -86,7 +169,13 @@
"sculk_charge_pop": "bubble_pop", "sculk_charge_pop": "bubble_pop",
"shriek": "" "shriek": ""
}, },
"blockentities": {
"sculk_catalyst": "",
"sculk_shrieker": ""
},
"entitynames": { "entitynames": {
"warden": "Warden" "warden": "Warden",
"frog": "Frog",
"tadpole": "Tadpole"
} }
} }

Datei anzeigen

@ -4,7 +4,6 @@ rootProject.name = "viabackwards-parent"
dependencyResolutionManagement { dependencyResolutionManagement {
repositories { repositories {
mavenLocal()
maven("https://repo.viaversion.com") maven("https://repo.viaversion.com")
maven("https://papermc.io/repo/repository/maven-public/") maven("https://papermc.io/repo/repository/maven-public/")
maven("https://oss.sonatype.org/content/repositories/snapshots/") maven("https://oss.sonatype.org/content/repositories/snapshots/")