Skip to content

Commit

Permalink
fixes some problems related to disposing of ant nests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thutmose committed Aug 27, 2022
1 parent 665776a commit 458c87f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/main/java/pokecube/api/entity/CapabilityInhabitable.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.common.util.LazyOptional;
import pokecube.api.blocks.IInhabitable;
import pokecube.api.utils.TagNames;

public class CapabilityInhabitable
{
Expand Down Expand Up @@ -58,14 +57,14 @@ public void onExitHabitat(final Mob mob)
{
if (this.tile.getBlockPos() != null) this.wrapped.setPos(this.tile.getBlockPos());
this.getWrapped().onExitHabitat(mob);
mob.getPersistentData().putBoolean(TagNames.NOPOOF, true);
mob.setPersistenceRequired();
}

@Override
public boolean onEnterHabitat(final Mob mob)
{
if (this.tile.getBlockPos() != null) this.wrapped.setPos(this.tile.getBlockPos());
mob.getPersistentData().putBoolean(TagNames.NOPOOF, true);
mob.setPersistenceRequired();
return this.getWrapped().onEnterHabitat(mob);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ public boolean onEnterHabitat(final Mob mob)
this.ants.remove(mob.getUUID());
this.workers.get(AntTasks.getJob(mob)).remove(mob.getUUID());

if (this.eggs.size() < Math.max(10, ants / 2))
if (this.eggs.size() < Math.min(Math.max(PokecubeCore.getConfig().antNestMobNumber / 2, ants / 2),
PokecubeCore.getConfig().antNestMobNumber / 2))
{
final IPokemob poke = PokemobCaps.getPokemobFor(mob);
Optional<BlockPos> room = this.getFreeEggRoom();
Expand Down

0 comments on commit 458c87f

Please sign in to comment.