Java 类net.minecraft.block.BlockStainedGlass 实例源码

项目:LittleThings-old    文件:TileEntityItemElevator.java   
private IInventory searchForInventory()
{
    for (int j = 1; j < 64; j++) {
        TileEntity foundte = worldObj.getTileEntity(getPos().add(0, j, 0));
        Block foundBlock = worldObj.getBlockState(getPos().add(0, j, 0)).getBlock();

        if (foundte != null && foundte instanceof IInventory) {
            this.foundInventory = getPos().add(0, j, 0);
            this.oldBlock = foundBlock;
            return (IInventory) foundte;
        } else if (foundte == null && !((foundBlock instanceof BlockGlass) || foundBlock instanceof BlockStainedGlass)) {
            this.foundInventory = null;
            this.oldBlock = null;
            return null;
        }
    }

    this.foundInventory = null;
    this.oldBlock = null;
    return null;
}
项目:MC-Prefab    文件:StructureProduceFarm.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos, EnumFacing assumedNorth,
        Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        ProduceFarmConfiguration wareHouseConfiguration = (ProduceFarmConfiguration)configuration;

        blockState = blockState.withProperty(BlockStainedGlass.COLOR, wareHouseConfiguration.dyeColor);
        block.setBlockState(blockState);
        //this.placedBlocks.add(block);
        this.priorityOneBlocks.add(block);

        return true;
    }

    return false;
}
项目:MC-Prefab    文件:StructureWarehouse.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos, EnumFacing assumedNorth,
        Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        WareHouseConfiguration wareHouseConfiguration = (WareHouseConfiguration)configuration;

        blockState = blockState.withProperty(BlockStainedGlass.COLOR, wareHouseConfiguration.dyeColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);

        return true;
    }

    return false;
}
项目:Backmemed    文件:ConnectedTextures.java   
private static boolean isFullCubeModel(IBlockState p_isFullCubeModel_0_)
{
    if (p_isFullCubeModel_0_.isFullCube())
    {
        return true;
    }
    else
    {
        Block block = p_isFullCubeModel_0_.getBlock();
        return block instanceof BlockGlass ? true : block instanceof BlockStainedGlass;
    }
}
项目:LittleThings-old    文件:TileEntityItemElevator.java   
private void updatePartials()
{
    for (int j = 1; j < 64; j++) {
        BlockPos added = getPos().add(0, j, 0);
        if (worldObj.getBlockState(added).getBlock() instanceof BlockGlass || worldObj.getBlockState(added).getBlock() instanceof BlockStainedGlass)
            for (int i = 10; i >= 1; i--)
                worldObj.spawnParticle(EnumParticleTypes.PORTAL,
                        added.getX() + 0.5, added.getY() - 1 + i / 10, added.getZ() + 0.5,
                        0, 0.3, 0);
        else break;
    }
}
项目:Easy-Editors    文件:BlockPropertyRegistry.java   
private static void registerVanillaVariantProps() {
    // TODO: omit similar blocks
    registerVariantProperty(BlockStone.VARIANT);
    registerVariantProperty(BlockPlanks.VARIANT);
    registerVariantProperty(BlockSapling.TYPE);
    registerVariantProperty(BlockDirt.VARIANT);
    registerVariantProperty(BlockSand.VARIANT);
    registerVariantProperty(BlockOldLog.VARIANT);
    registerVariantProperty(BlockNewLog.VARIANT);
    registerVariantProperty(BlockOldLeaf.VARIANT);
    registerVariantProperty(BlockNewLeaf.VARIANT);
    registerVariantProperty(BlockSandStone.TYPE);
    registerVariantProperty(BlockTallGrass.TYPE);
    registerVariantProperty(BlockPistonExtension.TYPE);
    registerVariantProperty(BlockColored.COLOR);
    registerVariantProperty(BlockPistonMoving.TYPE);
    registerVariantProperty(Blocks.YELLOW_FLOWER.getTypeProperty());
    registerVariantProperty(Blocks.RED_FLOWER.getTypeProperty());
    registerVariantProperty(BlockStoneSlab.VARIANT);
    registerVariantProperty(BlockWoodSlab.VARIANT);
    registerVariantProperty(BlockAnvil.DAMAGE);
    registerVariantProperty(BlockQuartz.VARIANT);
    registerVariantProperty(BlockCarpet.COLOR);
    registerVariantProperty(BlockDoublePlant.VARIANT);
    registerVariantProperty(BlockStainedGlass.COLOR);
    registerVariantProperty(BlockStainedGlassPane.COLOR);
    registerVariantProperty(BlockPrismarine.VARIANT);
    registerVariantProperty(BlockRedSandstone.TYPE);
    registerVariantProperty(BlockStoneSlabNew.VARIANT);
}
项目:TheStuffMod    文件:ItemPaintbrush.java   
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float textureX, float textureY, float textureZ) {
    if(!world.isRemote) {
        if(world.getBlock(x, y, z) instanceof BlockColoured || world.getBlock(x, y, z) instanceof BlockColored || world.getBlock(x, y, z) instanceof BlockStainedGlass || world.getBlock(x, y, z) instanceof BlockStainedGlassPane) {
            if(world.getBlockMetadata(x, y, z) != this.getDamage(itemstack)) {
                world.setBlockMetadataWithNotify(x, y, z, this.getDamage(itemstack), 2);
                player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
                return true;
            } else return false;
        } else if(world.getBlock(x, y, z) instanceof BlockHardenedClay) {
            world.setBlock(x, y, z, Blocks.stained_hardened_clay, this.getDamage(itemstack), 2);
            player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
            return true;
        } else if(world.getBlock(x, y, z) instanceof BlockGlass) {
            world.setBlock(x, y, z, Blocks.stained_glass, this.getDamage(itemstack), 2);
            player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
            return true;
        } else if(world.getBlock(x, y, z) == Blocks.glass_pane) {
            world.setBlock(x, y, z, Blocks.stained_glass_pane, this.getDamage(itemstack), 2);
            player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
            return true;
        } else if(world.getBlock(x, y, z) instanceof BlockWood) {
            world.setBlock(x, y, z, ModBlocks.woodColoured, this.getDamage(itemstack), 2);
            player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
            return true;
        } else if(world.getBlock(x, y, z) == Blocks.brick_block) {
            world.setBlock(x, y, z, ModBlocks.brickColoured, this.getDamage(itemstack), 2);
            player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
            return true;
        }
    }
    return false;
   }
