diff --git a/src/main/java/net/raphimc/viaaprilfools/api/AprilFoolsMappings.java b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java similarity index 83% rename from src/main/java/net/raphimc/viaaprilfools/api/AprilFoolsMappings.java rename to src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java index d566530..ee51400 100644 --- a/src/main/java/net/raphimc/viaaprilfools/api/AprilFoolsMappings.java +++ b/src/main/java/net/raphimc/viaaprilfools/api/data/AprilFoolsMappings.java @@ -15,9 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package net.raphimc.viaaprilfools.api; +package net.raphimc.viaaprilfools.api.data; -import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader; import com.viaversion.viabackwards.api.data.BackwardsMappings; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; @@ -28,24 +27,23 @@ import java.util.logging.Logger; public class AprilFoolsMappings extends BackwardsMappings { - private static final BackwardsMappingDataLoader LOADER = new BackwardsMappingDataLoader(AprilFoolsMappings.class, "assets/viaaprilfools/data/"); - public AprilFoolsMappings(String unmappedVersion, String mappedVersion, @Nullable Class> vvProtocolClass) { super(unmappedVersion, mappedVersion, vvProtocolClass); } @Override protected @Nullable CompoundTag readMappingsFile(String name) { - return LOADER.loadNBTFromDir(name); + return VAFMappingDataLoader.INSTANCE.loadNBTFromDir(name); } @Override protected @Nullable CompoundTag readUnmappedIdentifiersFile(String name) { - return LOADER.loadNBT(name, true); + return VAFMappingDataLoader.INSTANCE.loadNBT(name, true); } @Override protected Logger getLogger() { return ViaAprilFools.getPlatform().getLogger(); } + } diff --git a/src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java b/src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java new file mode 100644 index 0000000..1173c56 --- /dev/null +++ b/src/main/java/net/raphimc/viaaprilfools/api/data/VAFMappingDataLoader.java @@ -0,0 +1,44 @@ +/* + * This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools + * Copyright (C) 2021-2024 RK_01/RaphiMC 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 . + */ +package net.raphimc.viaaprilfools.api.data; + +import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader; +import net.raphimc.viaaprilfools.ViaAprilFools; + +import java.io.File; +import java.util.logging.Logger; + +public class VAFMappingDataLoader extends BackwardsMappingDataLoader { + + public static final VAFMappingDataLoader INSTANCE = new VAFMappingDataLoader(); + + public VAFMappingDataLoader() { + super(AprilFoolsMappings.class, "assets/viaaprilfools/data/"); + } + + @Override + public File getDataFolder() { + return ViaAprilFools.getPlatform().getDataFolder(); + } + + @Override + public Logger getLogger() { + return ViaAprilFools.getPlatform().getLogger(); + } + +} diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java index c864457..cead5c2 100644 --- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java +++ b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_14to3D_Shareware/Protocol1_14to3D_Shareware.java @@ -28,7 +28,7 @@ import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14; -import net.raphimc.viaaprilfools.api.AprilFoolsMappings; +import net.raphimc.viaaprilfools.api.data.AprilFoolsMappings; import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets.BlockItemPackets3D_Shareware; import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.packets.EntityPackets3D_Shareware; import net.raphimc.viaaprilfools.protocols.protocol1_14to3D_Shareware.storage.ChunkCenterTracker3D_Shareware; diff --git a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java index 4a6f963..eb40a3d 100644 --- a/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java +++ b/src/main/java/net/raphimc/viaaprilfools/protocols/protocol1_16to20w14infinite/Protocol1_16to20w14infinite.java @@ -35,7 +35,7 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerA import com.viaversion.viaversion.rewriter.RecipeRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; -import net.raphimc.viaaprilfools.api.AprilFoolsMappings; +import net.raphimc.viaaprilfools.api.data.AprilFoolsMappings; import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.metadata.MetadataRewriter1_16to20w14infinite; import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets.BlockItemPackets20w14infinite; import net.raphimc.viaaprilfools.protocols.protocol1_16to20w14infinite.packets.EntityPackets20w14infinite;