protected int getRedstonePower(World world, BlockPos pos, IBlockState state) { int var4 = super.getRedstonePower(world, pos, state); EnumDirection var5 = state.getValue(DIRECTION); BlockPos var6 = pos.offset(var5); IBlock var7 = world.getBlockState(var6).getBlock(); if (var7.hasComparatorInputOverride()) { var4 = var7.getComparatorInputOverride(world, var6); } else if (var4 < 15 && var7.isNormalCube()) { var6 = var6.offset(var5); var7 = world.getBlockState(var6).getBlock(); if (var7.hasComparatorInputOverride()) { var4 = var7.getComparatorInputOverride(world, var6); } else if (var7.getMaterial() == Material.air) { EntityItemFrame var8 = this.func_176461_a(world, var5, var6); if (var8 != null) { var4 = var8.func_174866_q(); } } } return var4; }
protected void initialWorldChunkLoad() { boolean var1 = true; boolean var2 = true; boolean var3 = true; boolean var4 = true; int var5 = 0; this.setUserMessage("menu.generatingTerrain"); byte var6 = 0; logger.info("Preparing start region for level " + var6); WorldServer var7 = this.worldServers[var6]; BlockPos var8 = var7.getSpawnPoint(); long var9 = getCurrentTimeMillis(); for (int var11 = -192; var11 <= 192 && this.isServerRunning(); var11 += 16) { for (int var12 = -192; var12 <= 192 && this.isServerRunning(); var12 += 16) { long var13 = getCurrentTimeMillis(); if (var13 - var9 > 1000L) { this.outputPercentRemaining("Preparing spawn area", var5 * 100 / 625); var9 = var13; } ++var5; var7.theChunkProviderServer.loadChunk(var8.getX() + var11 >> 4, var8.getZ() + var12 >> 4); } } this.clearCurrentTask(); }
protected void onRocketLand(BlockPos pos) { this.setPositionAndRotation( pos.getX() + 0.5, pos.getY() + 0.4D + this.getOnPadYOffset(), pos.getZ() + 0.5, this.rotationYaw, 0.0F); this.stopRocketSound(); }
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) { if (!worldIn.isRemote) { if (((Boolean) state.getValue(EXPLODE)).booleanValue()) { // float power = 2F + (((5000) / 10369F) * 18F); // ProcessHandler.addProcess(new NuclearExplosion(worldIn, pos.getX(), pos.getY(), // pos.getZ(), power)); EntityNukePrimed entitytntprimed = new EntityNukePrimed( worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter); worldIn.spawnEntityInWorld(entitytntprimed); worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); } } }
@Override public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) { if (!worldIn.isRemote) { EntityNukePrimed entitytntprimed = new EntityNukePrimed( worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, explosionIn.getExplosivePlacedBy()); entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; worldIn.spawnEntityInWorld(entitytntprimed); } }
@SuppressWarnings("rawtypes") @Override public void addCollisionBoxesToList( World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { int meta = getMetaFromState(state); if (meta == 2 || meta == 6) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } else if (meta == 0 || meta == 4) { this.setBlockBounds( 0.3F, 0.0F, 0.3F, 0.7F, worldIn.getBlockState(pos.up()).getBlock() == this ? 1.0F : 0.6F, 0.7F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } /*else if (meta == 7) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.38F, 1.0F); super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity); }*/ else { super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } }
@Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { EnumBlockMultiType type = (EnumBlockMultiType) state.getValue(MULTI_TYPE); int renderType = 0; switch (type) { case CRYO_CHAMBER: IBlockState stateAbove = worldIn.getBlockState(pos.up()); TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos); if (stateAbove.getBlock() == this && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) { renderType = 0; } else { renderType = 4; } if (tile != null && tile.mainBlockPosition != null) { IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition); if (stateMain.getBlock() == MarsBlocks.machine && stateMain.getValue(BlockMachineMars.TYPE) == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) { EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING); renderType += dir.getHorizontalIndex(); } } break; default: break; } return state.withProperty(RENDER_TYPE, renderType); }
@Override public void onNeighborBlockChange( World world, BlockPos pos, IBlockState state, Block neighborBlock) { if (world.isAirBlock(pos.up())) { this.dropBlockAsItem(world, pos, state, 0); world.setBlockToAir(pos); } }
@Override public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack held, EnumFacing facing, float fx, float par8, float par9) { System.out.println("Im awake!"); if (world.isRemote == false) { player.openGui(LabStuffMain.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); return true; } return false; }
@Override public void onCreate(World world, BlockPos placedPosition) { int buildHeight = world.getHeight() - 1; for (int y = 0; y < 3; y += 2) { if (placedPosition.getY() + y > buildHeight) return; for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { final BlockPos vecToAdd = placedPosition.add(x, y, z); if (!vecToAdd.equals(placedPosition)) { ((BlockTelepadFake) AsteroidBlocks.fakeTelepad) .makeFakeBlock( world, vecToAdd, placedPosition, AsteroidBlocks.fakeTelepad .getDefaultState() .withProperty(BlockTelepadFake.TOP, y == 2)); } } } } }
@Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { int meta = getMetaFromState(worldIn.getBlockState(pos)); if (meta == 2 || meta == 6) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); } else if (meta == 0 || meta == 4) { this.setBlockBounds( 0.3F, 0.0F, 0.3F, 0.7F, worldIn.getBlockState(pos.up()).getBlock() == this ? 1.0F : 0.6F, 0.7F); } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } }
/* Event hooks */ public boolean didActivateBlock( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumDirection side, float hitX, float hitY, float hitZ) { if (player.capabilities.allowEdit) { state = state.cycleProperty(MODE); world.playSoundAtLocation( pos.getCenter(), "random.click", 0.3F, state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? 0.55F : 0.5F); world.setBlockState(pos, state, 2); this.func_176462_k(world, pos, state); return true; } else { return false; } }