From 9d1fc8be9a87bb7b887f7a3eb6467ab581822027 Mon Sep 17 00:00:00 2001 From: msticninja Date: Fri, 1 Feb 2019 14:49:51 -0600 Subject: [PATCH 1/2] Avoid Dedicated Server Crash due to calling SERVER side on client-only method. This crash affects my dedicated server, running SpongeForge on 1.12.2. Crashlog is here: https://pastebin.com/atkWTke2 Probably don't merge this, the "fix" is a hack, but it does get the server running, and I can connect a client to it and play without any negative effects. --- src/main/java/mods/railcraft/api/charge/Charge.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/mods/railcraft/api/charge/Charge.java b/src/main/java/mods/railcraft/api/charge/Charge.java index a6592b6..ec56727 100644 --- a/src/main/java/mods/railcraft/api/charge/Charge.java +++ b/src/main/java/mods/railcraft/api/charge/Charge.java @@ -133,7 +133,7 @@ public INetwork network(World world) { /** * Entry point for rendering charge related effects. */ - @SideOnly(Side.CLIENT) + // @SideOnly(Side.CLIENT) public static IZapEffectRenderer effects() { return effects; } @@ -271,7 +271,7 @@ default void zapEffectDeath(World world, Object source) { } } - @SideOnly(Side.CLIENT) + // @SideOnly(Side.CLIENT) public interface IZapEffectRenderer { /** * Helper method that most blocks can use for spark effects. It has a chance of calling From eb03ee54d7be58ff6afe6f04f406fb8ce0e6449c Mon Sep 17 00:00:00 2001 From: liach <7806504+liach@users.noreply.github.com> Date: Mon, 11 Feb 2019 21:40:57 -0800 Subject: [PATCH 2/2] Move sideonly to methods Suggested by chocohead: this will not cause class not found exceptions. --- src/main/java/mods/railcraft/api/charge/Charge.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/mods/railcraft/api/charge/Charge.java b/src/main/java/mods/railcraft/api/charge/Charge.java index ec56727..f76c914 100644 --- a/src/main/java/mods/railcraft/api/charge/Charge.java +++ b/src/main/java/mods/railcraft/api/charge/Charge.java @@ -133,7 +133,6 @@ public INetwork network(World world) { /** * Entry point for rendering charge related effects. */ - // @SideOnly(Side.CLIENT) public static IZapEffectRenderer effects() { return effects; } @@ -271,7 +270,6 @@ default void zapEffectDeath(World world, Object source) { } } - // @SideOnly(Side.CLIENT) public interface IZapEffectRenderer { /** * Helper method that most blocks can use for spark effects. It has a chance of calling @@ -282,6 +280,7 @@ public interface IZapEffectRenderer { * @param chance Integer value such that chance of sparking is defined by {@code rand.nextInt(chance) == 0} * Most blocks use 50, tracks use 75. Lower numbers means more frequent sparks. */ + @SideOnly(Side.CLIENT) default void throwSparks(IBlockState state, World world, BlockPos pos, Random rand, int chance) { } @@ -291,6 +290,7 @@ default void throwSparks(IBlockState state, World world, BlockPos pos, Random ra * @param source Can be a TileEntity, Entity, BlockPos, or Vec3d * @throws IllegalArgumentException If source is of an unexpected type. */ + @SideOnly(Side.CLIENT) default void zapEffectPoint(World world, Object source) { } @@ -300,12 +300,14 @@ default void zapEffectPoint(World world, Object source) { * @param source Can be a TileEntity, Entity, BlockPos, or Vec3d * @throws IllegalArgumentException If source is of an unexpected type. */ + @SideOnly(Side.CLIENT) default void zapEffectDeath(World world, Object source) { } /** * Spawns a spark from the surface of each rendered side of a block. */ + @SideOnly(Side.CLIENT) default void zapEffectSurface(IBlockState stateIn, World worldIn, BlockPos pos) { } }