001 package net.minecraft.village; 002 003 public class VillageDoorInfo 004 { 005 public final int posX; 006 public final int posY; 007 public final int posZ; 008 public final int insideDirectionX; 009 public final int insideDirectionZ; 010 public int lastActivityTimestamp; 011 public boolean isDetachedFromVillageFlag = false; 012 private int doorOpeningRestrictionCounter = 0; 013 014 public VillageDoorInfo(int par1, int par2, int par3, int par4, int par5, int par6) 015 { 016 this.posX = par1; 017 this.posY = par2; 018 this.posZ = par3; 019 this.insideDirectionX = par4; 020 this.insideDirectionZ = par5; 021 this.lastActivityTimestamp = par6; 022 } 023 024 /** 025 * Returns the squared distance between this door and the given coordinate. 026 */ 027 public int getDistanceSquared(int par1, int par2, int par3) 028 { 029 int var4 = par1 - this.posX; 030 int var5 = par2 - this.posY; 031 int var6 = par3 - this.posZ; 032 return var4 * var4 + var5 * var5 + var6 * var6; 033 } 034 035 /** 036 * Get the square of the distance from a location 2 blocks away from the door considered 'inside' and the given 037 * arguments 038 */ 039 public int getInsideDistanceSquare(int par1, int par2, int par3) 040 { 041 int var4 = par1 - this.posX - this.insideDirectionX; 042 int var5 = par2 - this.posY; 043 int var6 = par3 - this.posZ - this.insideDirectionZ; 044 return var4 * var4 + var5 * var5 + var6 * var6; 045 } 046 047 public int getInsidePosX() 048 { 049 return this.posX + this.insideDirectionX; 050 } 051 052 public int getInsidePosY() 053 { 054 return this.posY; 055 } 056 057 public int getInsidePosZ() 058 { 059 return this.posZ + this.insideDirectionZ; 060 } 061 062 public boolean isInside(int par1, int par2) 063 { 064 int var3 = par1 - this.posX; 065 int var4 = par2 - this.posZ; 066 return var3 * this.insideDirectionX + var4 * this.insideDirectionZ >= 0; 067 } 068 069 public void resetDoorOpeningRestrictionCounter() 070 { 071 this.doorOpeningRestrictionCounter = 0; 072 } 073 074 public void incrementDoorOpeningRestrictionCounter() 075 { 076 ++this.doorOpeningRestrictionCounter; 077 } 078 079 public int getDoorOpeningRestrictionCounter() 080 { 081 return this.doorOpeningRestrictionCounter; 082 } 083 }