BlockWorldState .java

net.minecraft.block.state.BlockWorldState (class): members: tileEntityInitialized, field_181628_c, tileEntity, hasState, state, getPos, pos, getTileEntity.

net.minecraft.block.stateclass61 linescommon1.6 KB

API Surface (5)

IBlockState getBlockState()
TileEntity getTileEntity()
BlockPos getPos()
Predicate<BlockWorldState> hasState(final Predicate<IBlockState> predicatesIn)
boolean apply(BlockWorldState p_apply_1_)

Fields & Constants (6)

world
pos
field_181628_c
state
tileEntity
tileEntityInitialized

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BlockWorldState.java61 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block.state;
2
3
import com.google.common.base.Predicate;
4
import net.minecraft.tileentity.TileEntity;
5
import net.minecraft.util.BlockPos;
6
import net.minecraft.world.World;
7
8
public class BlockWorldState
9
{
10
    private final World world;
11
    private final BlockPos pos;
12
    private final boolean field_181628_c;
13
    private IBlockState state;
14
    private TileEntity tileEntity;
15
    private boolean tileEntityInitialized;
16
17
    public BlockWorldState(World worldIn, BlockPos posIn, boolean p_i46451_3_)
18
    {
19
        this.world = worldIn;
20
        this.pos = posIn;
21
        this.field_181628_c = p_i46451_3_;
22
    }
23
24
    public IBlockState getBlockState()
25
    {
26
        if (this.state == null && (this.field_181628_c || this.world.isBlockLoaded(this.pos)))
27
        {
28
            this.state = this.world.getBlockState(this.pos);
29
        }
30
31
        return this.state;
32
    }
33
34
    public TileEntity getTileEntity()
35
    {
36
        if (this.tileEntity == null && !this.tileEntityInitialized)
37
        {
38
            this.tileEntity = this.world.getTileEntity(this.pos);
39
            this.tileEntityInitialized = true;
40
        }
41
42
        return this.tileEntity;
43
    }
44
45
    public BlockPos getPos()
46
    {
47
        return this.pos;
48
    }
49
50
    public static Predicate<BlockWorldState> hasState(final Predicate<IBlockState> predicatesIn)
51
    {
52
        return new Predicate<BlockWorldState>()
53
        {
54
            public boolean apply(BlockWorldState p_apply_1_)
55
            {
56
                return p_apply_1_ != null && predicatesIn.apply(p_apply_1_.getBlockState());
57
            }
58
        };
59
    }
60
}
61

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