Java Code Examples for net.minecraft.world.Explosion#doExplosionA()

The following examples show how to use net.minecraft.world.Explosion#doExplosionA() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntitySpecialArrow.java    From Artifacts with MIT License 5 votes vote down vote up
public void hitEffect(Entity entityHit) {
	switch (this.effect.ID) {
		case 1:
			Explosion explosion = new Explosion(this.worldObj, this, this.posX, this.posY, this.posZ, 2F);
			explosion.doExplosionA();
			explosion.doExplosionB(true);
			break;
	}
}
 
Example 2
Source File: EntitySpecialArrow.java    From Artifacts with MIT License 5 votes vote down vote up
public void missEffect(int x, int y, int z) {
	switch (this.effect.ID) {
		case 1:
			Explosion explosion = new Explosion(this.worldObj, this, this.posX, this.posY, this.posZ, 2F);
			explosion.doExplosionA();
			explosion.doExplosionB(true);
			setDead();
			break;
	}
}
 
Example 3
Source File: EventsCommon.java    From Valkyrien-Skies with Apache License 2.0 3 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onExplosionStart(ExplosionEvent.Start event) {
    // Only run on server side
    if (!event.getWorld().isRemote) {
        Explosion explosion = event.getExplosion();
        Vector center = new Vector(explosion.x, explosion.y, explosion.z);
        Optional<PhysicsObject> optionalPhysicsObject = ValkyrienUtils
            .getPhysicsObject(event.getWorld(),
                new BlockPos(event.getExplosion().getPosition()), true);
        if (optionalPhysicsObject.isPresent()) {
            return;
        }
        // Explosion radius
        float radius = explosion.size;
        AxisAlignedBB toCheck = new AxisAlignedBB(center.X - radius, center.Y - radius,
            center.Z - radius,
            center.X + radius, center.Y + radius, center.Z + radius);
        // Find nearby ships, we will check if the explosion effects them
        List<PhysicsWrapperEntity> shipsNear = ValkyrienSkiesMod.VS_PHYSICS_MANAGER
            .getManagerForWorld(event.getWorld())
            .getNearbyPhysObjects(toCheck);
        // Process the explosion on the nearby ships
        for (PhysicsWrapperEntity ship : shipsNear) {
            Vector inLocal = new Vector(center);

            ship.getPhysicsObject().getShipTransformationManager().getCurrentTickTransform()
                .transform(inLocal, TransformType.GLOBAL_TO_SUBSPACE);

            Explosion expl = new Explosion(event.getWorld(), null, inLocal.X, inLocal.Y,
                inLocal.Z, radius, explosion.causesFire, true);

            double waterRange = .6D;

            for (int x = (int) Math.floor(expl.x - waterRange);
                x <= Math.ceil(expl.x + waterRange); x++) {
                for (int y = (int) Math.floor(expl.y - waterRange);
                    y <= Math.ceil(expl.y + waterRange); y++) {
                    for (int z = (int) Math.floor(expl.z - waterRange);
                        z <= Math.ceil(expl.z + waterRange); z++) {
                        IBlockState state = event.getWorld()
                            .getBlockState(new BlockPos(x, y, z));
                        if (state.getBlock() instanceof BlockLiquid) {
                            return;
                        }
                    }
                }
            }

            expl.doExplosionA();
            event.getExplosion().affectedBlockPositions.addAll(expl.affectedBlockPositions);
        }
    }
}