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

项目: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;
   }
项目:Backmemed    文件:ConnectedTextures.java   
private static boolean skipConnectedTexture(IBlockAccess p_skipConnectedTexture_0_, IBlockState p_skipConnectedTexture_1_, BlockPos p_skipConnectedTexture_2_, BakedQuad p_skipConnectedTexture_3_, RenderEnv p_skipConnectedTexture_4_)
{
    Block block = p_skipConnectedTexture_1_.getBlock();

    if (block instanceof BlockPane)
    {
        EnumFacing enumfacing = p_skipConnectedTexture_3_.getFace();

        if (enumfacing != EnumFacing.UP && enumfacing != EnumFacing.DOWN)
        {
            return false;
        }

        if (!p_skipConnectedTexture_3_.isFaceQuad())
        {
            return false;
        }

        BlockPos blockpos = p_skipConnectedTexture_2_.offset(p_skipConnectedTexture_3_.getFace());
        IBlockState iblockstate = p_skipConnectedTexture_0_.getBlockState(blockpos);

        if (iblockstate.getBlock() != block)
        {
            return false;
        }

        if (block == Blocks.STAINED_GLASS_PANE && iblockstate.getValue(BlockStainedGlassPane.COLOR) != p_skipConnectedTexture_1_.getValue(BlockStainedGlassPane.COLOR))
        {
            return false;
        }

        iblockstate = iblockstate.getActualState(p_skipConnectedTexture_0_, blockpos);
        double d0 = (double)p_skipConnectedTexture_3_.getMidX();

        if (d0 < 0.4D)
        {
            if (((Boolean)iblockstate.getValue(BlockPane.WEST)).booleanValue())
            {
                return true;
            }
        }
        else if (d0 > 0.6D)
        {
            if (((Boolean)iblockstate.getValue(BlockPane.EAST)).booleanValue())
            {
                return true;
            }
        }
        else
        {
            double d1 = p_skipConnectedTexture_3_.getMidZ();

            if (d1 < 0.4D)
            {
                if (((Boolean)iblockstate.getValue(BlockPane.NORTH)).booleanValue())
                {
                    return true;
                }
            }
            else
            {
                if (d1 <= 0.6D)
                {
                    return true;
                }

                if (((Boolean)iblockstate.getValue(BlockPane.SOUTH)).booleanValue())
                {
                    return true;
                }
            }
        }
    }

    return false;
}
项目: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;
  }
}