Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d35d16575 | ||
|
|
e70f595f76 | ||
|
|
888441b81d | ||
|
|
71f4012537 | ||
|
|
ce6ca4dc0f | ||
|
|
becba6498e | ||
|
|
95bc340b06 | ||
|
|
1ab93c4021 | ||
|
|
b36052465f | ||
|
|
5695726d9a | ||
|
|
025a892daf | ||
|
|
74aa5f4598 | ||
|
|
db345577a2 | ||
|
|
80f41c8c24 | ||
|
|
169650f17c | ||
|
|
4361ebe636 | ||
|
|
9d52fd6212 | ||
|
|
abb2abe5c9 | ||
|
|
e9d1d257ea | ||
|
|
a721eb4d03 | ||
|
|
fe644127c1 | ||
|
|
71cc1ca4b5 | ||
|
|
5df0dacf92 | ||
|
|
448f452965 | ||
|
|
3d6c31c479 | ||
|
|
067c93a63a | ||
|
|
04a970ef08 | ||
|
|
3d32cb3adf | ||
|
|
1ef1a861ca | ||
|
|
deb11bf1a9 | ||
|
|
87ad6bd2b1 | ||
|
|
3054b758df | ||
|
|
5777f4a117 | ||
|
|
9615a5aba2 | ||
|
|
8fff947863 | ||
|
|
68f77cc809 | ||
|
|
4f801b4228 | ||
|
|
54dc05046f | ||
|
|
e05c585b37 | ||
|
|
a03a3a2a8d | ||
|
|
e251565837 | ||
|
|
455bb546f0 | ||
|
|
fa707e5391 | ||
|
|
6f2961a00b | ||
|
|
43ebe3c3e3 | ||
|
|
f8d10be031 | ||
|
|
3f01f0100c | ||
|
|
29d3787de8 | ||
|
|
59df758ceb | ||
|
|
80360bf27c | ||
|
|
3da7d7513e | ||
|
|
a654becac8 | ||
|
|
77a5b2212b | ||
|
|
7013ed8acf | ||
|
|
9d41854e22 | ||
|
|
edf9ccca8b | ||
|
|
d62165bf51 | ||
|
|
00bc4a9d6a | ||
|
|
7885babe1e | ||
|
|
9a53678838 | ||
|
|
91874ffc3b | ||
|
|
e71c34255b | ||
|
|
8e78a14c14 | ||
|
|
3b85200641 | ||
|
|
1dc0f72e54 | ||
|
|
13d27a6f4d | ||
|
|
3cec1751c9 | ||
|
|
80f9dce513 | ||
|
|
cf7c718493 | ||
|
|
0ba20299a3 |
No files matched your search
@@ -1,5 +1,6 @@
|
||||
name: Bug Report
|
||||
description: Report a bug or console error
|
||||
labels: [unconfirmed]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
|
||||
@@ -105,9 +105,3 @@ nbdist/
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
.nb-gradle/
|
||||
|
||||
|
||||
|
||||
### Git ###
|
||||
# Don't exclude the .gitignore itself
|
||||
!.gitignore
|
||||
@@ -11,7 +11,7 @@ Supported Versions
|
||||
**Green** = ViaVersion\
|
||||
**Purple** = ViaBackwards addition
|
||||
|
||||

|
||||

