mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 19:29:17 +00:00
Code cleanup and remove some unused code
This commit is contained in:
1 parent
f0f8c9a984
commit
fdf3493ed0
295 files changed
+899
-2840
No files matched your search
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -23,51 +22,12 @@ import forestry.core.vect.VectUtil;
|
||||
|
||||
public class FarmHelper {
|
||||
|
||||
public static FarmDirection getOpposite(FarmDirection farmDirection) {
|
||||
private static FarmDirection getOpposite(FarmDirection farmDirection) {
|
||||
ForgeDirection forgeDirection = farmDirection.getForgeDirection();
|
||||
ForgeDirection forgeDirectionOpposite = forgeDirection.getOpposite();
|
||||
return FarmDirection.getFarmDirection(forgeDirectionOpposite);
|
||||
}
|
||||
|
||||
public static int getFarmSizeNorthSouth(World world, Vect start) {
|
||||
FarmDirection farmSide = FarmDirection.NORTH;
|
||||
FarmDirection startSide = FarmDirection.EAST;
|
||||
|
||||
Vect corner = getFarmMultiblockCorner(world, start, farmSide, startSide);
|
||||
|
||||
return getFarmSizeInDirection(world, corner, farmSide, getOpposite(startSide));
|
||||
}
|
||||
|
||||
public static int getFarmSizeEastWest(World world, Vect start) {
|
||||
FarmDirection farmSide = FarmDirection.EAST;
|
||||
FarmDirection startSide = FarmDirection.NORTH;
|
||||
|
||||
Vect corner = getFarmMultiblockCorner(world, start, farmSide, startSide);
|
||||
|
||||
return getFarmSizeInDirection(world, corner, farmSide, getOpposite(startSide));
|
||||
}
|
||||
|
||||
private static int getFarmSizeInDirection(World world, Vect start, FarmDirection farmSide, FarmDirection searchDirection) {
|
||||
int size = 0;
|
||||
|
||||
FarmDirection toCenter = getOpposite(farmSide);
|
||||
|
||||
Vect target = start.add(farmSide);
|
||||
|
||||
TileEntity farmTile;
|
||||
do {
|
||||
size++;
|
||||
|
||||
target = target.add(searchDirection);
|
||||
|
||||
Vect farmTileLocation = target.add(toCenter);
|
||||
farmTile = VectUtil.getTile(world, farmTileLocation);
|
||||
|
||||
} while (farmTile instanceof IFarmComponent);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
public static Vect getFarmMultiblockCorner(World world, Vect start, FarmDirection farmSide, FarmDirection layoutDirection) {
|
||||
Vect edge = getFarmMultiblockEdge(world, start, farmSide);
|
||||
return getFarmMultiblockEdge(world, edge, getOpposite(layoutDirection));
|
||||
|
||||
Reference in new issue
Block a user