Search in sources :

Example 1 with ExplosionBridge

use of org.spongepowered.common.bridge.world.level.ExplosionBridge in project SpongeCommon by SpongePowered.

the class SpongeExplosionBuilder method build.

@Override
public Explosion build() throws IllegalStateException {
    // TODO Check coordinates and if world is loaded here.
    Preconditions.checkState(this.location != null, "Location is null!");
    final World<?, ?> world = this.location.world();
    final Vector3d origin = this.location.position();
    final net.minecraft.world.level.Explosion explosion = new net.minecraft.world.level.Explosion((net.minecraft.world.level.Level) world, (Entity) this.sourceExplosive, null, null, origin.x(), origin.y(), origin.z(), this.radius, this.canCauseFire, this.shouldBreakBlocks ? net.minecraft.world.level.Explosion.BlockInteraction.DESTROY : net.minecraft.world.level.Explosion.BlockInteraction.NONE);
    ((ExplosionBridge) explosion).bridge$setShouldBreakBlocks(this.shouldBreakBlocks);
    ((ExplosionBridge) explosion).bridge$setShouldDamageEntities(this.shouldDamageEntities);
    ((ExplosionBridge) explosion).bridge$setShouldPlaySmoke(this.shouldSmoke);
    ((ExplosionBridge) explosion).bridge$setResolution(this.resolution);
    ((ExplosionBridge) explosion).bridge$setRandomness(this.randomness);
    ((ExplosionBridge) explosion).bridge$setKnockback(this.knockback);
    return (Explosion) explosion;
}
Also used : ExplosionBridge(org.spongepowered.common.bridge.world.level.ExplosionBridge) Explosion(org.spongepowered.api.world.explosion.Explosion) Vector3d(org.spongepowered.math.vector.Vector3d)

Aggregations

Explosion (org.spongepowered.api.world.explosion.Explosion)1 ExplosionBridge (org.spongepowered.common.bridge.world.level.ExplosionBridge)1 Vector3d (org.spongepowered.math.vector.Vector3d)1