|
||||
|
||||
Releases / Dev Builds
|
||||
-
|
||||
|
||||
@@ -8,5 +8,5 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
// version must be manually kept in sync with the one in root project settings.gradle.kts
|
||||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
|
||||
implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.0")
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "com.viaversion"
|
||||
version = "4.0.0"
|
||||
version = "4.1.0"
|
||||
description = "Allow older clients to join newer server versions."
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ description: Allow older Minecraft versions to connect to a newer server version
|
||||
main: com.viaversion.viabackwards.BukkitPlugin
|
||||
api-version: 1.13
|
||||
|
||||
authors: [Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1]
|
||||
authors: [Matsv, kennytv, Gerrygames, creeper123123321, ForceUpdate1]
|
||||
website: ${url}
|
||||
|
||||
depend: [ViaVersion]
|
||||
@@ -1,5 +1,5 @@
|
||||
name: ViaBackwards
|
||||
main: com.viaversion.viabackwards.BungeePlugin
|
||||
author: "Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1"
|
||||
author: "Matsv, kennytv, Gerrygames, creeper123123321, ForceUpdate1"
|
||||
version: ${version}
|
||||
depends: [ViaVersion]
|
||||
@@ -31,6 +31,8 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
||||
private boolean addTeamColorToPrefix;
|
||||
private boolean fix1_13FacePlayer;
|
||||
private boolean alwaysShowOriginalMobName;
|
||||
private boolean fix1_13FormattedInventoryTitles;
|
||||
private boolean handlePingsAsInvAcknowledgements;
|
||||
|
||||
public ViaBackwardsConfig(File configFile) {
|
||||
super(configFile);
|
||||
@@ -46,7 +48,9 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
||||
addCustomEnchantsToLore = getBoolean("add-custom-enchants-into-lore", true);
|
||||
addTeamColorToPrefix = getBoolean("add-teamcolor-to-prefix", true);
|
||||
fix1_13FacePlayer = getBoolean("fix-1_13-face-player", false);
|
||||
fix1_13FormattedInventoryTitles = getBoolean("fix-formatted-inventory-titles", true);
|
||||
alwaysShowOriginalMobName = getBoolean("always-show-original-mob-name", true);
|
||||
handlePingsAsInvAcknowledgements = getBoolean("handle-pings-as-inv-acknowledgements", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,11 +68,21 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
||||
return fix1_13FacePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fix1_13FormattedInventoryTitle() {
|
||||
return fix1_13FormattedInventoryTitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysShowOriginalMobName() {
|
||||
return alwaysShowOriginalMobName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePingsAsInvAcknowledgements() {
|
||||
return handlePingsAsInvAcknowledgements || Boolean.getBoolean("com.viaversion.handlePingsAsInvAcknowledgements");
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");
|
||||
|
||||
@@ -40,10 +40,14 @@ public interface ViaBackwardsConfig {
|
||||
*/
|
||||
boolean isFix1_13FacePlayer();
|
||||
|
||||
boolean fix1_13FormattedInventoryTitle();
|
||||
|
||||
/**
|
||||
* Always shows the original mob's name instead of only when hovering over them with the cursor.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean alwaysShowOriginalMobName();
|
||||
|
||||
boolean handlePingsAsInvAcknowledgements();
|
||||
}
|
||||
@@ -43,6 +43,8 @@ import com.viaversion.viabackwards.protocol.protocol1_16_2to1_16_3.Protocol1_16_
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_3to1_16_4.Protocol1_16_3To1_16_4;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16to1_16_1.Protocol1_16To1_16_1;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.Protocol1_17To1_17_1;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.ProtocolManager;
|
||||
@@ -54,7 +56,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public interface ViaBackwardsPlatform {
|
||||
|
||||
String MINIMUM_VV_VERSION = "4.0.0";
|
||||
String MINIMUM_VV_VERSION = "4.1.0";
|
||||
String IMPL_VERSION = "$IMPL_VERSION";
|
||||
|
||||
/**
|
||||
@@ -104,6 +106,8 @@ public interface ViaBackwardsPlatform {
|
||||
protocolManager.registerProtocol(new Protocol1_16_3To1_16_4(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_4);
|
||||
|
||||
protocolManager.registerProtocol(new Protocol1_16_4To1_17(), ProtocolVersion.v1_16_4, ProtocolVersion.v1_17);
|
||||
protocolManager.registerProtocol(new Protocol1_17To1_17_1(), ProtocolVersion.v1_17, ProtocolVersion.v1_17_1);
|
||||
protocolManager.registerProtocol(new Protocol1_17_1To1_18(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_18);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
private final Class<? extends Protocol> vvProtocolClass;
|
||||
private Int2ObjectMap<MappedItem> backwardsItemMappings;
|
||||
private Map<String, String> backwardsSoundMappings;
|
||||
private Map<String, String> entityNames;
|
||||
|
||||
public BackwardsMappings(String oldVersion, String newVersion, @Nullable Class<? extends Protocol> vvProtocolClass) {
|
||||
this(oldVersion, newVersion, vvProtocolClass, false);
|
||||
@@ -60,7 +61,12 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
|
||||
JsonObject diffSounds = diffMappings.getAsJsonObject("sounds");
|
||||
if (diffSounds != null) {
|
||||
backwardsSoundMappings = VBMappingDataLoader.objectToMap(diffSounds);
|
||||
backwardsSoundMappings = VBMappingDataLoader.objectToNamespacedMap(diffSounds);
|
||||
}
|
||||
|
||||
JsonObject diffEntityNames = diffMappings.getAsJsonObject("entitynames");
|
||||
if (diffEntityNames != null) {
|
||||
entityNames = VBMappingDataLoader.objectToMap(diffEntityNames);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +83,8 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
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));
|
||||
return VBMappings.vbBuilder().unmapped(oldMappings.getAsJsonArray(key)).mapped(newMappings.getAsJsonArray(key))
|
||||
.diffMappings(diff).warnOnMissing(shouldWarnOnMissing(key)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +92,8 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
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));
|
||||
return VBMappings.vbBuilder().unmapped(oldMappings.getAsJsonObject(key)).mapped(newMappings.getAsJsonObject(key))
|
||||
.diffMappings(diff).warnOnMissing(shouldWarnOnMissing(key)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,7 +142,7 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
}
|
||||
|
||||
public @Nullable String getMappedNamedSound(String id) {
|
||||
if (backwardsItemMappings == null) {
|
||||
if (backwardsSoundMappings == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -145,6 +153,10 @@ public class BackwardsMappings extends MappingDataBase {
|
||||
return backwardsSoundMappings.get(id);
|
||||
}
|
||||
|
||||
public @Nullable String mappedEntityName(String entityName) {
|
||||
return entityNames.get(entityName);
|
||||
}
|
||||
|
||||
public @Nullable Int2ObjectMap<MappedItem> getBackwardsItemMappings() {
|
||||
return backwardsItemMappings;
|
||||
}
|
||||
|
||||
+11
-11
@@ -38,7 +38,7 @@ import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VBMappingDataLoader {
|
||||
public final class VBMappingDataLoader {
|
||||
|
||||
public static JsonObject loadFromDataDir(String name) {
|
||||
File file = new File(ViaBackwards.getPlatform().getDataFolder(), name);
|
||||
@@ -68,12 +68,8 @@ public class VBMappingDataLoader {
|
||||
}
|
||||
}
|
||||
|
||||
public static void mapIdentifiers(int[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers, JsonObject diffIdentifiers) {
|
||||
mapIdentifiers(output, oldIdentifiers, newIdentifiers, diffIdentifiers, true);
|
||||
}
|
||||
|
||||
public static void mapIdentifiers(int[] output, JsonObject oldIdentifiers, JsonObject newIdentifiers, JsonObject diffIdentifiers, boolean warnOnMissing) {
|
||||
Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers);
|
||||
Object2IntMap<String> newIdentifierMap = MappingDataLoader.indexedObjectToMap(newIdentifiers);
|
||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||
String key = entry.getValue().getAsString();
|
||||
int mappedId = newIdentifierMap.getInt(key);
|
||||
@@ -113,8 +109,8 @@ public class VBMappingDataLoader {
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, String> objectToMap(JsonObject object) {
|
||||
Map<String, String> mappings = new HashMap<>();
|
||||
public static Map<String, String> objectToNamespacedMap(JsonObject object) {
|
||||
Map<String, String> mappings = new HashMap<>(object.size());
|
||||
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (key.indexOf(':') == -1) {
|
||||
@@ -129,12 +125,16 @@ public class VBMappingDataLoader {
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MappedItem> loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
||||
return loadItemMappings(oldMapping, newMapping, diffMapping, false);
|
||||
public static Map<String, String> objectToMap(JsonObject object) {
|
||||
Map<String, String> mappings = new HashMap<>(object.size());
|
||||
for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
mappings.put(entry.getKey(), entry.getValue().getAsString());
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<MappedItem> loadItemMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
Int2ObjectMap<MappedItem> itemMapping = new Int2ObjectOpenHashMap<>(diffMapping.size(), 1F);
|
||||
Int2ObjectMap<MappedItem> itemMapping = new Int2ObjectOpenHashMap<>(diffMapping.size(), 0.99F);
|
||||
Object2IntMap<String> newIdenfierMap = MappingDataLoader.indexedObjectToMap(newMapping);
|
||||
Object2IntMap<String> oldIdenfierMap = MappingDataLoader.indexedObjectToMap(oldMapping);
|
||||
for (Map.Entry<String, JsonElement> entry : diffMapping.entrySet()) {
|
||||
|
||||
@@ -18,33 +18,47 @@
|
||||
package com.viaversion.viabackwards.api.data;
|
||||
|
||||
import com.viaversion.viaversion.api.data.IntArrayMappings;
|
||||
import com.viaversion.viaversion.libs.gson.JsonArray;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.api.data.MappingDataLoader;
|
||||
import com.viaversion.viaversion.api.data.Mappings;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class VBMappings extends IntArrayMappings {
|
||||
public final class VBMappings extends IntArrayMappings {
|
||||
|
||||
public VBMappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
super(create(size, oldMapping, newMapping, diffMapping, warnOnMissing));
|
||||
private VBMappings(final int[] oldToNew, final int mappedIds) {
|
||||
super(oldToNew, mappedIds);
|
||||
}
|
||||
|
||||
public VBMappings(JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
super(create(oldMapping.entrySet().size(), oldMapping, newMapping, diffMapping, warnOnMissing));
|
||||
public static Mappings.Builder<VBMappings> vbBuilder() {
|
||||
return new Builder(VBMappings::new);
|
||||
}
|
||||
|
||||
public VBMappings(JsonObject oldMapping, JsonObject newMapping, boolean warnOnMissing) {
|
||||
this(oldMapping, newMapping, null, warnOnMissing);
|
||||
}
|
||||
public static final class Builder extends Mappings.Builder<VBMappings> {
|
||||
|
||||
public VBMappings(JsonArray oldMapping, JsonArray newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
super(oldMapping.size(), oldMapping, newMapping, diffMapping, warnOnMissing);
|
||||
}
|
||||
private Builder(final MappingsSupplier<VBMappings> supplier) {
|
||||
super(supplier);
|
||||
}
|
||||
|
||||
private static int[] create(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping, boolean warnOnMissing) {
|
||||
int[] oldToNew = new int[size];
|
||||
Arrays.fill(oldToNew, -1);
|
||||
VBMappingDataLoader.mapIdentifiers(oldToNew, oldMapping, newMapping, diffMapping, warnOnMissing);
|
||||
return oldToNew;
|
||||
@Override
|
||||
public VBMappings build() {
|
||||
final int size = this.size != -1 ? this.size : size(unmapped);
|
||||
final int mappedSize = this.mappedSize != -1 ? this.mappedSize : size(mapped);
|
||||
final int[] mappings = new int[size];
|
||||
Arrays.fill(mappings, -1);
|
||||
// Do conversion if one is an array and the other an object, otherwise directly map
|
||||
if (unmapped.isJsonArray()) {
|
||||
if (mapped.isJsonObject()) {
|
||||
VBMappingDataLoader.mapIdentifiers(mappings, toJsonObject(unmapped.getAsJsonArray()), mapped.getAsJsonObject(), diffMappings, warnOnMissing);
|
||||
} else {
|
||||
// Use the normal loader
|
||||
MappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonArray(), mapped.getAsJsonArray(), diffMappings, warnOnMissing);
|
||||
}
|
||||
} else if (mapped.isJsonArray()) {
|
||||
VBMappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonObject(), toJsonObject(mapped.getAsJsonArray()), diffMappings, warnOnMissing);
|
||||
} else {
|
||||
VBMappingDataLoader.mapIdentifiers(mappings, unmapped.getAsJsonObject(), mapped.getAsJsonObject(), diffMappings, warnOnMissing);
|
||||
}
|
||||
return supplier.supply(mappings, mappedSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
-10
@@ -18,27 +18,40 @@
|
||||
|
||||
package com.viaversion.viabackwards.api.entities.storage;
|
||||
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class EntityData {
|
||||
private final BackwardsProtocol<?, ?, ?, ?> protocol;
|
||||
private final int id;
|
||||
private final int replacementId;
|
||||
private Object mobName;
|
||||
private final String key;
|
||||
private NameVisibility nameVisibility = NameVisibility.NONE;
|
||||
private MetaCreator defaultMeta;
|
||||
|
||||
public EntityData(int id, int replacementId) {
|
||||
this.id = id;
|
||||
this.replacementId = replacementId;
|
||||
public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, EntityType type, int replacementId) {
|
||||
this(protocol, type.name(), type.getId(), replacementId);
|
||||
}
|
||||
|
||||
public EntityData jsonName(String name) {
|
||||
this.mobName = ChatRewriter.legacyTextToJson(name);
|
||||
public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, String key, int id, int replacementId) {
|
||||
this.protocol = protocol;
|
||||
this.id = id;
|
||||
this.replacementId = replacementId;
|
||||
this.key = key.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public EntityData jsonName() {
|
||||
this.nameVisibility = NameVisibility.JSON;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityData mobName(String name) {
|
||||
this.mobName = name;
|
||||
public EntityData plainName() {
|
||||
this.nameVisibility = NameVisibility.PLAIN;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -59,7 +72,16 @@ public class EntityData {
|
||||
* @return custom mobname, can be either a String or a JsonElement
|
||||
*/
|
||||
public @Nullable Object mobName() {
|
||||
return mobName;
|
||||
if (nameVisibility == NameVisibility.NONE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String name = protocol.getMappingData().mappedEntityName(key);
|
||||
if (name == null) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Entity name for " + key + " not found in protocol " + protocol.getClass().getSimpleName());
|
||||
name = key;
|
||||
}
|
||||
return nameVisibility == NameVisibility.JSON ? ChatRewriter.legacyTextToJson(name) : name;
|
||||
}
|
||||
|
||||
public int replacementId() {
|
||||
@@ -82,7 +104,7 @@ public class EntityData {
|
||||
public String toString() {
|
||||
return "EntityData{" +
|
||||
"id=" + id +
|
||||
", mobName='" + mobName + '\'' +
|
||||
", mobName='" + key + '\'' +
|
||||
", replacementId=" + replacementId +
|
||||
", defaultMeta=" + defaultMeta +
|
||||
'}';
|
||||
@@ -93,4 +115,10 @@ public class EntityData {
|
||||
|
||||
void createMeta(WrappedMetadata storage);
|
||||
}
|
||||
|
||||
private enum NameVisibility {
|
||||
PLAIN,
|
||||
JSON,
|
||||
NONE
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -17,19 +17,19 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.api.entities.storage;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
|
||||
public class EntityObjectData extends EntityData {
|
||||
private final boolean isObject;
|
||||
private final int objectData;
|
||||
|
||||
public EntityObjectData(int id, boolean isObject, int replacementId, int objectData) {
|
||||
super(id, replacementId);
|
||||
this.isObject = isObject;
|
||||
public EntityObjectData(BackwardsProtocol<?, ?, ?, ?> protocol, String key, int id, int replacementId, int objectData) {
|
||||
super(protocol, key, id, replacementId);
|
||||
this.objectData = objectData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObjectType() {
|
||||
return isObject;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-5
@@ -63,14 +63,19 @@ public class EntityPositionHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPositionStorage positionStorage = create ? storageSupplier.get() : storedEntity.get(storageClass);
|
||||
if (positionStorage == null) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Stored entity with id " + entityId + " missing " + storageClass.getSimpleName());
|
||||
return;
|
||||
EntityPositionStorage positionStorage;
|
||||
if (create) {
|
||||
positionStorage = storageSupplier.get();
|
||||
storedEntity.put(positionStorage);
|
||||
} else {
|
||||
positionStorage = storedEntity.get(storageClass);
|
||||
if (positionStorage == null) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Stored entity with id " + entityId + " missing " + storageClass.getSimpleName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
positionStorage.setCoordinates(x, y, z, relative);
|
||||
storedEntity.put(positionStorage);
|
||||
}
|
||||
|
||||
public EntityPositionStorage getStorage(UserConnection user, int entityId) {
|
||||
|
||||
+3
-3
@@ -87,10 +87,10 @@ public class EnchantmentRewriter {
|
||||
Iterator<Tag> iterator = enchantments.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
CompoundTag enchantmentEntry = (CompoundTag) iterator.next();
|
||||
StringTag idTag = enchantmentEntry.get("id");
|
||||
if (idTag == null) continue;
|
||||
Tag idTag = enchantmentEntry.get("id");
|
||||
if (!(idTag instanceof StringTag)) continue;
|
||||
|
||||
String enchantmentId = idTag.getValue();
|
||||
String enchantmentId = ((StringTag) idTag).getValue();
|
||||
String remappedName = enchantmentMappings.get(enchantmentId);
|
||||
if (remappedName != null) {
|
||||
if (!changed) {
|
||||
|
||||
@@ -20,17 +20,17 @@ package com.viaversion.viabackwards.api.rewriters;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
|
||||
public abstract class EntityRewriter<T extends BackwardsProtocol> extends EntityRewriterBase<T> {
|
||||
|
||||
protected EntityRewriter(T protocol) {
|
||||
this(protocol, MetaType1_14.OptChat, MetaType1_14.Boolean);
|
||||
this(protocol, Types1_14.META_TYPES.optionalComponentType, Types1_14.META_TYPES.booleanType);
|
||||
}
|
||||
|
||||
protected EntityRewriter(T protocol, MetaType displayType, MetaType displayVisibilityType) {
|
||||
|
||||
+17
-12
@@ -52,6 +52,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
private final MetaType displayVisibilityMetaType;
|
||||
private final int displayNameIndex;
|
||||
private final int displayVisibilityIndex;
|
||||
protected boolean allowNullEntityType;
|
||||
|
||||
EntityRewriterBase(T protocol, MetaType displayNameMetaType, int displayNameIndex,
|
||||
MetaType displayVisibilityMetaType, int displayVisibilityIndex) {
|
||||
@@ -64,10 +65,16 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
|
||||
@Override
|
||||
public void handleMetadata(int entityId, List<Metadata> metadataList, UserConnection connection) {
|
||||
EntityType type = tracker(connection).entityType(entityId);
|
||||
if (type == null && !allowNullEntityType) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.handleMetadata(entityId, metadataList, connection);
|
||||
|
||||
EntityType type = tracker(connection).entityType(entityId);
|
||||
if (type == null) return;
|
||||
if (type == null) {
|
||||
return; // Don't handle untracked entities - basically always the fault of a plugin sending virtual entities through concurrency-unsafe handling
|
||||
}
|
||||
|
||||
EntityData entityData = entityDataForType(type);
|
||||
|
||||
@@ -84,11 +91,9 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
}
|
||||
|
||||
// Add any other extra meta for mapped entities
|
||||
if (entityData != null) {
|
||||
//TODO only do this once for a first meta packet?
|
||||
if (entityData != null && entityData.hasBaseMeta()) {
|
||||
entityData.defaultMeta().createMeta(new WrappedMetadata(metadataList));
|
||||
}
|
||||
//TODO only do this once for a first meta packet?
|
||||
if (entityData != null && entityData.hasBaseMeta()) {
|
||||
entityData.defaultMeta().createMeta(new WrappedMetadata(metadataList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +136,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
|
||||
// Already rewrite the id here
|
||||
int mappedReplacementId = newEntityId(mappedType.getId());
|
||||
EntityData data = new EntityData(type.getId(), mappedReplacementId);
|
||||
EntityData data = new EntityData(protocol, type, mappedReplacementId);
|
||||
mapEntityType(type.getId(), mappedReplacementId);
|
||||
entityDataMappings.put(type.getId(), data);
|
||||
return data;
|
||||
@@ -147,7 +152,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
@Override
|
||||
public <E extends Enum<E> & EntityType> void mapTypes(EntityType[] oldTypes, Class<E> newTypeClass) {
|
||||
if (typeMappings == null) {
|
||||
typeMappings = new Int2IntOpenHashMap(oldTypes.length, 1F);
|
||||
typeMappings = new Int2IntOpenHashMap(oldTypes.length, 0.99F);
|
||||
typeMappings.defaultReturnValue(-1);
|
||||
}
|
||||
for (EntityType oldType : oldTypes) {
|
||||
@@ -180,9 +185,9 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
}
|
||||
|
||||
// ONLY TRACKS, DOESN'T REWRITE IDS
|
||||
protected PacketHandler getTrackerHandler(Type intType, int typeIndex) {
|
||||
protected PacketHandler getTrackerHandler(Type<? extends Number> intType, int typeIndex) {
|
||||
return wrapper -> {
|
||||
Number id = (Number) wrapper.get(intType, typeIndex);
|
||||
Number id = wrapper.get(intType, typeIndex);
|
||||
tracker(wrapper.user()).addEntity(wrapper.get(Type.VAR_INT, 0), typeFromId(id.intValue()));
|
||||
};
|
||||
}
|
||||
@@ -191,7 +196,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends En
|
||||
return getTrackerHandler(Type.VAR_INT, 1);
|
||||
}
|
||||
|
||||
protected PacketHandler getTrackerHandler(EntityType entityType, Type intType) {
|
||||
protected PacketHandler getTrackerHandler(EntityType entityType, Type<? extends Number> intType) {
|
||||
return wrapper -> tracker(wrapper.user()).addEntity((int) wrapper.get(intType, 0), entityType);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -174,6 +174,8 @@ public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> exten
|
||||
tags.put(pos, tag);
|
||||
|
||||
// Handle given Block Entities
|
||||
if (pos.getY() < 0 || pos.getY() > 255) continue; // 1.17
|
||||
|
||||
ChunkSection section = chunk.getSections()[pos.getY() >> 4];
|
||||
if (section == null) continue;
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
}
|
||||
|
||||
protected EntityObjectData mapObjectType(ObjectType oldObjectType, ObjectType replacement, int data) {
|
||||
EntityObjectData entData = new EntityObjectData(oldObjectType.getId(), true, replacement.getId(), data);
|
||||
EntityObjectData entData = new EntityObjectData(protocol, oldObjectType.getType().name(), oldObjectType.getId(), replacement.getId(), data);
|
||||
objectTypes.put(oldObjectType, entData);
|
||||
return entData;
|
||||
}
|
||||
|
||||
+11
@@ -123,6 +123,17 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerCombatKill(ClientboundPacketType packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.INT);
|
||||
handler(wrapper -> processText(wrapper.passthrough(Type.COMPONENT)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleTranslate(JsonObject root, String translate) {
|
||||
String newTranslate = newTranslatables.get(translate);
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
|
||||
public class PotionSplashHandler {
|
||||
|
||||
private static final Int2IntMap DATA = new Int2IntOpenHashMap(14, 1F);
|
||||
private static final Int2IntMap DATA = new Int2IntOpenHashMap(14, 0.99F);
|
||||
|
||||
static {
|
||||
DATA.defaultReturnValue(-1);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
||||
protocol.registerClientbound(ClientboundPackets1_9_3.SET_SLOT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE); // 0 - Window ID
|
||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||
map(Type.SHORT); // 1 - Slot ID
|
||||
map(Type.ITEM); // 2 - Slot Value
|
||||
|
||||
|
||||
+7
-7
@@ -215,10 +215,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
||||
// Guardian
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.ELDER_GUARDIAN, Entity1_11Types.EntityType.GUARDIAN);
|
||||
// Skeletons
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.WITHER_SKELETON, Entity1_11Types.EntityType.SKELETON).mobName("Wither Skeleton").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(1)));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.STRAY, Entity1_11Types.EntityType.SKELETON).mobName("Stray").spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2)));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.WITHER_SKELETON, Entity1_11Types.EntityType.SKELETON).plainName().spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(1)));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.STRAY, Entity1_11Types.EntityType.SKELETON).plainName().spawnMetadata(storage -> storage.add(getSkeletonTypeMeta(2)));
|
||||
// Zombies
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.HUSK, Entity1_11Types.EntityType.ZOMBIE).mobName("Husk").spawnMetadata(storage -> handleZombieType(storage, 6));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.HUSK, Entity1_11Types.EntityType.ZOMBIE).plainName().spawnMetadata(storage -> handleZombieType(storage, 6));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_VILLAGER, Entity1_11Types.EntityType.ZOMBIE).spawnMetadata(storage -> handleZombieType(storage, 1));
|
||||
// Horses
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(0))); // Nob able to ride the horse without having the MetaType sent.
|
||||
@@ -228,10 +228,10 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.ZOMBIE_HORSE, Entity1_11Types.EntityType.HORSE).spawnMetadata(storage -> storage.add(getHorseMetaType(3)));
|
||||
// New mobs
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_FANGS, Entity1_11Types.EntityType.SHULKER);
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).mobName("Evoker");
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).mobName("Vex");
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.VINDICATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).mobName("Vindicator").spawnMetadata(storage -> storage.add(new Metadata(13, MetaType1_9.VarInt, 4))); // Base Profession
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA, Entity1_11Types.EntityType.HORSE).mobName("Llama").spawnMetadata(storage -> storage.add(getHorseMetaType(1)));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.EVOCATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).plainName();
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.VEX, Entity1_11Types.EntityType.BAT).plainName();
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.VINDICATION_ILLAGER, Entity1_11Types.EntityType.VILLAGER).plainName().spawnMetadata(storage -> storage.add(new Metadata(13, MetaType1_9.VarInt, 4))); // Base Profession
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA, Entity1_11Types.EntityType.HORSE).plainName().spawnMetadata(storage -> storage.add(getHorseMetaType(1)));
|
||||
mapEntityTypeWithData(Entity1_11Types.EntityType.LIAMA_SPIT, Entity1_11Types.EntityType.SNOWBALL);
|
||||
|
||||
mapObjectType(Entity1_11Types.ObjectType.LIAMA_SPIT, Entity1_11Types.ObjectType.SNOWBALL, -1);
|
||||
|
||||
+17
@@ -19,6 +19,7 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_11_1to1_12;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.BlockItemPackets1_12;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets.ChatPackets1_12;
|
||||
@@ -39,6 +40,12 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||
|
||||
public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
|
||||
|
||||
private static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.12", "1.11", null, true) {
|
||||
@Override
|
||||
protected boolean shouldWarnOnMissing(final String key) {
|
||||
return super.shouldWarnOnMissing(key) && !key.equals("sounds");
|
||||
}
|
||||
};
|
||||
private final EntityPackets1_12 entityPackets = new EntityPackets1_12(this);
|
||||
private final BlockItemPackets1_12 blockItemPackets = new BlockItemPackets1_12(this);
|
||||
|
||||
@@ -83,6 +90,11 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
|
||||
user.put(new ShoulderTracker(user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets1_12 getEntityRewriter() {
|
||||
return entityPackets;
|
||||
@@ -92,4 +104,9 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BlockItemPackets1_12 getItemRewriter() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMappingDataToLoad() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
|
||||
public class MapColorMapping {
|
||||
private static final Int2IntMap MAPPING = new Int2IntOpenHashMap(64, 1F);
|
||||
private static final Int2IntMap MAPPING = new Int2IntOpenHashMap(64, 0.99F);
|
||||
|
||||
static {
|
||||
MAPPING.defaultReturnValue(-1);
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
||||
|
||||
// Apologize (may happen in some cases, maybe if inventory is full?)
|
||||
PacketWrapper confirm = wrapper.create(ServerboundPackets1_12.WINDOW_CONFIRMATION);
|
||||
confirm.write(Type.BYTE, wrapper.get(Type.UNSIGNED_BYTE, 0).byteValue());
|
||||
confirm.write(Type.UNSIGNED_BYTE, wrapper.get(Type.UNSIGNED_BYTE, 0));
|
||||
confirm.write(Type.SHORT, wrapper.get(Type.SHORT, 1));
|
||||
confirm.write(Type.BOOLEAN, false); // Success - not used
|
||||
|
||||
|
||||
+2
-2
@@ -212,8 +212,8 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
mapEntityTypeWithData(Entity1_12Types.EntityType.PARROT, Entity1_12Types.EntityType.BAT).mobName("Parrot").spawnMetadata(storage -> storage.add(new Metadata(12, MetaType1_12.Byte, (byte) 0x00)));
|
||||
mapEntityTypeWithData(Entity1_12Types.EntityType.ILLUSION_ILLAGER, Entity1_12Types.EntityType.EVOCATION_ILLAGER).mobName("Illusioner");
|
||||
mapEntityTypeWithData(Entity1_12Types.EntityType.PARROT, Entity1_12Types.EntityType.BAT).plainName().spawnMetadata(storage -> storage.add(new Metadata(12, MetaType1_12.Byte, (byte) 0x00)));
|
||||
mapEntityTypeWithData(Entity1_12Types.EntityType.ILLUSION_ILLAGER, Entity1_12Types.EntityType.EVOCATION_ILLAGER).plainName();
|
||||
|
||||
// Handle Illager
|
||||
filter().filterFamily(Entity1_12Types.EntityType.EVOCATION_ILLAGER).cancel(12);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import com.viaversion.viaversion.util.Pair;
|
||||
|
||||
public class FlowerPotHandler implements BackwardsBlockEntityProvider.BackwardsBlockEntityHandler {
|
||||
|
||||
private static final Int2ObjectMap<Pair<String, Byte>> FLOWERS = new Int2ObjectOpenHashMap<>(22, 1F);
|
||||
private static final Int2ObjectMap<Pair<String, Byte>> FLOWERS = new Int2ObjectOpenHashMap<>(22, 0.99F);
|
||||
private static final Pair<String, Byte> AIR = new Pair<>("minecraft:air", (byte) 0);
|
||||
|
||||
static {
|
||||
|
||||
+4
-3
@@ -49,7 +49,8 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back
|
||||
|
||||
@Override
|
||||
public void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
|
||||
enchantmentMappings = new VBMappings(oldMappings.getAsJsonObject("enchantments"), newMappings.getAsJsonObject("enchantments"), false);
|
||||
enchantmentMappings = VBMappings.vbBuilder().warnOnMissing(false)
|
||||
.unmapped(oldMappings.getAsJsonObject("enchantments")).mapped(newMappings.getAsJsonObject("enchantments")).build();
|
||||
for (Map.Entry<String, Integer> entry : StatisticMappings.CUSTOM_STATS.entrySet()) {
|
||||
statisticMappings.put(entry.getValue().intValue(), entry.getKey());
|
||||
}
|
||||
@@ -60,7 +61,7 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back
|
||||
|
||||
// Has lots of compat layers, so we can't use the default Via method
|
||||
private static void mapIdentifiers(int[] output, JsonObject newIdentifiers, JsonObject oldIdentifiers, JsonObject mapping) {
|
||||
Object2IntMap newIdentifierMap = MappingDataLoader.indexedObjectToMap(oldIdentifiers);
|
||||
Object2IntMap<String> newIdentifierMap = MappingDataLoader.indexedObjectToMap(oldIdentifiers);
|
||||
for (Map.Entry<String, JsonElement> entry : newIdentifiers.entrySet()) {
|
||||
String key = entry.getValue().getAsString();
|
||||
int value = newIdentifierMap.getInt(key);
|
||||
@@ -101,7 +102,7 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back
|
||||
int[] oldToNew = new int[8582];
|
||||
Arrays.fill(oldToNew, -1);
|
||||
mapIdentifiers(oldToNew, oldMappings.getAsJsonObject("blockstates"), newMappings.getAsJsonObject("blocks"), diffMappings.getAsJsonObject("blockstates"));
|
||||
return new IntArrayMappings(oldToNew);
|
||||
return IntArrayMappings.of(oldToNew, -1);
|
||||
} else {
|
||||
return super.loadFromObject(oldMappings, newMappings, diffMappings, key);
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class PaintingMapping {
|
||||
private static final Int2ObjectMap<String> PAINTINGS = new Int2ObjectOpenHashMap<>(26, 1F);
|
||||
private static final Int2ObjectMap<String> PAINTINGS = new Int2ObjectOpenHashMap<>(26, 0.99F);
|
||||
|
||||
public static void init() {
|
||||
add("Kebab");
|
||||
|
||||
+6
-1
@@ -271,7 +271,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
|
||||
protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE);
|
||||
map(Type.UNSIGNED_BYTE);
|
||||
map(Type.SHORT);
|
||||
map(Type.FLAT_ITEM, Type.ITEM);
|
||||
|
||||
@@ -302,6 +302,11 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
|
||||
if (!provider.isHandled(id)) continue;
|
||||
|
||||
int sectionIndex = ((NumberTag) tag.get("y")).asInt() >> 4;
|
||||
if (sectionIndex < 0 || sectionIndex > 15) {
|
||||
// 1.17 chunks
|
||||
continue;
|
||||
}
|
||||
|
||||
ChunkSection section = chunk.getSections()[sectionIndex];
|
||||
|
||||
int x = ((NumberTag) tag.get("x")).asInt();
|
||||
|
||||
+8
-9
@@ -281,25 +281,25 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
// Rewrite new Entity 'drowned'
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.DROWNED, Entity1_13Types.EntityType.ZOMBIE_VILLAGER).mobName("Drowned");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.DROWNED, Entity1_13Types.EntityType.ZOMBIE_VILLAGER).plainName();
|
||||
|
||||
// Fishy
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.COD, Entity1_13Types.EntityType.SQUID).mobName("Cod");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.SALMON, Entity1_13Types.EntityType.SQUID).mobName("Salmon");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.PUFFERFISH, Entity1_13Types.EntityType.SQUID).mobName("Puffer Fish");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.TROPICAL_FISH, Entity1_13Types.EntityType.SQUID).mobName("Tropical Fish");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.COD, Entity1_13Types.EntityType.SQUID).plainName();
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.SALMON, Entity1_13Types.EntityType.SQUID).plainName();
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.PUFFERFISH, Entity1_13Types.EntityType.SQUID).plainName();
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.TROPICAL_FISH, Entity1_13Types.EntityType.SQUID).plainName();
|
||||
|
||||
// Phantom
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.PHANTOM, Entity1_13Types.EntityType.PARROT).mobName("Phantom").spawnMetadata(storage -> {
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.PHANTOM, Entity1_13Types.EntityType.PARROT).plainName().spawnMetadata(storage -> {
|
||||
// The phantom is grey/blue so let's do yellow/blue
|
||||
storage.add(new Metadata(15, MetaType1_12.VarInt, 3));
|
||||
});
|
||||
|
||||
// Dolphin
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).mobName("Dolphin");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.DOLPHIN, Entity1_13Types.EntityType.SQUID).plainName();
|
||||
|
||||
// Turtle
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.TURTLE, Entity1_13Types.EntityType.OCELOT).mobName("Turtle");
|
||||
mapEntityTypeWithData(Entity1_13Types.EntityType.TURTLE, Entity1_13Types.EntityType.OCELOT).plainName();
|
||||
|
||||
// Rewrite Meta types
|
||||
filter().handler((event, meta) -> {
|
||||
@@ -328,7 +328,6 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
||||
typeId - 1
|
||||
));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Rewrite Custom Name from Chat to String
|
||||
|
||||
+23
-19
@@ -187,7 +187,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
UUID uuid = packetWrapper.passthrough(Type.UUID);
|
||||
if (action == 0) { // Add
|
||||
String name = packetWrapper.passthrough(Type.STRING);
|
||||
storage.usernames.put(uuid, name);
|
||||
storage.usernames().put(uuid, name);
|
||||
int nProperties = packetWrapper.passthrough(Type.VAR_INT);
|
||||
for (int j = 0; j < nProperties; j++) {
|
||||
packetWrapper.passthrough(Type.STRING);
|
||||
@@ -210,7 +210,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
packetWrapper.passthrough(Type.COMPONENT);
|
||||
}
|
||||
} else if (action == 4) { // Remove Player
|
||||
storage.usernames.remove(uuid);
|
||||
storage.usernames().remove(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,11 +313,12 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
|
||||
TabCompleteStorage storage = wrapper.user().get(TabCompleteStorage.class);
|
||||
|
||||
if (!storage.commands.isEmpty()) {
|
||||
storage.commands.clear();
|
||||
if (!storage.commands().isEmpty()) {
|
||||
storage.commands().clear();
|
||||
}
|
||||
|
||||
int size = wrapper.read(Type.VAR_INT);
|
||||
boolean initialNodes = true;
|
||||
for (int i = 0; i < size; i++) {
|
||||
byte flags = wrapper.read(Type.BYTE);
|
||||
wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE); // Children indices
|
||||
@@ -326,11 +327,14 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
}
|
||||
|
||||
byte nodeType = (byte) (flags & 0x03);
|
||||
if (initialNodes && nodeType == 2) {
|
||||
initialNodes = false;
|
||||
}
|
||||
|
||||
if (nodeType == 1 || nodeType == 2) { // Literal/argument node
|
||||
String name = wrapper.read(Type.STRING);
|
||||
|
||||
if (nodeType == 1) {
|
||||
storage.commands.add('/' + name);
|
||||
if (nodeType == 1 && initialNodes) {
|
||||
storage.commands().add('/' + name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,25 +357,25 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
TabCompleteStorage storage = wrapper.user().get(TabCompleteStorage.class);
|
||||
if (storage.lastRequest == null) {
|
||||
if (storage.lastRequest() == null) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
if (storage.lastId != wrapper.read(Type.VAR_INT)) wrapper.cancel();
|
||||
if (storage.lastId() != wrapper.read(Type.VAR_INT)) wrapper.cancel();
|
||||
int start = wrapper.read(Type.VAR_INT);
|
||||
int length = wrapper.read(Type.VAR_INT);
|
||||
|
||||
int lastRequestPartIndex = storage.lastRequest.lastIndexOf(' ') + 1;
|
||||
int lastRequestPartIndex = storage.lastRequest().lastIndexOf(' ') + 1;
|
||||
if (lastRequestPartIndex != start) wrapper.cancel(); // Client only replaces after space
|
||||
|
||||
if (length != storage.lastRequest.length() - lastRequestPartIndex) {
|
||||
if (length != storage.lastRequest().length() - lastRequestPartIndex) {
|
||||
wrapper.cancel(); // We can't set the length in previous versions
|
||||
}
|
||||
|
||||
int count = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < count; i++) {
|
||||
String match = wrapper.read(Type.STRING);
|
||||
wrapper.write(Type.STRING, (start == 0 && !storage.lastAssumeCommand ? "/" : "") + match);
|
||||
wrapper.write(Type.STRING, (start == 0 && !storage.isLastAssumeCommand() ? "/" : "") + match);
|
||||
// Ignore tooltip
|
||||
if (wrapper.read(Type.BOOLEAN)) {
|
||||
wrapper.read(Type.STRING);
|
||||
@@ -396,14 +400,14 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
if (!assumeCommand && !command.startsWith("/")) {
|
||||
// Complete usernames for non-commands
|
||||
String buffer = command.substring(command.lastIndexOf(' ') + 1);
|
||||
for (String value : storage.usernames.values()) {
|
||||
for (String value : storage.usernames().values()) {
|
||||
if (startsWithIgnoreCase(value, buffer)) {
|
||||
suggestions.add(value);
|
||||
}
|
||||
}
|
||||
} else if (!storage.commands.isEmpty() && !command.contains(" ")) {
|
||||
} else if (!storage.commands().isEmpty() && !command.contains(" ")) {
|
||||
// Complete commands names with values from 'Declare Commands' packet
|
||||
for (String value : storage.commands) {
|
||||
for (String value : storage.commands()) {
|
||||
if (startsWithIgnoreCase(value, command)) {
|
||||
suggestions.add(value);
|
||||
}
|
||||
@@ -418,7 +422,7 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
response.write(Type.STRING, value);
|
||||
}
|
||||
response.scheduleSend(Protocol1_12_2To1_13.class);
|
||||
storage.lastRequest = null;
|
||||
storage.setLastRequest(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -430,9 +434,9 @@ public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
wrapper.write(Type.VAR_INT, id);
|
||||
wrapper.write(Type.STRING, command);
|
||||
|
||||
storage.lastId = id;
|
||||
storage.lastAssumeCommand = assumeCommand;
|
||||
storage.lastRequest = command;
|
||||
storage.setLastId(id);
|
||||
storage.setLastAssumeCommand(assumeCommand);
|
||||
storage.setLastRequest(command);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+37
-5
@@ -26,9 +26,41 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TabCompleteStorage implements StorableObject {
|
||||
public int lastId;
|
||||
public String lastRequest;
|
||||
public boolean lastAssumeCommand;
|
||||
public Map<UUID, String> usernames = new HashMap<>();
|
||||
public Set<String> commands = new HashSet<>();
|
||||
private final Map<UUID, String> usernames = new HashMap<>();
|
||||
private final Set<String> commands = new HashSet<>();
|
||||
private int lastId;
|
||||
private String lastRequest;
|
||||
private boolean lastAssumeCommand;
|
||||
|
||||
public Map<UUID, String> usernames() {
|
||||
return usernames;
|
||||
}
|
||||
|
||||
public Set<String> commands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public int lastId() {
|
||||
return lastId;
|
||||
}
|
||||
|
||||
public void setLastId(final int lastId) {
|
||||
this.lastId = lastId;
|
||||
}
|
||||
|
||||
public String lastRequest() {
|
||||
return lastRequest;
|
||||
}
|
||||
|
||||
public void setLastRequest(String lastRequest) {
|
||||
this.lastRequest = lastRequest;
|
||||
}
|
||||
|
||||
public boolean isLastAssumeCommand() {
|
||||
return lastAssumeCommand;
|
||||
}
|
||||
|
||||
public void setLastAssumeCommand(boolean lastAssumeCommand) {
|
||||
this.lastAssumeCommand = lastAssumeCommand;
|
||||
}
|
||||
}
|
||||
+3
-11
@@ -19,8 +19,6 @@ package com.viaversion.viabackwards.protocol.protocol1_13_1to1_13_2.packets;
|
||||
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13_1to1_13_2.Protocol1_13_1To1_13_2;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_13;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_13_2;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
@@ -54,9 +52,7 @@ public class EntityPackets1_13_2 {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
for (Metadata metadata : wrapper.get(Types1_13.METADATA_LIST, 0)) {
|
||||
if (metadata.metaType() == MetaType1_13_2.Slot) {
|
||||
metadata.setMetaType(MetaType1_13.Slot);
|
||||
}
|
||||
metadata.setMetaType(Types1_13.META_TYPES.byId(metadata.metaType().typeId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -79,9 +75,7 @@ public class EntityPackets1_13_2 {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
for (Metadata metadata : wrapper.get(Types1_13.METADATA_LIST, 0)) {
|
||||
if (metadata.metaType() == MetaType1_13_2.Slot) {
|
||||
metadata.setMetaType(MetaType1_13.Slot);
|
||||
}
|
||||
metadata.setMetaType(Types1_13.META_TYPES.byId(metadata.metaType().typeId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -98,9 +92,7 @@ public class EntityPackets1_13_2 {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
for (Metadata metadata : wrapper.get(Types1_13.METADATA_LIST, 0)) {
|
||||
if (metadata.metaType() == MetaType1_13_2.Slot) {
|
||||
metadata.setMetaType(MetaType1_13.Slot);
|
||||
}
|
||||
metadata.setMetaType(Types1_13.META_TYPES.byId(metadata.metaType().typeId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class InventoryPackets1_13_2 {
|
||||
protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE); // 0 - Window ID
|
||||
map(Type.UNSIGNED_BYTE); // 0 - Window ID
|
||||
map(Type.SHORT); // 1 - Slot ID
|
||||
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 2 - Slot Value
|
||||
}
|
||||
|
||||
+1
@@ -170,6 +170,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
||||
}
|
||||
|
||||
//TODO Soft memory leak: Don't store light if chunk is already loaded
|
||||
wrapper.user().get(ChunkLightStorage.class).setStoredLight(skyLight, blockLight, x, z);
|
||||
wrapper.cancel();
|
||||
}
|
||||
|
||||
+2
-2
@@ -33,12 +33,12 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_13_2;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_13;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_13_2;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
@@ -289,7 +289,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
|
||||
return;
|
||||
}
|
||||
List<Metadata> metadataList = new ArrayList<>();
|
||||
metadataList.add(new Metadata(16, MetaType1_13_2.VarInt, armorType));
|
||||
metadataList.add(new Metadata(16, Types1_13_2.META_TYPES.varIntType, armorType));
|
||||
wrapper.write(Types1_13.METADATA_LIST, metadataList);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-25
@@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_13_2;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
@@ -51,7 +50,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
private EntityPositionHandler positionHandler;
|
||||
|
||||
public EntityPackets1_14(Protocol1_13_2To1_14 protocol) {
|
||||
super(protocol, MetaType1_13_2.OptChat, MetaType1_13_2.Boolean);
|
||||
super(protocol, Types1_13_2.META_TYPES.optionalComponentType, Types1_13_2.META_TYPES.booleanType);
|
||||
}
|
||||
|
||||
//TODO work the method into this class alone
|
||||
@@ -318,6 +317,12 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Max Players
|
||||
wrapper.passthrough(Type.STRING); // Level Type
|
||||
wrapper.read(Type.VAR_INT); // Read View Distance
|
||||
|
||||
//TODO Track client position
|
||||
// Manually add position storage
|
||||
/*int entitiyId = wrapper.get(Type.INT, 0);
|
||||
StoredEntityData storedEntity = protocol.getEntityRewriter().tracker(wrapper.user()).entityData(entitiyId);
|
||||
storedEntity.put(new EntityPositionStorage1_14());*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -347,30 +352,29 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
protected void registerRewrites() {
|
||||
mapTypes(Entity1_14Types.values(), Entity1_13Types.EntityType.class);
|
||||
|
||||
mapEntityTypeWithData(Entity1_14Types.CAT, Entity1_14Types.OCELOT).jsonName("Cat");
|
||||
mapEntityTypeWithData(Entity1_14Types.TRADER_LLAMA, Entity1_14Types.LLAMA).jsonName("Trader Llama");
|
||||
mapEntityTypeWithData(Entity1_14Types.FOX, Entity1_14Types.WOLF).jsonName("Fox");
|
||||
mapEntityTypeWithData(Entity1_14Types.PANDA, Entity1_14Types.POLAR_BEAR).jsonName("Panda");
|
||||
mapEntityTypeWithData(Entity1_14Types.PILLAGER, Entity1_14Types.VILLAGER).jsonName("Pillager");
|
||||
mapEntityTypeWithData(Entity1_14Types.WANDERING_TRADER, Entity1_14Types.VILLAGER).jsonName("Wandering Trader");
|
||||
mapEntityTypeWithData(Entity1_14Types.RAVAGER, Entity1_14Types.COW).jsonName("Ravager");
|
||||
mapEntityTypeWithData(Entity1_14Types.CAT, Entity1_14Types.OCELOT).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.TRADER_LLAMA, Entity1_14Types.LLAMA).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.FOX, Entity1_14Types.WOLF).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.PANDA, Entity1_14Types.POLAR_BEAR).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.PILLAGER, Entity1_14Types.VILLAGER).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.WANDERING_TRADER, Entity1_14Types.VILLAGER).jsonName();
|
||||
mapEntityTypeWithData(Entity1_14Types.RAVAGER, Entity1_14Types.COW).jsonName();
|
||||
|
||||
filter().handler((event, meta) -> {
|
||||
int typeId = meta.metaType().typeId();
|
||||
if (typeId <= 15) {
|
||||
meta.setMetaType(MetaType1_13_2.byId(typeId));
|
||||
meta.setMetaType(Types1_13_2.META_TYPES.byId(typeId));
|
||||
}
|
||||
|
||||
MetaType type = meta.metaType();
|
||||
|
||||
if (type == MetaType1_13_2.Slot) {
|
||||
if (type == Types1_13_2.META_TYPES.itemType) {
|
||||
Item item = (Item) meta.getValue();
|
||||
meta.setValue(protocol.getItemRewriter().handleItemToClient(item));
|
||||
} else if (type == MetaType1_13_2.BlockID) {
|
||||
} else if (type == Types1_13_2.META_TYPES.blockStateType) {
|
||||
int blockstate = (Integer) meta.getValue();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockstate));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
filter().type(Entity1_14Types.PILLAGER).cancel(15);
|
||||
@@ -393,6 +397,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
|
||||
filter().handler((event, meta) -> {
|
||||
EntityType type = event.entityType();
|
||||
if (type == null) return;
|
||||
if (type.isOrHasParent(Entity1_14Types.ABSTRACT_ILLAGER_BASE) || type == Entity1_14Types.RAVAGER || type == Entity1_14Types.WITCH) {
|
||||
int index = event.index();
|
||||
if (index == 14) {
|
||||
@@ -408,7 +413,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
});
|
||||
|
||||
filter().type(Entity1_14Types.FIREWORK_ROCKET).index(8).handler((event, meta) -> {
|
||||
meta.setMetaType(MetaType1_13_2.VarInt);
|
||||
meta.setMetaType(Types1_13_2.META_TYPES.varIntType);
|
||||
Integer value = (Integer) meta.getValue();
|
||||
if (value == null) {
|
||||
meta.setValue(0);
|
||||
@@ -421,7 +426,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
|
||||
MetaHandler villagerDataHandler = (event, meta) -> {
|
||||
VillagerData villagerData = (VillagerData) meta.getValue();
|
||||
meta.setTypeAndValue(MetaType1_13_2.VarInt, villagerDataToProfession(villagerData));
|
||||
meta.setTypeAndValue(Types1_13_2.META_TYPES.varIntType, villagerDataToProfession(villagerData));
|
||||
if (meta.id() == 16) {
|
||||
event.setIndex(15); // decreased by 2 again in one of the following handlers
|
||||
}
|
||||
@@ -434,13 +439,13 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
filter().filterFamily(Entity1_14Types.ABSTRACT_SKELETON).index(13).handler((event, meta) -> {
|
||||
byte value = (byte) meta.getValue();
|
||||
if ((value & 4) != 0) {
|
||||
event.createExtraMeta(new Metadata(14, MetaType1_13_2.Boolean, true));
|
||||
event.createExtraMeta(new Metadata(14, Types1_13_2.META_TYPES.booleanType, true));
|
||||
}
|
||||
});
|
||||
filter().filterFamily(Entity1_14Types.ZOMBIE).index(13).handler((event, meta) -> {
|
||||
byte value = (byte) meta.getValue();
|
||||
if ((value & 4) != 0) {
|
||||
event.createExtraMeta(new Metadata(16, MetaType1_13_2.Boolean, true));
|
||||
event.createExtraMeta(new Metadata(16, Types1_13_2.META_TYPES.booleanType, true));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -473,16 +478,9 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
// Something
|
||||
filter().removeIndex(6);
|
||||
|
||||
filter().handler((event, meta) -> {
|
||||
int typeId = meta.metaType().typeId();
|
||||
if (typeId > 15) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("New 1.14 metadata was not handled: " + meta + " entity: " + event.entityType());
|
||||
}
|
||||
});
|
||||
|
||||
filter().type(Entity1_14Types.OCELOT).index(13).handler((event, meta) -> {
|
||||
event.setIndex(15);
|
||||
meta.setTypeAndValue(MetaType1_13_2.VarInt, 0);
|
||||
meta.setTypeAndValue(Types1_13_2.META_TYPES.varIntType, 0);
|
||||
});
|
||||
|
||||
filter().type(Entity1_14Types.CAT).handler((event, meta) -> {
|
||||
|
||||
+2
-3
@@ -59,9 +59,8 @@ public class PlayerPackets1_14 extends RewriterBase<Protocol1_13_2To1_14> {
|
||||
protocol.registerServerbound(ServerboundPackets1_13.PLAYER_DIGGING, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.BYTE);
|
||||
map(Type.VAR_INT); // Action
|
||||
map(Type.POSITION, Type.POSITION1_14); // Position
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+13
-5
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_13to1_13_1;
|
||||
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
@@ -109,14 +110,21 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
map(Type.UNSIGNED_BYTE); // Id
|
||||
map(Type.STRING); // Window Type
|
||||
handler(wrapper -> {
|
||||
JsonElement title = wrapper.read(Type.COMPONENT);
|
||||
JsonElement title = wrapper.passthrough(Type.COMPONENT);
|
||||
translatableRewriter.processText(title);
|
||||
|
||||
// https://bugs.mojang.com/browse/MC-124543
|
||||
JsonObject legacyComponent = new JsonObject();
|
||||
legacyComponent.addProperty("text", ChatRewriter.jsonToLegacyText(title.toString()));
|
||||
if (ViaBackwards.getConfig().fix1_13FormattedInventoryTitle()) {
|
||||
if (title.isJsonObject() && title.getAsJsonObject().size() == 1
|
||||
&& title.getAsJsonObject().has("translate")) {
|
||||
// Hotfix simple translatable components from being converted to legacy text
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.write(Type.COMPONENT, legacyComponent);
|
||||
// https://bugs.mojang.com/browse/MC-124543
|
||||
JsonObject legacyComponent = new JsonObject();
|
||||
legacyComponent.addProperty("text", ChatRewriter.jsonToLegacyText(title.toString()));
|
||||
wrapper.set(Type.COMPONENT, 0, legacyComponent);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+3
-4
@@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_13;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
@@ -141,13 +140,13 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13
|
||||
protected void registerRewrites() {
|
||||
// Rewrite items & blocks
|
||||
filter().handler((event, meta) -> {
|
||||
if (meta.metaType() == MetaType1_13.Slot) {
|
||||
if (meta.metaType() == Types1_13.META_TYPES.itemType) {
|
||||
protocol.getItemRewriter().handleItemToClient((Item) meta.getValue());
|
||||
} else if (meta.metaType() == MetaType1_13.BlockID) {
|
||||
} else if (meta.metaType() == Types1_13.META_TYPES.blockStateType) {
|
||||
// Convert to new block id
|
||||
int data = (int) meta.getValue();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
} else if (meta.metaType() == MetaType1_13.PARTICLE) {
|
||||
} else if (meta.metaType() == Types1_13.META_TYPES.particleType) {
|
||||
rewriteParticle((Particle) meta.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
+11
-8
@@ -24,11 +24,11 @@ import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.data.ImmediateR
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -50,7 +50,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
if (!wrapper.user().get(ImmediateRespawn.class).isImmediateRespawn()) return;
|
||||
|
||||
// Instantly request respawn when 1.15 gamerule is set
|
||||
PacketWrapper statusPacket = wrapper.create(0x04);
|
||||
PacketWrapper statusPacket = wrapper.create(ServerboundPackets1_14.CLIENT_STATUS);
|
||||
statusPacket.write(Type.VAR_INT, 0);
|
||||
statusPacket.sendToServer(Protocol1_14_4To1_15.class);
|
||||
});
|
||||
@@ -122,7 +122,10 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
|
||||
handler(getTrackerHandler(Entity1_15Types.PLAYER, Type.INT));
|
||||
|
||||
handler(wrapper -> wrapper.user().get(ImmediateRespawn.class).setImmediateRespawn(wrapper.read(Type.BOOLEAN)));
|
||||
handler(wrapper -> {
|
||||
boolean immediateRespawn = !wrapper.read(Type.BOOLEAN); // Inverted
|
||||
wrapper.user().get(ImmediateRespawn.class).setImmediateRespawn(immediateRespawn);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -195,16 +198,16 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
registerMetaTypeHandler(MetaType1_14.Slot, MetaType1_14.BlockID, MetaType1_14.PARTICLE, null);
|
||||
registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, Types1_14.META_TYPES.particleType, null);
|
||||
|
||||
filter().filterFamily(Entity1_15Types.LIVINGENTITY).removeIndex(12);
|
||||
|
||||
filter().type(Entity1_15Types.BEE).cancel(15);
|
||||
filter().type(Entity1_15Types.BEE).cancel(16);
|
||||
|
||||
mapEntityTypeWithData(Entity1_15Types.BEE, Entity1_15Types.PUFFERFISH).jsonName("Bee").spawnMetadata(storage -> {
|
||||
storage.add(new Metadata(14, MetaType1_14.Boolean, false));
|
||||
storage.add(new Metadata(15, MetaType1_14.VarInt, 2));
|
||||
mapEntityTypeWithData(Entity1_15Types.BEE, Entity1_15Types.PUFFERFISH).jsonName().spawnMetadata(storage -> {
|
||||
storage.add(new Metadata(14, Types1_14.META_TYPES.booleanType, false));
|
||||
storage.add(new Metadata(15, Types1_14.META_TYPES.varIntType, 2));
|
||||
});
|
||||
|
||||
filter().type(Entity1_15Types.ENDERMAN).cancel(16);
|
||||
@@ -213,7 +216,7 @@ public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
// Redundant health removed in 1.15
|
||||
filter().type(Entity1_15Types.WOLF).addIndex(17);
|
||||
filter().type(Entity1_15Types.WOLF).index(8).handler((event, meta) -> {
|
||||
event.createExtraMeta(new Metadata(17/*WOLF_HEALTH*/, MetaType1_14.Float, event.meta().value()));
|
||||
event.createExtraMeta(new Metadata(17/*WOLF_HEALTH*/, Types1_14.META_TYPES.floatType, event.meta().value()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -203,7 +203,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
user.put(new PlayerSneakStorage());
|
||||
user.put(new WorldNameTracker());
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_16Types.PLAYER));
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_16Types.PLAYER, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ public class TranslatableRewriter1_16 extends TranslatableRewriter {
|
||||
@Override
|
||||
public void processText(JsonElement value) {
|
||||
super.processText(value);
|
||||
if (!value.isJsonObject()) return;
|
||||
|
||||
if (value == null || !value.isJsonObject()) return;
|
||||
|
||||
// c o l o r s
|
||||
JsonObject object = value.getAsJsonObject();
|
||||
|
||||
+44
-14
@@ -20,19 +20,23 @@ package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets;
|
||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.WorldNameTracker;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage.WolfDataMaskStorage;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.Particle;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_16;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
@@ -42,7 +46,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
|
||||
private final ValueTransformer<String, Integer> dimensionTransformer = new ValueTransformer<String, Integer>(Type.STRING, Type.INT) {
|
||||
@Override
|
||||
public Integer transform(PacketWrapper wrapper, String input) throws Exception {
|
||||
public Integer transform(PacketWrapper wrapper, String input) {
|
||||
switch (input) {
|
||||
case "minecraft:the_nether":
|
||||
return -1;
|
||||
@@ -113,7 +117,9 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
|
||||
// Send a dummy respawn with a different dimension if the world name was different and the same dimension was used
|
||||
if (clientWorld.getEnvironment() != null && dimension == clientWorld.getEnvironment().getId()
|
||||
&& (wrapper.user().isClientSide() || Via.getPlatform().isProxy() || !nextWorldName.equals(worldNameTracker.getWorldName()))) {
|
||||
&& (wrapper.user().isClientSide() || Via.getPlatform().isProxy()
|
||||
|| wrapper.user().getProtocolInfo().getProtocolVersion() <= ProtocolVersion.v1_12_2.getVersion() // Hotfix for https://github.com/ViaVersion/ViaBackwards/issues/381
|
||||
|| !nextWorldName.equals(worldNameTracker.getWorldName()))) {
|
||||
PacketWrapper packet = wrapper.create(ClientboundPackets1_15.RESPAWN);
|
||||
packet.write(Type.INT, dimension == 0 ? -1 : 0);
|
||||
packet.write(Type.LONG, 0L);
|
||||
@@ -176,7 +182,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
registerTracker(ClientboundPackets1_16.SPAWN_PAINTING, Entity1_16Types.PAINTING);
|
||||
registerTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16Types.PLAYER);
|
||||
registerRemoveEntities(ClientboundPackets1_16.DESTROY_ENTITIES);
|
||||
registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||
registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_16.METADATA_LIST, Types1_14.METADATA_LIST);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_16.ENTITY_PROPERTIES, new PacketRemapper() {
|
||||
@Override
|
||||
@@ -244,14 +250,16 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().handler((event, meta) -> {
|
||||
meta.setMetaType(Types1_14.META_TYPES.byId(meta.metaType().typeId()));
|
||||
|
||||
MetaType type = meta.metaType();
|
||||
if (type == MetaType1_14.Slot) {
|
||||
if (type == Types1_14.META_TYPES.itemType) {
|
||||
meta.setValue(protocol.getItemRewriter().handleItemToClient((Item) meta.getValue()));
|
||||
} else if (type == MetaType1_14.BlockID) {
|
||||
} else if (type == Types1_14.META_TYPES.blockStateType) {
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId((int) meta.getValue()));
|
||||
} else if (type == MetaType1_14.PARTICLE) {
|
||||
} else if (type == Types1_14.META_TYPES.particleType) {
|
||||
rewriteParticle((Particle) meta.getValue());
|
||||
} else if (type == MetaType1_14.OptChat) {
|
||||
} else if (type == Types1_14.META_TYPES.optionalComponentType) {
|
||||
JsonElement text = meta.value();
|
||||
if (text != null) {
|
||||
protocol.getTranslatableRewriter().processText(text);
|
||||
@@ -262,10 +270,10 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
mapEntityType(Entity1_16Types.ZOMBIFIED_PIGLIN, Entity1_15Types.ZOMBIE_PIGMAN);
|
||||
mapTypes(Entity1_16Types.values(), Entity1_15Types.class);
|
||||
|
||||
mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName("Hoglin");
|
||||
mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName("Zoglin");
|
||||
mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName("Piglin");
|
||||
mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName("Strider");
|
||||
mapEntityTypeWithData(Entity1_16Types.HOGLIN, Entity1_16Types.COW).jsonName();
|
||||
mapEntityTypeWithData(Entity1_16Types.ZOGLIN, Entity1_16Types.COW).jsonName();
|
||||
mapEntityTypeWithData(Entity1_16Types.PIGLIN, Entity1_16Types.ZOMBIFIED_PIGLIN).jsonName();
|
||||
mapEntityTypeWithData(Entity1_16Types.STRIDER, Entity1_16Types.MAGMA_CUBE).jsonName();
|
||||
|
||||
filter().type(Entity1_16Types.ZOGLIN).cancel(16);
|
||||
filter().type(Entity1_16Types.HOGLIN).cancel(15);
|
||||
@@ -276,7 +284,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
|
||||
filter().type(Entity1_16Types.STRIDER).index(15).handler((event, meta) -> {
|
||||
boolean baby = meta.value();
|
||||
meta.setTypeAndValue(MetaType1_14.VarInt, baby ? 1 : 3);
|
||||
meta.setTypeAndValue(Types1_14.META_TYPES.varIntType, baby ? 1 : 3);
|
||||
});
|
||||
filter().type(Entity1_16Types.STRIDER).cancel(16);
|
||||
filter().type(Entity1_16Types.STRIDER).cancel(17);
|
||||
@@ -287,9 +295,31 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
filter().filterFamily(Entity1_16Types.ABSTRACT_ARROW).cancel(8);
|
||||
filter().filterFamily(Entity1_16Types.ABSTRACT_ARROW).handler((event, meta) -> {
|
||||
if (event.index() >= 8) {
|
||||
event.setIndex(event.index() + 1); // TODO is this right...?
|
||||
event.setIndex(event.index() + 1);
|
||||
}
|
||||
});
|
||||
|
||||
filter().type(Entity1_16Types.WOLF).index(16).handler((event, meta) -> {
|
||||
byte mask = meta.value();
|
||||
StoredEntityData data = tracker(event.user()).entityData(event.entityId());
|
||||
data.put(new WolfDataMaskStorage(mask));
|
||||
});
|
||||
|
||||
filter().type(Entity1_16Types.WOLF).index(20).handler((event, meta) -> {
|
||||
StoredEntityData data = tracker(event.user()).entityDataIfPresent(event.entityId());
|
||||
byte previousMask = 0;
|
||||
if (data != null) {
|
||||
WolfDataMaskStorage wolfData = data.get(WolfDataMaskStorage.class);
|
||||
if (wolfData != null) {
|
||||
previousMask = wolfData.tameableMask();
|
||||
}
|
||||
}
|
||||
|
||||
int angerTime = meta.value();
|
||||
byte tameableMask = (byte) (angerTime > 0 ? previousMask | 2 : previousMask & -3);
|
||||
event.createExtraMeta(new Metadata(16, Types1_14.META_TYPES.byteType, tameableMask));
|
||||
event.cancel();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage;
|
||||
|
||||
public final class WolfDataMaskStorage {
|
||||
|
||||
private byte tameableMask;
|
||||
|
||||
public WolfDataMaskStorage(byte tameableMask) {
|
||||
this.tameableMask = tameableMask;
|
||||
}
|
||||
|
||||
public void setTameableMask(byte tameableMask) {
|
||||
this.tameableMask = tameableMask;
|
||||
}
|
||||
|
||||
public byte tameableMask() {
|
||||
return tameableMask;
|
||||
}
|
||||
}
|
||||
+6
-13
@@ -21,14 +21,12 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntArrayTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
@@ -98,13 +96,8 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr
|
||||
}
|
||||
|
||||
for (CompoundTag blockEntity : chunk.getBlockEntities()) {
|
||||
if (blockEntity == null) continue;
|
||||
|
||||
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.asInt(), y.asShort(), z.asInt()));
|
||||
if (blockEntity != null) {
|
||||
handleBlockEntity(blockEntity);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -114,10 +107,10 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr
|
||||
protocol.registerClientbound(ClientboundPackets1_16_2.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.POSITION1_14);
|
||||
map(Type.UNSIGNED_BYTE);
|
||||
handler(wrapper -> {
|
||||
Position position = wrapper.passthrough(Type.POSITION1_14);
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
handleBlockEntity(wrapper.passthrough(Type.NBT), position);
|
||||
handleBlockEntity(wrapper.passthrough(Type.NBT));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -161,7 +154,7 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr
|
||||
});
|
||||
}
|
||||
|
||||
private void handleBlockEntity(CompoundTag tag, Position position) {
|
||||
private void handleBlockEntity(CompoundTag tag) {
|
||||
StringTag idTag = tag.get("id");
|
||||
if (idTag == null) return;
|
||||
if (idTag.getValue().equals("minecraft:skull")) {
|
||||
|
||||
+5
-5
@@ -23,10 +23,9 @@ import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_16;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
@@ -50,7 +49,7 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
registerTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.PAINTING);
|
||||
registerTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.PLAYER);
|
||||
registerRemoveEntities(ClientboundPackets1_16_2.DESTROY_ENTITIES);
|
||||
registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST);
|
||||
registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_16.METADATA_LIST);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() {
|
||||
@Override
|
||||
@@ -104,10 +103,11 @@ public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2>
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
registerMetaTypeHandler(MetaType1_14.Slot, MetaType1_14.BlockID, MetaType1_14.PARTICLE, MetaType1_14.OptChat);
|
||||
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType,
|
||||
Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.optionalComponentType);
|
||||
|
||||
mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class);
|
||||
mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName("Piglin Brute");
|
||||
mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName();
|
||||
|
||||
filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(15).toIndex(16);
|
||||
filter().filterFamily(Entity1_16_2Types.ABSTRACT_PIGLIN).index(16).toIndex(15);
|
||||
|
||||
+19
@@ -17,12 +17,14 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_16_4to1_17;
|
||||
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.EntityPackets1_17;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.TagData;
|
||||
@@ -186,8 +188,23 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
handler(wrapper -> {
|
||||
wrapper.cancel();
|
||||
|
||||
int id = wrapper.read(Type.INT);
|
||||
short shortId = (short) id;
|
||||
if (id == shortId && ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) {
|
||||
wrapper.user().get(PingRequests.class).addId(shortId);
|
||||
|
||||
// Send inventory acknowledgement to replace ping packet functionality in the unsigned byte range
|
||||
PacketWrapper acknowledgementPacket = wrapper.create(ClientboundPackets1_16_2.WINDOW_CONFIRMATION);
|
||||
acknowledgementPacket.write(Type.UNSIGNED_BYTE, (short) 0); // Inventory id
|
||||
acknowledgementPacket.write(Type.SHORT, shortId); // Confirmation id
|
||||
acknowledgementPacket.write(Type.BOOLEAN, false); // Accepted
|
||||
acknowledgementPacket.send(Protocol1_16_4To1_17.class);
|
||||
return;
|
||||
}
|
||||
|
||||
// Plugins expecting a real response will have to handle this accordingly themselves
|
||||
PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG);
|
||||
pongPacket.write(Type.INT, id);
|
||||
pongPacket.sendToServer(Protocol1_16_4To1_17.class);
|
||||
});
|
||||
}
|
||||
@@ -208,6 +225,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
});
|
||||
|
||||
//TODO translatables
|
||||
mergePacket(ClientboundPackets1_17.TITLE_TEXT, ClientboundPackets1_16_2.TITLE, 0);
|
||||
mergePacket(ClientboundPackets1_17.TITLE_SUBTITLE, ClientboundPackets1_16_2.TITLE, 1);
|
||||
mergePacket(ClientboundPackets1_17.ACTIONBAR, ClientboundPackets1_16_2.TITLE, 2);
|
||||
@@ -231,6 +249,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
@Override
|
||||
public void init(UserConnection user) {
|
||||
addEntityTracker(user, new EntityTrackerBase(user, Entity1_17Types.PLAYER));
|
||||
user.put(new PingRequests());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+28
-4
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets;
|
||||
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.data.MapColorRewrites;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests;
|
||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
@@ -34,6 +36,7 @@ import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPac
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
@@ -92,7 +95,27 @@ public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_1
|
||||
});
|
||||
}
|
||||
});
|
||||
protocol.cancelServerbound(ServerboundPackets1_16_2.WINDOW_CONFIRMATION);
|
||||
protocol.registerServerbound(ServerboundPackets1_16_2.WINDOW_CONFIRMATION, null, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
wrapper.cancel();
|
||||
if (!ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle ping packet replacement
|
||||
short inventoryId = wrapper.read(Type.UNSIGNED_BYTE);
|
||||
short confirmationId = wrapper.read(Type.SHORT);
|
||||
boolean accepted = wrapper.read(Type.BOOLEAN);
|
||||
if (inventoryId == 0 && accepted && wrapper.user().get(PingRequests.class).removeId(confirmationId)) {
|
||||
PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG);
|
||||
pongPacket.write(Type.INT, (int) confirmationId);
|
||||
pongPacket.sendToServer(Protocol1_16_4To1_17.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_17.SPAWN_PARTICLE, new PacketRemapper() {
|
||||
@Override
|
||||
@@ -109,7 +132,7 @@ public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_1
|
||||
map(Type.INT); // Particle count
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
if (id == 15) {
|
||||
if (id == 16) {
|
||||
wrapper.passthrough(Type.FLOAT); // R
|
||||
wrapper.passthrough(Type.FLOAT); // G
|
||||
wrapper.passthrough(Type.FLOAT); // B
|
||||
@@ -119,7 +142,7 @@ public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_1
|
||||
wrapper.read(Type.FLOAT); // R
|
||||
wrapper.read(Type.FLOAT); // G
|
||||
wrapper.read(Type.FLOAT); // B
|
||||
} else if (id == 36) {
|
||||
} else if (id == 37) {
|
||||
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
|
||||
wrapper.cancel();
|
||||
}
|
||||
@@ -307,9 +330,10 @@ public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_1
|
||||
boolean hasMarkers = wrapper.read(Type.BOOLEAN);
|
||||
if (!hasMarkers) {
|
||||
wrapper.write(Type.VAR_INT, 0); // Array size
|
||||
} else {
|
||||
MapColorRewriter.getRewriteHandler(MapColorRewrites::getMappedColor).handle(wrapper);
|
||||
}
|
||||
});
|
||||
handler(MapColorRewriter.getRewriteHandler(MapColorRewrites::getMappedColor));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+19
-17
@@ -24,11 +24,10 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.Particle;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_16;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_17;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
@@ -46,12 +45,12 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerTrackerWithData(ClientboundPackets1_17.SPAWN_ENTITY, Entity1_16_2Types.FALLING_BLOCK);
|
||||
registerTrackerWithData(ClientboundPackets1_17.SPAWN_ENTITY, Entity1_17Types.FALLING_BLOCK);
|
||||
registerSpawnTracker(ClientboundPackets1_17.SPAWN_MOB);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EXPERIENCE_ORB);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.PAINTING);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.PLAYER);
|
||||
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_17.METADATA_LIST, Types1_14.METADATA_LIST);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_EXPERIENCE_ORB, Entity1_17Types.EXPERIENCE_ORB);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_17Types.PAINTING);
|
||||
registerTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_17Types.PLAYER);
|
||||
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_17.METADATA_LIST, Types1_16.METADATA_LIST);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_17.REMOVE_ENTITY, ClientboundPackets1_16_2.DESTROY_ENTITIES, new PacketRemapper() {
|
||||
@Override
|
||||
@@ -77,18 +76,19 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
map(Type.STRING_ARRAY); // Worlds
|
||||
map(Type.NBT); // Dimension registry
|
||||
map(Type.NBT); // Current dimension data
|
||||
map(Type.STRING); // World
|
||||
handler(wrapper -> {
|
||||
byte previousGamemode = wrapper.get(Type.BYTE, 0);
|
||||
if (previousGamemode == -1) { // "Unset" gamemode removed
|
||||
wrapper.set(Type.BYTE, 0, (byte) 0);
|
||||
}
|
||||
});
|
||||
handler(getTrackerHandler(Entity1_16_2Types.PLAYER, Type.INT));
|
||||
handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT));
|
||||
handler(worldDataTrackerHandler(1));
|
||||
handler(wrapper -> {
|
||||
CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||
CompoundTag biomeRegsitry = registry.get("minecraft:worldgen/biome");
|
||||
ListTag biomes = biomeRegsitry.get("value");
|
||||
CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
ListTag biomes = biomeRegistry.get("value");
|
||||
for (Tag biome : biomes) {
|
||||
CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
|
||||
StringTag category = biomeCompound.get("category");
|
||||
@@ -113,6 +113,7 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.NBT); // Dimension data
|
||||
map(Type.STRING); // World
|
||||
handler(worldDataTrackerHandler(0));
|
||||
handler(wrapper -> reduceExtendedHeight(wrapper.get(Type.NBT, 0), true));
|
||||
}
|
||||
@@ -145,6 +146,7 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
}
|
||||
});
|
||||
|
||||
// TODO translatables
|
||||
protocol.mergePacket(ClientboundPackets1_17.COMBAT_ENTER, ClientboundPackets1_16_2.COMBAT_EVENT, 0);
|
||||
protocol.mergePacket(ClientboundPackets1_17.COMBAT_END, ClientboundPackets1_16_2.COMBAT_EVENT, 1);
|
||||
protocol.mergePacket(ClientboundPackets1_17.COMBAT_KILL, ClientboundPackets1_16_2.COMBAT_EVENT, 2);
|
||||
@@ -153,10 +155,10 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().handler((event, meta) -> {
|
||||
meta.setMetaType(MetaType1_14.byId(meta.metaType().typeId()));
|
||||
meta.setMetaType(Types1_16.META_TYPES.byId(meta.metaType().typeId()));
|
||||
|
||||
MetaType type = meta.metaType();
|
||||
if (type == MetaType1_14.PARTICLE) {
|
||||
if (type == Types1_16.META_TYPES.particleType) {
|
||||
Particle particle = (Particle) meta.getValue();
|
||||
if (particle.getId() == 15) { // Dust / Dust Transition
|
||||
// Remove transition target color values 4-6
|
||||
@@ -169,7 +171,7 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
}
|
||||
|
||||
rewriteParticle(particle);
|
||||
} else if (type == MetaType1_14.Pose) {
|
||||
} else if (type == Types1_16.META_TYPES.poseType) {
|
||||
// Goat LONG_JUMP added at 6
|
||||
int pose = meta.value();
|
||||
if (pose == 6) {
|
||||
@@ -181,7 +183,7 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
});
|
||||
|
||||
// Particles have already been handled
|
||||
registerMetaTypeHandler(MetaType1_14.Slot, MetaType1_14.BlockID, null, MetaType1_14.OptChat);
|
||||
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType, null, Types1_16.META_TYPES.optionalComponentType);
|
||||
|
||||
mapTypes(Entity1_17Types.values(), Entity1_16_2Types.class);
|
||||
filter().type(Entity1_17Types.AXOLOTL).cancel(17);
|
||||
@@ -192,10 +194,10 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17
|
||||
|
||||
filter().type(Entity1_17Types.GOAT).cancel(17);
|
||||
|
||||
mapEntityTypeWithData(Entity1_17Types.AXOLOTL, Entity1_17Types.TROPICAL_FISH).jsonName("Axolotl");
|
||||
mapEntityTypeWithData(Entity1_17Types.GOAT, Entity1_17Types.SHEEP).jsonName("Goat");
|
||||
mapEntityTypeWithData(Entity1_17Types.AXOLOTL, Entity1_17Types.TROPICAL_FISH).jsonName();
|
||||
mapEntityTypeWithData(Entity1_17Types.GOAT, Entity1_17Types.SHEEP).jsonName();
|
||||
|
||||
mapEntityTypeWithData(Entity1_17Types.GLOW_SQUID, Entity1_17Types.SQUID).jsonName("Glow Squid");
|
||||
mapEntityTypeWithData(Entity1_17Types.GLOW_SQUID, Entity1_17Types.SQUID).jsonName();
|
||||
mapEntityTypeWithData(Entity1_17Types.GLOW_ITEM_FRAME, Entity1_17Types.ITEM_FRAME);
|
||||
|
||||
filter().type(Entity1_17Types.SHULKER).addIndex(17); // TODO Handle attachment pos?
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntOpenHashSet;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntSet;
|
||||
|
||||
public final class PingRequests implements StorableObject {
|
||||
private final IntSet ids = new IntOpenHashSet();
|
||||
|
||||
public void addId(short id) {
|
||||
ids.add(id);
|
||||
}
|
||||
|
||||
public boolean removeId(short id) {
|
||||
return ids.remove(id);
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.EntityPackets1_18;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_18, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||
|
||||
private static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
private BlockItemPackets1_18 itemRewriter;
|
||||
|
||||
public Protocol1_17_1To1_18() {
|
||||
super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_18To1_17_1.class, MAPPINGS::load);
|
||||
|
||||
translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.CHAT_MESSAGE);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.ACTIONBAR);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.TITLE_TEXT);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_18.TITLE_SUBTITLE);
|
||||
translatableRewriter.registerBossBar(ClientboundPackets1_18.BOSSBAR);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_18.DISCONNECT);
|
||||
translatableRewriter.registerTabList(ClientboundPackets1_18.TAB_LIST);
|
||||
translatableRewriter.registerOpenWindow(ClientboundPackets1_18.OPEN_WINDOW);
|
||||
translatableRewriter.registerCombatKill(ClientboundPackets1_18.COMBAT_KILL);
|
||||
translatableRewriter.registerPing();
|
||||
|
||||
itemRewriter = new BlockItemPackets1_18(this, translatableRewriter);
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
|
||||
|
||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
|
||||
|
||||
registerServerbound(ServerboundPackets1_17.CLIENT_SETTINGS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.STRING); // Language
|
||||
map(Type.BYTE); // View distance
|
||||
map(Type.VAR_INT); // Chat visibility
|
||||
map(Type.BOOLEAN); // Chat colors
|
||||
map(Type.UNSIGNED_BYTE); // Model customization
|
||||
map(Type.VAR_INT); // Main hand
|
||||
map(Type.BOOLEAN); // Text filtering enabled
|
||||
create(Type.BOOLEAN, true); // Allow listing in server list preview
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, Entity1_17Types.PLAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets1_18 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockItemPackets1_18 getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data;
|
||||
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||
|
||||
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
|
||||
|
||||
private final Int2ObjectMap<String> blockEntities = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public BackwardsMappings() {
|
||||
super("1.18", "1.17", Protocol1_18To1_17_1.class, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadVBExtras(final JsonObject oldMappings, final JsonObject newMappings) {
|
||||
for (final Object2IntMap.Entry<String> entry : Protocol1_18To1_17_1.MAPPINGS.blockEntityIds().object2IntEntrySet()) {
|
||||
blockEntities.put(entry.getIntValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public Int2ObjectMap<String> blockEntities() {
|
||||
return blockEntities;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class BlockEntityIds {
|
||||
|
||||
private static final int[] IDS;
|
||||
|
||||
static {
|
||||
final int[] ids = com.viaversion.viaversion.protocols.protocol1_18to1_17_1.BlockEntityIds.getIds();
|
||||
IDS = new int[Arrays.stream(ids).max().getAsInt() + 1];
|
||||
Arrays.fill(IDS, -1);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
final int id = ids[i];
|
||||
if (id != -1) {
|
||||
IDS[id] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int mappedId(final int id) {
|
||||
if (id < 0 || id > IDS.length) {
|
||||
return -1;
|
||||
}
|
||||
return IDS[id];
|
||||
}
|
||||
}
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BlockEntityIds;
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||
import com.viaversion.viaversion.util.MathUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_18> {
|
||||
|
||||
public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol, final TranslatableRewriter translatableRewriter) {
|
||||
super(protocol, translatableRewriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_18.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, Type.FLAT_VAR_INT_ITEM);
|
||||
registerSetSlot1_17_1(ClientboundPackets1_18.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||
registerEntityEquipmentArray(ClientboundPackets1_18.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||
registerTradeList(ClientboundPackets1_18.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
||||
registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.EFFECT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.INT); // Effect id
|
||||
map(Type.POSITION1_14); // Location
|
||||
map(Type.INT); // Data
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
int data = wrapper.get(Type.INT, 1);
|
||||
if (id == 1010) { // Play record
|
||||
wrapper.set(Type.INT, 1, protocol.getMappingData().getNewItemId(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.SPAWN_PARTICLE, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.INT); // Particle id
|
||||
map(Type.BOOLEAN); // Override limiter
|
||||
map(Type.DOUBLE); // X
|
||||
map(Type.DOUBLE); // Y
|
||||
map(Type.DOUBLE); // Z
|
||||
map(Type.FLOAT); // Offset X
|
||||
map(Type.FLOAT); // Offset Y
|
||||
map(Type.FLOAT); // Offset Z
|
||||
map(Type.FLOAT); // Max speed
|
||||
map(Type.INT); // Particle Count
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
if (id == 3) { // Block marker
|
||||
int blockState = wrapper.read(Type.VAR_INT);
|
||||
if (blockState == 7786) { // Light block
|
||||
wrapper.set(Type.INT, 0, 3);
|
||||
} else {
|
||||
// Else assume barrier block
|
||||
wrapper.set(Type.INT, 0, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
|
||||
if (mappings.isBlockParticle(id)) {
|
||||
int data = wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(data));
|
||||
} else if (mappings.isItemParticle(id)) {
|
||||
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||
}
|
||||
|
||||
int newId = protocol.getMappingData().getNewParticleId(id);
|
||||
if (newId != id) {
|
||||
wrapper.set(Type.INT, 0, newId);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.POSITION1_14);
|
||||
handler(wrapper -> {
|
||||
final int id = wrapper.read(Type.VAR_INT);
|
||||
final CompoundTag tag = wrapper.read(Type.NBT);
|
||||
if (tag == null) {
|
||||
// Cancel nbt-less updates (screw open commandblocks)
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
final int mappedId = BlockEntityIds.mappedId(id);
|
||||
if (mappedId == -1) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
handleSpawner(id, tag);
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedId);
|
||||
wrapper.write(Type.NBT, tag);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.CHUNK_DATA, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
|
||||
final Chunk1_18Type chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(),
|
||||
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()),
|
||||
MathUtil.ceilLog2(tracker.biomesSent()));
|
||||
final Chunk oldChunk = wrapper.read(chunkType);
|
||||
final ChunkSection[] sections = oldChunk.getSections();
|
||||
final BitSet mask = new BitSet(oldChunk.getSections().length);
|
||||
final int[] biomeData = new int[sections.length * ChunkSection.BIOME_SIZE];
|
||||
int biomeIndex = 0;
|
||||
for (int j = 0; j < sections.length; j++) {
|
||||
final ChunkSection section = sections[j];
|
||||
// Write biome palette into biome array
|
||||
final DataPalette biomePalette = section.palette(PaletteType.BIOMES);
|
||||
for (int i = 0; i < ChunkSection.BIOME_SIZE; i++) {
|
||||
biomeData[biomeIndex++] = biomePalette.idAt(i);
|
||||
}
|
||||
|
||||
// Rewrite to empty section
|
||||
if (section.getNonAirBlocksCount() == 0) {
|
||||
sections[j] = null;
|
||||
} else {
|
||||
mask.set(j);
|
||||
}
|
||||
}
|
||||
|
||||
final List<CompoundTag> blockEntityTags = new ArrayList<>(oldChunk.blockEntities().size());
|
||||
for (final BlockEntity blockEntity : oldChunk.blockEntities()) {
|
||||
final String id = protocol.getMappingData().blockEntities().get(blockEntity.typeId());
|
||||
if (id == null) {
|
||||
// Shrug
|
||||
continue;
|
||||
}
|
||||
|
||||
final CompoundTag tag;
|
||||
if (blockEntity.tag() != null) {
|
||||
tag = blockEntity.tag();
|
||||
handleSpawner(blockEntity.typeId(), tag);
|
||||
} else {
|
||||
tag = new CompoundTag();
|
||||
}
|
||||
|
||||
blockEntityTags.add(tag);
|
||||
tag.put("x", new IntTag((oldChunk.getX() << 4) + blockEntity.sectionX()));
|
||||
tag.put("y", new IntTag(blockEntity.y()));
|
||||
tag.put("z", new IntTag((oldChunk.getZ() << 4) + blockEntity.sectionZ()));
|
||||
tag.put("id", new StringTag(id));
|
||||
}
|
||||
|
||||
final Chunk chunk = new BaseChunk(oldChunk.getX(), oldChunk.getZ(), true, false, mask,
|
||||
oldChunk.getSections(), biomeData, oldChunk.getHeightMap(), blockEntityTags);
|
||||
wrapper.write(new Chunk1_17Type(tracker.currentWorldSectionHeight()), chunk);
|
||||
|
||||
// Create and send light packet first
|
||||
final PacketWrapper lightPacket = wrapper.create(ClientboundPackets1_17_1.UPDATE_LIGHT);
|
||||
lightPacket.write(Type.VAR_INT, chunk.getX());
|
||||
lightPacket.write(Type.VAR_INT, chunk.getZ());
|
||||
lightPacket.write(Type.BOOLEAN, wrapper.read(Type.BOOLEAN)); // Trust edges
|
||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Sky light mask
|
||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Block light mask
|
||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty sky light mask
|
||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty block light mask
|
||||
|
||||
final int skyLightLength = wrapper.read(Type.VAR_INT);
|
||||
lightPacket.write(Type.VAR_INT, skyLightLength);
|
||||
for (int i = 0; i < skyLightLength; i++) {
|
||||
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
||||
}
|
||||
|
||||
final int blockLightLength = wrapper.read(Type.VAR_INT);
|
||||
lightPacket.write(Type.VAR_INT, blockLightLength);
|
||||
for (int i = 0; i < blockLightLength; i++) {
|
||||
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
||||
}
|
||||
|
||||
lightPacket.send(Protocol1_17_1To1_18.class);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.cancelClientbound(ClientboundPackets1_18.SET_SIMULATION_DISTANCE);
|
||||
}
|
||||
|
||||
private void handleSpawner(final int typeId, final CompoundTag tag) {
|
||||
if (typeId == 8) {
|
||||
final CompoundTag spawnData = tag.get("SpawnData");
|
||||
final CompoundTag entity;
|
||||
if (spawnData != null && (entity = spawnData.get("entity")) != null) {
|
||||
tag.put("SpawnData", entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets;
|
||||
|
||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.Particle;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_17;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_18;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.FloatTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18> {
|
||||
|
||||
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||
super(protocol);
|
||||
allowNullEntityType = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerMetadataRewriter(ClientboundPackets1_18.ENTITY_METADATA, Types1_18.METADATA_LIST, Types1_17.METADATA_LIST);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.JOIN_GAME, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.INT); // Entity ID
|
||||
map(Type.BOOLEAN); // Hardcore
|
||||
map(Type.UNSIGNED_BYTE); // Gamemode
|
||||
map(Type.BYTE); // Previous Gamemode
|
||||
map(Type.STRING_ARRAY); // Worlds
|
||||
map(Type.NBT); // Dimension registry
|
||||
map(Type.NBT); // Current dimension data
|
||||
map(Type.STRING); // World
|
||||
map(Type.LONG); // Seed
|
||||
map(Type.VAR_INT); // Max players
|
||||
map(Type.VAR_INT); // Chunk radius
|
||||
read(Type.VAR_INT); // Read simulation distance
|
||||
handler(worldDataTrackerHandler(1));
|
||||
handler(wrapper -> {
|
||||
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
final ListTag biomes = biomeRegistry.get("value");
|
||||
for (final Tag biome : new ArrayList<>(biomes.getValue())) {
|
||||
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
|
||||
final StringTag category = biomeCompound.get("category");
|
||||
if (category.getValue().equals("mountain")) {
|
||||
biomes.remove(biome);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The client just needs something
|
||||
biomeCompound.put("depth", new FloatTag(0.125F));
|
||||
biomeCompound.put("scale", new FloatTag(0.05F));
|
||||
}
|
||||
|
||||
// Track amount of biomes sent
|
||||
tracker(wrapper.user()).setBiomesSent(biomes.size());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_18.RESPAWN, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.NBT); // Dimension data
|
||||
map(Type.STRING); // World
|
||||
handler(worldDataTrackerHandler(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().handler((event, meta) -> {
|
||||
meta.setMetaType(Types1_17.META_TYPES.byId(meta.metaType().typeId()));
|
||||
|
||||
MetaType type = meta.metaType();
|
||||
if (type == Types1_17.META_TYPES.particleType) {
|
||||
Particle particle = (Particle) meta.getValue();
|
||||
if (particle.getId() == 3) { // Block marker
|
||||
Particle.ParticleData data = particle.getArguments().remove(0);
|
||||
int blockState = (int) data.getValue();
|
||||
if (blockState == 7786) { // Light block
|
||||
particle.setId(3);
|
||||
} else {
|
||||
// Else assume barrier block
|
||||
particle.setId(2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rewriteParticle(particle);
|
||||
}
|
||||
});
|
||||
|
||||
// Particles have already been handled
|
||||
registerMetaTypeHandler(Types1_17.META_TYPES.itemType, null, null, Types1_17.META_TYPES.optionalComponentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType typeFromId(final int typeId) {
|
||||
return Entity1_17Types.getTypeFromId(typeId);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17to1_17_1;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.storage.InventoryStateIds;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
|
||||
public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||
|
||||
private static final int MAX_PAGE_LENGTH = 8192;
|
||||
private static final int MAX_TITLE_LENGTH = 128;
|
||||
private static final int MAX_PAGES = 200; // Actually limited to 100 when handling the read packet, but /shrug
|
||||
|
||||
public Protocol1_17To1_17_1() {
|
||||
super(ClientboundPackets1_17_1.class, ClientboundPackets1_17.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerClientbound(ClientboundPackets1_17_1.REMOVE_ENTITIES, null, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
int[] entityIds = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
wrapper.cancel();
|
||||
for (int entityId : entityIds) {
|
||||
// Send individual remove packets
|
||||
PacketWrapper newPacket = wrapper.create(ClientboundPackets1_17.REMOVE_ENTITY);
|
||||
newPacket.write(Type.VAR_INT, entityId);
|
||||
newPacket.send(Protocol1_17To1_17_1.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerClientbound(ClientboundPackets1_17_1.CLOSE_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
|
||||
});
|
||||
}
|
||||
});
|
||||
registerClientbound(ClientboundPackets1_17_1.SET_SLOT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
int stateId = wrapper.read(Type.VAR_INT);
|
||||
wrapper.user().get(InventoryStateIds.class).setStateId(containerId, stateId);
|
||||
});
|
||||
}
|
||||
});
|
||||
registerClientbound(ClientboundPackets1_17_1.WINDOW_ITEMS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
int stateId = wrapper.read(Type.VAR_INT);
|
||||
wrapper.user().get(InventoryStateIds.class).setStateId(containerId, stateId);
|
||||
|
||||
// Length is encoded as a var int in 1.17.1
|
||||
wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY, wrapper.read(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT));
|
||||
|
||||
// Carried item - should work without adding it to the array above
|
||||
wrapper.read(Type.FLAT_VAR_INT_ITEM);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerServerbound(ServerboundPackets1_17.CLOSE_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
|
||||
});
|
||||
}
|
||||
});
|
||||
registerServerbound(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
int stateId = wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
|
||||
wrapper.write(Type.VAR_INT, stateId == Integer.MAX_VALUE ? 0 : stateId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
Item item = wrapper.read(Type.FLAT_VAR_INT_ITEM);
|
||||
boolean signing = wrapper.read(Type.BOOLEAN);
|
||||
wrapper.passthrough(Type.VAR_INT); // Slot comes first
|
||||
|
||||
CompoundTag tag = item.tag();
|
||||
ListTag pagesTag;
|
||||
StringTag titleTag = null;
|
||||
// Sanity checks
|
||||
if (tag == null || (pagesTag = tag.get("pages")) == null
|
||||
|| (signing && (titleTag = tag.get("title")) == null)) {
|
||||
wrapper.write(Type.VAR_INT, 0); // Pages length
|
||||
wrapper.write(Type.BOOLEAN, false); // Optional title
|
||||
return;
|
||||
}
|
||||
|
||||
// Write pages - limit them first
|
||||
if (pagesTag.size() > MAX_PAGES) {
|
||||
pagesTag = new ListTag(pagesTag.getValue().subList(0, MAX_PAGES));
|
||||
}
|
||||
|
||||
wrapper.write(Type.VAR_INT, pagesTag.size());
|
||||
for (Tag pageTag : pagesTag) {
|
||||
String page = ((StringTag) pageTag).getValue();
|
||||
// Limit page length
|
||||
if (page.length() > MAX_PAGE_LENGTH) {
|
||||
page = page.substring(0, MAX_PAGE_LENGTH);
|
||||
}
|
||||
|
||||
wrapper.write(Type.STRING, page);
|
||||
}
|
||||
|
||||
// Write optional title
|
||||
wrapper.write(Type.BOOLEAN, signing);
|
||||
if (signing) {
|
||||
if (titleTag == null) {
|
||||
titleTag = tag.get("title");
|
||||
}
|
||||
|
||||
// Limit title length
|
||||
String title = titleTag.getValue();
|
||||
if (title.length() > MAX_TITLE_LENGTH) {
|
||||
title = title.substring(0, MAX_TITLE_LENGTH);
|
||||
}
|
||||
|
||||
wrapper.write(Type.STRING, title);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection connection) {
|
||||
connection.put(new InventoryStateIds());
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.storage;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
|
||||
public final class InventoryStateIds implements StorableObject {
|
||||
private final Int2IntMap ids = new Int2IntOpenHashMap();
|
||||
|
||||
public InventoryStateIds() {
|
||||
// Inventory ids are unsigned bytes, so this is safe to do
|
||||
ids.defaultReturnValue(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public void setStateId(short containerId, int id) {
|
||||
ids.put(containerId, id);
|
||||
}
|
||||
|
||||
public int removeStateId(short containerId) {
|
||||
return ids.remove(containerId);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10>
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
mapEntityTypeWithData(Entity1_10Types.EntityType.POLAR_BEAR, Entity1_10Types.EntityType.SHEEP).mobName("Polar Bear");
|
||||
mapEntityTypeWithData(Entity1_10Types.EntityType.POLAR_BEAR, Entity1_10Types.EntityType.SHEEP).plainName();
|
||||
|
||||
// Change the sheep color when the polar bear is standing up (index 13 -> Standing up)
|
||||
filter().type(Entity1_10Types.EntityType.POLAR_BEAR).index(13).handler((event, meta) -> {
|
||||
|
||||
@@ -11,4 +11,12 @@ add-custom-enchants-into-lore: true
|
||||
add-teamcolor-to-prefix: true
|
||||
#
|
||||
# Converts the 1.13 face look-at packet for 1.12- players. Requires a bit of extra caching.
|
||||
fix-1_13-face-player: false
|
||||
fix-1_13-face-player: false
|
||||
#
|
||||
# Fixes 1.13 clients and lower not seeing color or formatting in inventory titles by converting them to legacy text.
|
||||
# If you have issues with translatable text being displayed wrongly, disable this.
|
||||
fix-formatted-inventory-titles: true
|
||||
#
|
||||
# Sends inventory acknowledgement packets to act as a replacement for ping packets for sub 1.17 clients.
|
||||
# This only takes effect for ids in the short range. Useful for anticheat compatibility.
|
||||
handle-pings-as-inv-acknowledgements: false
|
||||
@@ -31,5 +31,14 @@
|
||||
"item.armor.equip_elytra": "item.armor.equip_generic",
|
||||
"item.bottle.empty": "item.bottle.fill",
|
||||
"item.totem.use": "block.anvil.destroy"
|
||||
},
|
||||
"entitynames": {
|
||||
"wither_skeleton": "Polar Bear",
|
||||
"stray": "Stray",
|
||||
"husk": "Husk",
|
||||
"evocation_illager": "Evoker",
|
||||
"vex": "Vex",
|
||||
"vindication_illager": "Vindicator",
|
||||
"liama": "Llama"
|
||||
}
|
||||
}
|
||||
@@ -48,5 +48,9 @@
|
||||
"entity.parrot.step": "entity.chicken.step",
|
||||
"entity.player.hurt_drown": "entity.player.hurt",
|
||||
"entity.player.hurt_on_fire": "entity.player.hurt"
|
||||
},
|
||||
"entitynames": {
|
||||
"parrot": "Parrot",
|
||||
"illusion_illager": "Illusioner"
|
||||
}
|
||||
}
|
||||
@@ -5960,5 +5960,15 @@
|
||||
"item.trident.throw": "entity.skeleton.shoot",
|
||||
"item.trident.thunder": "entity.lightning_bolt.thunder",
|
||||
"music.under_water": "music.creative"
|
||||
},
|
||||
"entitynames": {
|
||||
"drowned": "Drowned",
|
||||
"cod": "Cod",
|
||||
"salmon": "Salmon",
|
||||
"pufferfish": "Pufferfish",
|
||||
"tropical_fish": "Tropical Fish",
|
||||
"phantom": "Phantom",
|
||||
"dolphin": "Dolphin",
|
||||
"turtle": "Turtle"
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@
|
||||
"minecraft:brick_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:prismarine_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:sandstone_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:red_sandstone_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:red_sandstone_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:mossy_stone_brick_wall": "minecraft:mossy_cobblestone_wall[",
|
||||
"minecraft:granite_wall": "minecraft:cobblestone_wall[",
|
||||
"minecraft:stone_brick_wall": "minecraft:cobblestone_wall[",
|
||||
@@ -1008,5 +1008,14 @@
|
||||
"sneeze": "spit",
|
||||
"campfire_cosy_smoke": "cloud",
|
||||
"campfire_signal_smoke": "cloud"
|
||||
},
|
||||
"entitynames": {
|
||||
"cat": "Cat",
|
||||
"trader_llama": "Trader Llama",
|
||||
"fox": "Fox",
|
||||
"panda": "Panda",
|
||||
"pillager": "Pillager",
|
||||
"wandering_trader": "Wandering Trader",
|
||||
"ravager": "Ravager"
|
||||
}
|
||||
}
|
||||
@@ -94,5 +94,8 @@
|
||||
"falling_honey": "falling_lava",
|
||||
"landing_honey": "landing_lava",
|
||||
"falling_nectar": "falling_water"
|
||||
},
|
||||
"entitynames": {
|
||||
"bee": "Bee"
|
||||
}
|
||||
}
|
||||
@@ -6242,5 +6242,11 @@
|
||||
"landing_obsidian_tear": "landing_lava",
|
||||
"reverse_portal": "portal",
|
||||
"white_ash": "mycelium"
|
||||
},
|
||||
"entitynames": {
|
||||
"hoglin": "Hoglin",
|
||||
"zoglin": "Zoglin",
|
||||
"piglin": "Piglin",
|
||||
"strider": "Strider"
|
||||
}
|
||||
}
|
||||
@@ -826,7 +826,7 @@
|
||||
"name": "1.17 Lightning Rod"
|
||||
},
|
||||
"minecraft:powder_snow_bucket": {
|
||||
"id": "minecraft:milk_bucket",
|
||||
"id": "minecraft:snow_block",
|
||||
"name": "1.17 Powder Snow Bucket"
|
||||
},
|
||||
"minecraft:dripstone_block": {
|
||||
@@ -1177,7 +1177,6 @@
|
||||
"id": "minecraft:silverfish_spawn_egg",
|
||||
"name": "1.17 Goat Spawn Egg"
|
||||
},
|
||||
|
||||
"minecraft:raw_iron_block": {
|
||||
"id": "minecraft:iron_block",
|
||||
"name": "1.17 Raw Iron Block"
|
||||
@@ -1411,5 +1410,10 @@
|
||||
"electric_spark": "happy_villager",
|
||||
"scrape": "happy_villager",
|
||||
"light": "barrier"
|
||||
},
|
||||
"entitynames": {
|
||||
"axolotl": "Axolotl",
|
||||
"goat": "Goat",
|
||||
"glow_squid": "Glow Squid"
|
||||
}
|
||||
}
|
||||
@@ -29,5 +29,8 @@
|
||||
"entity.piglin_brute.hurt": "entity.piglin.hurt",
|
||||
"entity.piglin_brute.step": "entity.piglin.step",
|
||||
"entity.piglin_brute.converted_to_zombified": "entity.piglin.converted_to_zombified"
|
||||
},
|
||||
"entitynames": {
|
||||
"piglin_brute": "Piglin Brute"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"sounds": {
|
||||
"item.bundle.drop_contents": "",
|
||||
"item.bundle.insert": "",
|
||||
"item.bundle.remove_one": "",
|
||||
"block.growing_plant.crop": "",
|
||||
"music_disc.otherside": "",
|
||||
"music.overworld.dripstone_caves": "",
|
||||
"music.overworld.grove": "",
|
||||
"music.overworld.jagged_peaks": "",
|
||||
"music.overworld.lush_caves": "",
|
||||
"music.overworld.meadow": "",
|
||||
"music.overworld.frozen_peaks": "",
|
||||
"music.overworld.snowy_slopes": "",
|
||||
"music.overworld.stony_peaks": ""
|
||||
},
|
||||
"items": {
|
||||
"minecraft:music_disc_otherside": {
|
||||
"id": "minecraft:music_disc_ward",
|
||||
"name": "1.18 Otherside Music Disc"
|
||||
}
|
||||
},
|
||||
"particles": {
|
||||
"block_marker": "barrier"
|
||||
}
|
||||
}
|
||||
@@ -19,5 +19,8 @@
|
||||
"entity.wither_skeleton.death": "entity.skeleton.death",
|
||||
"entity.wither_skeleton.hurt": "entity.skeleton.hurt",
|
||||
"entity.wither_skeleton.step": "entity.skeleton.step"
|
||||
},
|
||||
"entitynames": {
|
||||
"polar_bear": "Polar Bear"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,65 @@
|
||||
{
|
||||
"1.18": {
|
||||
"selectWorld.conversion.tooltip": "This world must be opened in an older version (like 1.6.4) to be safely converted",
|
||||
"selectWorld.incompatible_series": "Created by an incompatible version",
|
||||
"options.gamma.default": "Default",
|
||||
"options.simulationDistance": "Simulation Distance",
|
||||
"options.prioritizeChunkUpdates": "Chunk Builder",
|
||||
"options.prioritizeChunkUpdates.none": "Threaded",
|
||||
"options.prioritizeChunkUpdates.byPlayer": "Semi Blocking",
|
||||
"options.prioritizeChunkUpdates.nearby": "Fully Blocking",
|
||||
"options.prioritizeChunkUpdates.none.tooltip": "Nearby chunks are compiled in parallel threads. This may result in brief visual holes when blocks are destroyed.",
|
||||
"options.prioritizeChunkUpdates.byPlayer.tooltip": "Some actions within a chunk will recompile the chunk immediately. This includes block placing & destroying.",
|
||||
"options.prioritizeChunkUpdates.nearby.tooltip": "Nearby chunks are always compiled immediately. This may impact game performance when blocks are placed or destroyed.",
|
||||
"options.difficulty.online": "Server Difficulty",
|
||||
"options.audioDevice": "Device",
|
||||
"options.audioDevice.default": "System Default",
|
||||
"options.online": "Online...",
|
||||
"options.online.title": "Online Options",
|
||||
"options.allowServerListing": "Allow Server Listings",
|
||||
"options.allowServerListing.tooltip": "Servers may list online players as part of their public status.\nWith this option off your name will not show up in such lists.",
|
||||
"options.autosaveIndicator": "Autosave Indicator",
|
||||
"options.hideLightningFlashes": "Hide Lightning Flashes",
|
||||
"options.hideLightningFlashes.tooltip": "Prevents lightning bolts from making the sky flash. The bolts themselves will still be visible.",
|
||||
"controls.keybinds": "Key Binds...",
|
||||
"controls.keybinds.title": "Key Binds",
|
||||
"item.minecraft.music_disc_otherside": "Music Disc",
|
||||
"item.minecraft.music_disc_otherside.desc": "Lena Raine - otherside",
|
||||
"subtitles.block.growing_plant.crop": "Plant cropped",
|
||||
"subtitles.item.bundle.drop_contents": "Bundle empties",
|
||||
"subtitles.item.bundle.insert": "Item packed",
|
||||
"subtitles.item.bundle.remove_one": "Item unpacked",
|
||||
"advancements.adventure.fall_from_world_height.title": "Caves & Cliffs",
|
||||
"advancements.adventure.fall_from_world_height.description": "Free fall from the top of the world (build limit) to the bottom of the world and survive",
|
||||
"advancements.adventure.play_jukebox_in_meadows.title": "Sound of Music",
|
||||
"advancements.adventure.play_jukebox_in_meadows.description": "Make the Meadows come alive with the sound of music from a jukebox",
|
||||
"advancements.adventure.trade_at_world_height.title": "Star Trader",
|
||||
"advancements.adventure.trade_at_world_height.description": "Trade with a villager at the build height limit",
|
||||
"advancements.nether.ride_strider_in_overworld_lava.title": "Feels like home",
|
||||
"advancements.nether.ride_strider_in_overworld_lava.description": "Take a Strider for a loooong ride on a lava lake in the Overworld",
|
||||
"commands.jfr.started": "JFR profiling started",
|
||||
"commands.jfr.start.failed": "Failed to start JFR profiling",
|
||||
"commands.jfr.stopped": "JFR profiling stopped and dumped to %s",
|
||||
"commands.jfr.dump.failed": "Failed to dump JFR recording: %s",
|
||||
"commands.worldborder.set.failed.far": "World border cannot be further out than %s blocks",
|
||||
"biome.minecraft.old_growth_birch_forest": "Old Growth Birch Forest",
|
||||
"biome.minecraft.old_growth_pine_taiga": "Old Growth Pine Taiga",
|
||||
"biome.minecraft.old_growth_spruce_taiga": "Old Growth Spruce Taiga",
|
||||
"biome.minecraft.frozen_peaks": "Frozen Peaks",
|
||||
"biome.minecraft.grove": "Grove",
|
||||
"biome.minecraft.jagged_peaks": "Jagged Peaks",
|
||||
"biome.minecraft.meadow": "Meadow",
|
||||
"biome.minecraft.snowy_plains": "Snowy Plains",
|
||||
"biome.minecraft.snowy_slopes": "Snowy Slopes",
|
||||
"biome.minecraft.sparse_jungle": "Sparse Jungle",
|
||||
"biome.minecraft.stony_peaks": "Stony Peaks",
|
||||
"biome.minecraft.stony_shore": "Stony Shore",
|
||||
"biome.minecraft.windswept_forest": "Windswept Forest",
|
||||
"biome.minecraft.windswept_gravelly_hills": "Windswept Gravelly Hills",
|
||||
"biome.minecraft.windswept_hills": "Windswept Hills",
|
||||
"biome.minecraft.windswept_savanna": "Windswept Savanna",
|
||||
"biome.minecraft.wooded_badlands": "Wooded Badlands"
|
||||
},
|
||||
"1.17": {
|
||||
"gui.socialInteractions.title": "Social Interactions",
|
||||
"gui.socialInteractions.tab_all": "All",
|
||||
|
||||
@@ -33,9 +33,9 @@ public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Path configDirPath = FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaBackwards");
|
||||
Path configDirPath = FabricLoader.getInstance().getConfigDir().resolve("ViaBackwards");
|
||||
configDir = configDirPath.toFile();
|
||||
this.init(configDirPath.resolve("config.yml").toFile());
|
||||
this.init(getDataFolder());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"environment": "*",
|
||||
"authors": [
|
||||
"Matsv",
|
||||
"KennyTV",
|
||||
"kennytv",
|
||||
"Gerrygames",
|
||||
"creeper123123321",
|
||||
"ForceUpdate1"
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
metadata.format.version = "1.0"
|
||||
metadata.format.version = "1.1"
|
||||
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "4.0.0-1.17-rc2-SNAPSHOT"
|
||||
viaver = "4.1.0-1.18-pre8-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
guava = "17.0"
|
||||
log4j = "2.8.1"
|
||||
|
||||
checkerQual = "3.14.0"
|
||||
checkerQual = "3.18.0"
|
||||
|
||||
# Platforms
|
||||
paper = "1.16.5-R0.1-SNAPSHOT"
|
||||
bungee = "1.16-R0.5-SNAPSHOT"
|
||||
sponge = "5.0.0"
|
||||
velocity = "3.0.0-SNAPSHOT"
|
||||
fabricLoader = "0.4.8+build.154"
|
||||
fabricLoader = "0.11.6"
|
||||
|
||||
|
||||
[libraries]
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,101 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
+1
-1
@@ -18,7 +18,7 @@ dependencyResolutionManagement {
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id("net.kyori.blossom") version "1.2.0"
|
||||
id("com.github.johnrengelman.shadow") version "7.0.0"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.logging.Logger;
|
||||
@Plugin(id = "viabackwards",
|
||||
name = "ViaBackwards",
|
||||
version = VersionInfo.VERSION,
|
||||
authors = {"Matsv", "KennyTV", "Gerrygames", "creeper123123321", "ForceUpdate1"},
|
||||
authors = {"Matsv", "kennytv", "Gerrygames", "creeper123123321", "ForceUpdate1"},
|
||||
description = "Allow older Minecraft versions to connect to a newer server version.",
|
||||
dependencies = {@Dependency(id = "viaversion")}
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.logging.Logger;
|
||||
@Plugin(id = "viabackwards",
|
||||
name = "ViaBackwards",
|
||||
version = VersionInfo.VERSION,
|
||||
authors = {"Matsv", "KennyTV", "Gerrygames", "creeper123123321", "ForceUpdate1"},
|
||||
authors = {"Matsv", "kennytv", "Gerrygames", "creeper123123321", "ForceUpdate1"},
|
||||
description = "Allow older Minecraft versions to connect to a newer server version.",
|
||||
dependencies = {@Dependency(id = "viaversion")}
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user