Skip to content

Commit

Permalink
Avoid Dedicated Server Crash due to calling SERVER side on client-onl… (
Browse files Browse the repository at this point in the history
#33)

* 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.

* Move sideonly to methods 

Suggested by chocohead: this will not cause class not found exceptions.
  • Loading branch information
msticninja authored and CovertJaguar committed Feb 12, 2019
1 parent 0fdf67c commit 2a1a9a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/mods/railcraft/api/charge/Charge.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand All @@ -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) {
}

Expand All @@ -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) {
}

Expand All @@ -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) {
}
}
Expand Down

0 comments on commit 2a1a9a0

Please sign in to comment.