Search in sources :

Example 1 with BalloonDetector

use of ValkyrienWarfareControl.Balloon.BalloonDetector in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class BlockBalloonBurner method onBlockPlaced.

@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
    PhysicsWrapperEntity wrapperEntity = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldIn, pos);
    // Balloons can only be made on an active Ship
    if (wrapperEntity != null) {
        BlockPos balloonStart = pos.up(2);
        if (!worldIn.isRemote) {
            BalloonProcessor existingProcessor = wrapperEntity.wrapping.balloonManager.getProcessorAbovePos(pos);
            if (existingProcessor == null) {
                BalloonDetector detector = new BalloonDetector(balloonStart, worldIn, 25000);
                int balloonSize = detector.foundSet.size();
                if (balloonSize == 0) {
                    placer.addChatMessage(new TextComponentString("No balloon above"));
                } else {
                    placer.addChatMessage(new TextComponentString("Created a new Balloon"));
                    BalloonProcessor processor = BalloonProcessor.makeProcessorForDetector(wrapperEntity, detector);
                    wrapperEntity.wrapping.balloonManager.addBalloonProcessor(processor);
                // System.out.println("Balloon Walls Are " + detector.balloonWalls.size());
                }
            } else {
                placer.addChatMessage(new TextComponentString("Hooked onto Exisiting Balloon"));
            }
        }
    }
    return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
Also used : BalloonProcessor(ValkyrienWarfareControl.Balloon.BalloonProcessor) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) BalloonDetector(ValkyrienWarfareControl.Balloon.BalloonDetector) BlockPos(net.minecraft.util.math.BlockPos) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 BalloonDetector (ValkyrienWarfareControl.Balloon.BalloonDetector)1 BalloonProcessor (ValkyrienWarfareControl.Balloon.BalloonProcessor)1 BlockPos (net.minecraft.util.math.BlockPos)1 TextComponentString (net.minecraft.util.text.TextComponentString)1