修复子弹移动问题
This commit is contained in:
parent
2e5d9b75f6
commit
26f63be31f
3 changed files with 12 additions and 4 deletions
|
@ -35,8 +35,7 @@ import software.bernie.geckolib.core.animation.RawAnimation;
|
||||||
import software.bernie.geckolib.core.object.PlayState;
|
import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.List;
|
// TODO 重写阔剑地雷
|
||||||
|
|
||||||
public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
|
public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
|
||||||
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.BOOLEAN);
|
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.STRING);
|
||||||
|
@ -87,7 +86,7 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MobType getMobType() {
|
public MobType getMobType() {
|
||||||
return MobType.UNDEFINED;
|
return super.getMobType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,7 +199,9 @@ public class ClaymoreEntity extends TamableAnimal implements GeoEntity {
|
||||||
@Override
|
@Override
|
||||||
public AgeableMob getBreedOffspring(ServerLevel serverWorld, AgeableMob ageable) {
|
public AgeableMob getBreedOffspring(ServerLevel serverWorld, AgeableMob ageable) {
|
||||||
ClaymoreEntity retval = TargetModEntities.CLAYMORE.get().create(serverWorld);
|
ClaymoreEntity retval = TargetModEntities.CLAYMORE.get().create(serverWorld);
|
||||||
|
if (retval != null) {
|
||||||
retval.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(retval.blockPosition()), MobSpawnType.BREEDING, null, null);
|
retval.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(retval.blockPosition()), MobSpawnType.BREEDING, null, null);
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
||||||
this.updateHeading();
|
this.updateHeading();
|
||||||
this.onProjectileTick();
|
this.onProjectileTick();
|
||||||
|
|
||||||
|
Vec3 vec = this.getDeltaMovement();
|
||||||
|
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
Vec3 startVec = this.position();
|
Vec3 startVec = this.position();
|
||||||
Vec3 endVec = startVec.add(this.getDeltaMovement());
|
Vec3 endVec = startVec.add(this.getDeltaMovement());
|
||||||
|
@ -199,6 +201,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
||||||
} else {
|
} else {
|
||||||
this.onHit(result);
|
this.onHit(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setPos(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z);
|
||||||
|
} else {
|
||||||
|
this.setPosRaw(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tickCount > 200) {
|
if (this.tickCount > 200) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
// TODO 把伤害逻辑移植到箭类中
|
||||||
@Mod.EventBusSubscriber
|
@Mod.EventBusSubscriber
|
||||||
public class ArrowdamageProcedure {
|
public class ArrowdamageProcedure {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
Loading…
Add table
Reference in a new issue