3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 05:20:10 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-03-27 20:48:17 +01:00
Ursprung 9beaf71196
Commit 41b04f9902
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
6 geänderte Dateien mit 36 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -95,7 +95,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
// Set custom name - only done if there is no original one
if (!data.contains(StructuredDataKey.CUSTOM_NAME)) {
data.set(StructuredDataKey.CUSTOM_NAME, mappedItem.tagName());
tag.putBoolean(nbtTagName + "|customName", true);
tag.putBoolean(getNbtTagName() + "|customName", true);
}
return item;
}
@ -152,7 +152,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
}
// Remove custom name
if (customData.value().remove(nbtTagName + "|customName") != null) {
if (customData.value().remove(getNbtTagName() + "|customName") != null) {
data.remove(StructuredDataKey.CUSTOM_NAME);
} else {
final Tag name = removeBackupTag(customData.value(), "Name");
@ -163,13 +163,13 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
}
protected void saveTag(CompoundTag customData, Tag tag, String name) {
String backupName = nbtTagName + "|o" + name;
String backupName = getNbtTagName() + "|o" + name;
if (!customData.contains(backupName)) {
customData.put(backupName, tag);
}
}
protected @Nullable Tag removeBackupTag(CompoundTag customData, String tagName) {
return customData.remove(nbtTagName + "|o" + tagName);
return customData.remove(getNbtTagName() + "|o" + tagName);
}
}

Datei anzeigen

@ -123,7 +123,22 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
wrapper.write(Type.BOOLEAN, wrapper.user().get(SecureChatStorage.class).enforcesSecureChat());
});
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED, wrapper -> {
System.out.println(wrapper.passthrough(Type.STRING)); // Command
wrapper.passthrough(Type.LONG); // Timestamp
wrapper.passthrough(Type.LONG); // Salt
final Integer passthrough = wrapper.passthrough(Type.VAR_INT);
System.out.println(passthrough);
if (passthrough != 0) {
return;
}
System.out.println(wrapper.passthrough(Type.VAR_INT));
System.out.println(wrapper.passthrough(Type.ACKNOWLEDGED_BIT_SET));
});
registerClientbound(State.LOGIN, ClientboundLoginPackets.COOKIE_REQUEST.getId(), -1, wrapper -> handleCookieRequest(wrapper, ServerboundLoginPackets.COOKIE_RESPONSE));
cancelClientbound(ClientboundConfigurationPackets1_20_5.RESET_CHAT); // Old clients already reset chat when entering the configuration phase
registerClientbound(ClientboundConfigurationPackets1_20_5.COOKIE_REQUEST, null, wrapper -> handleCookieRequest(wrapper, ServerboundConfigurationPackets1_20_5.COOKIE_RESPONSE));
registerClientbound(ClientboundConfigurationPackets1_20_5.STORE_COOKIE, null, this::handleStoreCookie);
registerClientbound(ClientboundConfigurationPackets1_20_5.TRANSFER, null, this::handleTransfer);

Datei anzeigen

@ -101,7 +101,9 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
Preconditions.checkNotNull(entry.tag(), "Server unexpectedly sent null dimension data for " + entry.key());
final String dimensionKey = Key.stripMinecraftNamespace(entry.key());
dimensionDataMap.put(dimensionKey, new DimensionDataImpl(i, (CompoundTag) entry.tag()));
final CompoundTag tag = (CompoundTag) entry.tag();
updateDimensionTypeData(tag);
dimensionDataMap.put(dimensionKey, new DimensionDataImpl(i, tag));
keys[i] = dimensionKey;
}
registryDataStorage.setDimensionKeys(keys);
@ -246,6 +248,16 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
});
}
private void updateDimensionTypeData(final CompoundTag elementTag) {
final CompoundTag monsterSpawnLightLevel = elementTag.getCompoundTag("monster_spawn_light_level");
if (monsterSpawnLightLevel != null) {
final CompoundTag value = new CompoundTag();
monsterSpawnLightLevel.put("value", value);
value.putInt("min_inclusive", monsterSpawnLightLevel.getInt("min_inclusive"));
value.putInt("max_inclusive", monsterSpawnLightLevel.getInt("max_inclusive"));
}
}
@Override
protected void registerRewrites() {
filter().mapMetaType(typeId -> {
@ -289,6 +301,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
filter().type(EntityTypes1_20_5.LLAMA).addIndex(20); // Carpet color
filter().type(EntityTypes1_20_5.ARMADILLO).removeIndex(17); // State
filter().type(EntityTypes1_20_5.WOLF).removeIndex(22); // Wolf variant
filter().type(EntityTypes1_20_5.OMINOUS_ITEM_SPAWNER).removeIndex(8); // Item
}
@Override
@ -306,6 +319,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
mapEntityTypeWithData(EntityTypes1_20_5.ARMADILLO, EntityTypes1_20_5.COW).tagName();
mapEntityTypeWithData(EntityTypes1_20_5.BOGGED, EntityTypes1_20_5.STRAY).tagName();
mapEntityTypeWithData(EntityTypes1_20_5.BREEZE_WIND_CHARGE, EntityTypes1_20_5.WIND_CHARGE);
mapEntityTypeWithData(EntityTypes1_20_5.OMINOUS_ITEM_SPAWNER, EntityTypes1_20_5.TEXT_DISPLAY);
}
@Override

Datei anzeigen

@ -1,4 +1,4 @@
projectVersion=4.10.0-24w12a-SNAPSHOT
projectVersion=4.10.0-24w13a-SNAPSHOT
# Smile emoji
mcVersions=1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.10.0-24w11a-SNAPSHOT"
viaver = "4.10.0-24w13a-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"