mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-17 19:05:10 +00:00
reformat project according to .editorconfig
Signed-off-by: Glease <[email protected]>
This commit is contained in:
36 files changed
+2507
-2467
No files matched your search
@@ -6,10 +6,10 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.Flip;
|
||||
import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
int DIRECTIONS_COUNT= Direction.VALUES.length;
|
||||
int ROTATIONS_COUNT= Rotation.VALUES.length;
|
||||
int FLIPS_COUNT= Flip.VALUES.length;
|
||||
public interface IAlignment extends IAlignmentLimits, IAlignmentProvider {
|
||||
int DIRECTIONS_COUNT = Direction.VALUES.length;
|
||||
int ROTATIONS_COUNT = Rotation.VALUES.length;
|
||||
int FLIPS_COUNT = Flip.VALUES.length;
|
||||
int STATES_COUNT = ExtendedFacing.STATES_COUNT;
|
||||
|
||||
ExtendedFacing getExtendedFacing();
|
||||
@@ -23,48 +23,48 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
IAlignmentLimits getAlignmentLimits();
|
||||
|
||||
@Override
|
||||
default IAlignment getAlignment(){
|
||||
default IAlignment getAlignment() {
|
||||
return this;
|
||||
}
|
||||
|
||||
static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip){
|
||||
return (direction.ordinal()*ROTATIONS_COUNT+rotation.getIndex())*FLIPS_COUNT+flip.getIndex();
|
||||
static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip) {
|
||||
return (direction.ordinal() * ROTATIONS_COUNT + rotation.getIndex()) * FLIPS_COUNT + flip.getIndex();
|
||||
}
|
||||
|
||||
default ForgeDirection getDirection(){
|
||||
default ForgeDirection getDirection() {
|
||||
return getExtendedFacing().getDirection();
|
||||
}
|
||||
|
||||
default void setDirection(ForgeDirection direction){
|
||||
default void setDirection(ForgeDirection direction) {
|
||||
setExtendedFacing(getExtendedFacing().with(direction));
|
||||
}
|
||||
|
||||
default Rotation getRotation(){
|
||||
default Rotation getRotation() {
|
||||
return getExtendedFacing().getRotation();
|
||||
}
|
||||
|
||||
default void setRotation(Rotation rotation){
|
||||
default void setRotation(Rotation rotation) {
|
||||
setExtendedFacing(getExtendedFacing().with(rotation));
|
||||
}
|
||||
|
||||
default Flip getFlip(){
|
||||
default Flip getFlip() {
|
||||
return getExtendedFacing().getFlip();
|
||||
}
|
||||
|
||||
default void setFlip(Flip flip){
|
||||
default void setFlip(Flip flip) {
|
||||
setExtendedFacing(getExtendedFacing().with(flip));
|
||||
}
|
||||
|
||||
default boolean toolSetDirection(ForgeDirection direction){
|
||||
if(direction==null || direction==ForgeDirection.UNKNOWN){
|
||||
for (int i = 0,j=getDirection().ordinal()+1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) {
|
||||
default boolean toolSetDirection(ForgeDirection direction) {
|
||||
if (direction == null || direction == ForgeDirection.UNKNOWN) {
|
||||
for (int i = 0, j = getDirection().ordinal() + 1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) {
|
||||
if (toolSetDirection(Direction.VALUES[(j + i) % valuesLength].getForgeDirection())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) {
|
||||
if(checkedSetExtendedFacing(extendedFacing)){
|
||||
if (checkedSetExtendedFacing(extendedFacing)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -72,17 +72,17 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean checkedSetDirection(ForgeDirection direction){
|
||||
if (isNewDirectionValid(direction)){
|
||||
default boolean checkedSetDirection(ForgeDirection direction) {
|
||||
if (isNewDirectionValid(direction)) {
|
||||
setDirection(direction);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean canSetToDirectionAny(ForgeDirection direction){
|
||||
default boolean canSetToDirectionAny(ForgeDirection direction) {
|
||||
for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) {
|
||||
if(isNewExtendedFacingValid(extendedFacing)){
|
||||
if (isNewExtendedFacingValid(extendedFacing)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -90,10 +90,10 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
}
|
||||
|
||||
default boolean toolSetRotation(Rotation rotation) {
|
||||
if(rotation==null){
|
||||
if (rotation == null) {
|
||||
int flips = Flip.VALUES.length;
|
||||
int rotations = Rotation.VALUES.length;
|
||||
for (int ii = 0,jj=getFlip().ordinal(); ii < flips; ii++) {
|
||||
for (int ii = 0, jj = getFlip().ordinal(); ii < flips; ii++) {
|
||||
for (int i = 1, j = getRotation().ordinal(); i < rotations; i++) {
|
||||
if (checkedSetExtendedFacing(ExtendedFacing.of(getDirection(), Rotation.VALUES[(j + i) % rotations], Flip.VALUES[(jj + ii) % flips]))) {
|
||||
return true;
|
||||
@@ -101,55 +101,55 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else {
|
||||
} else {
|
||||
return checkedSetRotation(rotation);
|
||||
}
|
||||
}
|
||||
|
||||
default boolean checkedSetRotation(Rotation rotation){
|
||||
if (isNewRotationValid(rotation)){
|
||||
default boolean checkedSetRotation(Rotation rotation) {
|
||||
if (isNewRotationValid(rotation)) {
|
||||
setRotation(rotation);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean toolSetFlip(Flip flip){
|
||||
if(flip==null){
|
||||
default boolean toolSetFlip(Flip flip) {
|
||||
if (flip == null) {
|
||||
for (int i = 1, j = getFlip().ordinal(), valuesLength = Flip.VALUES.length; i < valuesLength; i++) {
|
||||
if (checkedSetFlip(Flip.VALUES[(j + i) % valuesLength])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else {
|
||||
} else {
|
||||
return checkedSetFlip(flip);
|
||||
}
|
||||
}
|
||||
|
||||
default boolean checkedSetFlip(Flip flip){
|
||||
if (isNewFlipValid(flip)){
|
||||
default boolean checkedSetFlip(Flip flip) {
|
||||
if (isNewFlipValid(flip)) {
|
||||
setFlip(flip);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean toolSetExtendedFacing(ExtendedFacing extendedFacing){
|
||||
if(extendedFacing==null){
|
||||
for (int i = 0,j=getExtendedFacing().ordinal()+1, valuesLength = ExtendedFacing.VALUES.length; i < valuesLength; i++) {
|
||||
if (checkedSetExtendedFacing(ExtendedFacing.VALUES[(j + i)%valuesLength])){
|
||||
default boolean toolSetExtendedFacing(ExtendedFacing extendedFacing) {
|
||||
if (extendedFacing == null) {
|
||||
for (int i = 0, j = getExtendedFacing().ordinal() + 1, valuesLength = ExtendedFacing.VALUES.length; i < valuesLength; i++) {
|
||||
if (checkedSetExtendedFacing(ExtendedFacing.VALUES[(j + i) % valuesLength])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else {
|
||||
} else {
|
||||
return checkedSetExtendedFacing(extendedFacing);
|
||||
}
|
||||
}
|
||||
|
||||
default boolean checkedSetExtendedFacing(ExtendedFacing alignment){
|
||||
if (isNewExtendedFacingValid(alignment)){
|
||||
default boolean checkedSetExtendedFacing(ExtendedFacing alignment) {
|
||||
if (isNewExtendedFacingValid(alignment)) {
|
||||
setExtendedFacing(alignment);
|
||||
return true;
|
||||
}
|
||||
@@ -157,31 +157,31 @@ public interface IAlignment extends IAlignmentLimits,IAlignmentProvider {
|
||||
}
|
||||
|
||||
default boolean isNewDirectionValid(ForgeDirection direction) {
|
||||
return isNewExtendedFacingValid(direction,getRotation(),getFlip());
|
||||
return isNewExtendedFacingValid(direction, getRotation(), getFlip());
|
||||
}
|
||||
|
||||
default boolean isNewRotationValid(Rotation rotation){
|
||||
return isNewExtendedFacingValid(getDirection(),rotation,getFlip());
|
||||
default boolean isNewRotationValid(Rotation rotation) {
|
||||
return isNewExtendedFacingValid(getDirection(), rotation, getFlip());
|
||||
}
|
||||
|
||||
default boolean isNewFlipValid(Flip flip){
|
||||
return isNewExtendedFacingValid(getDirection(),getRotation(),flip);
|
||||
default boolean isNewFlipValid(Flip flip) {
|
||||
return isNewExtendedFacingValid(getDirection(), getRotation(), flip);
|
||||
}
|
||||
|
||||
default boolean isExtendedFacingValid() {
|
||||
return isNewExtendedFacingValid(getDirection(),getRotation(),getFlip());
|
||||
return isNewExtendedFacingValid(getDirection(), getRotation(), getFlip());
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip){
|
||||
default boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip) {
|
||||
return getAlignmentLimits().isNewExtendedFacingValid(direction, rotation, flip);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean isNewExtendedFacingValid(ExtendedFacing alignment){
|
||||
default boolean isNewExtendedFacingValid(ExtendedFacing alignment) {
|
||||
return getAlignmentLimits().isNewExtendedFacingValid(
|
||||
alignment.getDirection(),
|
||||
alignment.getRotation(),
|
||||
alignment.getFlip());
|
||||
alignment.getDirection(),
|
||||
alignment.getRotation(),
|
||||
alignment.getFlip());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user