Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-10-03 08:41:05 +02:00
Add tooltip_order and manually add curse enchantment tags
Dieser Commit ist enthalten in:
Ursprung
009e2deed1
Commit
67a349d74b
@ -32,7 +32,8 @@ public enum RegistryType {
|
|||||||
ITEM("item"),
|
ITEM("item"),
|
||||||
FLUID("fluid"),
|
FLUID("fluid"),
|
||||||
ENTITY("entity_type"),
|
ENTITY("entity_type"),
|
||||||
GAME_EVENT("game_event");
|
GAME_EVENT("game_event"),
|
||||||
|
ENCHANTMENT("enchantment");
|
||||||
|
|
||||||
private static final Map<String, RegistryType> MAP = new HashMap<>();
|
private static final Map<String, RegistryType> MAP = new HashMap<>();
|
||||||
private static final RegistryType[] VALUES = values();
|
private static final RegistryType[] VALUES = values();
|
||||||
|
@ -214,6 +214,7 @@ public final class Protocol1_20_5To1_21 extends AbstractProtocol<ClientboundPack
|
|||||||
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:blocks_wind_charge_explosions");
|
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:blocks_wind_charge_explosions");
|
||||||
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:can_turn_in_boats", "minecraft:deflects_projectiles", "minecraft:immune_to_infested",
|
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:can_turn_in_boats", "minecraft:deflects_projectiles", "minecraft:immune_to_infested",
|
||||||
"minecraft:immune_to_oozing", "minecraft:no_anger_from_wind_charge");
|
"minecraft:immune_to_oozing", "minecraft:no_anger_from_wind_charge");
|
||||||
|
tagRewriter.addTag(RegistryType.ENCHANTMENT, "minecraft:curse", 10, 41); // Binding and vanishing curse
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,11 +40,11 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
|
|
||||||
public class TagRewriter<C extends ClientboundPacketType> implements com.viaversion.viaversion.api.rewriter.TagRewriter {
|
public class TagRewriter<C extends ClientboundPacketType> implements com.viaversion.viaversion.api.rewriter.TagRewriter {
|
||||||
private static final int[] EMPTY_ARRAY = {};
|
private static final int[] EMPTY_ARRAY = {};
|
||||||
private final Protocol<C, ?, ?, ?> protocol;
|
private final Map<RegistryType, List<TagData>> toAdd = new EnumMap<>(RegistryType.class);
|
||||||
private final Map<RegistryType, List<TagData>> newTags = new EnumMap<>(RegistryType.class);
|
|
||||||
private final Map<RegistryType, Map<String, String>> toRename = new EnumMap<>(RegistryType.class);
|
private final Map<RegistryType, Map<String, String>> toRename = new EnumMap<>(RegistryType.class);
|
||||||
private final Map<RegistryType, Set<String>> toRemove = new EnumMap<>(RegistryType.class);
|
private final Map<RegistryType, Set<String>> toRemove = new EnumMap<>(RegistryType.class);
|
||||||
private final Set<String> toRemoveRegistries = new HashSet<>();
|
private final Set<String> toRemoveRegistries = new HashSet<>();
|
||||||
|
private final Protocol<C, ?, ?, ?> protocol;
|
||||||
|
|
||||||
public TagRewriter(final Protocol<C, ?, ?, ?> protocol) {
|
public TagRewriter(final Protocol<C, ?, ?, ?> protocol) {
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
@ -56,6 +56,7 @@ public class TagRewriter<C extends ClientboundPacketType> implements com.viavers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Tags for player synchronized registries
|
||||||
for (RegistryType type : RegistryType.getValues()) {
|
for (RegistryType type : RegistryType.getValues()) {
|
||||||
List<TagData> tags = protocol.getMappingData().getTags(type);
|
List<TagData> tags = protocol.getMappingData().getTags(type);
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
@ -235,12 +236,12 @@ public class TagRewriter<C extends ClientboundPacketType> implements com.viavers
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable List<TagData> getNewTags(RegistryType tagType) {
|
public @Nullable List<TagData> getNewTags(RegistryType tagType) {
|
||||||
return newTags.get(tagType);
|
return toAdd.get(tagType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TagData> getOrComputeNewTags(RegistryType tagType) {
|
public List<TagData> getOrComputeNewTags(RegistryType tagType) {
|
||||||
return newTags.computeIfAbsent(tagType, type -> new ArrayList<>());
|
return toAdd.computeIfAbsent(tagType, type -> new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable IdRewriteFunction getRewriter(RegistryType tagType) {
|
public @Nullable IdRewriteFunction getRewriter(RegistryType tagType) {
|
||||||
@ -249,6 +250,7 @@ public class TagRewriter<C extends ClientboundPacketType> implements com.viavers
|
|||||||
case BLOCK -> mappingData != null && mappingData.getBlockMappings() != null ? mappingData::getNewBlockId : null;
|
case BLOCK -> mappingData != null && mappingData.getBlockMappings() != null ? mappingData::getNewBlockId : null;
|
||||||
case ITEM -> mappingData != null && mappingData.getItemMappings() != null ? mappingData::getNewItemId : null;
|
case ITEM -> mappingData != null && mappingData.getItemMappings() != null ? mappingData::getNewItemId : null;
|
||||||
case ENTITY -> protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null;
|
case ENTITY -> protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null;
|
||||||
|
case ENCHANTMENT -> mappingData != null && mappingData.getEnchantmentMappings() != null ? id -> mappingData.getEnchantmentMappings().getNewId(id) : null;
|
||||||
case FLUID, GAME_EVENT -> null;
|
case FLUID, GAME_EVENT -> null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Binäre Datei nicht angezeigt.
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren