mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
* gradle updateBuildScript * fix comments and commented-out code Code deletion, converting comments into javadocs, and refactoring code to not need comments. * remove redundant suppressions * replace C-style array declaration with Java-style * make private field final * remove unnecessary semicolon * extract a common part from an if * simplify boolean expression * simplify ternary if * remove unused imports * convert escaped characters for clarity * replace while with for * replace explicit types with diamond operators * replace anonymous type with lambda * enable modern Java syntax * migrate to enhanced switch * migrate to pattern variables for instanceof * remove empty javadoc * add Nonnull annotation to overrides of Nonnull methods * replace wailaStack with null When wailaStack is not null, the flow breaks out of the loop, so there's no need to confuse the reader with putting wailaStack both as the result and the parameter of the call - there's no recursion. * int cannot be bigger than its max value * suppress dataflow warning * remove redundant initializer The default value of int is 0. * null check is covered by instanceof * simplify some calls of addVertexWithUV * fix typos and add TODOs * make flipState more understandable
78 lines
1.6 KiB
Java
78 lines
1.6 KiB
Java
package com.glodblock.github.util;
|
|
|
|
import java.util.Objects;
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
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, this.w);
|
|
}
|
|
|
|
public BlockPos getOffSet(int x, int y, int z) {
|
|
return new BlockPos(this.x + x, this.y + y, this.z + z, this.w);
|
|
}
|
|
|
|
public TileEntity getTileEntity() {
|
|
if (w != null) {
|
|
return w.getTileEntity(x, y, z);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public int getX() {
|
|
return x;
|
|
}
|
|
|
|
public int getY() {
|
|
return y;
|
|
}
|
|
|
|
public int getZ() {
|
|
return z;
|
|
}
|
|
|
|
public World getWorld() {
|
|
return w;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj) {
|
|
if (obj instanceof BlockPos pos) {
|
|
return pos.x == x && pos.y == y && pos.z == z && Objects.equals(pos.w, w);
|
|
}
|
|
return false;
|
|
}
|
|
}
|