VillageDoorInfo .java

net.minecraft.village.VillageDoorInfo (class, 116 lines): members: incrementDoorOpeningRestrictionCounter, resetDoorOpeningRestrictionCounter, insideBlock.

net.minecraft.villageclass116 linescommon3.1 KB

API Surface (15)

int getDistanceSquared(int x, int y, int z)
int getDistanceToDoorBlockSq(BlockPos pos)
int getDistanceToInsideBlockSq(BlockPos pos)
boolean func_179850_c(BlockPos pos)
void resetDoorOpeningRestrictionCounter()
void incrementDoorOpeningRestrictionCounter()
int getDoorOpeningRestrictionCounter()
BlockPos getDoorBlockPos()
BlockPos getInsideBlockPos()
int getInsideOffsetX()
int getInsideOffsetZ()
int getInsidePosY()
void func_179849_a(int timestamp)
boolean getIsDetachedFromVillageFlag()
void setIsDetachedFromVillageFlag(boolean detached)

Fields & Constants (6)

doorBlockPos
insideBlock
insideDirection
lastActivityTimestamp
isDetachedFromVillageFlag
doorOpeningRestrictionCounter

Code Graph: Dependencies (2)

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

Full Source

VillageDoorInfo.java116 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.village;
2
3
import net.minecraft.util.BlockPos;
4
import net.minecraft.util.EnumFacing;
5
6
public class VillageDoorInfo
7
{
8
    /** a block representing the door. Could be either upper or lower part */
9
    private final BlockPos doorBlockPos;
10
    private final BlockPos insideBlock;
11
12
    /** the inside direction is where can see less sky */
13
    private final EnumFacing insideDirection;
14
    private int lastActivityTimestamp;
15
    private boolean isDetachedFromVillageFlag;
16
    private int doorOpeningRestrictionCounter;
17
18
    public VillageDoorInfo(BlockPos pos, int p_i45871_2_, int p_i45871_3_, int p_i45871_4_)
19
    {
20
        this(pos, getFaceDirection(p_i45871_2_, p_i45871_3_), p_i45871_4_);
21
    }
22
23
    private static EnumFacing getFaceDirection(int deltaX, int deltaZ)
24
    {
25
        return deltaX < 0 ? EnumFacing.WEST : (deltaX > 0 ? EnumFacing.EAST : (deltaZ < 0 ? EnumFacing.NORTH : EnumFacing.SOUTH));
26
    }
27
28
    public VillageDoorInfo(BlockPos pos, EnumFacing facing, int timestamp)
29
    {
30
        this.doorBlockPos = pos;
31
        this.insideDirection = facing;
32
        this.insideBlock = pos.offset(facing, 2);
33
        this.lastActivityTimestamp = timestamp;
34
    }
35
36
    /**
37
     * Returns the squared distance between this door and the given coordinate.
38
     */
39
    public int getDistanceSquared(int x, int y, int z)
40
    {
41
        return (int)this.doorBlockPos.distanceSq((double)x, (double)y, (double)z);
42
    }
43
44
    public int getDistanceToDoorBlockSq(BlockPos pos)
45
    {
46
        return (int)pos.distanceSq(this.getDoorBlockPos());
47
    }
48
49
    public int getDistanceToInsideBlockSq(BlockPos pos)
50
    {
51
        return (int)this.insideBlock.distanceSq(pos);
52
    }
53
54
    public boolean func_179850_c(BlockPos pos)
55
    {
56
        int i = pos.getX() - this.doorBlockPos.getX();
57
        int j = pos.getZ() - this.doorBlockPos.getY();
58
        return i * this.insideDirection.getFrontOffsetX() + j * this.insideDirection.getFrontOffsetZ() >= 0;
59
    }
60
61
    public void resetDoorOpeningRestrictionCounter()
62
    {
63
        this.doorOpeningRestrictionCounter = 0;
64
    }
65
66
    public void incrementDoorOpeningRestrictionCounter()
67
    {
68
        ++this.doorOpeningRestrictionCounter;
69
    }
70
71
    public int getDoorOpeningRestrictionCounter()
72
    {
73
        return this.doorOpeningRestrictionCounter;
74
    }
75
76
    public BlockPos getDoorBlockPos()
77
    {
78
        return this.doorBlockPos;
79
    }
80
81
    public BlockPos getInsideBlockPos()
82
    {
83
        return this.insideBlock;
84
    }
85
86
    public int getInsideOffsetX()
87
    {
88
        return this.insideDirection.getFrontOffsetX() * 2;
89
    }
90
91
    public int getInsideOffsetZ()
92
    {
93
        return this.insideDirection.getFrontOffsetZ() * 2;
94
    }
95
96
    public int getInsidePosY()
97
    {
98
        return this.lastActivityTimestamp;
99
    }
100
101
    public void func_179849_a(int timestamp)
102
    {
103
        this.lastActivityTimestamp = timestamp;
104
    }
105
106
    public boolean getIsDetachedFromVillageFlag()
107
    {
108
        return this.isDetachedFromVillageFlag;
109
    }
110
111
    public void setIsDetachedFromVillageFlag(boolean detached)
112
    {
113
        this.isDetachedFromVillageFlag = detached;
114
    }
115
}
116

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