Skip to content

Commit

Permalink
Fixed #202
Browse files Browse the repository at this point in the history
  • Loading branch information
wdog5 committed Feb 1, 2024
1 parent 885e908 commit d32a798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,6 @@ public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0,
return strikeLightning(entityIn, LightningStrikeEvent.Cause.WEATHER);
}

@Redirect(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;isThundering()Z"))
private boolean banner$thunderChance(ServerLevel instance) {
return this.isRaining() && this.isThundering() && this.bridge$spigotConfig().thunderChance > 0;
}

@ModifyConstant(method = "tickChunk", constant = @Constant(intValue = 100000))
private int banner$configChane(int constant) {
return this.bridge$spigotConfig().thunderChance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ public void notifyAndUpdatePhysics(BlockPos blockposition, LevelChunk chunk, Blo
// CraftBukkit end
}

@Inject(method = "isThundering", at = @At("HEAD"), cancellable = true)
private void banner$isThundering(CallbackInfoReturnable<Boolean> cir) {
if (spigotConfig != null && spigotConfig.thunderChance <= 0) {
cir.setReturnValue(false);
}
}

@Inject(method = "setBlockEntity",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/level/Level;getChunkAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/chunk/LevelChunk;",
Expand Down

0 comments on commit d32a798

Please sign in to comment.