Skip to content

Commit

Permalink
Fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Nov 28, 2020
1 parent 53904f9 commit c42d6f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/ladysnake/spawnlanterns/mixin/InfoMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@

@Mixin(SpawnHelper.Info.class)
public abstract class InfoMixin implements ExtendedSpawnInfo {
@Shadow
public abstract int getSpawningChunkCount();
@Shadow @Final
Object2IntOpenHashMap<SpawnGroup> groupToCount;

@Shadow @Final private int spawningChunkCount;
private PlayerEntity closestPlayer;

@Override
Expand All @@ -31,7 +30,7 @@ public void setClosestPlayer(PlayerEntity player) {
@Inject(method = "isBelowCap", at = @At("RETURN"), cancellable = true)
private void isBelowCap(SpawnGroup group, CallbackInfoReturnable<Boolean> 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));
}
}
Expand Down

0 comments on commit c42d6f9

Please sign in to comment.