mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed crash when summoning sombra with commands when on peaceful mode. Closes #187
This commit is contained in:
parent
b7487e9901
commit
7187ad61ee
1 changed files with 17 additions and 15 deletions
|
@ -226,28 +226,30 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti
|
||||||
setPersistent();
|
setPersistent();
|
||||||
Optional<BlockPos> homePos = getHomePos();
|
Optional<BlockPos> homePos = getHomePos();
|
||||||
|
|
||||||
if (homePos.isEmpty() && !isRemoved()) {
|
if (homePos.isEmpty()) {
|
||||||
setHomePos(getWorld().getTopPosition(Type.MOTION_BLOCKING_NO_LEAVES, getBlockPos()));
|
setHomePos(getWorld().getTopPosition(Type.MOTION_BLOCKING_NO_LEAVES, getBlockPos()));
|
||||||
homePos = getHomePos();
|
homePos = getHomePos();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getBlockPos().getSquaredDistance(homePos.get()) > MathHelper.square(getAreaRadius())) {
|
if (!isRemoved()) {
|
||||||
teleportTo(Vec3d.ofCenter(homePos.get()));
|
if (getBlockPos().getSquaredDistance(homePos.get()) > MathHelper.square(getAreaRadius())) {
|
||||||
getNavigation().stop();
|
teleportTo(Vec3d.ofCenter(homePos.get()));
|
||||||
}
|
getNavigation().stop();
|
||||||
|
}
|
||||||
|
|
||||||
prevBiteTime = biteTime;
|
prevBiteTime = biteTime;
|
||||||
if (biteTime > 0) {
|
if (biteTime > 0) {
|
||||||
biteTime--;
|
biteTime--;
|
||||||
}
|
}
|
||||||
|
|
||||||
float targetSize = getScaleFactor();
|
float targetSize = getScaleFactor();
|
||||||
boolean sizeChanging = prevSize != currentSize;
|
boolean sizeChanging = prevSize != currentSize;
|
||||||
prevSize = currentSize;
|
prevSize = currentSize;
|
||||||
tickGrowth(targetSize, sizeChanging);
|
tickGrowth(targetSize, sizeChanging);
|
||||||
|
|
||||||
if (!hasPositionTarget() && homePos.isPresent()) {
|
if (!hasPositionTarget() && homePos.isPresent()) {
|
||||||
setPositionTarget(homePos.get(), (int)getAreaRadius());
|
setPositionTarget(homePos.get(), (int)getAreaRadius());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
Loading…
Reference in a new issue