BlockEndPortalFrame .java

net.minecraft.block.BlockEndPortalFrame (class): extends Block. members: EYE, getComparatorInputOverride, hasComparatorInputOverride, FACING, isOpaqueCube.

net.minecraft.blockclass120 linescommonextends Block3.9 KB

API Surface (10)

boolean isOpaqueCube()
void setBlockBoundsForItemRender()
void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
Item getItemDropped(IBlockState state, Random rand, int fortune)
IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
boolean hasComparatorInputOverride()
int getComparatorInputOverride(World worldIn, BlockPos pos)
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
BlockState createBlockState()

Fields & Constants (2)

FACING
EYE

String literals (1)

"facing"

Full Source

BlockEndPortalFrame.java120 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.List;
4
import java.util.Random;
5
import net.minecraft.block.material.MapColor;
6
import net.minecraft.block.material.Material;
7
import net.minecraft.block.properties.IProperty;
8
import net.minecraft.block.properties.PropertyBool;
9
import net.minecraft.block.properties.PropertyDirection;
10
import net.minecraft.block.state.BlockState;
11
import net.minecraft.block.state.IBlockState;
12
import net.minecraft.entity.Entity;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.item.Item;
15
import net.minecraft.util.AxisAlignedBB;
16
import net.minecraft.util.BlockPos;
17
import net.minecraft.util.EnumFacing;
18
import net.minecraft.world.World;
19
20
public class BlockEndPortalFrame extends Block
21
{
22
    public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
23
    public static final PropertyBool EYE = PropertyBool.create("eye");
24
25
    public BlockEndPortalFrame()
26
    {
27
        super(Material.rock, MapColor.greenColor);
28
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(EYE, Boolean.valueOf(false)));
29
    }
30
31
    /**
32
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
33
     */
34
    public boolean isOpaqueCube()
35
    {
36
        return false;
37
    }
38
39
    /**
40
     * Sets the block's bounds for rendering it as an item
41
     */
42
    public void setBlockBoundsForItemRender()
43
    {
44
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
45
    }
46
47
    /**
48
     * Add all collision boxes of this Block to the list that intersect with the given mask.
49
     */
50
    public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
51
    {
52
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
53
        super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
54
55
        if (((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue())
56
        {
57
            this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F);
58
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
59
        }
60
61
        this.setBlockBoundsForItemRender();
62
    }
63
64
    /**
65
     * Get the Item that this Block should drop when harvested.
66
     */
67
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
68
    {
69
        return null;
70
    }
71
72
    /**
73
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
74
     * IBlockstate
75
     */
76
    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
77
    {
78
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(EYE, Boolean.valueOf(false));
79
    }
80
81
    public boolean hasComparatorInputOverride()
82
    {
83
        return true;
84
    }
85
86
    public int getComparatorInputOverride(World worldIn, BlockPos pos)
87
    {
88
        return ((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue() ? 15 : 0;
89
    }
90
91
    /**
92
     * Convert the given metadata into a BlockState for this Block
93
     */
94
    public IBlockState getStateFromMeta(int meta)
95
    {
96
        return this.getDefaultState().withProperty(EYE, Boolean.valueOf((meta & 4) != 0)).withProperty(FACING, EnumFacing.getHorizontal(meta & 3));
97
    }
98
99
    /**
100
     * Convert the BlockState into the correct metadata value
101
     */
102
    public int getMetaFromState(IBlockState state)
103
    {
104
        int i = 0;
105
        i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
106
107
        if (((Boolean)state.getValue(EYE)).booleanValue())
108
        {
109
            i |= 4;
110
        }
111
112
        return i;
113
    }
114
115
    protected BlockState createBlockState()
116
    {
117
        return new BlockState(this, new IProperty[] {FACING, EYE});
118
    }
119
}
120

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