Skip to content

Commit

Permalink
chore: update Project.xml and reformat all code
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed May 10, 2024
1 parent c9d619c commit cd945d8
Show file tree
Hide file tree
Showing 366 changed files with 15,124 additions and 17,713 deletions.
5 changes: 3 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Allay-API/src/main/java/org/allaymc/api/AllayAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public void bindI18n(I18n i18nImpl) {
* If the interface has not been implemented, it will throw an exception <br>
*
* @param api the interface
*
* @return the implementation instance of the specific interface
*/
public <T> T getAPIInstance(Class<T> api) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import org.allaymc.api.block.property.type.BlockPropertyType;
import org.allaymc.api.utils.exception.BlockComponentInjectException;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;

/**
* This is an annotation for validation, used on {@link org.allaymc.api.block.component.BlockComponent BlockComponent} and its subclasses,
Expand Down
89 changes: 44 additions & 45 deletions Allay-API/src/main/java/org/allaymc/api/block/data/BlockFace.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,57 @@
*/
public enum BlockFace {

DOWN( -1, new Vector3i( 0, -1, 0 ) ),
UP( -1, new Vector3i( 0, 1, 0 ) ),
NORTH( 2, new Vector3i( 0, 0, -1 ) ),
SOUTH( 0, new Vector3i( 0, 0, 1 ) ),
WEST( 1, new Vector3i( -1, 0, 0 ) ),
EAST( 3, new Vector3i( 1, 0, 0 ) );
DOWN(-1, new Vector3i(0, -1, 0)),
UP(-1, new Vector3i(0, 1, 0)),
NORTH(2, new Vector3i(0, 0, -1)),
SOUTH(0, new Vector3i(0, 0, 1)),
WEST(1, new Vector3i(-1, 0, 0)),
EAST(3, new Vector3i(1, 0, 0));

public static final BlockFace[] STAIR_DIRECTION_VALUE_TO_BLOCK_FACE =
new BlockFace[]{
BlockFace.EAST, BlockFace.WEST,
BlockFace.SOUTH, BlockFace.NORTH};
private final int horizontalIndex;
private final Vector3ic offset;

BlockFace( int horizontalIndex, Vector3ic offset ) {
BlockFace(int horizontalIndex, Vector3ic offset) {
this.horizontalIndex = horizontalIndex;
this.offset = offset;
}

public static BlockFace fromId(int value) {
return switch (value) {
case 0 -> BlockFace.DOWN;
case 1 -> BlockFace.UP;
case 2 -> BlockFace.NORTH;
case 3 -> BlockFace.SOUTH;
case 4 -> BlockFace.WEST;
case 5 -> BlockFace.EAST;
default -> null;
};
}

public static BlockFace[] getHorizontal() {
return new BlockFace[]{
NORTH,
EAST,
SOUTH,
WEST
};
}

public static BlockFace[] getVertical() {
return new BlockFace[]{
UP,
DOWN
};
}

public static BlockFace getBlockFaceByStairDirectionValue(int value) {
return STAIR_DIRECTION_VALUE_TO_BLOCK_FACE[value];
}

public Vector3ic getOffset() {
return offset;
}
Expand Down Expand Up @@ -107,7 +143,7 @@ public int getHorizontalIndex() {
}

public BlockFace opposite() {
return switch ( this ) {
return switch (this) {
case DOWN -> UP;
case UP -> DOWN;
case NORTH -> SOUTH;
Expand All @@ -117,47 +153,10 @@ public BlockFace opposite() {
};
}

public static BlockFace fromId( int value ) {
return switch ( value ) {
case 0 -> BlockFace.DOWN;
case 1 -> BlockFace.UP;
case 2 -> BlockFace.NORTH;
case 3 -> BlockFace.SOUTH;
case 4 -> BlockFace.WEST;
case 5 -> BlockFace.EAST;
default -> null;
};
}

public static BlockFace[] getHorizontal() {
return new BlockFace[] {
NORTH,
EAST,
SOUTH,
WEST
};
}

public static BlockFace[] getVertical() {
return new BlockFace[] {
UP,
DOWN
};
}

public boolean isHorizontal() {
return this == NORTH || this == EAST || this == SOUTH || this == WEST;
}

public static final BlockFace[] STAIR_DIRECTION_VALUE_TO_BLOCK_FACE =
new BlockFace[] {
BlockFace.EAST, BlockFace.WEST,
BlockFace.SOUTH, BlockFace.NORTH};

public static BlockFace getBlockFaceByStairDirectionValue(int value) {
return STAIR_DIRECTION_VALUE_TO_BLOCK_FACE[value];
}

public int toStairDirectionValue() {
return switch (this) {
case EAST -> 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
@FunctionalInterface
public interface OnInteract {
/**
*
* @param player The player who interacted with the block
* @param itemStack The item in the player's hand
* @param dimension The dimension of the block & player
* @param blockPos The pos of the block that the player clicked on
* @param player The player who interacted with the block
* @param itemStack The item in the player's hand
* @param dimension The dimension of the block & player
* @param blockPos The pos of the block that the player clicked on
* @param placeBlockPos Assuming the player is holding a block item in their hand, this parameter indicates where the block will be placed (if it can be placed)
* @param clickPos The precise pos where the player clicked
* @param blockFace The face of the block that the player clicked on
* @param clickPos The precise pos where the player clicked
* @param blockFace The face of the block that the player clicked on
*
* @return Whether the operation is valid.
* For example, right-clicking on the crafting table is normally considered a valid operation, so this method will return true
* If false is returned, the useItemOn method of the player's item will continue to be called
* For example, right-clicking on the crafting table is normally considered a valid operation, so this method will return true
* If false is returned, the useItemOn method of the player's item will continue to be called
*/
boolean onInteract(EntityPlayer player, ItemStack itemStack, Dimension dimension, Vector3ic blockPos, Vector3ic placeBlockPos, Vector3fc clickPos, BlockFace blockFace);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum Attachment {
HANGING,
HANGING,

MULTIPLE,
MULTIPLE,

SIDE,
SIDE,

STANDING
STANDING
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum BambooLeafSize {
LARGE_LEAVES,
LARGE_LEAVES,

NO_LEAVES,
NO_LEAVES,

SMALL_LEAVES
SMALL_LEAVES
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum BambooStalkThickness {
THICK,
THICK,

THIN
THIN
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum BigDripleafTilt {
FULL_TILT,
FULL_TILT,

NONE,
NONE,

PARTIAL_TILT,
PARTIAL_TILT,

UNSTABLE
UNSTABLE
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum CauldronLiquid {
LAVA,
LAVA,

POWDER_SNOW,
POWDER_SNOW,

WATER
WATER
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum ChemistryTableType {
COMPOUND_CREATOR,
COMPOUND_CREATOR,

ELEMENT_CONSTRUCTOR,
ELEMENT_CONSTRUCTOR,

LAB_TABLE,
LAB_TABLE,

MATERIAL_REDUCER
MATERIAL_REDUCER
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum ChiselType {
CHISELED,
CHISELED,

DEFAULT,
DEFAULT,

LINES,
LINES,

SMOOTH
SMOOTH
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum CoralColor {
BLUE,
BLUE,

PINK,
PINK,

PURPLE,
PURPLE,

RED,
RED,

YELLOW
YELLOW
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum CrackedState {
CRACKED,
CRACKED,

MAX_CRACKED,
MAX_CRACKED,

NO_CRACKS
NO_CRACKS
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum Damage {
BROKEN,
BROKEN,

SLIGHTLY_DAMAGED,
SLIGHTLY_DAMAGED,

UNDAMAGED,
UNDAMAGED,

VERY_DAMAGED
VERY_DAMAGED
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
/**
* Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} <br>
* Allay Project <p>
*
* @author daoge_cmd
*/
public enum DirtType {
COARSE,
COARSE,

NORMAL
NORMAL
}
Loading

0 comments on commit cd945d8

Please sign in to comment.