ViaFabric/viafabric-mc1152/src/main/java/com/viaversion/fabric/mc1152/platform/VFLoader.java

52 lines
2.2 KiB
Java

/*
* This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
* Copyright (C) 2018-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.fabric.mc1152.platform;
import com.viaversion.fabric.mc1152.providers.VFHandItemProvider;
import com.viaversion.fabric.mc1152.providers.FabricVersionProvider;
import com.viaversion.fabric.mc1152.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override
public void unload() {
// Nothing to do
}
}