修复mk42的重力
This commit is contained in:
parent
68ba553b54
commit
df025d24cd
2 changed files with 41 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
package net.mcreator.target.block;
|
package net.mcreator.target.block;
|
||||||
|
|
||||||
|
import net.mcreator.target.entity.Mk42Entity;
|
||||||
import net.mcreator.target.entity.Target1Entity;
|
import net.mcreator.target.entity.Target1Entity;
|
||||||
import net.mcreator.target.init.TargetModSounds;
|
import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
|
@ -77,7 +78,7 @@ public class JumpPadBlock extends Block {
|
||||||
super.entityInside(blockstate, level, pos, entity);
|
super.entityInside(blockstate, level, pos, entity);
|
||||||
|
|
||||||
// 禁止套娃
|
// 禁止套娃
|
||||||
if (entity instanceof Target1Entity) return;
|
if (entity instanceof Target1Entity || entity instanceof Mk42Entity) return;
|
||||||
|
|
||||||
boolean zooming = entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
boolean zooming = entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
|
||||||
public Mk42Entity(EntityType<Mk42Entity> type, Level world) {
|
public Mk42Entity(EntityType<Mk42Entity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
xpReward = 0;
|
xpReward = 0;
|
||||||
setNoAi(true);
|
setNoAi(false);
|
||||||
setPersistenceRequired();
|
setPersistenceRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,20 +362,52 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void travel(Vec3 dir) {
|
||||||
|
// if (this.getFirstPassenger() == null) return;
|
||||||
|
// Entity gunner = this.getFirstPassenger();
|
||||||
|
// if (this.isVehicle()) {
|
||||||
|
// this.setYRot(gunner.getYRot());
|
||||||
|
// this.yRotO = this.getYRot();
|
||||||
|
// this.setXRot(Mth.clamp(gunner.getXRot() - 1.35f, -85, 15));
|
||||||
|
// this.setRot(this.getYRot(), this.getXRot());
|
||||||
|
// this.yBodyRot = gunner.getYRot();
|
||||||
|
// this.yHeadRot = gunner.getYRot();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 dir) {
|
public void travel(Vec3 dir) {
|
||||||
if (this.getFirstPassenger() == null) return;
|
Entity entity = this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0);
|
||||||
Entity gunner = this.getFirstPassenger();
|
|
||||||
if (this.isVehicle()) {
|
if (this.isVehicle()) {
|
||||||
this.setYRot(gunner.getYRot());
|
this.setYRot(entity.getYRot());
|
||||||
this.yRotO = this.getYRot();
|
this.yRotO = this.getYRot();
|
||||||
this.setXRot(Mth.clamp(gunner.getXRot() - 1.35f, -85, 15));
|
this.setXRot(Mth.clamp(entity.getXRot() - 1.35f, -85, 15));
|
||||||
this.setRot(this.getYRot(), this.getXRot());
|
this.setRot(this.getYRot(), this.getXRot());
|
||||||
this.yBodyRot = gunner.getYRot();
|
this.yBodyRot = entity.getYRot();
|
||||||
this.yHeadRot = gunner.getYRot();
|
this.yHeadRot = entity.getYRot();
|
||||||
|
this.setMaxUpStep(1.0F);
|
||||||
|
if (entity instanceof LivingEntity passenger) {
|
||||||
|
this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED));
|
||||||
|
float forward = passenger.zza;
|
||||||
|
float strafe = passenger.xxa;
|
||||||
|
super.travel(new Vec3(strafe, 0, forward));
|
||||||
|
}
|
||||||
|
double d1 = this.getX() - this.xo;
|
||||||
|
double d0 = this.getZ() - this.zo;
|
||||||
|
float f1 = (float) Math.sqrt(d1 * d1 + d0 * d0) * 4;
|
||||||
|
if (f1 > 1.0F)
|
||||||
|
f1 = 1.0F;
|
||||||
|
this.walkAnimation.setSpeed(this.walkAnimation.speed() + (f1 - this.walkAnimation.speed()) * 0.4F);
|
||||||
|
this.walkAnimation.position(this.walkAnimation.position() + this.walkAnimation.speed());
|
||||||
|
this.calculateEntityAnimation(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
this.setMaxUpStep(0.5F);
|
||||||
|
super.travel(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityDimensions getDimensions(Pose p_33597_) {
|
public EntityDimensions getDimensions(Pose p_33597_) {
|
||||||
return super.getDimensions(p_33597_).scale((float) 1);
|
return super.getDimensions(p_33597_).scale((float) 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue