diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9c2b86f..2ed7d25 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/Common/build.gradle b/Common/build.gradle
index 0547852..efc9343 100644
--- a/Common/build.gradle
+++ b/Common/build.gradle
@@ -2,11 +2,13 @@ plugins {
id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish'
+ id 'com.github.johnrengelman.shadow' version '7.0.0'
}
archivesBaseName = "${mod_name}-common-${minecraft_version}"
minecraft {
+ accessWideners(project.file("src/main/resources/craterlib.aw"))
version(minecraft_version)
runs {
if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) {
@@ -22,7 +24,7 @@ minecraft {
}
dependencies {
- compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
+ compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
}
processResources {
@@ -32,6 +34,20 @@ processResources {
expand buildProps
}
}
+
+shadowJar {
+ dependencies {
+ include(dependency('me.hypherionmc.night-config:toml:3.6.5_custom'))
+ include(dependency('me.hypherionmc.night-config:core:3.6.5_custom'))
+
+ //relocate 'me.hypherionmc.nightconfig', 'shadow.hypherionmc.nightconfig'
+ }
+ classifier ''
+}
+
+build.dependsOn shadowJar
+reg.configureJarTask(shadowJar)
+
publishing {
publications {
mavenJava(MavenPublication) {
@@ -39,12 +55,26 @@ publishing {
artifactId project.archivesBaseName
version project.version
from components.java
+ pom.withXml {
+ Node pomNode = asNode()
+ pomNode.dependencies.'*'.findAll() {
+ it.artifactId.text() == 'regutils-joined-fabric' ||
+ it.artifactId.text() == 'core' ||
+ it.artifactId.text() == 'toml'
+ }.each() {
+ it.parent().remove(it)
+ }
+ }
}
}
repositories {
maven {
- url "file://" + System.getenv("local_maven")
+ url "https://maven.firstdarkdev.xyz/" + (project.isSnapshot ? "snapshots" : "releases")
+ credentials {
+ username System.getenv("MAVEN_USER")
+ password System.getenv("MAVEN_PASS")
+ }
}
}
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/Constants.java b/Common/src/main/java/me/hypherionmc/craterlib/Constants.java
index 6a7543d..8232c1d 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/Constants.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/Constants.java
@@ -4,7 +4,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class Constants {
- public static final String MOD_ID = "craterlib";
- public static final String MOD_NAME = "CraterLib";
- public static final Logger LOG = LogManager.getLogger(MOD_NAME);
+ public static final String MOD_ID = "craterlib";
+ public static final String MOD_NAME = "CraterLib";
+ public static final Logger LOG = LogManager.getLogger(MOD_NAME);
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ISidedTickable.java b/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ISidedTickable.java
index 4f18bbf..2e73b91 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ISidedTickable.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ISidedTickable.java
@@ -5,9 +5,29 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
+/**
+ * Helper Interface for BlockEntities that tick both Client and Server Side
+ */
public interface ISidedTickable {
+ /**
+ * Server Tick Event
+ *
+ * @param level
+ * @param pos
+ * @param state
+ * @param blockEntity
+ */
public void serverTick(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity);
+
+ /**
+ * Client Tick Event
+ *
+ * @param level
+ * @param pos
+ * @param state
+ * @param blockEntity
+ */
public void clientTick(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity);
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ITickable.java b/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ITickable.java
index ffa3c86..600f899 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ITickable.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/api/blockentities/ITickable.java
@@ -5,8 +5,19 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
+/**
+ * Helper Interface for BlockEntities that only tick on a single side
+ */
public interface ITickable {
+ /**
+ * The Tick Event. Can be either Server or Client Sided
+ *
+ * @param level
+ * @param pos
+ * @param state
+ * @param blockEntity
+ */
public void tick(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity);
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/CustomRenderType.java b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/CustomRenderType.java
index 5a09023..9067131 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/CustomRenderType.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/CustomRenderType.java
@@ -1,9 +1,17 @@
package me.hypherionmc.craterlib.api.rendering;
-import net.minecraft.client.renderer.entity.layers.RenderLayer;
+import net.minecraft.client.renderer.RenderType;
+/**
+ * Helper Interface for defining Block render types
+ */
public interface CustomRenderType {
- RenderLayer getCustomRenderType();
+ /**
+ * Get the render type of the block
+ *
+ * @return
+ */
+ RenderType getCustomRenderType();
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/DyableBlock.java b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/DyableBlock.java
index 81bb77d..9d115ae 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/DyableBlock.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/DyableBlock.java
@@ -1,12 +1,25 @@
package me.hypherionmc.craterlib.api.rendering;
-import net.minecraft.client.color.block.BlockColors;
+import net.minecraft.client.color.block.BlockColor;
import net.minecraft.world.item.DyeColor;
+/**
+ * Helper Interface for Dyable Blocks
+ */
public interface DyableBlock {
- BlockColors dyeHandler();
+ /**
+ * Get the BlockColor handler for the block
+ *
+ * @return
+ */
+ BlockColor dyeHandler();
+ /**
+ * Get the default Dye Color for Un-dyed states
+ *
+ * @return
+ */
DyeColor defaultDyeColor();
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/ItemDyable.java b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/ItemDyable.java
index 9ed2e2c..3f86328 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/ItemDyable.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/api/rendering/ItemDyable.java
@@ -2,8 +2,16 @@ package me.hypherionmc.craterlib.api.rendering;
import net.minecraft.world.item.DyeColor;
+/**
+ * Helper Interface for Dyable Items
+ */
public interface ItemDyable {
+ /**
+ * Get the DyeColor of the Item
+ *
+ * @return
+ */
public DyeColor getColor();
}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/client/gui/widgets/TimeSliderWidget.java b/Common/src/main/java/me/hypherionmc/craterlib/client/gui/widgets/TimeSliderWidget.java
index 10ff84f..d934701 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/client/gui/widgets/TimeSliderWidget.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/client/gui/widgets/TimeSliderWidget.java
@@ -4,6 +4,9 @@ import net.minecraft.client.gui.components.AbstractSliderButton;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
+/**
+ * A custom slider widget used for Time. Mostly used by the Hyper Lighting Smoke Machine
+ */
public class TimeSliderWidget extends AbstractSliderButton {
private final double maxValue;
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/client/registry/ClientRegistry.java b/Common/src/main/java/me/hypherionmc/craterlib/client/registry/ClientRegistry.java
new file mode 100644
index 0000000..d84281f
--- /dev/null
+++ b/Common/src/main/java/me/hypherionmc/craterlib/client/registry/ClientRegistry.java
@@ -0,0 +1,45 @@
+package me.hypherionmc.craterlib.client.registry;
+
+import me.hypherionmc.craterlib.api.rendering.DyableBlock;
+import me.hypherionmc.craterlib.api.rendering.ItemDyable;
+import me.hypherionmc.craterlib.client.rendering.ItemColorHandler;
+import me.hypherionmc.craterlib.systems.reg.RegistrationProvider;
+import net.minecraft.client.color.block.BlockColors;
+import net.minecraft.client.color.item.ItemColors;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.level.block.Block;
+
+/**
+ * Helper for registering Block and Item color handlers
+ */
+public class ClientRegistry {
+
+ /**
+ * Register Block Color Handlers
+ *
+ * @param colors
+ * @param blocks
+ */
+ public static void registerBlockColors(BlockColors colors, RegistrationProvider blocks) {
+ blocks.getEntries().forEach(blockRegistryObject -> {
+ if (blockRegistryObject.get() instanceof DyableBlock dyableBlock) {
+ colors.register(dyableBlock.dyeHandler(), (Block) dyableBlock);
+ }
+ });
+ }
+
+ /**
+ * Register Item Color Handlers
+ *
+ * @param colors
+ * @param items
+ */
+ public static void registerItemColors(ItemColors colors, RegistrationProvider- items) {
+ items.getEntries().forEach(itemRegistryObject -> {
+ if (itemRegistryObject.get() instanceof ItemDyable itemDyable) {
+ colors.register(new ItemColorHandler(), (Item) itemDyable);
+ }
+ });
+ }
+
+}
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/client/rendering/ItemColorHandler.java b/Common/src/main/java/me/hypherionmc/craterlib/client/rendering/ItemColorHandler.java
index cd2cebf..1204388 100644
--- a/Common/src/main/java/me/hypherionmc/craterlib/client/rendering/ItemColorHandler.java
+++ b/Common/src/main/java/me/hypherionmc/craterlib/client/rendering/ItemColorHandler.java
@@ -1,18 +1,31 @@
package me.hypherionmc.craterlib.client.rendering;
-import me.hypherionmc.craterlib.api.rendering.DyableBlock;
import me.hypherionmc.craterlib.api.rendering.ItemDyable;
-import me.hypherionmc.craterlib.common.item.BlockItemDyable;
-import net.minecraft.client.color.item.ItemColors;
+import net.minecraft.client.color.item.ItemColor;
import net.minecraft.world.item.ItemStack;
-public class ItemColorHandler extends ItemColors {
+/**
+ * Helper Class for Dyable Items implementing a simple color handler
+ */
+public class ItemColorHandler implements ItemColor {
+ /***
+ * Get the color for the Item/ItemStack
+ * @param stack
+ * @param tintIndex
+ * @return
+ */
@Override
public int getColor(ItemStack stack, int tintIndex) {
return this.getColorFromStack(stack);
}
+ /**
+ * Get the color for the specific items stack, or return BLACK (0)
+ *
+ * @param stack
+ * @return
+ */
private int getColorFromStack(ItemStack stack) {
if (stack.getItem() instanceof ItemDyable itemDyable) {
return itemDyable.getColor().getMaterialColor().col;
diff --git a/Common/src/main/java/me/hypherionmc/craterlib/common/config/ConfigController.java b/Common/src/main/java/me/hypherionmc/craterlib/common/config/ConfigController.java
new file mode 100644
index 0000000..7bdaa9c
--- /dev/null
+++ b/Common/src/main/java/me/hypherionmc/craterlib/common/config/ConfigController.java
@@ -0,0 +1,42 @@
+package me.hypherionmc.craterlib.common.config;
+
+import me.hypherionmc.craterlib.Constants;
+import me.hypherionmc.nightconfig.core.file.FileWatcher;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+/**
+ * Controls Config File Reloads and Events
+ */
+public class ConfigController implements Serializable {
+
+ /**
+ * Cache of registered configs
+ */
+ private static final HashMap