3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-26 17:08:05 +02:00

Fix skull rotation

Fixes #121
Dieser Commit ist enthalten in:
KennyTV 2019-12-30 14:24:44 +01:00
Ursprung b339216533
Commit 3e01afbe17
3 geänderte Dateien mit 11 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -19,11 +19,11 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
public class BannerHandler implements BackwardsBlockEntityHandler {
private final int WALL_BANNER_START = 7110; // 4 each
private final int WALL_BANNER_STOP = 7173;
private static final int WALL_BANNER_START = 7110; // 4 each
private static final int WALL_BANNER_STOP = 7173;
private final int BANNER_START = 6854; // 16 each
private final int BANNER_STOP = 7109;
private static final int BANNER_START = 6854; // 16 each
private static final int BANNER_STOP = 7109;
@Override
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {

Datei anzeigen

@ -16,12 +16,13 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ByteTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
public class SkullHandler implements BackwardsBlockEntityHandler {
private final int SKULL_START = 5447;
private static final int SKULL_START = 5447;
@Override
public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) {
int pos = (blockId - SKULL_START) % 20;
byte type = (byte) Math.floor((blockId - SKULL_START) / 20);
int diff = blockId - SKULL_START;
int pos = diff % 20;
byte type = (byte) Math.floor(diff / 20f);
// Set type
tag.put(new ByteTag("SkullType", type));

Datei anzeigen

@ -36,18 +36,6 @@ public class BackwardsMappings {
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...");
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
@ -55,6 +43,7 @@ public class BackwardsMappings {
for (Map.Entry<String, JsonElement> entry : newIdentifiers.entrySet()) {
String key = entry.getValue().getAsString();
Map.Entry<String, JsonElement> value = MappingDataLoader.findValue(oldIdentifiers, key);
short hardId = -1;
if (value == null) {
JsonPrimitive replacement = mapping.getAsJsonPrimitive(key);
if (replacement == null && key.contains("[")) {
@ -63,6 +52,7 @@ public class BackwardsMappings {
if (replacement != null) {
if (replacement.getAsString().startsWith("id:")) {
String id = replacement.getAsString().replace("id:", "");
hardId = Short.parseShort(id);
value = MappingDataLoader.findValue(oldIdentifiers, oldIdentifiers.getAsJsonPrimitive(id).getAsString());
} else {
value = MappingDataLoader.findValue(oldIdentifiers, replacement.getAsString());
@ -79,7 +69,7 @@ public class BackwardsMappings {
continue;
}
}
output[Integer.parseInt(entry.getKey())] = Short.parseShort(value.getKey());
output[Integer.parseInt(entry.getKey())] = hardId != -1 ? hardId : Short.parseShort(value.getKey());
}
}