/
minecraftbackup
/
ViaBackwards
Обзор
Документация
Войти
/
minecraftbackup
/
ViaBackwards
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
common/src/main/java/com/viaversion/viabackwards/api/BackwardsProtocol.java
72 строки
3 KB
Nassim Jahnke
Handle item changes in show item text components
12 июн 2024, 19:08
Не верифицирован
12 июн 2024, 19:08
a9b9c48
Код
Авторство
О чём код?
/* * This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards * Copyright (C) 2016-2024 ViaVersion and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.viaversion.viabackwards.api; import com.viaversion.viabackwards.api.data.BackwardsMappingData; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; import org.checkerframework.checker.nullness.qual.Nullable; public abstract class BackwardsProtocol<CU extends ClientboundPacketType, CM extends ClientboundPacketType, SM extends ServerboundPacketType, SU extends ServerboundPacketType> extends AbstractProtocol<CU, CM, SM, SU> { protected BackwardsProtocol() { } protected BackwardsProtocol(@Nullable Class<CU> oldClientboundPacketEnum, @Nullable Class<CM> clientboundPacketEnum, @Nullable Class<SM> oldServerboundPacketEnum, @Nullable Class<SU> serverboundPacketEnum) { super(oldClientboundPacketEnum, clientboundPacketEnum, oldServerboundPacketEnum, serverboundPacketEnum); } /** * Waits for the given protocol to be loaded to then asynchronously execute the runnable for this protocol. */ protected void executeAsyncAfterLoaded(Class<? extends Protocol> protocolClass, Runnable runnable) { Via.getManager().getProtocolManager().addMappingLoaderFuture(getClass(), protocolClass, runnable); } @Override protected void registerPackets() { super.registerPackets(); final BackwardsMappingData mappingData = getMappingData(); if (mappingData != null && mappingData.getViaVersionProtocolClass() != null) { executeAsyncAfterLoaded(mappingData.getViaVersionProtocolClass(), this::loadMappingData); } } @Override public boolean hasMappingDataToLoad() { // Manually load them later, since they depend on VV's mappings return false; } @Override public @Nullable BackwardsMappingData getMappingData() { // Change return type to BackwardsMappings return null; } @Override public @Nullable TranslatableRewriter<CU> getComponentRewriter() { return null; } }