Skip to content

Commit

Permalink
Updated Via API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Mar 25, 2024
1 parent 315e81c commit c1b7418
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* 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 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;
Expand All @@ -28,24 +27,23 @@

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<? extends Protocol<?, ?, ?, ?>> 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();
}

}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
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;
Expand Down

0 comments on commit c1b7418

Please sign in to comment.