BlockStainedGlassPane .java

net.minecraft.block.BlockStainedGlassPane (class): members: COLOR, onBlockAdded, breakBlock, damageDropped, getSubBlocks, getMapColor, getBlockLayer.

net.minecraft.blockclass99 linescommonextends BlockPane3.1 KB

API Surface (9)

int damageDropped(IBlockState state)
void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
MapColor getMapColor(IBlockState state)
EnumWorldBlockLayer getBlockLayer()
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
BlockState createBlockState()
void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
void breakBlock(World worldIn, BlockPos pos, IBlockState state)

Fields & Constants (1)

COLOR

String literals (1)

"color"

Full Source

BlockStainedGlassPane.java99 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.List;
4
import net.minecraft.block.material.MapColor;
5
import net.minecraft.block.material.Material;
6
import net.minecraft.block.properties.IProperty;
7
import net.minecraft.block.properties.PropertyEnum;
8
import net.minecraft.block.state.BlockState;
9
import net.minecraft.block.state.IBlockState;
10
import net.minecraft.creativetab.CreativeTabs;
11
import net.minecraft.item.EnumDyeColor;
12
import net.minecraft.item.Item;
13
import net.minecraft.item.ItemStack;
14
import net.minecraft.util.BlockPos;
15
import net.minecraft.util.EnumWorldBlockLayer;
16
import net.minecraft.world.World;
17
18
public class BlockStainedGlassPane extends BlockPane
19
{
20
    public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.<EnumDyeColor>create("color", EnumDyeColor.class);
21
22
    public BlockStainedGlassPane()
23
    {
24
        super(Material.glass, false);
25
        this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(COLOR, EnumDyeColor.WHITE));
26
        this.setCreativeTab(CreativeTabs.tabDecorations);
27
    }
28
29
    /**
30
     * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
31
     * returns the metadata of the dropped item based on the old metadata of the block.
32
     */
33
    public int damageDropped(IBlockState state)
34
    {
35
        return ((EnumDyeColor)state.getValue(COLOR)).getMetadata();
36
    }
37
38
    /**
39
     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
40
     */
41
    public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
42
    {
43
        for (int i = 0; i < EnumDyeColor.values().length; ++i)
44
        {
45
            list.add(new ItemStack(itemIn, 1, i));
46
        }
47
    }
48
49
    /**
50
     * Get the MapColor for this Block and the given BlockState
51
     */
52
    public MapColor getMapColor(IBlockState state)
53
    {
54
        return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
55
    }
56
57
    public EnumWorldBlockLayer getBlockLayer()
58
    {
59
        return EnumWorldBlockLayer.TRANSLUCENT;
60
    }
61
62
    /**
63
     * Convert the given metadata into a BlockState for this Block
64
     */
65
    public IBlockState getStateFromMeta(int meta)
66
    {
67
        return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta));
68
    }
69
70
    /**
71
     * Convert the BlockState into the correct metadata value
72
     */
73
    public int getMetaFromState(IBlockState state)
74
    {
75
        return ((EnumDyeColor)state.getValue(COLOR)).getMetadata();
76
    }
77
78
    protected BlockState createBlockState()
79
    {
80
        return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH, COLOR});
81
    }
82
83
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
84
    {
85
        if (!worldIn.isRemote)
86
        {
87
            BlockBeacon.updateColorAsync(worldIn, pos);
88
        }
89
    }
90
91
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
92
    {
93
        if (!worldIn.isRemote)
94
        {
95
            BlockBeacon.updateColorAsync(worldIn, pos);
96
        }
97
    }
98
}
99

Deobfuscated MCP 1.8.9 source of BlockStainedGlassPane from Marcelektro/MavenMCP-1.8.9 (net/minecraft/block/BlockStainedGlassPane.java), stored verbatim.