Fix sombra not being able to move, save the summoning progress, and set his home position correctly when spawned directly

This commit is contained in:
Sollace 2023-08-27 23:15:35 +01:00
parent bf06bc0ba4
commit 6bbea1766f
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 8 additions and 4 deletions

View file

@ -72,6 +72,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.minecraft.world.WorldEvents;
import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.event.GameEvent;
public class SombraEntity extends HostileEntity implements ArenaCombatant, ParticleSource<SombraEntity> {
@ -219,7 +220,7 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti
Optional<BlockPos> homePos = getHomePos();
if (homePos.isEmpty() && !isRemoved()) {
setHomePos(getBlockPos());
setHomePos(getWorld().getTopPosition(Type.MOTION_BLOCKING_NO_LEAVES, getBlockPos()));
homePos = getHomePos();
}
@ -242,10 +243,9 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti
setPositionTarget(homePos.get(), (int)getAreaRadius());
}
setVelocity(Vec3d.ZERO);
super.tick();
if (getTarget() == null && getVelocity().y < 0) {
if (getTarget() == null && getVelocity().y < -0.1F) {
setVelocity(getVelocity().multiply(1, 0.4, 1));
}
@ -285,7 +285,7 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti
}
if (getTarget() == null && getNavigation().isIdle()) {
getNavigation().startMovingTo(homePos.get().getX(), homePos.get().getY() + 10, homePos.get().getZ(), 2);
getNavigation().startMovingTo(homePos.get().getX(), homePos.get().getY() + 5, homePos.get().getZ(), 2);
}
}

View file

@ -336,6 +336,8 @@ public class StormCloudEntity extends Entity {
nbt.putInt("clearTicks", getClearTicks());
nbt.putFloat("size", getSize(1));
nbt.putBoolean("cursed", cursed);
nbt.putInt("phase", phase);
nbt.putInt("nextPhase", nextPhase);
}
@Override
@ -344,6 +346,8 @@ public class StormCloudEntity extends Entity {
setClearTicks(nbt.getInt("clearTicks"));
setSize(currentSize = nbt.getFloat("size"));
cursed = nbt.getBoolean("cursed");
phase = nbt.getInt("phase");
nextPhase = nbt.getInt("nextPhase");
}
@Override