annotations

This commit is contained in:
FalsePattern committed 2022-05-06 23:53:11 +02:00
1 parent 016f1ad839
commit 01127b4512
13 files changed
+55 -4

No files matched your search

@@ -0,0 +1,24 @@
package com.falsepattern.lib;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Anything annotated with this annotation will be considered stable, and the class/method/field will not get breaking
* changes without a full deprecation cycle.
*
* If a class or method is NOT annotated with this annotation, it will be considered unstable, and the package/method arguments/etc.
* can freely change between patch releases without notice.
*
* If a class is annotated with this annotation, all currently existing public and protected members in the class will
* be considered stable.
*
* Private members will never be considered stable, and can be removed without notice.
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@StableAPI(since = "0.6.0")
public @interface StableAPI {
String since();
}
@@ -1,5 +1,6 @@
package com.falsepattern.lib.compat;
import com.falsepattern.lib.StableAPI;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Lists;
import cpw.mods.fml.relauncher.Side;
@@ -16,6 +17,7 @@ import java.util.Iterator;
import java.util.List;
@Immutable
@StableAPI(since = "0.6.0")
public class BlockPos extends Vec3i {
/**
* An immutable block pos with zero as all coordinates.
@@ -1,7 +1,12 @@
package com.falsepattern.lib.compat;
import com.falsepattern.lib.StableAPI;
import net.minecraft.entity.Entity;
import javax.annotation.concurrent.Immutable;
@Immutable
@StableAPI(since = "0.6.0")
public class ChunkPos {
/**
* The X position of this Chunk Coordinate Pair
@@ -1,7 +1,9 @@
package com.falsepattern.lib.compat;
import com.falsepattern.lib.StableAPI;
import net.minecraft.util.EnumFacing;
@StableAPI(since = "0.6.0")
public enum Rotation {
NONE("rotate_0"),
CLOCKWISE_90("rotate_90"),
@@ -1,11 +1,13 @@
package com.falsepattern.lib.compat;
import com.falsepattern.lib.StableAPI;
import net.minecraft.util.MathHelper;
import javax.annotation.concurrent.Immutable;
import java.util.Objects;
@Immutable
@StableAPI(since = "0.6.0")
public class Vec3i implements Comparable<Vec3i> {
/**
* An immutable vector with zero as all coordinates.
@@ -1,12 +1,13 @@
package com.falsepattern.lib.config;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.falsepattern.lib.StableAPI;
import java.lang.annotation.*;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@StableAPI(since = "0.6.0")
public @interface Config {
/**
* The mod id that this configuration is associated with.
@@ -1,5 +1,6 @@
package com.falsepattern.lib.config;
import com.falsepattern.lib.StableAPI;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import lombok.AccessLevel;
@@ -18,6 +19,7 @@ import java.util.*;
* Class for controlling the loading of configuration files.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@StableAPI(since = "0.6.0")
public class ConfigurationManager {
private static final Map<String, Set<Class<?>>> configs = new HashMap<>();
@@ -1,11 +1,13 @@
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.NonNull;
import lombok.val;
import java.util.Arrays;
import java.util.stream.Collectors;
@StableAPI(since = "0.6.0")
public class ComplexVersion extends Version {
final Version[] versions;
public ComplexVersion(@NonNull Version mainVersion, Version... subVersions) {
@@ -1,5 +1,6 @@
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.CoreLoadingPlugin;
import com.falsepattern.lib.internal.FalsePatternLib;
import lombok.NonNull;
@@ -13,6 +14,7 @@ import java.net.URL;
import java.util.*;
@StableAPI(since = "0.6.0")
public class DependencyLoader {
private static final Map<String, Version> loadedLibraries = new HashMap<>();
@@ -1,5 +1,6 @@
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
@@ -7,6 +8,7 @@ import lombok.val;
import java.util.Objects;
@StableAPI(since = "0.6.0")
public class SemanticVersion extends Version {
@Getter
private final int majorVersion;
@@ -1,5 +1,8 @@
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
@StableAPI(since = "0.6.0")
public abstract class Version implements Comparable<Version> {
protected Version(){}
@@ -1,5 +1,6 @@
package com.falsepattern.lib.text;
import com.falsepattern.lib.StableAPI;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lombok.NonNull;
@@ -23,6 +24,7 @@ import java.util.*;
/**
* Universal escape sequence-based text rendering and chat messages.
*/
@StableAPI(since = "0.6.0")
public final class FormattedText {
private static final Map<Character, EnumChatFormatting> reverseMap = new HashMap<>();
private static final Map<EnumChatFormatting, Color> colorMap = new HashMap<>();
@@ -1,5 +1,6 @@
package com.falsepattern.lib.util;
import com.falsepattern.lib.StableAPI;
import lombok.val;
import java.io.ByteArrayOutputStream;
@@ -13,6 +14,7 @@ import java.nio.charset.StandardCharsets;
/**
* A utility class for reading resources in many ways.
*/
@StableAPI(since = "0.6.0")
public class ResourceUtil {
/**