mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
eio conduct compact and fix transfer item and fluid in differentdirections
This commit is contained in:
1 parent
292a70ab6e
commit
c6f7c17854
3 files changed
+81
-9
No files matched your search
@@ -1,30 +1,49 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BlockPos {
|
||||
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
private final World w;
|
||||
|
||||
public BlockPos(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = null;
|
||||
}
|
||||
|
||||
public BlockPos(int x, int y, int z, World w) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public BlockPos(@Nonnull TileEntity te) {
|
||||
this.x = te.xCoord;
|
||||
this.y = te.yCoord;
|
||||
this.z = te.zCoord;
|
||||
this.w = te.getWorldObj();
|
||||
}
|
||||
|
||||
public BlockPos getOffSet(ForgeDirection face) {
|
||||
return new BlockPos(this.x + face.offsetX, this.y + face.offsetY, this.z + face.offsetZ);
|
||||
return new BlockPos(this.x + face.offsetX, this.y + face.offsetY, this.z + face.offsetZ, this.w);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
if (w != null) {
|
||||
return w.getTileEntity(x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
@@ -39,11 +58,15 @@ public class BlockPos {
|
||||
return z;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockPos) {
|
||||
BlockPos pos = (BlockPos) obj;
|
||||
return pos.x == x && pos.y == y && pos.z == z;
|
||||
return pos.x == x && pos.y == y && pos.z == z && Objects.equals(pos.w, w);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user