mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-18 16:17:45 +01:00
Abstract mapping data loading
This commit is contained in:
parent
ececd96718
commit
947e5c3e07
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-all</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-bukkit</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-bungee</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-core</artifactId>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nl.matsv.viabackwards.api;
|
||||
|
||||
import nl.matsv.viabackwards.api.data.BackwardsMappings;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
@ -12,18 +13,9 @@ public abstract class BackwardsProtocol<C1 extends ClientboundPacketType, C2 ext
|
||||
protected BackwardsProtocol() {
|
||||
}
|
||||
|
||||
protected BackwardsProtocol(boolean hasMappingDataToLoad) {
|
||||
super(hasMappingDataToLoad);
|
||||
}
|
||||
|
||||
protected BackwardsProtocol(@Nullable Class<C1> oldClientboundPacketEnum, @Nullable Class<C2> clientboundPacketEnum,
|
||||
@Nullable Class<S1> oldServerboundPacketEnum, @Nullable Class<S2> serverboundPacketEnum) {
|
||||
super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum, false);
|
||||
}
|
||||
|
||||
protected BackwardsProtocol(@Nullable Class<C1> oldClientboundPacketEnum, @Nullable Class<C2> clientboundPacketEnum,
|
||||
@Nullable Class<S1> oldServerboundPacketEnum, @Nullable Class<S2> serverboundPacketEnum, boolean hasMappingDatatToLoad) {
|
||||
super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum, hasMappingDatatToLoad);
|
||||
super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,4 +24,9 @@ public abstract class BackwardsProtocol<C1 extends ClientboundPacketType, C2 ext
|
||||
protected void executeAsyncAfterLoaded(Class<? extends Protocol> protocolClass, Runnable runnable) {
|
||||
ProtocolRegistry.addMappingLoaderFuture(getClass(), protocolClass, runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,118 @@
|
||||
package nl.matsv.viabackwards.api.data;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.data.MappingData;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class BackwardsMappings extends MappingData {
|
||||
|
||||
private final Class<? extends Protocol> vvProtocolClass;
|
||||
private Int2ObjectMap<MappedItem> backwardsItemMappings;
|
||||
private Map<String, String> backwardsSoundMappings;
|
||||
|
||||
public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class<? extends Protocol> vvProtocolClass) {
|
||||
this(oldVersion, newVersion, vvProtocolClass, false);
|
||||
}
|
||||
|
||||
public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class<? extends Protocol> vvProtocolClass, boolean hasDiffFile) {
|
||||
super(oldVersion, newVersion, hasDiffFile);
|
||||
Preconditions.checkArgument(!vvProtocolClass.isAssignableFrom(BackwardsProtocol.class));
|
||||
this.vvProtocolClass = vvProtocolClass;
|
||||
// Just re-use ViaVersion's item id map
|
||||
loadItems = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
// Load them later
|
||||
}
|
||||
|
||||
public void loadVBMappings() {
|
||||
super.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadExtras(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings) {
|
||||
if (diffMappings != null) {
|
||||
JsonObject diffItems = diffMappings.getAsJsonObject("items");
|
||||
if (diffItems != null) {
|
||||
backwardsItemMappings = VBMappingDataLoader.loadItemMappings(oldMappings.getAsJsonObject("items"), newMappings.getAsJsonObject("items"), diffItems);
|
||||
}
|
||||
|
||||
JsonObject diffSounds = diffMappings.getAsJsonObject("sounds");
|
||||
if (diffSounds != null) {
|
||||
backwardsSoundMappings = VBMappingDataLoader.objectToMap(diffSounds);
|
||||
}
|
||||
}
|
||||
|
||||
// Just re-use ViaVersion's item id map
|
||||
if (vvProtocolClass != null) {
|
||||
itemMappings = ProtocolRegistry.getProtocol(vvProtocolClass).getMappingData().getItemMappings().inverse();
|
||||
}
|
||||
|
||||
loadVBExtras(oldMappings, newMappings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Mappings loadFromArray(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {
|
||||
if (!oldMappings.has(key) || !newMappings.has(key)) return null;
|
||||
|
||||
JsonObject diff = diffMappings != null ? diffMappings.getAsJsonObject(key) : null;
|
||||
return new VBMappings(oldMappings.getAsJsonArray(key), newMappings.getAsJsonArray(key), diff, shouldWarnOnMissing(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Mappings loadFromObject(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {
|
||||
if (!oldMappings.has(key) || !newMappings.has(key)) return null;
|
||||
|
||||
JsonObject diff = diffMappings != null ? diffMappings.getAsJsonObject(key) : null;
|
||||
return new VBMappings(oldMappings.getAsJsonObject(key), newMappings.getAsJsonObject(key), diff, shouldWarnOnMissing(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonObject loadDiffFile() {
|
||||
return VBMappingDataLoader.loadFromDataDir("mapping-" + newVersion + "to" + oldVersion + ".json");
|
||||
}
|
||||
|
||||
protected boolean shouldWarnOnMissing(String key) {
|
||||
return !key.equals("blocks") && !key.equals("statistics");
|
||||
}
|
||||
|
||||
protected void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MappedItem getMappedItem(int id) {
|
||||
return backwardsItemMappings != null ? backwardsItemMappings.get(id) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMappedNamedSound(String id) {
|
||||
return backwardsSoundMappings != null ? backwardsSoundMappings.get(id) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int checkValidity(int id, String type) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Int2ObjectMap<MappedItem> getBackwardsItemMappings() {
|
||||
return backwardsItemMappings;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Map<String, String> getBackwardsSoundMappings() {
|
||||
return backwardsSoundMappings;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package nl.matsv.viabackwards.api.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Backwards mappings for newly (!) added items.
|
||||
*/
|
||||
public class VBItemMappings {
|
||||
|
||||
private final Int2ObjectMap<MappedItem> itemMapping;
|
||||
|
||||
public VBItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
||||
Map<Integer, MappedItem> itemMapping = new HashMap<>();
|
||||
for (Map.Entry<String, JsonElement> entry : diffMapping.entrySet()) {
|
||||
JsonObject object = entry.getValue().getAsJsonObject();
|
||||
String mappedIdName = object.getAsJsonPrimitive("id").getAsString();
|
||||
Map.Entry<String, JsonElement> value = MappingDataLoader.findValue(newMapping, mappedIdName);
|
||||
if (value == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("No key for " + mappedIdName + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Map.Entry<String, JsonElement> oldEntry = MappingDataLoader.findValue(oldMapping, entry.getKey());
|
||||
if (oldEntry == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("No old entry for " + mappedIdName + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = Integer.parseInt(oldEntry.getKey());
|
||||
int mappedId = Integer.parseInt(value.getKey());
|
||||
String name = object.getAsJsonPrimitive("name").getAsString();
|
||||
itemMapping.put(id, new MappedItem(mappedId, name));
|
||||
}
|
||||
|
||||
this.itemMapping = new Int2ObjectOpenHashMap<>(itemMapping, 1F);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MappedItem getMappedItem(int id) {
|
||||
return itemMapping.get(id);
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import us.myles.viaversion.libs.gson.JsonArray;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
import us.myles.viaversion.libs.gson.JsonIOException;
|
||||
@ -16,6 +18,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VBMappingDataLoader {
|
||||
@ -43,6 +46,7 @@ public class VBMappingDataLoader {
|
||||
try (InputStreamReader reader = new InputStreamReader(stream)) {
|
||||
return GsonUtil.getGson().fromJson(reader, JsonObject.class);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -122,4 +126,50 @@ public class VBMappingDataLoader {
|
||||
output[i] = index.shortValue();
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, String> objectToMap(JsonObject object) {
|
||||
Map<String, String> mappings = new HashMap<>();
|
||||
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (key.indexOf(':') == -1) {
|
||||
key = "minecraft:" + key;
|
||||
}
|
||||
String value = entry.getValue().getAsString();
|
||||
if (value.indexOf(':') == -1) {
|
||||
value = "minecraft:" + value;
|
||||
}
|
||||
mappings.put(key, value);
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MappedItem> loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
||||
Map<Integer, MappedItem> itemMapping = new HashMap<>();
|
||||
for (Map.Entry<String, JsonElement> entry : diffMapping.entrySet()) {
|
||||
JsonObject object = entry.getValue().getAsJsonObject();
|
||||
String mappedIdName = object.getAsJsonPrimitive("id").getAsString();
|
||||
Map.Entry<String, JsonElement> value = MappingDataLoader.findValue(newMapping, mappedIdName);
|
||||
if (value == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("No key for " + mappedIdName + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Map.Entry<String, JsonElement> oldEntry = MappingDataLoader.findValue(oldMapping, entry.getKey());
|
||||
if (oldEntry == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("No old entry for " + mappedIdName + " :( ");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = Integer.parseInt(oldEntry.getKey());
|
||||
int mappedId = Integer.parseInt(value.getKey());
|
||||
String name = object.getAsJsonPrimitive("name").getAsString();
|
||||
itemMapping.put(id, new MappedItem(mappedId, name));
|
||||
}
|
||||
|
||||
return new Int2ObjectOpenHashMap<>(itemMapping, 1F);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public class VBMappings extends Mappings {
|
||||
super(create(oldMapping, newMapping, diffMapping, true));
|
||||
}
|
||||
|
||||
public VBMappings(JsonArray oldMapping, JsonArray newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
super(create(oldMapping, newMapping, diffMapping, warnOnMissing));
|
||||
}
|
||||
|
||||
private static short[] create(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
short[] oldToNew = new short[size];
|
||||
Arrays.fill(oldToNew, (short) -1);
|
||||
|
@ -1,43 +0,0 @@
|
||||
package nl.matsv.viabackwards.api.data;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.viaversion.libs.gson.JsonArray;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Backwards mappings for sound ids and names.
|
||||
*/
|
||||
public class VBSoundMappings {
|
||||
|
||||
private final Map<String, String> namedSoundMappings = new HashMap<>();
|
||||
private final Mappings idMappings;
|
||||
|
||||
public VBSoundMappings(JsonArray oldSounds, JsonArray newSounds, JsonObject diffMapping) {
|
||||
idMappings = new VBMappings(oldSounds, newSounds, diffMapping);
|
||||
for (Map.Entry<String, JsonElement> entry : diffMapping.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (key.indexOf(':') == -1) {
|
||||
key = "minecraft:" + key;
|
||||
}
|
||||
String value = entry.getValue().getAsString();
|
||||
if (value.indexOf(':') == -1) {
|
||||
value = "minecraft:" + value;
|
||||
}
|
||||
namedSoundMappings.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getNewId(String oldId) {
|
||||
return namedSoundMappings.get(oldId);
|
||||
}
|
||||
|
||||
public int getNewId(int oldId) {
|
||||
return idMappings.getNewId(oldId);
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
|
||||
import java.util.List;
|
||||
@ -25,7 +24,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
super(protocol, displayType, 2);
|
||||
}
|
||||
|
||||
public void registerSpawnTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType, IdRewriteFunction blockStateRewriter) {
|
||||
public void registerSpawnTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType) {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -42,7 +41,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
EntityType entityType = setOldEntityId(wrapper);
|
||||
if (entityType == fallingBlockType) {
|
||||
int blockState = wrapper.get(Type.INT, 0);
|
||||
wrapper.set(Type.INT, 0, blockStateRewriter.rewrite(blockState));
|
||||
wrapper.set(Type.INT, 0, protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -4,29 +4,20 @@ import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.data.MappedItem;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.ByteTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
|
||||
public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewriterBase<T> {
|
||||
|
||||
private final MappedItemFunction mappedItemFunction;
|
||||
private final TranslatableRewriter translatableRewriter;
|
||||
|
||||
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter,
|
||||
@Nullable IdRewriteFunction oldRewriter, @Nullable IdRewriteFunction newRewriter, MappedItemFunction mappedItemFunction) {
|
||||
super(protocol, oldRewriter, newRewriter, true);
|
||||
this.translatableRewriter = translatableRewriter;
|
||||
this.mappedItemFunction = mappedItemFunction;
|
||||
}
|
||||
|
||||
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter, MappedItemFunction mappedItemFunction) {
|
||||
protected ItemRewriter(T protocol, @Nullable TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, true);
|
||||
this.translatableRewriter = translatableRewriter;
|
||||
this.mappedItemFunction = mappedItemFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,19 +62,21 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
}
|
||||
}
|
||||
|
||||
MappedItem data = mappedItemFunction.get(item.getIdentifier());
|
||||
MappedItem data = protocol.getMappingData().getMappedItem(item.getIdentifier());
|
||||
if (data == null) {
|
||||
// Just rewrite the id
|
||||
return super.handleItemToClient(item);
|
||||
}
|
||||
|
||||
// Set remapped id
|
||||
item.setIdentifier(data.getId());
|
||||
|
||||
// Set custom name - only done if there is no original one
|
||||
if (item.getTag() == null) {
|
||||
item.setTag(new CompoundTag(""));
|
||||
}
|
||||
|
||||
// Save original id, set remapped id
|
||||
item.getTag().put(new IntTag(nbtTagName + "|id", item.getIdentifier()));
|
||||
item.setIdentifier(data.getId());
|
||||
|
||||
// Set custom name - only done if there is no original one
|
||||
if (display == null) {
|
||||
item.getTag().put(display = new CompoundTag("display"));
|
||||
}
|
||||
@ -94,10 +87,18 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
return item;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface MappedItemFunction {
|
||||
@Override
|
||||
@Nullable
|
||||
public Item handleItemToServer(Item item) {
|
||||
if (item == null) return null;
|
||||
|
||||
@Nullable
|
||||
MappedItem get(int id);
|
||||
super.handleItemToServer(item);
|
||||
if (item.getTag() != null) {
|
||||
IntTag originalId = item.getTag().remove(nbtTagName + "|id");
|
||||
if (originalId != null) {
|
||||
item.setIdentifier(originalId.getValue());
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package nl.matsv.viabackwards.api.rewriters;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.viaversion.libs.opennbt.conversion.builtin.CompoundTagConverter;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
@ -13,28 +12,20 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Rewriter<T> {
|
||||
|
||||
protected static final CompoundTagConverter CONVERTER = new CompoundTagConverter();
|
||||
protected final IdRewriteFunction toClientRewriter;
|
||||
protected final IdRewriteFunction toServerRewriter;
|
||||
protected final String nbtTagName;
|
||||
protected final boolean jsonNameFormat;
|
||||
|
||||
protected ItemRewriterBase(T protocol, @Nullable IdRewriteFunction toClientRewriter, @Nullable IdRewriteFunction toServerRewriter, boolean jsonNameFormat) {
|
||||
protected ItemRewriterBase(T protocol, boolean jsonNameFormat) {
|
||||
super(protocol);
|
||||
this.toClientRewriter = toClientRewriter;
|
||||
this.toServerRewriter = toServerRewriter;
|
||||
this.jsonNameFormat = jsonNameFormat;
|
||||
nbtTagName = "VB|" + protocol.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
protected ItemRewriterBase(T protocol, boolean jsonNameFormat) {
|
||||
this(protocol, null, null, jsonNameFormat);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Item handleItemToClient(Item item) {
|
||||
if (item == null) return null;
|
||||
if (toClientRewriter != null) {
|
||||
item.setIdentifier(toClientRewriter.rewrite(item.getIdentifier()));
|
||||
if (protocol.getMappingData() != null) {
|
||||
item.setIdentifier(protocol.getMappingData().getNewItemId(item.getIdentifier()));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@ -42,8 +33,8 @@ public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Rewr
|
||||
@Nullable
|
||||
public Item handleItemToServer(Item item) {
|
||||
if (item == null) return null;
|
||||
if (toServerRewriter != null) {
|
||||
item.setIdentifier(toServerRewriter.rewrite(item.getIdentifier()));
|
||||
if (protocol.getMappingData() != null) {
|
||||
item.setIdentifier(protocol.getMappingData().getOldItemId(item.getIdentifier()));
|
||||
}
|
||||
restoreDisplayTag(item);
|
||||
return item;
|
||||
|
@ -20,7 +20,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@ -79,13 +78,9 @@ public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> exten
|
||||
}
|
||||
}
|
||||
|
||||
protected LegacyBlockItemRewriter(T protocol, @Nullable IdRewriteFunction oldRewriter, @Nullable IdRewriteFunction newRewriter) {
|
||||
super(protocol, oldRewriter, newRewriter, false);
|
||||
replacementData = LEGACY_MAPPINGS.get(protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
||||
}
|
||||
|
||||
protected LegacyBlockItemRewriter(T protocol) {
|
||||
this(protocol, null, null);
|
||||
super(protocol, false);
|
||||
replacementData = LEGACY_MAPPINGS.get(protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,22 +3,15 @@ package nl.matsv.viabackwards.api.rewriters;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.IdRewriteFunction;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewriter {
|
||||
|
||||
private final Function<String, String> stringIdRewriter;
|
||||
private final BackwardsProtocol protocol;
|
||||
|
||||
public SoundRewriter(BackwardsProtocol protocol, IdRewriteFunction idRewriter, Function<String, String> stringIdRewriter) {
|
||||
super(protocol, idRewriter);
|
||||
this.stringIdRewriter = stringIdRewriter;
|
||||
}
|
||||
|
||||
public SoundRewriter(BackwardsProtocol protocol, IdRewriteFunction idRewriter) {
|
||||
this(protocol, idRewriter, null);
|
||||
public SoundRewriter(BackwardsProtocol protocol) {
|
||||
super(protocol);
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public void registerNamedSound(ClientboundPacketType packetType) {
|
||||
@ -28,7 +21,7 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
||||
map(Type.STRING); // Sound identifier
|
||||
handler(wrapper -> {
|
||||
String soundId = wrapper.get(Type.STRING, 0);
|
||||
String mappedId = stringIdRewriter.apply(soundId);
|
||||
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
||||
if (mappedId == null) return;
|
||||
if (!mappedId.isEmpty()) {
|
||||
wrapper.set(Type.STRING, 0, mappedId);
|
||||
@ -53,7 +46,7 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
||||
}
|
||||
|
||||
String soundId = wrapper.read(Type.STRING);
|
||||
String mappedId = stringIdRewriter.apply(soundId);
|
||||
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
||||
if (mappedId == null) {
|
||||
// No mapping found
|
||||
wrapper.write(Type.STRING, soundId);
|
||||
|
@ -36,6 +36,7 @@ import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_12_1, ServerboundPackets1_13, ServerboundPackets1_12_1> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private BlockItemPackets1_13 blockItemPackets;
|
||||
|
||||
public Protocol1_12_2To1_13() {
|
||||
@ -45,7 +46,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_13To1_12_2.class, () -> {
|
||||
BackwardsMappings.init();
|
||||
MAPPINGS.loadVBMappings();
|
||||
PaintingMapping.init();
|
||||
Via.getManager().getProviders().register(BackwardsBlockEntityProvider.class, new BackwardsBlockEntityProvider());
|
||||
});
|
||||
@ -54,7 +55,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
@Override
|
||||
protected void handleTranslate(JsonObject root, String translate) {
|
||||
String newTranslate = newTranslatables.get(translate);
|
||||
if (newTranslate != null || (newTranslate = BackwardsMappings.translateMappings.get(translate)) != null) {
|
||||
if (newTranslate != null || (newTranslate = getMappingData().getTranslateMappings().get(translate)) != null) {
|
||||
root.addProperty("translate", newTranslate);
|
||||
}
|
||||
}
|
||||
@ -117,4 +118,9 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BlockItemPackets1_13 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.block_entity_handlers;
|
||||
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBlockEntityProvider;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
@ -52,7 +52,7 @@ public class PistonHandler implements BackwardsBlockEntityProvider.BackwardsBloc
|
||||
|
||||
// There doesn't seem to be a nicer way around it :(
|
||||
private void addEntries(String data, int id) {
|
||||
id = BackwardsMappings.blockMappings.getNewId(id);
|
||||
id = Protocol1_12_2To1_13.MAPPINGS.getNewBlockStateId(id);
|
||||
pistonIds.put(data, id);
|
||||
|
||||
String substring = data.substring(10);
|
||||
|
@ -11,14 +11,12 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.data.VBItemMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||
import nl.matsv.viabackwards.api.data.VBMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBSoundMappings;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.StatisticMappings;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@ -30,29 +28,22 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static final Int2ObjectMap<String> statisticMappings = new Int2ObjectOpenHashMap<>();
|
||||
public static final Map<String, String> translateMappings = new HashMap<>();
|
||||
public static BlockMappingsShortArray blockMappings;
|
||||
public static VBSoundMappings soundMappings;
|
||||
public static VBItemMappings itemMappings;
|
||||
public static Mappings enchantmentMappings;
|
||||
public class BackwardsMappings extends nl.matsv.viabackwards.api.data.BackwardsMappings {
|
||||
private final Int2ObjectMap<String> statisticMappings = new Int2ObjectOpenHashMap<>();
|
||||
private final Map<String, String> translateMappings = new HashMap<>();
|
||||
private Mappings enchantmentMappings;
|
||||
|
||||
public static void init() {
|
||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.13 -> 1.12.2 mappings...");
|
||||
JsonObject mapping1_12 = MappingDataLoader.getMappingsCache().get("mapping-1.12.json");
|
||||
JsonObject mapping1_13 = MappingDataLoader.getMappingsCache().get("mapping-1.13.json");
|
||||
JsonObject mapping1_12_2to1_13 = VBMappingDataLoader.loadFromDataDir("mapping-1.12.2to1.13.json");
|
||||
|
||||
blockMappings = new BlockMappingsShortArray(mapping1_13.getAsJsonObject("blocks"), mapping1_12.getAsJsonObject("blocks"), mapping1_12_2to1_13.getAsJsonObject("blockstates"));
|
||||
itemMappings = new VBItemMappings(mapping1_13.getAsJsonObject("items"), mapping1_12.getAsJsonObject("items"), mapping1_12_2to1_13.getAsJsonObject("items"));
|
||||
soundMappings = new VBSoundMappings(mapping1_13.getAsJsonArray("sounds"), mapping1_12.getAsJsonArray("sounds"), mapping1_12_2to1_13.getAsJsonObject("sounds"));
|
||||
enchantmentMappings = new VBMappings(mapping1_13.getAsJsonObject("enchantments"), mapping1_12.getAsJsonObject("enchantments"), false);
|
||||
public BackwardsMappings() {
|
||||
super("1.13", "1.12", Protocol1_13To1_12_2.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
|
||||
enchantmentMappings = new VBMappings(oldMappings.getAsJsonObject("enchantments"), newMappings.getAsJsonObject("enchantments"), false);
|
||||
for (Map.Entry<String, Integer> entry : StatisticMappings.CUSTOM_STATS.entrySet()) {
|
||||
statisticMappings.put(entry.getValue().intValue(), entry.getKey());
|
||||
}
|
||||
for (Map.Entry<String, String> entry : MappingData.translateMapping.entrySet()) {
|
||||
for (Map.Entry<String, String> entry : Protocol1_13To1_12_2.MAPPINGS.getTranslateMapping().entrySet()) {
|
||||
translateMappings.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
@ -93,16 +84,28 @@ public class BackwardsMappings {
|
||||
}
|
||||
}
|
||||
|
||||
public static class BlockMappingsShortArray {
|
||||
private final short[] oldToNew = new short[8582];
|
||||
|
||||
private BlockMappingsShortArray(JsonObject newIdentifiers, JsonObject oldIdentifiers, JsonObject mapping) {
|
||||
@Override
|
||||
@Nullable
|
||||
protected Mappings loadFromObject(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {
|
||||
if (key.equals("blockstates")) {
|
||||
short[] oldToNew = new short[8582];
|
||||
Arrays.fill(oldToNew, (short) -1);
|
||||
mapIdentifiers(oldToNew, newIdentifiers, oldIdentifiers, mapping);
|
||||
}
|
||||
|
||||
public int getNewId(int old) {
|
||||
return old >= 0 && old < oldToNew.length ? oldToNew[old] : -1;
|
||||
mapIdentifiers(oldToNew, oldMappings.getAsJsonObject("blockstates"), newMappings.getAsJsonObject("blocks"), diffMappings.getAsJsonObject("blockstates"));
|
||||
return new Mappings(oldToNew);
|
||||
} else {
|
||||
return super.loadFromObject(oldMappings, newMappings, diffMappings, key);
|
||||
}
|
||||
}
|
||||
|
||||
public Int2ObjectMap<String> getStatisticMappings() {
|
||||
return statisticMappings;
|
||||
}
|
||||
|
||||
public Map<String, String> getTranslateMappings() {
|
||||
return translateMappings;
|
||||
}
|
||||
|
||||
public Mappings getEnchantmentMappings() {
|
||||
return enchantmentMappings;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data;
|
||||
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets.BlockItemPackets1_13;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@ -35,7 +34,7 @@ public class ParticleMapping {
|
||||
}
|
||||
|
||||
private int[] rewrite(int newType) {
|
||||
int blockType = BlockItemPackets1_13.toOldId(newType);
|
||||
int blockType = Protocol1_12_2To1_13.MAPPINGS.getNewBlockStateId(newType);
|
||||
|
||||
int type = blockType >> 4;
|
||||
int meta = blockType & 15;
|
||||
|
@ -15,7 +15,6 @@ import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.block_entity_handlers.FlowerPotHandler;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.providers.BackwardsBlockEntityProvider;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.BackwardsBlockStorage;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
@ -33,8 +32,8 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
|
||||
@ -61,23 +60,10 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
private final String extraNbtTag;
|
||||
|
||||
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) {
|
||||
super(protocol, null, id -> BackwardsMappings.itemMappings.getMappedItem(id));
|
||||
super(protocol, null);
|
||||
extraNbtTag = "VB|" + protocol.getClass().getSimpleName() + "|2";
|
||||
}
|
||||
|
||||
public static int toOldId(int oldId) {
|
||||
if (oldId < 0) {
|
||||
oldId = 0; // Some plugins use negative numbers to clear blocks, remap them to air.
|
||||
}
|
||||
int newId = BackwardsMappings.blockMappings.getNewId(oldId);
|
||||
if (newId != -1)
|
||||
return newId;
|
||||
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
||||
// Default stone
|
||||
return 1 << 4;
|
||||
}
|
||||
|
||||
public static boolean isDamageable(int id) {
|
||||
return id >= 256 && id <= 259 // iron shovel, pickaxe, axe, flint and steel
|
||||
|| id == 261 // bow
|
||||
@ -101,7 +87,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int itemId = wrapper.read(Type.VAR_INT);
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(itemId);
|
||||
int oldId = protocol.getMappingData().getItemMappings().get(itemId);
|
||||
if (oldId != -1) {
|
||||
Optional<String> eggEntityId = SpawnEggRewriter.getEntityId(oldId);
|
||||
if (eggEntityId.isPresent()) {
|
||||
@ -220,7 +206,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
BackwardsBlockStorage storage = wrapper.user().get(BackwardsBlockStorage.class);
|
||||
storage.checkAndStore(position, blockState);
|
||||
|
||||
wrapper.write(Type.VAR_INT, toOldId(blockState));
|
||||
wrapper.write(Type.VAR_INT, protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
|
||||
// Flower pot special treatment
|
||||
flowerPotSpecialTreatment(wrapper.user(), blockState, position);
|
||||
@ -257,7 +243,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
flowerPotSpecialTreatment(wrapper.user(), block, position);
|
||||
|
||||
// Change to old id
|
||||
record.setBlockId(toOldId(block));
|
||||
record.setBlockId(protocol.getMappingData().getNewBlockStateId(block));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -357,7 +343,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
for (int p = 0; p < section.getPaletteSize(); p++) {
|
||||
int old = section.getPaletteEntry(p);
|
||||
if (old != 0) {
|
||||
int oldId = toOldId(old);
|
||||
int oldId = protocol.getMappingData().getNewBlockStateId(old);
|
||||
section.setPaletteEntry(p, oldId);
|
||||
}
|
||||
}
|
||||
@ -413,9 +399,9 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
int data = wrapper.get(Type.INT, 1);
|
||||
if (id == 1010) { // Play record
|
||||
wrapper.set(Type.INT, 1, MappingData.oldToNewItems.inverse().get(data) >> 4);
|
||||
wrapper.set(Type.INT, 1, protocol.getMappingData().getItemMappings().get(data) >> 4);
|
||||
} else if (id == 2001) { // Block break + block break sound
|
||||
data = toOldId(data);
|
||||
data = protocol.getMappingData().getNewBlockStateId(data);
|
||||
int blockId = data >> 4;
|
||||
int blockData = data & 0xF;
|
||||
wrapper.set(Type.INT, 1, (blockId & 0xFFF) | (blockData << 12));
|
||||
@ -478,7 +464,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
// Enchantment table
|
||||
if (property >= 4 && property <= 6) {
|
||||
short oldId = wrapper.get(Type.SHORT, 1);
|
||||
wrapper.set(Type.SHORT, 1, (short) BackwardsMappings.enchantmentMappings.getNewId(oldId));
|
||||
wrapper.set(Type.SHORT, 1, (short) protocol.getMappingData().getEnchantmentMappings().getNewId(oldId));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -543,7 +529,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
|
||||
// No custom mapping found, look at VV mappings
|
||||
if (item.getIdentifier() == originalId) {
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(item.getIdentifier());
|
||||
int oldId = protocol.getMappingData().getItemMappings().get(item.getIdentifier());
|
||||
if (oldId != -1) {
|
||||
rawId = itemIdToRaw(oldId, item, tag);
|
||||
} else if (item.getIdentifier() == 362) { // base/colorless shulker box
|
||||
@ -668,7 +654,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
lore.add(new StringTag("", mappedEnchantmentId + " " + EnchantmentRewriter.getRomanNumber(level)));
|
||||
noMapped.add(enchantmentEntry);
|
||||
} else if (!newId.isEmpty()) {
|
||||
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
|
||||
Short oldId = Protocol1_13To1_12_2.MAPPINGS.getOldEnchantmentsIds().inverse().get(newId);
|
||||
if (oldId == null) {
|
||||
if (!newId.startsWith("viaversion:legacy/")) {
|
||||
// Custom enchant (?)
|
||||
@ -837,7 +823,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
item.setIdentifier(identifier);
|
||||
|
||||
int newId = -1;
|
||||
if (!MappingData.oldToNewItems.containsKey(rawId)) {
|
||||
if (!protocol.getMappingData().getItemMappings().inverse().containsKey(rawId)) {
|
||||
if (!isDamageable(item.getIdentifier()) && item.getIdentifier() != 358) { // Map
|
||||
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||
tag.put(new IntTag(extraNbtTag, originalId)); // Data will be lost, saving original id
|
||||
@ -847,7 +833,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
newId = 362; // directly set the new id -> base/colorless shulker box
|
||||
} else if (item.getIdentifier() == 31 && item.getData() == 0) { // Shrub was removed
|
||||
rawId = 32 << 4; // Dead Bush
|
||||
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
||||
} else if (protocol.getMappingData().getItemMappings().inverse().containsKey(rawId & ~0xF)) {
|
||||
rawId &= ~0xF; // Remove data
|
||||
} else {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
@ -858,7 +844,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
|
||||
if (newId == -1) {
|
||||
newId = MappingData.oldToNewItems.get(rawId);
|
||||
newId = protocol.getMappingData().getItemMappings().inverse().get(rawId);
|
||||
}
|
||||
|
||||
item.setIdentifier(newId);
|
||||
@ -920,7 +906,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
if (dummyEnchant && oldId == 0 && level == 0) {
|
||||
continue; //Skip dummy enchatment
|
||||
}
|
||||
String newId = MappingData.oldEnchantmentsIds.get(oldId);
|
||||
String newId = Protocol1_13To1_12_2.MAPPINGS.getOldEnchantmentsIds().get(oldId);
|
||||
if (newId == null) {
|
||||
newId = "viaversion:legacy/" + oldId;
|
||||
}
|
||||
@ -1004,7 +990,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
// Create the flowerpot
|
||||
PacketWrapper blockCreate = new PacketWrapper(0x0B, null, user);
|
||||
blockCreate.write(Type.POSITION, position);
|
||||
blockCreate.write(Type.VAR_INT, toOldId(blockState));
|
||||
blockCreate.write(Type.VAR_INT, Protocol1_12_2To1_13.MAPPINGS.getNewBlockStateId(blockState));
|
||||
blockCreate.send(Protocol1_12_2To1_13.class, true);
|
||||
|
||||
// Send a block entity update
|
||||
|
@ -89,7 +89,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
||||
Entity1_13Types.ObjectType type = optionalType.get();
|
||||
if (type == Entity1_13Types.ObjectType.FALLING_BLOCK) {
|
||||
int blockState = wrapper.get(Type.INT, 0);
|
||||
int combined = BlockItemPackets1_13.toOldId(blockState);
|
||||
int combined = Protocol1_12_2To1_13.MAPPINGS.getNewBlockStateId(blockState);
|
||||
combined = ((combined >> 4) & 0xFFF) | ((combined & 0xF) << 12);
|
||||
wrapper.set(Type.INT, 0, combined);
|
||||
} else if (type == Entity1_13Types.ObjectType.ITEM_FRAME) {
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.base.Joiner;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.Rewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.ParticleMapping;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.storage.TabCompleteStorage;
|
||||
import nl.matsv.viabackwards.utils.ChatUtil;
|
||||
@ -542,7 +541,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
newSize--;
|
||||
continue;
|
||||
case 8:
|
||||
name = BackwardsMappings.statisticMappings.get(statisticId);
|
||||
name = protocol.getMappingData().getStatisticMappings().get(statisticId);
|
||||
if (name == null) {
|
||||
wrapper.read(Type.VAR_INT);
|
||||
newSize--;
|
||||
|
@ -3,7 +3,6 @@ package nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.Rewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.data.NamedSoundMapping;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
@ -27,7 +26,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
handler(wrapper -> {
|
||||
String newSound = wrapper.get(Type.STRING, 0);
|
||||
String oldSound = NamedSoundMapping.getOldId(newSound);
|
||||
if (oldSound != null || (oldSound = BackwardsMappings.soundMappings.getNewId(newSound)) != null) {
|
||||
if (oldSound != null || (oldSound = protocol.getMappingData().getMappedNamedSound(newSound)) != null) {
|
||||
wrapper.set(Type.STRING, 0, oldSound);
|
||||
} else if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Unknown named sound in 1.13->1.12 protocol: " + newSound);
|
||||
@ -52,7 +51,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
|
||||
String sound;
|
||||
if ((flags & 0x02) != 0) {
|
||||
sound = BackwardsMappings.soundMappings.getNewId(wrapper.read(Type.STRING));
|
||||
sound = protocol.getMappingData().getMappedNamedSound(wrapper.read(Type.STRING));
|
||||
if (sound == null) {
|
||||
sound = "";
|
||||
}
|
||||
@ -72,7 +71,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
||||
map(Type.VAR_INT);
|
||||
handler(wrapper -> {
|
||||
int newSound = wrapper.get(Type.VAR_INT, 0);
|
||||
int oldSound = BackwardsMappings.soundMappings.getNewId(newSound);
|
||||
int oldSound = protocol.getMappingData().getSoundMappings().getNewId(newSound);
|
||||
if (oldSound == -1) {
|
||||
wrapper.cancel();
|
||||
} else {
|
||||
|
@ -74,7 +74,7 @@ public class Protocol1_13_1To1_13_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
});
|
||||
|
||||
new StatisticsRewriter(this, null, null, null, id -> {
|
||||
new StatisticsRewriter(this, id -> {
|
||||
int newId = id;
|
||||
if (newId > 40) {
|
||||
if (id == 41) return -1;
|
||||
|
@ -1,10 +1,9 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.packets.BlockItemPackets1_14;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.packets.EntityPackets1_14;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.packets.PlayerPackets1_14;
|
||||
@ -21,11 +20,11 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_13, ServerboundPackets1_14, ServerboundPackets1_13> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.14", "1.13.2", Protocol1_14To1_13_2.class, true);
|
||||
private BlockItemPackets1_14 blockItemPackets;
|
||||
private EntityPackets1_14 entityPackets;
|
||||
|
||||
@ -35,7 +34,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_14To1_13_2.class, BackwardsMappings::init);
|
||||
executeAsyncAfterLoaded(Protocol1_14To1_13_2.class, MAPPINGS::loadVBMappings);
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_14.BOSSBAR);
|
||||
@ -53,8 +52,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
new PlayerPackets1_14(this).register();
|
||||
new SoundPackets1_14(this).register();
|
||||
|
||||
new StatisticsRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> MappingData.oldToNewItems.inverse().get(id),
|
||||
entityPackets::getOldEntityId, id -> BackwardsMappings.statisticsMappings.getNewId(id)).register(ClientboundPackets1_14.STATISTICS);
|
||||
new StatisticsRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_14.STATISTICS);
|
||||
|
||||
cancelOutgoing(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
|
||||
cancelOutgoing(ClientboundPackets1_14.UPDATE_VIEW_DISTANCE);
|
||||
@ -73,7 +71,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
for (int j = 0; j < blockIds.length; j++) {
|
||||
int id = blockIds[j];
|
||||
// Ignore new blocktags
|
||||
int blockId = BackwardsMappings.blockMappings.getNewId(id);
|
||||
int blockId = getMappingData().getNewBlockId(id);
|
||||
blockIds[j] = blockId;
|
||||
}
|
||||
}
|
||||
@ -85,7 +83,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
for (int j = 0; j < itemIds.length; j++) {
|
||||
int itemId = itemIds[j];
|
||||
// Ignore new itemtags
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(itemId);
|
||||
int oldId = getMappingData().getItemMappings().get(itemId);
|
||||
itemIds[j] = oldId;
|
||||
}
|
||||
}
|
||||
@ -163,27 +161,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
});
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
int newId = BackwardsMappings.blockStateMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.13.2 blockstate id for 1.14 block " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
|
||||
public static int getNewBlockId(int id) {
|
||||
if (id == 669) return -1; // Bell
|
||||
|
||||
int newId = BackwardsMappings.blockMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.13.2 block id for 1.14 block " + id);
|
||||
return -1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection user) {
|
||||
// Register ClientWorld
|
||||
@ -211,4 +188,9 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public EntityPackets1_14 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.data.VBItemMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||
import nl.matsv.viabackwards.api.data.VBMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBSoundMappings;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
public static VBSoundMappings soundMappings;
|
||||
public static VBItemMappings itemMappings;
|
||||
|
||||
public static void init() {
|
||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.14 -> 1.13.2 mappings...");
|
||||
JsonObject mapping1_13_2 = MappingDataLoader.getMappingsCache().get("mapping-1.13.2.json");
|
||||
JsonObject mapping1_14 = MappingDataLoader.getMappingsCache().get("mapping-1.14.json");
|
||||
JsonObject mapping1_13_2to1_14 = VBMappingDataLoader.loadFromDataDir("mapping-1.13.2to1.14.json");
|
||||
|
||||
blockStateMappings = new VBMappings(mapping1_14.getAsJsonObject("blockstates"), mapping1_13_2.getAsJsonObject("blockstates"), mapping1_13_2to1_14.getAsJsonObject("blockstates"));
|
||||
blockMappings = new VBMappings(mapping1_14.getAsJsonObject("blocks"), mapping1_13_2.getAsJsonObject("blocks"), mapping1_13_2to1_14.getAsJsonObject("blocks"), false);
|
||||
itemMappings = new VBItemMappings(mapping1_14.getAsJsonObject("items"), mapping1_13_2.getAsJsonObject("items"), mapping1_13_2to1_14.getAsJsonObject("items"));
|
||||
soundMappings = new VBSoundMappings(mapping1_14.getAsJsonArray("sounds"), mapping1_13_2.getAsJsonArray("sounds"), mapping1_13_2to1_14.getAsJsonObject("sounds"));
|
||||
statisticsMappings = new Mappings(mapping1_14.getAsJsonArray("statistics"), mapping1_13_2.getAsJsonArray("statistics"), false);
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.storage.ChunkLightStorage;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
@ -31,7 +30,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.RecipeRewriter1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
@ -51,7 +50,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
public BlockItemPackets1_14(Protocol1_13_2To1_14 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter, BlockItemPackets1_14::getOldItemId, BlockItemPackets1_14::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
|
||||
super(protocol, translatableRewriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -176,9 +175,9 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
});
|
||||
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13_2To1_14::getNewBlockStateId, Protocol1_13_2To1_14::getNewBlockId);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION);
|
||||
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_14.COOLDOWN, BlockItemPackets1_14::getOldItemId);
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_14.COOLDOWN);
|
||||
itemRewriter.registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
itemRewriter.registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||
itemRewriter.registerAdvancements(ClientboundPackets1_14.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||
@ -358,7 +357,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
map(Type.UNSIGNED_BYTE); // Action param
|
||||
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
|
||||
handler(wrapper -> {
|
||||
int mappedId = Protocol1_13_2To1_14.getNewBlockId(wrapper.get(Type.VAR_INT, 0));
|
||||
int mappedId = protocol.getMappingData().getNewBlockId(wrapper.get(Type.VAR_INT, 0));
|
||||
if (mappedId == -1) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
@ -378,7 +377,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int id = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
wrapper.set(Type.VAR_INT, 0, Protocol1_13_2To1_14.getNewBlockStateId(id));
|
||||
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(id));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -443,7 +442,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
for (int y = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int id = section.getFlatBlock(x, y, z);
|
||||
if (MappingData.nonFullBlocks.contains(id)) {
|
||||
if (Protocol1_14To1_13_2.MAPPINGS.getNonFullBlocks().contains(id)) {
|
||||
section.getBlockLightNibbleArray().set(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
@ -453,7 +452,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
|
||||
for (int j = 0; j < section.getPaletteSize(); j++) {
|
||||
int old = section.getPaletteEntry(j);
|
||||
int newId = Protocol1_13_2To1_14.getNewBlockStateId(old);
|
||||
int newId = protocol.getMappingData().getNewBlockStateId(old);
|
||||
section.setPaletteEntry(j, newId);
|
||||
}
|
||||
}
|
||||
@ -488,9 +487,9 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
int data = wrapper.get(Type.INT, 1);
|
||||
if (id == 1010) { // Play record
|
||||
wrapper.set(Type.INT, 1, data = BlockItemPackets1_14.getOldItemId(data));
|
||||
wrapper.set(Type.INT, 1, protocol.getMappingData().getNewItemId(data));
|
||||
} else if (id == 2001) { // Block break + block break sound
|
||||
wrapper.set(Type.INT, 1, data = Protocol1_13_2To1_14.getNewBlockStateId(data));
|
||||
wrapper.set(Type.INT, 1, protocol.getMappingData().getNewBlockStateId(data));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -584,23 +583,4 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
public static int getNewItemId(int id) {
|
||||
int newId = MappingData.oldToNewItems.get(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 item for 1.13.2 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getOldItemId(int id) {
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||
if (oldId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.13.2 item for 1.14 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return oldId;
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
int data = wrapper.get(Type.INT, 0);
|
||||
if (objectType == Entity1_13Types.ObjectType.FALLING_BLOCK) {
|
||||
int blockState = wrapper.get(Type.INT, 0);
|
||||
int combined = Protocol1_13_2To1_14.getNewBlockStateId(blockState);
|
||||
int combined = protocol.getMappingData().getNewBlockStateId(blockState);
|
||||
wrapper.set(Type.INT, 0, combined);
|
||||
} else if (entityType.isOrHasParent(Entity1_13Types.EntityType.ABSTRACT_ARROW)) {
|
||||
wrapper.set(Type.INT, 0, data + 1);
|
||||
@ -351,7 +351,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
meta.setValue(getProtocol().getBlockItemPackets().handleItemToClient(item));
|
||||
} else if (type == MetaType1_13_2.BlockID) {
|
||||
int blockstate = (Integer) meta.getValue();
|
||||
meta.setValue(Protocol1_13_2To1_14.getNewBlockStateId(blockstate));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockstate));
|
||||
}
|
||||
|
||||
return meta;
|
||||
|
@ -5,7 +5,6 @@ import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.rewriters.Rewriter;
|
||||
import nl.matsv.viabackwards.api.rewriters.SoundRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.storage.EntityPositionStorage1_14;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
@ -20,8 +19,7 @@ public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
SoundRewriter soundRewriter = new SoundRewriter(protocol,
|
||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||
SoundRewriter soundRewriter = new SoundRewriter(protocol);
|
||||
soundRewriter.registerSound(ClientboundPackets1_14.SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_14.NAMED_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_14.STOP_SOUND);
|
||||
@ -34,7 +32,7 @@ public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
|
||||
wrapper.cancel();
|
||||
|
||||
int soundId = wrapper.read(Type.VAR_INT);
|
||||
int newId = BackwardsMappings.soundMappings.getNewId(soundId);
|
||||
int newId = protocol.getMappingData().getSoundMappings().getNewId(soundId);
|
||||
if (newId == -1) return;
|
||||
|
||||
int category = wrapper.read(Type.VAR_INT);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13to1_13_1;
|
||||
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.packets.EntityPackets1_13_1;
|
||||
@ -14,18 +15,23 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_13, ServerboundPackets1_13, ServerboundPackets1_13> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.13.2", "1.13", Protocol1_13_1To1_13.class, true);
|
||||
|
||||
public Protocol1_13To1_13_1() {
|
||||
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_13_1To1_13.class, MAPPINGS::loadVBMappings);
|
||||
|
||||
new EntityPackets1_13_1(this).register();
|
||||
InventoryPackets1_13_1.register(this);
|
||||
WorldPackets1_13_1.register(this);
|
||||
@ -161,42 +167,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, Protocol1_13To1_13_1::getNewBlockId,
|
||||
InventoryPackets1_13_1::getOldItemId, null).register(ClientboundPackets1_13.TAGS);
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int blockId) {
|
||||
if (blockId > 8590) {
|
||||
blockId -= 17;
|
||||
} else if (blockId > 8588) {
|
||||
blockId = 8573;
|
||||
} else if (blockId > 8479) {
|
||||
blockId -= 16;
|
||||
} else if (blockId > 8469 && blockId % 2 == 0) {
|
||||
if (blockId % 2 == 0) {
|
||||
blockId = 8459 + (blockId - 8470) / 2;
|
||||
} else {
|
||||
blockId = 0; //TODO replace new blocks
|
||||
}
|
||||
} else if (blockId > 8463) {
|
||||
blockId = 0; //TODO replace new blocks
|
||||
} else if (blockId > 1127) {
|
||||
blockId -= 1;
|
||||
} else if (blockId == 1127) {
|
||||
blockId = 1126;
|
||||
}
|
||||
|
||||
return blockId;
|
||||
}
|
||||
|
||||
public static int getNewBlockId(int blockId) {
|
||||
if (blockId > 565) {
|
||||
blockId -= 5;
|
||||
} else if (blockId > 561) {
|
||||
blockId = 0; // Replacements not needed
|
||||
}
|
||||
|
||||
return blockId;
|
||||
new TagRewriter(this, null).register(ClientboundPackets1_13.TAGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -208,7 +179,13 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
// Init protocol in EntityTracker
|
||||
user.get(EntityTracker.class).initProtocol(this);
|
||||
|
||||
if (!user.has(ClientWorld.class))
|
||||
if (!user.has(ClientWorld.class)) {
|
||||
user.put(new ClientWorld(user));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
||||
// Rewrite falling block
|
||||
if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) {
|
||||
int data = wrapper.get(Type.INT, 0);
|
||||
wrapper.set(Type.INT, 0, Protocol1_13To1_13_1.getNewBlockStateId(data));
|
||||
wrapper.set(Type.INT, 0, protocol.getMappingData().getNewBlockStateId(data));
|
||||
}
|
||||
|
||||
// Track Entity
|
||||
@ -134,7 +134,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
||||
} else if (meta.getMetaType() == MetaType1_13.BlockID) {
|
||||
// Convert to new block id
|
||||
int data = (int) meta.getValue();
|
||||
meta.setValue(Protocol1_13To1_13_1.getNewBlockStateId(data));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
}
|
||||
|
||||
return meta;
|
||||
@ -160,7 +160,7 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
||||
Metadata meta = e.getData();
|
||||
|
||||
int data = (int) meta.getValue();
|
||||
meta.setValue(Protocol1_13To1_13_1.getNewBlockStateId(data));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
|
||||
return meta;
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.packets;
|
||||
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
@ -15,7 +16,7 @@ public class InventoryPackets1_13_1 {
|
||||
public static void register(Protocol protocol) {
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets1_13_1::toClient, InventoryPackets1_13_1::toServer);
|
||||
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN, InventoryPackets1_13_1::getOldItemId);
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN);
|
||||
itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_ITEM_ARRAY);
|
||||
itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_ITEM);
|
||||
|
||||
@ -62,27 +63,11 @@ public class InventoryPackets1_13_1 {
|
||||
|
||||
public static void toClient(Item item) {
|
||||
if (item == null) return;
|
||||
item.setIdentifier(getOldItemId(item.getIdentifier()));
|
||||
}
|
||||
|
||||
// 1.13.1 Item Id
|
||||
public static int getNewItemId(int itemId) {
|
||||
if (itemId >= 443) {
|
||||
return itemId + 5;
|
||||
}
|
||||
return itemId;
|
||||
item.setIdentifier(Protocol1_13To1_13_1.MAPPINGS.getNewItemId(item.getIdentifier()));
|
||||
}
|
||||
|
||||
public static void toServer(Item item) {
|
||||
if (item == null) return;
|
||||
item.setIdentifier(getNewItemId(item.getIdentifier()));
|
||||
}
|
||||
|
||||
// 1.13 Item Id
|
||||
public static int getOldItemId(int newId) {
|
||||
if (newId >= 448) {
|
||||
return newId - 5;
|
||||
}
|
||||
return newId;
|
||||
item.setIdentifier(Protocol1_13To1_13_1.MAPPINGS.getOldItemId(item.getIdentifier()));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.packets;
|
||||
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||
@ -16,7 +15,7 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
public class WorldPackets1_13_1 {
|
||||
|
||||
public static void register(Protocol protocol) {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION, Protocol1_13To1_13_1::getNewBlockStateId, Protocol1_13To1_13_1::getNewBlockId);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
|
||||
@Override
|
||||
@ -30,7 +29,7 @@ public class WorldPackets1_13_1 {
|
||||
for (ChunkSection section : chunk.getSections()) {
|
||||
if (section != null) {
|
||||
for (int i = 0; i < section.getPaletteSize(); i++) {
|
||||
section.setPaletteEntry(i, Protocol1_13To1_13_1.getNewBlockStateId(section.getPaletteEntry(i)));
|
||||
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(section.getPaletteEntry(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,7 +41,7 @@ public class WorldPackets1_13_1 {
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_13.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_13.BLOCK_CHANGE);
|
||||
blockRewriter.registerMultiBlockChange(ClientboundPackets1_13.MULTI_BLOCK_CHANGE);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_13.EFFECT, 1010, 2001, InventoryPackets1_13_1::getOldItemId);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_13.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_13.SPAWN_PARTICLE, 3, 20, 27, InventoryPackets1_13_1::toClient, Type.FLAT_ITEM, Type.FLOAT);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_14_4to1_15;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
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.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.EntityTypeMapping;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ImmediateRespawn;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.packets.BlockItemPackets1_15;
|
||||
@ -20,10 +19,10 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||
|
||||
public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_15, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.15", "1.14", Protocol1_15To1_14_4.class, true);
|
||||
private BlockItemPackets1_15 blockItemPackets;
|
||||
|
||||
public Protocol1_14_4To1_15() {
|
||||
@ -32,7 +31,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, BackwardsMappings::init);
|
||||
executeAsyncAfterLoaded(Protocol1_15To1_14_4.class, MAPPINGS::loadVBMappings);
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_15.BOSSBAR);
|
||||
@ -47,8 +46,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
|
||||
new EntityPackets1_15(this).register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_15.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_15.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_15.NAMED_SOUND);
|
||||
@ -79,29 +77,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id),
|
||||
id -> MappingData.oldToNewItems.inverse().get(id), EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.TAGS);
|
||||
new TagRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.TAGS);
|
||||
|
||||
new StatisticsRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> MappingData.oldToNewItems.inverse().get(id),
|
||||
EntityTypeMapping::getOldEntityId, id -> BackwardsMappings.statisticsMappings.getNewId(id)).register(ClientboundPackets1_15.STATISTICS);
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
int newId = BackwardsMappings.blockStateMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.15 blockstate id for 1.14.4 block " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getNewBlockId(int id) {
|
||||
int newId = BackwardsMappings.blockMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.15 block id for 1.14.4 block " + id);
|
||||
return id;
|
||||
}
|
||||
return newId;
|
||||
new StatisticsRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,4 +96,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BlockItemPackets1_15 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.data.VBItemMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||
import nl.matsv.viabackwards.api.data.VBMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBSoundMappings;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
public static VBSoundMappings soundMappings;
|
||||
public static VBItemMappings itemMappings;
|
||||
|
||||
public static void init() {
|
||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.15 -> 1.14.4 mappings...");
|
||||
JsonObject mapping1_14 = MappingDataLoader.getMappingsCache().get("mapping-1.14.json");
|
||||
JsonObject mapping1_15 = MappingDataLoader.getMappingsCache().get("mapping-1.15.json");
|
||||
JsonObject mapping1_14to1_15 = VBMappingDataLoader.loadFromDataDir("mapping-1.14.4to1.15.json");
|
||||
|
||||
blockStateMappings = new VBMappings(mapping1_15.getAsJsonObject("blockstates"), mapping1_14.getAsJsonObject("blockstates"), mapping1_14to1_15.getAsJsonObject("blockstates"));
|
||||
blockMappings = new VBMappings(mapping1_15.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks"), mapping1_14to1_15.getAsJsonObject("blocks"), false);
|
||||
itemMappings = new VBItemMappings(mapping1_15.getAsJsonObject("items"), mapping1_14.getAsJsonObject("items"), mapping1_14to1_15.getAsJsonObject("items"));
|
||||
soundMappings = new VBSoundMappings(mapping1_15.getAsJsonArray("sounds"), mapping1_14.getAsJsonArray("sounds"), mapping1_14to1_15.getAsJsonObject("sounds"));
|
||||
statisticsMappings = new Mappings(mapping1_15.getAsJsonArray("statistics"), mapping1_14.getAsJsonArray("statistics"), false);
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.packets;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||
@ -18,19 +16,18 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.RecipeRewriter1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||
|
||||
public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_14_4To1_15> {
|
||||
|
||||
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter, BlockItemPackets1_15::getOldItemId, BlockItemPackets1_15::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
|
||||
super(protocol, translatableRewriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_14_4To1_15::getNewBlockStateId, Protocol1_14_4To1_15::getNewBlockId);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_14(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES);
|
||||
|
||||
@ -41,7 +38,7 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
});
|
||||
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_15.COOLDOWN, BlockItemPackets1_15::getOldItemId);
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_15.COOLDOWN);
|
||||
itemRewriter.registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
itemRewriter.registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||
itemRewriter.registerTradeList(ClientboundPackets1_15.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
||||
@ -92,7 +89,7 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
if (section == null) continue;
|
||||
for (int j = 0; j < section.getPaletteSize(); j++) {
|
||||
int old = section.getPaletteEntry(j);
|
||||
int newId = Protocol1_14_4To1_15.getNewBlockStateId(old);
|
||||
int newId = protocol.getMappingData().getNewBlockStateId(old);
|
||||
section.setPaletteEntry(j, newId);
|
||||
}
|
||||
}
|
||||
@ -101,7 +98,7 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
});
|
||||
|
||||
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001, BlockItemPackets1_15::getOldItemId);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_15.EFFECT, 1010, 2001);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_PARTICLE, new PacketRemapper() {
|
||||
@Override
|
||||
@ -127,7 +124,7 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
|
||||
if (id == 3 || id == 23) {
|
||||
int data = wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.set(Type.VAR_INT, 0, Protocol1_14_4To1_15.getNewBlockStateId(data));
|
||||
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(data));
|
||||
} else if (id == 32) {
|
||||
Item item = handleItemToClient(wrapper.read(Type.FLAT_VAR_INT_ITEM));
|
||||
wrapper.write(Type.FLAT_VAR_INT_ITEM, item);
|
||||
@ -137,23 +134,4 @@ public class BlockItemPackets1_15 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static int getNewItemId(int id) {
|
||||
int newId = MappingData.oldToNewItems.get(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.15 item for 1.14.4 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
|
||||
public static int getOldItemId(int id) {
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||
if (oldId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.14.4 item for 1.15 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return oldId;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
}
|
||||
});
|
||||
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_15Types.EntityType.FALLING_BLOCK, Protocol1_14_4To1_15::getNewBlockStateId);
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_15Types.EntityType.FALLING_BLOCK);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_MOB, new PacketRemapper() {
|
||||
@Override
|
||||
@ -191,7 +191,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
meta.setValue(protocol.getBlockItemPackets().handleItemToClient(item));
|
||||
} else if (type == MetaType1_14.BlockID) {
|
||||
int blockstate = (int) meta.getValue();
|
||||
meta.setValue(Protocol1_14_4To1_15.getNewBlockStateId(blockstate));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockstate));
|
||||
} else if (type == MetaType1_14.PARTICLE) {
|
||||
Particle particle = (Particle) meta.getValue();
|
||||
particle.setId(ParticleMapping.getOldId(particle.getId()));
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.rewriters.SoundRewriter;
|
||||
@ -21,7 +20,6 @@ import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
@ -31,6 +29,7 @@ import java.util.UUID;
|
||||
|
||||
public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_16, ClientboundPackets1_15, ServerboundPackets1_16, ServerboundPackets1_14> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private BlockItemPackets1_16 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
@ -40,7 +39,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, BackwardsMappings::init);
|
||||
executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, MAPPINGS::loadVBMappings);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter1_16(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_16.BOSSBAR);
|
||||
@ -95,8 +94,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_16.NAMED_SOUND);
|
||||
@ -114,11 +112,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id ->
|
||||
MappingData.oldToNewItems.inverse().get(id), entityPackets::getOldEntityId).register(ClientboundPackets1_16.TAGS);
|
||||
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16.TAGS);
|
||||
|
||||
new StatisticsRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id -> MappingData.oldToNewItems.inverse().get(id),
|
||||
entityPackets::getOldEntityId, id -> BackwardsMappings.statisticsMappings.getNewId(id)).register(ClientboundPackets1_16.STATISTICS);
|
||||
new StatisticsRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16.STATISTICS);
|
||||
|
||||
registerIncoming(ServerboundPackets1_14.ENTITY_ACTION, new PacketRemapper() {
|
||||
@Override
|
||||
@ -175,24 +171,6 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
cancelIncoming(ServerboundPackets1_14.UPDATE_JIGSAW_BLOCK);
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
int newId = BackwardsMappings.blockStateMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 blockstate id for 1.15 block " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getNewBlockId(int id) {
|
||||
int newId = BackwardsMappings.blockMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 block id for 1.15 block " + id);
|
||||
return id;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection user) {
|
||||
if (!user.has(ClientWorld.class)) {
|
||||
@ -212,4 +190,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +1,26 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.data.VBItemMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||
import nl.matsv.viabackwards.api.data.VBMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBSoundMappings;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings statisticsMappings;
|
||||
public static VBSoundMappings soundMappings;
|
||||
public static VBItemMappings itemMappings;
|
||||
public static Map<String, String> attributeMappings = new HashMap<>();
|
||||
public class BackwardsMappings extends nl.matsv.viabackwards.api.data.BackwardsMappings {
|
||||
private final Map<String, String> attributeMappings = new HashMap<>();
|
||||
|
||||
public static void init() {
|
||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.16 -> 1.15.2 mappings...");
|
||||
JsonObject mapping1_15 = MappingDataLoader.getMappingsCache().get("mapping-1.15.json");
|
||||
JsonObject mapping1_16 = MappingDataLoader.getMappingsCache().get("mapping-1.16.json");
|
||||
JsonObject mapping1_15to1_16 = VBMappingDataLoader.loadFromDataDir("mapping-1.15to1.16.json");
|
||||
public BackwardsMappings() {
|
||||
super("1.16", "1.15", Protocol1_16To1_15_2.class, true);
|
||||
}
|
||||
|
||||
blockStateMappings = new VBMappings(mapping1_16.getAsJsonObject("blockstates"), mapping1_15.getAsJsonObject("blockstates"), mapping1_15to1_16.getAsJsonObject("blockstates"));
|
||||
blockMappings = new VBMappings(mapping1_16.getAsJsonObject("blocks"), mapping1_15.getAsJsonObject("blocks"), mapping1_15to1_16.getAsJsonObject("blocks"), false);
|
||||
itemMappings = new VBItemMappings(mapping1_16.getAsJsonObject("items"), mapping1_15.getAsJsonObject("items"), mapping1_15to1_16.getAsJsonObject("items"));
|
||||
soundMappings = new VBSoundMappings(mapping1_16.getAsJsonArray("sounds"), mapping1_15.getAsJsonArray("sounds"), mapping1_15to1_16.getAsJsonObject("sounds"));
|
||||
statisticsMappings = new Mappings(mapping1_16.getAsJsonArray("statistics"), mapping1_15.getAsJsonArray("statistics"), false);
|
||||
|
||||
for (Map.Entry<String, String> entry : MappingData.attributeMappings.entrySet()) {
|
||||
@Override
|
||||
protected void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
|
||||
for (Map.Entry<String, String> entry : Protocol1_16To1_15_2.MAPPINGS.getAttributeMappings().entrySet()) {
|
||||
attributeMappings.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getAttributeMappings() {
|
||||
return attributeMappings;
|
||||
}
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.MapColorRewriter;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
@ -21,7 +19,6 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.RecipeRewriter1_1
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type;
|
||||
import us.myles.ViaVersion.util.CompactArrayUtil;
|
||||
@ -40,14 +37,13 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
public BlockItemPackets1_16(Protocol1_15_2To1_16 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter,
|
||||
BlockItemPackets1_16::getOldItemId, BlockItemPackets1_16::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
|
||||
super(protocol, translatableRewriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_15_2To1_16::getNewBlockStateId, Protocol1_15_2To1_16::getNewBlockId);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
|
||||
RecipeRewriter1_14 recipeRewriter = new RecipeRewriter1_14(protocol, this::handleItemToClient);
|
||||
// Remove new smithing type, only in this handler
|
||||
@ -80,7 +76,7 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
});
|
||||
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_16.COOLDOWN, BlockItemPackets1_16::getOldItemId);
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_16.COOLDOWN);
|
||||
itemRewriter.registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
itemRewriter.registerSetSlot(ClientboundPackets1_16.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||
itemRewriter.registerTradeList(ClientboundPackets1_16.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
||||
@ -145,7 +141,7 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
if (section == null) continue;
|
||||
for (int j = 0; j < section.getPaletteSize(); j++) {
|
||||
int old = section.getPaletteEntry(j);
|
||||
section.setPaletteEntry(j, Protocol1_15_2To1_16.getNewBlockStateId(old));
|
||||
section.setPaletteEntry(j, protocol.getMappingData().getNewBlockStateId(old));
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +175,7 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
});
|
||||
|
||||
blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001, BlockItemPackets1_16::getOldItemId);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_16.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_16.SPAWN_PARTICLE, 3, 23, 34,
|
||||
BlockItemPackets1_16::getNewParticleId, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||
|
||||
@ -375,24 +371,6 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
return item;
|
||||
}
|
||||
|
||||
public static int getNewItemId(int id) {
|
||||
int newId = MappingData.oldToNewItems.get(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 item for 1.15 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getOldItemId(int id) {
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||
if (oldId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.15 item for 1.16 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return oldId;
|
||||
}
|
||||
|
||||
private static final class EquipmentData {
|
||||
private final int slot;
|
||||
private final Item item;
|
||||
|
@ -3,7 +3,6 @@ package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets;
|
||||
import nl.matsv.viabackwards.api.rewriters.EntityRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_15Types;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_16Types;
|
||||
@ -45,7 +44,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_15_2To1_16::getNewBlockStateId);
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16Types.EntityType.FALLING_BLOCK);
|
||||
registerSpawnTracker(ClientboundPackets1_16.SPAWN_MOB);
|
||||
|
||||
protocol.registerOutgoing(ClientboundPackets1_16.RESPAWN, new PacketRemapper() {
|
||||
@ -128,7 +127,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
int size = wrapper.passthrough(Type.INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
String attributeIdentifier = wrapper.read(Type.STRING);
|
||||
String oldKey = BackwardsMappings.attributeMappings.get(attributeIdentifier);
|
||||
String oldKey = protocol.getMappingData().getAttributeMappings().get(attributeIdentifier);
|
||||
wrapper.write(Type.STRING, oldKey != null ? oldKey : attributeIdentifier.replace("minecraft:", ""));
|
||||
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
@ -191,7 +190,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
if (type == MetaType1_14.Slot) {
|
||||
meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue()));
|
||||
} else if (type == MetaType1_14.BlockID) {
|
||||
meta.setValue(Protocol1_15_2To1_16.getNewBlockStateId((int) meta.getValue()));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId((int) meta.getValue()));
|
||||
} else if (type == MetaType1_14.PARTICLE) {
|
||||
Particle particle = (Particle) meta.getValue();
|
||||
particle.setId(ParticleMapping.getOldId(particle.getId()));
|
||||
|
@ -1,11 +1,10 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
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.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.packets.BlockItemPackets1_16_2;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.packets.EntityPackets1_16_2;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
@ -18,12 +17,12 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||
|
||||
public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16, ServerboundPackets1_16_2, ServerboundPackets1_16> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.16.2", "1.16", Protocol1_16_2To1_16_1.class, true);
|
||||
private BlockItemPackets1_16_2 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
@ -33,7 +32,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_16_2To1_16_1.class, BackwardsMappings::init);
|
||||
executeAsyncAfterLoaded(Protocol1_16_2To1_16_1.class, MAPPINGS::loadVBMappings);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_16_2.BOSSBAR);
|
||||
@ -49,8 +48,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
EntityPackets1_16_2 entityPackets = new EntityPackets1_16_2(this);
|
||||
entityPackets.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this,
|
||||
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_16_2.NAMED_SOUND);
|
||||
@ -92,29 +90,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id ->
|
||||
MappingData.oldToNewItems.inverse().get(id), entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.TAGS);
|
||||
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.TAGS);
|
||||
|
||||
new StatisticsRewriter(this, id -> BackwardsMappings.blockMappings.getNewId(id), id ->
|
||||
MappingData.oldToNewItems.inverse().get(id), entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
int newId = BackwardsMappings.blockStateMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 blockstate id for 1.16.2 block " + id);
|
||||
return 0;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getNewBlockId(int id) {
|
||||
int newId = BackwardsMappings.blockMappings.getNewId(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 block id for 1.16.2 block " + id);
|
||||
return id;
|
||||
}
|
||||
return newId;
|
||||
new StatisticsRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,4 +110,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.data.VBItemMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBMappingDataLoader;
|
||||
import nl.matsv.viabackwards.api.data.VBMappings;
|
||||
import nl.matsv.viabackwards.api.data.VBSoundMappings;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings blockMappings;
|
||||
public static VBSoundMappings soundMappings;
|
||||
public static VBItemMappings itemMappings;
|
||||
|
||||
public static void init() {
|
||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.16.2 -> 1.16.1 mappings...");
|
||||
JsonObject mapping1_16 = MappingDataLoader.getMappingsCache().get("mapping-1.16.json");
|
||||
JsonObject mapping1_16_2 = MappingDataLoader.getMappingsCache().get("mapping-1.16.2.json");
|
||||
JsonObject mapping1_16to1_16_2 = VBMappingDataLoader.loadFromDataDir("mapping-1.16to1.16.2.json");
|
||||
|
||||
blockStateMappings = new VBMappings(mapping1_16_2.getAsJsonObject("blockstates"), mapping1_16.getAsJsonObject("blockstates"), mapping1_16to1_16_2.getAsJsonObject("blockstates"));
|
||||
blockMappings = new VBMappings(mapping1_16_2.getAsJsonObject("blocks"), mapping1_16.getAsJsonObject("blocks"), mapping1_16to1_16_2.getAsJsonObject("blocks"), false);
|
||||
itemMappings = new VBItemMappings(mapping1_16_2.getAsJsonObject("items"), mapping1_16.getAsJsonObject("items"), mapping1_16to1_16_2.getAsJsonObject("items"));
|
||||
soundMappings = new VBSoundMappings(mapping1_16_2.getAsJsonArray("sounds"), mapping1_16.getAsJsonArray("sounds"), mapping1_16to1_16_2.getAsJsonObject("sounds"));
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.packets;
|
||||
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsMappings;
|
||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord1_8;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
@ -14,7 +12,6 @@ import us.myles.ViaVersion.api.rewriters.BlockRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||
@ -29,18 +26,17 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_16_1To1_16_2> {
|
||||
|
||||
public BlockItemPackets1_16_2(Protocol1_16_1To1_16_2 protocol, TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter,
|
||||
BlockItemPackets1_16_2::getOldItemId, BlockItemPackets1_16_2::getNewItemId, id -> BackwardsMappings.itemMappings.getMappedItem(id));
|
||||
super(protocol, translatableRewriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_16_1To1_16_2::getNewBlockStateId, Protocol1_16_1To1_16_2::getNewBlockId);
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_16(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
|
||||
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN, BlockItemPackets1_16_2::getOldItemId);
|
||||
itemRewriter.registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
|
||||
itemRewriter.registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
itemRewriter.registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||
itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||
@ -82,7 +78,7 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
if (section == null) continue;
|
||||
for (int j = 0; j < section.getPaletteSize(); j++) {
|
||||
int old = section.getPaletteEntry(j);
|
||||
section.setPaletteEntry(j, Protocol1_16_1To1_16_2.getNewBlockStateId(old));
|
||||
section.setPaletteEntry(j, protocol.getMappingData().getNewBlockStateId(old));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +88,6 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
IntTag x = blockEntity.get("x");
|
||||
IntTag y = blockEntity.get("y");
|
||||
IntTag z = blockEntity.get("z");
|
||||
|
||||
if (x != null && y != null && z != null) {
|
||||
handleBlockEntity(blockEntity, new Position(x.getValue(), y.getValue().shortValue(), z.getValue()));
|
||||
}
|
||||
@ -129,7 +124,7 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
wrapper.write(Type.BLOCK_CHANGE_RECORD_ARRAY, blockChangeRecord);
|
||||
for (int i = 0; i < blockChangeRecord.length; i++) {
|
||||
BlockChangeRecord record = blockChangeRecord[i];
|
||||
int blockId = Protocol1_16_1To1_16_2.getNewBlockStateId(record.getBlockId());
|
||||
int blockId = protocol.getMappingData().getNewBlockStateId(record.getBlockId());
|
||||
// Relative y -> absolute y
|
||||
blockChangeRecord[i] = new BlockChangeRecord1_8(record.getSectionX(), record.getY(chunkY), record.getSectionZ(), blockId);
|
||||
}
|
||||
@ -137,7 +132,7 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
}
|
||||
});
|
||||
|
||||
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001, BlockItemPackets1_16_2::getOldItemId);
|
||||
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001);
|
||||
blockRewriter.registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, 3, 23, 34,
|
||||
null, this::handleItemToClient, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||
|
||||
@ -177,22 +172,4 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
skullOwnerCompoundTag.put(new IntArrayTag("Id", uuidIntArray));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getNewItemId(int id) {
|
||||
int newId = MappingData.oldToNewItems.get(id);
|
||||
if (newId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16.2 item for 1.16 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static int getOldItemId(int id) {
|
||||
int oldId = MappingData.oldToNewItems.inverse().get(id);
|
||||
if (oldId == -1) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.16 item for 1.16.2 item " + id);
|
||||
return 1;
|
||||
}
|
||||
return oldId;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerSpawnTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK, Protocol1_16_1To1_16_2::getNewBlockStateId);
|
||||
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);
|
||||
@ -97,7 +97,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
if (type == MetaType1_14.Slot) {
|
||||
meta.setValue(protocol.getBlockItemPackets().handleItemToClient((Item) meta.getValue()));
|
||||
} else if (type == MetaType1_14.BlockID) {
|
||||
meta.setValue(Protocol1_16_1To1_16_2.getNewBlockStateId((int) meta.getValue()));
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId((int) meta.getValue()));
|
||||
} else if (type == MetaType1_14.OptChat) {
|
||||
JsonElement text = meta.getCastedValue();
|
||||
if (text != null) {
|
||||
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"blockstates": {
|
||||
"minecraft:tnt[unstable=false]": "minecraft:tnt",
|
||||
"minecraft:tnt[unstable=true]": "minecraft:tnt",
|
||||
"minecraft:oak_sign": "minecraft:sign[",
|
||||
"minecraft:oak_wall_sign": "minecraft:wall_sign[",
|
||||
"minecraft:smooth_stone_slab": "minecraft:stone_slab[",
|
||||
"minecraft:dead_tube_coral": "minecraft:tube_coral",
|
||||
"minecraft:dead_brain_coral": "minecraft:brain_coral",
|
||||
"minecraft:dead_bubble_coral": "minecraft:bubble_coral",
|
||||
"minecraft:dead_fire_coral": "minecraft:fire_coral",
|
||||
"minecraft:dead_horn_coral": "minecraft:horn_coral",
|
||||
"minecraft:tube_coral": "minecraft:tube_coral",
|
||||
"minecraft:brain_coral": "minecraft:brain_coral",
|
||||
"minecraft:bubble_coral": "minecraft:bubble_coral",
|
||||
"minecraft:fire_coral": "minecraft:fire_coral",
|
||||
"minecraft:horn_coral": "minecraft:horn_coral",
|
||||
"minecraft:conduit": "minecraft:conduit"
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-fabric</artifactId>
|
||||
|
4
pom.xml
4
pom.xml
@ -16,7 +16,7 @@
|
||||
|
||||
<groupId>nl.matsv</groupId>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>Allow older clients to join newer server versions.</description>
|
||||
@ -65,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion</artifactId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-sponge</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>viabackwards-velocity</artifactId>
|
||||
|
Loading…
Reference in New Issue
Block a user