aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/utils')
-rw-r--r--src/main/java/me/Danker/utils/Utils.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index 29e61ed..245d071 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -23,6 +23,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.scoreboard.ScoreObjective;
@@ -31,6 +32,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.minecraft.util.Vec3;
+import net.minecraft.world.World;
public class Utils {
@@ -403,4 +405,19 @@ public class Utils {
return closestBlock;
}
+ public static BlockPos getBlockUnderItemFrame(World world, EntityItemFrame itemFrame) {
+ switch (itemFrame.facingDirection) {
+ case NORTH:
+ return new BlockPos(itemFrame.posX, itemFrame.posY, itemFrame.posZ + 1);
+ case EAST:
+ return new BlockPos(itemFrame.posX - 1, itemFrame.posY, itemFrame.posZ - 0.5);
+ case SOUTH:
+ return new BlockPos(itemFrame.posX, itemFrame.posY, itemFrame.posZ - 1);
+ case WEST:
+ return new BlockPos(itemFrame.posX + 1, itemFrame.posY, itemFrame.posZ - 0.5);
+ default:
+ return null;
+ }
+ }
+
}