Merge pull request #16 from FlorianMichael/via-update

Updated Via API usage
This commit is contained in:
RK_01 2023-10-08 10:41:35 +02:00 committed by GitHub
commit 0407b1e886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View File

@ -22,8 +22,8 @@ repositories {
} }
dependencies { dependencies {
compileOnly "com.viaversion:viaversion:4.8.1" compileOnly "com.viaversion:viaversion:4.9.0-23w40a-SNAPSHOT"
compileOnly("com.viaversion:viabackwards-common:4.8.1") { compileOnly("com.viaversion:viabackwards-common:4.9.0-23w40a-SNAPSHOT") {
exclude group: "com.viaversion", module: "viaversion" exclude group: "com.viaversion", module: "viaversion"
} }
compileOnly "org.yaml:snakeyaml:2.2" compileOnly "org.yaml:snakeyaml:2.2"

View File

@ -17,6 +17,7 @@
*/ */
package net.raphimc.viaaprilfools; package net.raphimc.viaaprilfools;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.util.Config; import com.viaversion.viaversion.util.Config;
import java.io.File; import java.io.File;
@ -29,11 +30,12 @@ public class ViaAprilFoolsConfig extends Config implements net.raphimc.viaaprilf
public ViaAprilFoolsConfig(final File configFile) { public ViaAprilFoolsConfig(final File configFile) {
super(configFile); super(configFile);
Via.getManager().getConfigurationProvider().register(this);
} }
@Override @Override
public void reloadConfig() { public void reload() {
super.reloadConfig(); super.reload();
this.loadFields(); this.loadFields();
} }

View File

@ -17,6 +17,8 @@
*/ */
package net.raphimc.viaaprilfools.platform; package net.raphimc.viaaprilfools.platform;
public interface ViaAprilFoolsConfig { import com.viaversion.viaversion.api.configuration.Config;
public interface ViaAprilFoolsConfig extends Config {
} }

View File

@ -37,7 +37,7 @@ public interface ViaAprilFoolsPlatform {
default void init(final File dataFolder) { default void init(final File dataFolder) {
final ViaAprilFoolsConfig config = new ViaAprilFoolsConfig(new File(dataFolder, "viaaprilfools.yml")); final ViaAprilFoolsConfig config = new ViaAprilFoolsConfig(new File(dataFolder, "viaaprilfools.yml"));
config.reloadConfig(); config.reload();
ViaAprilFools.init(this, config); ViaAprilFools.init(this, config);
Via.getManager().getSubPlatforms().add(ViaAprilFools.IMPL_VERSION); Via.getManager().getSubPlatforms().add(ViaAprilFools.IMPL_VERSION);

View File

@ -111,7 +111,7 @@ public class EntityPackets20w14infinite {
handler(wrapper -> { handler(wrapper -> {
wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none wrapper.write(Type.BYTE, (byte) -1); // Previous gamemode, set to none
wrapper.write(Type.STRING_ARRAY, WORLD_NAMES); // World list - only used for command completion wrapper.write(Type.STRING_ARRAY, WORLD_NAMES); // World list - only used for command completion
wrapper.write(Type.NBT, EntityPackets.DIMENSIONS_TAG); // Dimension registry wrapper.write(Type.NAMED_COMPOUND_TAG, EntityPackets.DIMENSIONS_TAG); // Dimension registry
}); });
handler(DIMENSION_HANDLER); // Dimension handler(DIMENSION_HANDLER); // Dimension
map(Type.LONG); // Seed map(Type.LONG); // Seed