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);
}
Aggregations