项目:MC-Prefab    文件:StructureAlternateStart.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    HouseConfiguration houseConfig = (HouseConfiguration) configuration;

    if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest)
            || (!houseConfig.addTorches && foundBlock instanceof BlockTorch)
            || (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace)))
    {
        // Don't place the block, returning true means that this has been
        // "handled"
        return true;
    }

    if (foundBlock instanceof BlockFurnace)
    {
        this.furnacePosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockStandingSign)
    {
        this.signPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);

        return true;
    }
    else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath()))
    {
        block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
        this.priorityOneBlocks.add(block);
        return true;
    }

    return false;
}
项目:Factorization    文件:BlockOreExtruder.java   
private static IBlockState clay(EnumDyeColor color) {
    if (color == null) return Blocks.hardened_clay.getDefaultState();
    return Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockStainedGlass.COLOR, color);
}
项目:Cyclic    文件:TileEntityBeaconPotion.java   
private void updateSegmentColors() {
  int i = this.pos.getX();
  int j = this.pos.getY();
  int k = this.pos.getZ();
  // int l = 5;
  this.beamSegments.clear();
  BeamSegment tileentitybeacon$beamsegment = new BeamSegment(EnumDyeColor.WHITE.getColorComponentValues());
  this.beamSegments.add(tileentitybeacon$beamsegment);
  boolean flag = true;
  BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
  for (int i1 = j + 1; i1 < 256; ++i1) {
    IBlockState iblockstate = this.world.getBlockState(blockpos$mutableblockpos.setPos(i, i1, k));
    float[] afloat;
    if (iblockstate.getBlock() == Blocks.STAINED_GLASS) {
      afloat = ((EnumDyeColor) iblockstate.getValue(BlockStainedGlass.COLOR)).getColorComponentValues();
    }
    else {
      if (iblockstate.getBlock() != Blocks.STAINED_GLASS_PANE) {
        if (iblockstate.getLightOpacity(world, blockpos$mutableblockpos) >= 15 && iblockstate.getBlock() != Blocks.BEDROCK) {
          this.beamSegments.clear();
          break;
        }
        float[] customColor = iblockstate.getBlock().getBeaconColorMultiplier(iblockstate, this.world, blockpos$mutableblockpos, getPos());
        if (customColor != null)
          afloat = customColor;
        else {
          tileentitybeacon$beamsegment.incrementHeight();
          continue;
        }
      }
      else
        afloat = ((EnumDyeColor) iblockstate.getValue(BlockStainedGlassPane.COLOR)).getColorComponentValues();
    }
    if (!flag) {
      afloat = new float[] { (tileentitybeacon$beamsegment.getColors()[0] + afloat[0]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[1] + afloat[1]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[2] + afloat[2]) / 2.0F };
    }
    if (Arrays.equals(afloat, tileentitybeacon$beamsegment.getColors())) {
      tileentitybeacon$beamsegment.incrementHeight();
    }
    else {
      tileentitybeacon$beamsegment = new BeamSegment(afloat);
      this.beamSegments.add(tileentitybeacon$beamsegment);
    }
    flag = false;
  }
}
项目:Cyclic    文件:TileEntityBeaconPowered.java   
private void updateSegmentColors() {
  int i = this.pos.getX();
  int j = this.pos.getY();
  int k = this.pos.getZ();
  // int l = 5;
  this.beamSegments.clear();
  BeamSegment tileentitybeacon$beamsegment = new BeamSegment(EnumDyeColor.WHITE.getColorComponentValues());
  this.beamSegments.add(tileentitybeacon$beamsegment);
  boolean flag = true;
  BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
  for (int i1 = j + 1; i1 < 256; ++i1) {
    IBlockState iblockstate = this.world.getBlockState(blockpos$mutableblockpos.setPos(i, i1, k));
    float[] afloat;
    if (iblockstate.getBlock() == Blocks.STAINED_GLASS) {
      afloat = ((EnumDyeColor) iblockstate.getValue(BlockStainedGlass.COLOR)).getColorComponentValues();
    }
    else {
      if (iblockstate.getBlock() != Blocks.STAINED_GLASS_PANE) {
        if (iblockstate.getLightOpacity(world, blockpos$mutableblockpos) >= 15 && iblockstate.getBlock() != Blocks.BEDROCK) {
          this.beamSegments.clear();
          break;
        }
        float[] customColor = iblockstate.getBlock().getBeaconColorMultiplier(iblockstate, this.world, blockpos$mutableblockpos, getPos());
        if (customColor != null)
          afloat = customColor;
        else {
          tileentitybeacon$beamsegment.incrementHeight();
          continue;
        }
      }
      else
        afloat = ((EnumDyeColor) iblockstate.getValue(BlockStainedGlassPane.COLOR)).getColorComponentValues();
    }
    if (!flag) {
      afloat = new float[] { (tileentitybeacon$beamsegment.getColors()[0] + afloat[0]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[1] + afloat[1]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[2] + afloat[2]) / 2.0F };
    }
    if (Arrays.equals(afloat, tileentitybeacon$beamsegment.getColors())) {
      tileentitybeacon$beamsegment.incrementHeight();
    }
    else {
      tileentitybeacon$beamsegment = new BeamSegment(afloat);
      this.beamSegments.add(tileentitybeacon$beamsegment);
    }
    flag = false;
  }
}