Skip to content

Commit

Permalink
fix crash on newer neoforge version
Browse files Browse the repository at this point in the history
closes #29
  • Loading branch information
MelanX committed Jun 24, 2024
1 parent 18014f5 commit f448925
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
13 changes: 1 addition & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,13 @@ import javax.xml.parsers.DocumentBuilderFactory
import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets

//buildscript {
// apply from: 'https://moddingx.github.io/ModUtils/v5/buildscript.gradle', to: buildscript
//}
//
//apply from: 'https://moddingx.github.io/ModUtils/v5/mod.gradle'
//apply plugin: 'org.moddingx.modgradle.cursedep'
//
//dependencies {
// implementation curse.mod(325235, 4886408)
//}

plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
id 'net.darkhax.curseforgegradle' version '1.1.18'
id 'com.modrinth.minotaur' version '2.+'
id 'net.neoforged.moddev' version '0.1.94'
id 'net.neoforged.moddev' version '[0.1,0.2)'
}

version = getVersion(minecraft_version + "-" + base_version, new URL(remote_maven + "/" + group.replace('.', '/') + "/" + name + "/maven-metadata.xml"))
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ org.gradle.caching=true
org.gradle.configuration-cache=true

## Mappings
parchment_minecraft_version=1.20.6
parchment_mappings_version=2024.06.02
parchment_minecraft_version=1.21
parchment_mappings_version=2024.06.23

## Loader Properties
minecraft_version=1.21
neo_version=21.0.0-beta
loader_version_range=[2,)
neo_version=21.0.31-beta
loader_version_range=[4,)

## Mod Properties
modid=simplebackups
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/de/melanx/simplebackups/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import de.melanx.simplebackups.config.ServerConfig;
import de.melanx.simplebackups.network.Pause;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
Expand All @@ -31,9 +31,7 @@ public void registerCommands(RegisterCommandsEvent event) {

@SubscribeEvent
public void onServerTick(LevelTickEvent.Post event) {
//noinspection ConstantConditions
Level level = event.getLevel();
if (!level.isClientSide
if (event.getLevel() instanceof ServerLevel level && !level.isClientSide
&& level.getGameTime() % 20 == 0 && level == level.getServer().overworld()) {
if (!level.getServer().getPlayerList().getPlayers().isEmpty() || this.doBackup || CommonConfig.doNoPlayerBackups()) {
this.doBackup = false;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
public net.minecraft.server.MinecraftServer storageSource
public net.minecraft.server.network.ServerCommonPacketListenerImpl connection
public net.minecraft.world.level.storage.LevelStorageSource$LevelStorageAccess checkLock()V
public net.minecraft.world.level.storage.LevelStorageSource$LevelStorageAccess levelId

0 comments on commit f448925

Please sign in to comment.