Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 21:32:52 +02:00
Ursprung
b339216533
Commit
3e01afbe17
@ -19,11 +19,11 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
|
|||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
|
|
||||||
public class BannerHandler implements BackwardsBlockEntityHandler {
|
public class BannerHandler implements BackwardsBlockEntityHandler {
|
||||||
private final int WALL_BANNER_START = 7110; // 4 each
|
private static final int WALL_BANNER_START = 7110; // 4 each
|
||||||
private final int WALL_BANNER_STOP = 7173;
|
private static final int WALL_BANNER_STOP = 7173;
|
||||||
|
|
||||||
private final int BANNER_START = 6854; // 16 each
|
private static final int BANNER_START = 6854; // 16 each
|
||||||
private final int BANNER_STOP = 7109;
|
private static final int BANNER_STOP = 7109;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {
|
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {
|
||||||
|
@ -16,12 +16,13 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ByteTag;
|
|||||||
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
|
||||||
public class SkullHandler implements BackwardsBlockEntityHandler {
|
public class SkullHandler implements BackwardsBlockEntityHandler {
|
||||||
private final int SKULL_START = 5447;
|
private static final int SKULL_START = 5447;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {
|
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {
|
||||||
int pos = (blockId - SKULL_START) % 20;
|
int diff = blockId - SKULL_START;
|
||||||
byte type = (byte) Math.floor((blockId - SKULL_START) / 20);
|
int pos = diff % 20;
|
||||||
|
byte type = (byte) Math.floor(diff / 20f);
|
||||||
|
|
||||||
// Set type
|
// Set type
|
||||||
tag.put(new ByteTag("SkullType", type));
|
tag.put(new ByteTag("SkullType", type));
|
||||||
|
@ -36,18 +36,6 @@ public class BackwardsMappings {
|
|||||||
blockMappings = new BlockMappingsShortArray(mapping1_13.getAsJsonObject("blocks"), mapping1_12.getAsJsonObject("blocks"), mapping1_12_2to1_13.getAsJsonObject("blockstates"));
|
blockMappings = new BlockMappingsShortArray(mapping1_13.getAsJsonObject("blocks"), mapping1_12.getAsJsonObject("blocks"), mapping1_12_2to1_13.getAsJsonObject("blockstates"));
|
||||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.13 -> 1.12.2 sound mapping...");
|
ViaBackwards.getPlatform().getLogger().info("Loading 1.13 -> 1.12.2 sound mapping...");
|
||||||
soundMappings = new VBMappings(mapping1_13.getAsJsonArray("sounds"), mapping1_12.getAsJsonArray("sounds"), mapping1_12_2to1_13.getAsJsonObject("sounds"));
|
soundMappings = new VBMappings(mapping1_13.getAsJsonArray("sounds"), mapping1_12.getAsJsonArray("sounds"), mapping1_12_2to1_13.getAsJsonObject("sounds"));
|
||||||
|
|
||||||
/*
|
|
||||||
// Simulate some trident sounds
|
|
||||||
SOUNDS[628] = 138; // throw -> shoot
|
|
||||||
SOUNDS[629] = 137; // hit -> hit_player
|
|
||||||
SOUNDS[630] = 137; // hit_ground -> hit
|
|
||||||
SOUNDS[631] = 139; // riptide_1 -> shoot
|
|
||||||
SOUNDS[632] = 139; // riptide_2
|
|
||||||
SOUNDS[633] = 139; // riptide_3
|
|
||||||
SOUNDS[634] = 139; // throw -> shoot
|
|
||||||
// no fitting thunder remap
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has lots of compat layers, so we can't use the default Via method
|
// Has lots of compat layers, so we can't use the default Via method
|
||||||
@ -55,6 +43,7 @@ public class BackwardsMappings {
|
|||||||
for (Map.Entry<String, JsonElement> entry : newIdentifiers.entrySet()) {
|
for (Map.Entry<String, JsonElement> entry : newIdentifiers.entrySet()) {
|
||||||
String key = entry.getValue().getAsString();
|
String key = entry.getValue().getAsString();
|
||||||
Map.Entry<String, JsonElement> value = MappingDataLoader.findValue(oldIdentifiers, key);
|
Map.Entry<String, JsonElement> value = MappingDataLoader.findValue(oldIdentifiers, key);
|
||||||
|
short hardId = -1;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
JsonPrimitive replacement = mapping.getAsJsonPrimitive(key);
|
JsonPrimitive replacement = mapping.getAsJsonPrimitive(key);
|
||||||
if (replacement == null && key.contains("[")) {
|
if (replacement == null && key.contains("[")) {
|
||||||
@ -63,6 +52,7 @@ public class BackwardsMappings {
|
|||||||
if (replacement != null) {
|
if (replacement != null) {
|
||||||
if (replacement.getAsString().startsWith("id:")) {
|
if (replacement.getAsString().startsWith("id:")) {
|
||||||
String id = replacement.getAsString().replace("id:", "");
|
String id = replacement.getAsString().replace("id:", "");
|
||||||
|
hardId = Short.parseShort(id);
|
||||||
value = MappingDataLoader.findValue(oldIdentifiers, oldIdentifiers.getAsJsonPrimitive(id).getAsString());
|
value = MappingDataLoader.findValue(oldIdentifiers, oldIdentifiers.getAsJsonPrimitive(id).getAsString());
|
||||||
} else {
|
} else {
|
||||||
value = MappingDataLoader.findValue(oldIdentifiers, replacement.getAsString());
|
value = MappingDataLoader.findValue(oldIdentifiers, replacement.getAsString());
|
||||||
@ -79,7 +69,7 @@ public class BackwardsMappings {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output[Integer.parseInt(entry.getKey())] = Short.parseShort(value.getKey());
|
output[Integer.parseInt(entry.getKey())] = hardId != -1 ? hardId : Short.parseShort(value.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren