From 6ecc76786555e2aaa7b1e9f5c65b9619a9d93239 Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Thu, 22 Feb 2018 15:46:32 +1000 Subject: + Added a debug item for linking blocks. % More project clean-up. % Made fish trap 2x slower. $ Fixed issue with fish trap name. $ Fixed .08 issue getting powder barrels. --- .../gtPlusPlus/api/objects/minecraft/BlockPos.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/Java/gtPlusPlus/api/objects/minecraft') diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java index d258d1fe73..3ccc10d4c2 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java @@ -2,6 +2,8 @@ package gtPlusPlus.api.objects.minecraft; import java.io.Serializable; +import gtPlusPlus.api.objects.data.AutoMap; + public class BlockPos implements Serializable{ private static final long serialVersionUID = -7271947491316682006L; @@ -82,4 +84,40 @@ public class BlockPos implements Serializable{ return distanceFrom(x, y, z) <= (range * range); } + + public BlockPos getUp() { + return new BlockPos(this.xPos, this.yPos+1, this.zPos, this.dim); + } + + public BlockPos getDown() { + return new BlockPos(this.xPos, this.yPos-1, this.zPos, this.dim); + } + + public BlockPos getXPos() { + return new BlockPos(this.xPos+1, this.yPos, this.zPos, this.dim); + } + + public BlockPos getXNeg() { + return new BlockPos(this.xPos-1, this.yPos, this.zPos, this.dim); + } + + public BlockPos getZPos() { + return new BlockPos(this.xPos, this.yPos, this.zPos+1, this.dim); + } + + public BlockPos getZNeg() { + return new BlockPos(this.xPos, this.yPos, this.zPos-1, this.dim); + } + + public AutoMap getSurroundingBlocks(){ + AutoMap sides = new AutoMap(); + sides.put(getUp()); + sides.put(getDown()); + sides.put(getXPos()); + sides.put(getXNeg()); + sides.put(getZPos()); + sides.put(getZNeg()); + return sides; + } + } -- cgit