Skip to content

Commit

Permalink
Remove unused classes and apply annotations for clarity
Browse files Browse the repository at this point in the history
Deleted `AbstractWidgetAccessor` and `PriorityMap` due to redundancy. Added `@SuppressWarnings("unused")` annotations across various utility classes to indicate intentional unused elements. Minor comment updates were also made for better future readability.
  • Loading branch information
ThePandaOliver committed Dec 22, 2024
1 parent b871891 commit 46720e2
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public static <T extends ConfigData, E extends ConfigHolder<T>> E register(Class
}

public static <T extends ConfigData> ClientConfigHolder<T> registerClient(Class<T> configClass) {
return PandaLibConfig.<T, ClientConfigHolder<T>>register(configClass, ClientConfigHolder::new);
return PandaLibConfig.register(configClass, ClientConfigHolder::new);
}

public static <T extends ConfigData> CommonConfigHolder<T> registerCommon(Class<T> configClass) {
return PandaLibConfig.<T, CommonConfigHolder<T>>register(configClass, CommonConfigHolder::new);
return PandaLibConfig.register(configClass, CommonConfigHolder::new);
}

public static Optional<ConfigHolder<? extends ConfigData>> getConfig(ResourceLocation resourceLocation) {
Expand Down Expand Up @@ -72,7 +72,7 @@ public static Map<Class<?>, ConfigHolder<?>> getConfigs(String modId) {
*
* @param modID the mod ID of the configuration
* @return the configuration screen
* @deprecated The config menu screen api is still in development, this is just here for quick support with future versions,
* @deprecated The config menu api will be added in the future, this is just here for quick support with future versions,
* this method is deprecated and returns null.
*/
@Deprecated
Expand All @@ -86,7 +86,7 @@ public static Screen getConfigScreen(String modID) {
* @param parent the parent screen
* @param modID the mod ID of the configuration
* @return the configuration screen
* @deprecated The config menu screen API is still in development, this is just here for quick support with future versions,
* @deprecated The config menu api will be added in the future, this is just here for quick support with future versions,
* this method is deprecated and returns null.
*/
@Deprecated
Expand All @@ -99,7 +99,7 @@ public static Screen getConfigScreen(Screen parent, String modID) {
*
* @param configClass the class of the config data
* @return the configuration screen
* @deprecated The config menu screen API is still in development, this is just here for quick support with future versions,
* @deprecated The config menu api will be added in the future, this is just here for quick support with future versions,
* this method is deprecated and returns null.
*/
@Deprecated
Expand All @@ -113,7 +113,7 @@ public static <T extends ConfigData> Screen getConfigScreen(Class<T> configClass
* @param parent the parent screen
* @param configClass the class of the config data
* @return the configuration screen
* @deprecated The config menu screen API is still in development, this is just here for quick support with future versions,
* @deprecated The config menu api will be added in the future, this is just here for quick support with future versions,
* this method is deprecated and returns null.
*/
@Deprecated
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public NetworkContext(Player player, Env envDirection) {
this.envDirection = envDirection;
}

/**
* @return The Sender if this was sent to the server or the receiver if this was sent to a client
*/
public Player getPlayer() {
return player;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.ServiceLoader;

@SuppressWarnings("unused")
public class Services {
private static final Logger LOGGER = LogUtils.getLogger();

Expand Down
19 changes: 8 additions & 11 deletions common/src/main/java/me/pandamods/pandalib/utils/AssimpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import java.util.Objects;

@SuppressWarnings("unused")
public class AssimpUtils {

// Conversion methods
@SuppressWarnings("unused")

public static Matrix4f toMatrix4f(AIMatrix4x4 aiMatrix) {
return new Matrix4f(
aiMatrix.a1(), aiMatrix.b1(), aiMatrix.c1(), aiMatrix.d1(),
Expand All @@ -29,33 +31,29 @@ public static Matrix4f toMatrix4f(AIMatrix4x4 aiMatrix) {
aiMatrix.a4(), aiMatrix.b4(), aiMatrix.c4(), aiMatrix.d4()
);
}

@SuppressWarnings("unused")

public static Matrix3f toMatrix3f(AIMatrix3x3 aiMatrix) {
return new Matrix3f(
aiMatrix.a1(), aiMatrix.b1(), aiMatrix.c1(),
aiMatrix.a2(), aiMatrix.b2(), aiMatrix.c2(),
aiMatrix.a3(), aiMatrix.b3(), aiMatrix.c3()
);
}

@SuppressWarnings("unused")

public static Vector3f toVector3f(AIVector3D vector) {
return new Vector3f(vector.x(), vector.y(), vector.z());
}

@SuppressWarnings("unused")
public static Vector2f toVector2f(AIVector2D vector) {
return new Vector2f(vector.x(), vector.y());
}

@SuppressWarnings("unused")

public static Quaternionf toQuaternionf(AIQuaternion quaternion) {
return new Quaternionf(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w());
}

// Equals methods
@SuppressWarnings("unused")

public static boolean AINodeEqualsAINode(AINode node1, AINode node2) {
boolean namesEqual = Objects.equals(node1.mName().dataString(), node2.mName().dataString());
boolean parentsEqual = (node1.mParent() != null) == (node2.mParent() != null);
Expand All @@ -66,8 +64,7 @@ public static boolean AINodeEqualsAINode(AINode node1, AINode node2) {
boolean meshesEqual = node1.mNumMeshes() == node2.mNumMeshes();
return namesEqual && parentsEqual && childrenEqual && meshesEqual;
}

@SuppressWarnings("unused")

public static boolean AINodeEqualsNode(AINode aiNode, Node node) {
boolean namesEqual = Objects.equals(aiNode.mName().dataString(), node.getName());
boolean parentsEqual = (aiNode.mParent() != null) == (node.getParent() != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;

@SuppressWarnings("unused")
public class BlockUtils {
public static void translateBlock(BlockState blockState, PoseStack poseStack) {
poseStack.translate(0.5f, 0.5f, 0.5f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

@SuppressWarnings("unused")
public class ClassUtils {
public static <T> T constructUnsafely(Class<T> cls) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.joml.Quaternionf;
import org.joml.Vector3f;

@SuppressWarnings("unused")
public class MathUtils {
public static Matrix4f lerpMatrix(Matrix4f matrix, Matrix4f other, float alpha) {
return lerpMatrix(matrix, other, alpha, new Matrix4f());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.client.renderer.texture.TextureAtlasSprite;

@Environment(value=EnvType.CLIENT)
@SuppressWarnings("unused")
public class PLSpriteCoordinateExpander implements VertexConsumer {
private final VertexConsumer delegate;
private final TextureAtlasSprite sprite;
Expand Down
37 changes: 13 additions & 24 deletions common/src/main/java/me/pandamods/pandalib/utils/PrintUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,88 +17,79 @@

import java.text.NumberFormat;

@SuppressWarnings("unused")
public class PrintUtils {

// Vector2
@SuppressWarnings("unused")

public static String getVector2String(Vector2fc vector) {
return getVector2String(vector.x(), vector.y());
}

@SuppressWarnings("unused")

public static String getVector2String(Vector2dc vector) {
return getVector2String(vector.x(), vector.y());
}

@SuppressWarnings("unused")

public static String getVector2String(Vector2ic vector) {
return getVector2String(vector.x(), vector.y());
}

@SuppressWarnings("unused")

public static String getVector2String(double x, double y) {
return "Vector2[" + x + ", " + y + "]";
}

// Vector3
@SuppressWarnings("unused")

public static String getVector3String(Vector3fc vector) {
return getVector3String(vector.x(), vector.y(), vector.z());
}

@SuppressWarnings("unused")

public static String getVector3String(Vector3dc vector) {
return getVector3String(vector.x(), vector.y(), vector.z());
}

@SuppressWarnings("unused")
public static String getVector3String(Vector3ic vector) {
return getVector3String(vector.x(), vector.y(), vector.z());
}

@SuppressWarnings("unused")
public static String getVector3String(double x, double y, double z) {
return "Vector3[" + x + ", " + y + ", " + z + "]";
}

// Vector4
@SuppressWarnings("unused")

public static String getVector4String(Vector4fc vector) {
return getVector4String(vector.x(), vector.y(), vector.z(), vector.w());
}

@SuppressWarnings("unused")
public static String getVector4String(Vector4dc vector) {
return getVector4String(vector.x(), vector.y(), vector.z(), vector.w());
}

@SuppressWarnings("unused")
public static String getVector4String(Vector4ic vector) {
return getVector4String(vector.x(), vector.y(), vector.z(), vector.w());
}

@SuppressWarnings("unused")
public static String getVector4String(double x, double y, double z, double w) {
return "Vector4[" + x + ", " + y + ", " + z + ", " + w + "]";
}

// Quaternion
@SuppressWarnings("unused")

public static String getQuaternionString(Quaternionfc quaternion) {
return getQuaternionString(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w());
}

@SuppressWarnings("unused")
public static String getQuaternionString(Quaterniondc quaternion) {
return getQuaternionString(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w());
}

@SuppressWarnings("unused")
private static String getQuaternionString(double x, double y, double z, double w) {
return "Quaternion[" + x + ", " + y + ", " + z + ", " + w + "]";
}

// Matrix3
@SuppressWarnings("unused")

public static String getMatrix3String(Matrix3fc matrix) {
return "Matrix3[" +
"\n| Rotation (Euler): " + getVector3String(matrix.getEulerAnglesXYZ(new Vector3f())) +
Expand All @@ -107,7 +98,6 @@ public static String getMatrix3String(Matrix3fc matrix) {
"\n]";
}

@SuppressWarnings("unused")
public static String getMatrix3String(Matrix3dc matrix) {
return "Matrix3[" +
"\n| Rotation (Euler): " + getVector3String(matrix.getEulerAnglesXYZ(new Vector3d())) +
Expand All @@ -117,7 +107,7 @@ public static String getMatrix3String(Matrix3dc matrix) {
}

// Matrix4
@SuppressWarnings("unused")

public static String getMatrix4String(Matrix4fc matrix) {
return "Matrix4[" +
"\n| Translation: " + getVector3String(matrix.getTranslation(new Vector3f())) +
Expand All @@ -126,8 +116,7 @@ public static String getMatrix4String(Matrix4fc matrix) {
"\n\\ Scale: " + getVector3String(matrix.getScale(new Vector3f())) +
"\n]";
}

@SuppressWarnings("unused")

public static String getMatrix4String(Matrix4dc matrix) {
return "Matrix4[" +
"\n| Translation: " + getVector3String(matrix.getTranslation(new Vector3d())) +
Expand Down
Loading

0 comments on commit 46720e2

Please sign in to comment.