Skip to content

Commit 96e4dfa

Browse files
committed
Refuse to load pokecube on broken java version
this forces a crash, with an error message explaining why.
1 parent 2744940 commit 96e4dfa

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/main/java/pokecube/core/PokecubeCore.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package pokecube.core;
22

3-
import java.util.Map;
4-
5-
import javax.annotation.Nullable;
6-
73
import com.google.common.collect.Maps;
84
import com.mojang.serialization.Codec;
9-
105
import net.minecraft.core.Registry;
116
import net.minecraft.core.particles.ParticleOptions;
127
import net.minecraft.resources.ResourceLocation;
@@ -87,6 +82,9 @@
8782
import thut.core.common.network.PacketHandler;
8883
import thut.wearables.ThutWearables;
8984

85+
import javax.annotation.Nullable;
86+
import java.util.Map;
87+
9088
@Mod(value = PokecubeCore.MODID)
9189
public class PokecubeCore
9290
{
@@ -219,8 +217,8 @@ public static Config getConfig()
219217
}
220218

221219
/**
222-
* For pokemob type mobs, this returns the pokedex entry for the
223-
* corresponding entity type, for other mobs it returns null.
220+
* For pokemob type mobs, this returns the pokedex entry for the corresponding entity type, for other mobs it
221+
* returns null.
224222
*
225223
* @param type
226224
* @return
@@ -307,6 +305,14 @@ public PokecubeCore()
307305

308306
private void loadComplete(final FMLLoadCompleteEvent event)
309307
{
308+
var version = Runtime.version();
309+
if (version.feature() == 17 && version.update() >= 8 && version.update() <= 10) throw new RuntimeException(
310+
"\nBroken Java Detected: " + version + ", Refusing to start.\n"
311+
+ "This version of Java has a major memory flaw, and will randomly crash.\n"
312+
+ "Please update to a newer version of Java 17, at least after 17.0.10\n"
313+
+ "If you need assistance with this, see the #faq channel in the Thut's Mods discord server.\n"
314+
+ "https://discord.gg/sXCpFaAh2x\n");
315+
310316
ItemGenerator.strippableBlocks(event);
311317
ItemGenerator.compostables(event);
312318
ItemGenerator.flammables(event);

src/main/java/pokecube/mobs/PokecubeMobs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void loadComplete(final FMLLoadCompleteEvent event)
8585
{
8686
if (PokecubeCore.getConfig().debug_misc && !FMLLoader.isProduction())
8787
{
88-
DataGenerator.execute(false);
88+
// DataGenerator.execute(false);
8989
}
9090
}
9191

0 commit comments

Comments
 (0)