mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2025-01-06 19:28:33 +01:00
Map first float of 1.21.4 custom model data as int for 1.21.3 clients (#942)
This commit is contained in:
parent
0dc7b471b8
commit
b214235c04
@ -37,6 +37,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
|||||||
private boolean bedrockAtY0;
|
private boolean bedrockAtY0;
|
||||||
private boolean sculkShriekersToCryingObsidian;
|
private boolean sculkShriekersToCryingObsidian;
|
||||||
private boolean mapDarknessEffect;
|
private boolean mapDarknessEffect;
|
||||||
|
private boolean mapCustomModelData;
|
||||||
private boolean suppressEmulationWarnings;
|
private boolean suppressEmulationWarnings;
|
||||||
|
|
||||||
public ViaBackwardsConfig(File configFile, Logger logger) {
|
public ViaBackwardsConfig(File configFile, Logger logger) {
|
||||||
@ -59,6 +60,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
|||||||
bedrockAtY0 = getBoolean("bedrock-at-y-0", false);
|
bedrockAtY0 = getBoolean("bedrock-at-y-0", false);
|
||||||
sculkShriekersToCryingObsidian = getBoolean("sculk-shriekers-to-crying-obsidian", false);
|
sculkShriekersToCryingObsidian = getBoolean("sculk-shriekers-to-crying-obsidian", false);
|
||||||
mapDarknessEffect = getBoolean("map-darkness-effect", true);
|
mapDarknessEffect = getBoolean("map-darkness-effect", true);
|
||||||
|
mapCustomModelData = getBoolean("map-custom-model-data", true);
|
||||||
suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false);
|
suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +109,11 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
|
|||||||
return mapDarknessEffect;
|
return mapDarknessEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mapCustomModelData() {
|
||||||
|
return mapCustomModelData;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean suppressEmulationWarnings() {
|
public boolean suppressEmulationWarnings() {
|
||||||
return suppressEmulationWarnings;
|
return suppressEmulationWarnings;
|
||||||
|
@ -85,6 +85,13 @@ public interface ViaBackwardsConfig extends Config {
|
|||||||
*/
|
*/
|
||||||
boolean mapDarknessEffect();
|
boolean mapDarknessEffect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If enabled, 1.21.3 clients will receive the first float of 1.21.4+ custom model data as int. Disable if you handle this change yourself.
|
||||||
|
*
|
||||||
|
* @return true if enabled
|
||||||
|
*/
|
||||||
|
boolean mapCustomModelData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
|
* Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
|
||||||
*
|
*
|
||||||
|
@ -22,6 +22,7 @@ import com.viaversion.nbt.tag.CompoundTag;
|
|||||||
import com.viaversion.nbt.tag.IntArrayTag;
|
import com.viaversion.nbt.tag.IntArrayTag;
|
||||||
import com.viaversion.nbt.tag.ListTag;
|
import com.viaversion.nbt.tag.ListTag;
|
||||||
import com.viaversion.nbt.tag.StringTag;
|
import com.viaversion.nbt.tag.StringTag;
|
||||||
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.rewriters.BackwardsStructuredItemRewriter;
|
import com.viaversion.viabackwards.api.rewriters.BackwardsStructuredItemRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.v1_21_4to1_21_2.Protocol1_21_4To1_21_2;
|
import com.viaversion.viabackwards.protocol.v1_21_4to1_21_2.Protocol1_21_4To1_21_2;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
@ -95,6 +96,11 @@ public final class BlockItemPacketRewriter1_21_4 extends BackwardsStructuredItem
|
|||||||
final CustomModelData1_21_4 modelData = dataContainer.get(StructuredDataKey.CUSTOM_MODEL_DATA1_21_4);
|
final CustomModelData1_21_4 modelData = dataContainer.get(StructuredDataKey.CUSTOM_MODEL_DATA1_21_4);
|
||||||
if (modelData != null) {
|
if (modelData != null) {
|
||||||
saveTag(createCustomTag(item), customModelDataToTag(modelData), "custom_model_data");
|
saveTag(createCustomTag(item), customModelDataToTag(modelData), "custom_model_data");
|
||||||
|
if (ViaBackwards.getConfig().mapCustomModelData() && modelData.floats().length > 0) {
|
||||||
|
// Put first float as old custom model data as this is the most common replacement
|
||||||
|
final int data = (int) modelData.floats()[0];
|
||||||
|
dataContainer.set(StructuredDataKey.CUSTOM_MODEL_DATA1_20_5, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
downgradeItemData(item);
|
downgradeItemData(item);
|
||||||
|
@ -31,5 +31,8 @@ sculk-shriekers-to-crying-obsidian: true
|
|||||||
# Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers.
|
# Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers.
|
||||||
map-darkness-effect: true
|
map-darkness-effect: true
|
||||||
#
|
#
|
||||||
|
# If enabled, 1.21.3 clients will receive the first float of 1.21.4+ custom model data as int. Disable if you handle this change yourself.
|
||||||
|
map-custom-model-data: true
|
||||||
|
#
|
||||||
# Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
|
# Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
|
||||||
suppress-emulation-warnings: false
|
suppress-emulation-warnings: false
|
||||||
|
Loading…
Reference in New Issue
Block a user