禁止船创消失掉落物
This commit is contained in:
parent
68f985227a
commit
df58552121
1 changed files with 12 additions and 14 deletions
|
@ -25,6 +25,7 @@ import net.minecraft.world.entity.AreaEffectCloud;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.MoverType;
|
import net.minecraft.world.entity.MoverType;
|
||||||
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.projectile.ThrownPotion;
|
import net.minecraft.world.entity.projectile.ThrownPotion;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -257,7 +258,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity,
|
||||||
crushEntities(this.getDeltaMovement());
|
crushEntities(this.getDeltaMovement());
|
||||||
}
|
}
|
||||||
|
|
||||||
collBlock();
|
collideBlock();
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
@ -281,23 +282,20 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity,
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
||||||
}
|
}
|
||||||
|
if (!(entity instanceof ItemEntity)) {
|
||||||
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger() ), (float) (25 * velocity.length()));
|
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger() ), (float) (25 * velocity.length()));
|
||||||
entity.invulnerableTime = 10;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collBlock() {
|
public void collideBlock() {
|
||||||
AABB aabb = AABB.ofSize(new Vec3(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ()), 5, 2.6, 5);
|
AABB aabb = AABB.ofSize(new Vec3(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ()), 3.6, 2.6, 3.6);
|
||||||
BlockPos.betweenClosedStream(aabb).forEach((block) -> {
|
BlockPos.betweenClosedStream(aabb).forEach((pos) -> {
|
||||||
BlockState blockstate = this.level().getBlockState(block);
|
BlockState blockstate = this.level().getBlockState(pos);
|
||||||
if (blockstate.is(Blocks.LILY_PAD)) {
|
if (blockstate.is(Blocks.LILY_PAD)) {
|
||||||
BlockPos blockPos = BlockPos.containing(new Vec3(block.getX(), block.getY(), block.getY()));
|
this.level().destroyBlock(pos, true);
|
||||||
this.level().destroyBlock(blockPos, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue