mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-28 04:27:25 +02:00
added ViaLoadingBaseBuilderCallback
This commit is contained in:
parent
5515d4eefc
commit
34c3a77e48
1
.github/DEVELOPER_API.md
vendored
1
.github/DEVELOPER_API.md
vendored
@ -21,6 +21,7 @@ public class ViaFabricPlusExampleAddon implements ClientModInitializer {
|
||||
| LoadClassicProtocolExtensionCallback | Called when the classic server sends the protocol extensions (only in **c0.30 CPE**) |
|
||||
| PreLoadCallback | Called before everything (Pre-pre load) |
|
||||
| SkipIdlePacketCallback | Called as soon as the idle packet is skipped in the <= 1.8 |
|
||||
| ViaLoadingBaseBuilderCallback | Called when Via* is initialized |
|
||||
|
||||
### General API
|
||||
#### Get the release version of an material:
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD 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 de.florianmichael.viafabricplus.event;
|
||||
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
||||
public interface ViaLoadingBaseBuilderCallback {
|
||||
|
||||
Event<ViaLoadingBaseBuilderCallback> EVENT = EventFactory.createArrayBacked(ViaLoadingBaseBuilderCallback.class, listeners -> builder -> {
|
||||
for (ViaLoadingBaseBuilderCallback listener : listeners) {
|
||||
listener.onBuildViaLoadingBase(builder);
|
||||
}
|
||||
});
|
||||
|
||||
void onBuildViaLoadingBase(final ViaLoadingBase.ViaLoadingBaseBuilder builder);
|
||||
}
|
@ -29,6 +29,7 @@ import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.v1_19_0.provider.CommandArgumentsProvider;
|
||||
import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.event.FinishViaLoadingBaseStartupCallback;
|
||||
import de.florianmichael.viafabricplus.event.ViaLoadingBaseBuilderCallback;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLBPipeline;
|
||||
import de.florianmichael.viafabricplus.protocolhack.platform.ViaAprilFoolsPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.platform.ViaBedrockPlatformImpl;
|
||||
@ -164,6 +165,7 @@ public class ProtocolHack {
|
||||
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
|
||||
});
|
||||
builder = builder.onProtocolReload(protocolVersion -> ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(protocolVersion));
|
||||
ViaLoadingBaseBuilderCallback.EVENT.invoker().onBuildViaLoadingBase(builder);
|
||||
builder.build();
|
||||
|
||||
FinishViaLoadingBaseStartupCallback.EVENT.invoker().onFinishViaLoadingBaseStartup();
|
||||
|
@ -30,7 +30,6 @@ import de.florianmichael.vialoadingbase.netty.VLBPipeline;
|
||||
import de.florianmichael.vialoadingbase.netty.event.CompressionReorderEvent;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import net.lenni0451.reflect.stream.RStream;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.netty.BatchLengthCodec;
|
||||
import net.raphimc.viabedrock.netty.PacketEncapsulationCodec;
|
||||
@ -121,7 +120,7 @@ public class ViaFabricPlusVLBPipeline extends VLBPipeline {
|
||||
if (evt.getClass().getName().equals("me.steinborn.krypton.mod.shared.misc.KryptonPipelineEvent")) {
|
||||
if (evt.toString().equals("COMPRESSION_ENABLED")) {
|
||||
super.userEventTriggered(ctx, new CompressionReorderEvent());
|
||||
ViaFabricPlus.LOGGER.info("Compression has been re-sorted after \"Krypton\"");
|
||||
ViaFabricPlus.LOGGER.info("Compression has been re-ordered after \"Krypton\"");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user