From c42d6f9c39e52a611dd00295954ff2435bd4c71d Mon Sep 17 00:00:00 2001 From: doctor4t <25477005+doctor4t@users.noreply.github.com> Date: Sat, 28 Nov 2020 10:25:30 +0100 Subject: [PATCH] Fix #2 --- CHANGELOG.md | 3 +++ src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf5af3..e1254c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Spawn Lanterns - Changelog: +### Spawn Lanterns 1.1 - 1.16.4 +- Fixed an issue that would cause a server to crash when starting with the mod + ### Spawn Lanterns 1.0 - 1.16.4 - Added Soothing status effect - Added Provocation status effect diff --git a/src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java b/src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java index fe5dfa2..6f99af2 100644 --- a/src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java +++ b/src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java @@ -16,11 +16,10 @@ @Mixin(SpawnHelper.Info.class) public abstract class InfoMixin implements ExtendedSpawnInfo { - @Shadow - public abstract int getSpawningChunkCount(); @Shadow @Final Object2IntOpenHashMap groupToCount; + @Shadow @Final private int spawningChunkCount; private PlayerEntity closestPlayer; @Override @@ -31,7 +30,7 @@ public void setClosestPlayer(PlayerEntity player) { @Inject(method = "isBelowCap", at = @At("RETURN"), cancellable = true) private void isBelowCap(SpawnGroup group, CallbackInfoReturnable ci) { if (!ci.getReturnValueZ() && (closestPlayer != null && closestPlayer.hasStatusEffect(SpawnLanterns.PROVOCATION))) { - int i = group.getCapacity() * this.getSpawningChunkCount() / SpawnHelperAccessor.getChunkArea(); + int i = group.getCapacity() * this.spawningChunkCount / SpawnHelperAccessor.getChunkArea(); ci.setReturnValue(this.groupToCount.getInt(group) < (i * 2)); } }