Last 1.18 initial work. Getting ready for 1.19

This commit is contained in:
2022-06-10 18:58:26 +02:00
parent a49903cc69
commit 94e13cc65d
35 changed files with 639 additions and 97 deletions

2
.idea/misc.xml generated
View File

@@ -9,7 +9,7 @@
</list> </list>
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="SwUserDefinedSpecifications"> <component name="SwUserDefinedSpecifications">

View File

@@ -2,11 +2,13 @@ plugins {
id 'java' id 'java'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.0.0'
} }
archivesBaseName = "${mod_name}-common-${minecraft_version}" archivesBaseName = "${mod_name}-common-${minecraft_version}"
minecraft { minecraft {
accessWideners(project.file("src/main/resources/craterlib.aw"))
version(minecraft_version) version(minecraft_version)
runs { runs {
if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) { if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) {
@@ -32,6 +34,20 @@ processResources {
expand buildProps 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 { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
@@ -39,12 +55,26 @@ publishing {
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
from components.java 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 { repositories {
maven { 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")
}
} }
} }
} }

View File

@@ -5,9 +5,29 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
/**
* Helper Interface for BlockEntities that tick both Client and Server Side
*/
public interface ISidedTickable { 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); 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); public void clientTick(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity);
} }

View File

@@ -5,8 +5,19 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
/**
* Helper Interface for BlockEntities that only tick on a single side
*/
public interface ITickable { 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); public void tick(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity);
} }

View File

@@ -1,9 +1,17 @@
package me.hypherionmc.craterlib.api.rendering; 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 { public interface CustomRenderType {
RenderLayer getCustomRenderType(); /**
* Get the render type of the block
*
* @return
*/
RenderType getCustomRenderType();
} }

View File

@@ -1,12 +1,25 @@
package me.hypherionmc.craterlib.api.rendering; 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; import net.minecraft.world.item.DyeColor;
/**
* Helper Interface for Dyable Blocks
*/
public interface DyableBlock { 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(); DyeColor defaultDyeColor();
} }

View File

@@ -2,8 +2,16 @@ package me.hypherionmc.craterlib.api.rendering;
import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeColor;
/**
* Helper Interface for Dyable Items
*/
public interface ItemDyable { public interface ItemDyable {
/**
* Get the DyeColor of the Item
*
* @return
*/
public DyeColor getColor(); public DyeColor getColor();
} }

View File

@@ -4,6 +4,9 @@ import net.minecraft.client.gui.components.AbstractSliderButton;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; 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 { public class TimeSliderWidget extends AbstractSliderButton {
private final double maxValue; private final double maxValue;

View File

@@ -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<Block> 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<Item> items) {
items.getEntries().forEach(itemRegistryObject -> {
if (itemRegistryObject.get() instanceof ItemDyable itemDyable) {
colors.register(new ItemColorHandler(), (Item) itemDyable);
}
});
}
}

View File

@@ -1,18 +1,31 @@
package me.hypherionmc.craterlib.client.rendering; package me.hypherionmc.craterlib.client.rendering;
import me.hypherionmc.craterlib.api.rendering.DyableBlock;
import me.hypherionmc.craterlib.api.rendering.ItemDyable; import me.hypherionmc.craterlib.api.rendering.ItemDyable;
import me.hypherionmc.craterlib.common.item.BlockItemDyable; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.world.item.ItemStack; 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 @Override
public int getColor(ItemStack stack, int tintIndex) { public int getColor(ItemStack stack, int tintIndex) {
return this.getColorFromStack(stack); return this.getColorFromStack(stack);
} }
/**
* Get the color for the specific items stack, or return BLACK (0)
*
* @param stack
* @return
*/
private int getColorFromStack(ItemStack stack) { private int getColorFromStack(ItemStack stack) {
if (stack.getItem() instanceof ItemDyable itemDyable) { if (stack.getItem() instanceof ItemDyable itemDyable) {
return itemDyable.getColor().getMaterialColor().col; return itemDyable.getColor().getMaterialColor().col;

View File

@@ -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<Object, FileWatcher> monitoredConfigs = new HashMap<>();
/**
* INTERNAL METHOD - Register and watch the config
*
* @param config - The config class to register and watch
*/
static void register_config(ModuleConfig config) {
if (monitoredConfigs.containsKey(config)) {
Constants.LOG.error("Failed to register " + config.getConfigPath().getName() + ". Config already registered");
} else {
FileWatcher configWatcher = new FileWatcher();
try {
configWatcher.setWatch(config.getConfigPath(), () -> {
Constants.LOG.info("Sending Reload Event for: " + config.getConfigPath().getName());
config.configReloaded();
});
} catch (Exception e) {
Constants.LOG.error("Failed to register " + config.getConfigPath().getName() + " for auto reloading. " + e.getMessage());
}
monitoredConfigs.put(config, configWatcher);
Constants.LOG.info("Registered " + config.getConfigPath().getName() + " successfully!");
}
}
}

View File

@@ -0,0 +1,147 @@
package me.hypherionmc.craterlib.common.config;
import me.hypherionmc.nightconfig.core.CommentedConfig;
import me.hypherionmc.nightconfig.core.Config;
import me.hypherionmc.nightconfig.core.conversion.ObjectConverter;
import me.hypherionmc.nightconfig.core.file.CommentedFileConfig;
import java.io.File;
/**
* Base Config class containing the save, upgrading and loading logic. All config classes must extend this class
*/
public class ModuleConfig {
/* Final Variables */
private final transient File configPath;
private final transient String networkID;
/**
* Set up the config
*
* @param modId - The ID of the Mod/Module the config belongs to
* @param configName - The name of the config file, excluding extension
*/
public ModuleConfig(String modId, String configName) {
this(modId, "", configName);
}
public ModuleConfig(String modId, String subFolder, String configName) {
/* Preserve the order of the config values */
Config.setInsertionOrderPreserved(true);
/* Configure Paths and Network SYNC ID */
File configDir = new File("config" + (subFolder.isEmpty() ? "" : File.separator + subFolder));
configPath = new File(configDir + File.separator + configName + ".toml");
networkID = modId + ":conf_" + configName.replace("-", "_");
/* Check if the required directories exists, otherwise we create them */
if (!configDir.exists()) {
configDir.mkdirs();
}
/* Register the Config for Watching and events */
ConfigController.register_config(this);
}
/**
* This method has to be called in the config constructor. This creates or upgrades the config file as needed
*
* @param config - The config class to use
*/
public void registerAndSetup(ModuleConfig config) {
if (!configPath.exists() || configPath.length() < 10) {
saveConfig(config);
} else {
migrateConfig(config);
}
}
/**
* Save the config to the disk
*
* @param conf - The config class to serialize and save
*/
public void saveConfig(ModuleConfig conf) {
/* Set up the Serializer and Config Object */
ObjectConverter converter = new ObjectConverter();
CommentedFileConfig config = CommentedFileConfig.builder(configPath).build();
/* Save the config and fire the reload event */
converter.toConfig(conf, config);
config.save();
}
/**
* Load the config from the file into a Class
*
* @param conf - The config Class to load
* @return - Returns the loaded version of the class
*/
public <T> T loadConfig(Object conf) {
/* Set up the Serializer and Config Object */
ObjectConverter converter = new ObjectConverter();
CommentedFileConfig config = CommentedFileConfig.builder(configPath).build();
config.load();
/* Load the config and return the loaded config */
converter.toObject(config, conf);
return (T) conf;
}
/**
* INTERNAL METHOD - Upgrades the config files in the event the config structure changes
*
* @param conf - The config class to load
*/
private void migrateConfig(ModuleConfig conf) {
/* Set up the Serializer and Config Objects */
CommentedFileConfig config = CommentedFileConfig.builder(configPath).build();
CommentedFileConfig newConfig = CommentedFileConfig.builder(configPath).build();
config.load();
/* Upgrade the config */
new ObjectConverter().toConfig(conf, newConfig);
updateConfigValues(config, newConfig, CommentedConfig.copy(newConfig), "");
newConfig.save();
}
private void updateConfigValues(CommentedConfig oldConfig, CommentedConfig newConfig, CommentedConfig outputConfig, String subKey) {
/* Loop over the config keys and check what has changed */
newConfig.valueMap().forEach((key, value) -> {
String finalKey = subKey + (subKey.isEmpty() ? "" : ".") + key;
if (value instanceof CommentedConfig commentedConfig) {
updateConfigValues(oldConfig, commentedConfig, outputConfig, finalKey);
} else {
outputConfig.set(finalKey,
oldConfig.contains(finalKey) ? oldConfig.get(finalKey) : value);
}
});
}
/**
* Get the location of the config file
*
* @return - The FILE object containing the config file
*/
public File getConfigPath() {
return configPath;
}
/**
* Get the NETWORK SYNC ID
*
* @return - Returns the Sync ID in format modid:config_name
*/
public String getNetworkID() {
return networkID;
}
/**
* Fired whenever changes to the config are detected
*/
public void configReloaded() {
}
}

View File

@@ -0,0 +1,11 @@
package me.hypherionmc.craterlib.common.config.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Syncable {
}

View File

@@ -6,12 +6,20 @@ import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
/**
* Base Item for Blocks that implement @link {DyableBlock}.
*/
public class BlockItemDyable extends BlockItem implements ItemDyable { public class BlockItemDyable extends BlockItem implements ItemDyable {
public BlockItemDyable(Block block, Properties properties) { public BlockItemDyable(Block block, Properties properties) {
super(block, properties); super(block, properties);
} }
/**
* Get the Item Color from the block
*
* @return
*/
@Override @Override
public DyeColor getColor() { public DyeColor getColor() {
if (this.getBlock() instanceof DyableBlock dyableBlock) { if (this.getBlock() instanceof DyableBlock dyableBlock) {

View File

@@ -17,6 +17,9 @@ import net.minecraft.world.level.gameevent.GameEvent;
import java.util.List; import java.util.List;
/**
* Custom Water Bottle item that supports Dye and can be used as Dye
*/
public class DyableWaterBottle extends DyeItem implements ItemDyable { public class DyableWaterBottle extends DyeItem implements ItemDyable {
private final DyeColor color; private final DyeColor color;
@@ -28,16 +31,35 @@ public class DyableWaterBottle extends DyeItem implements ItemDyable {
this.isGlowing = isGlowing; this.isGlowing = isGlowing;
} }
/**
* Normally this is used for enchanted items, in this case, it's used to check if the fluid is a glowing fluid
*
* @param stack
* @return
*/
@Override @Override
public boolean isFoil(ItemStack stack) { public boolean isFoil(ItemStack stack) {
return this.isGlowing; return this.isGlowing;
} }
/**
* Return the color of the item for the Color Handler
*
* @return
*/
@Override @Override
public DyeColor getColor() { public DyeColor getColor() {
return this.color; return this.color;
} }
/**
* This is basically the same as the vanilla method for water bottles
*
* @param stack
* @param level
* @param user
* @return
*/
@Override @Override
public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity user) { public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity user) {
Player playerEntity; Player playerEntity;

View File

@@ -6,6 +6,9 @@ import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
/**
* A custom water bucket that supports Dye Colors
*/
public class DyableWaterBucket extends BucketItem implements ItemDyable { public class DyableWaterBucket extends BucketItem implements ItemDyable {
private final DyeColor color; private final DyeColor color;
@@ -17,6 +20,12 @@ public class DyableWaterBucket extends BucketItem implements ItemDyable {
this.isGlowing = isGlowing; this.isGlowing = isGlowing;
} }
/**
* Normally this is used for enchanted items, in this case, it's used to check if the fluid is a glowing fluid
*
* @param stack
* @return
*/
@Override @Override
public boolean isFoil(ItemStack stack) { public boolean isFoil(ItemStack stack) {
return this.isGlowing; return this.isGlowing;

View File

@@ -0,0 +1,28 @@
package me.hypherionmc.craterlib.common.network;
import me.hypherionmc.craterlib.Constants;
import net.minecraft.Util;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.level.Level;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;
// TODO: FINISH NETWORK IMPLEMENTATION
public interface BaseNetworkPacket {
Map<String, Handler<?>> PACKETS = Util.make(new HashMap<>(), map -> {
Constants.LOG.info("Registering Config Packets");
});
void write(FriendlyByteBuf buf);
void handle(Level level);
record Handler<T extends BaseNetworkPacket>(Class<T> clazz, BiConsumer<T, FriendlyByteBuf> write,
Function<FriendlyByteBuf, T> read,
BiConsumer<T, Level> handle) {
}
}

View File

@@ -0,0 +1,13 @@
package me.hypherionmc.craterlib.common.particles;
import net.minecraft.core.particles.SimpleParticleType;
/**
* Helper Class for exposing a hidden constructor in the vanilla particle type
*/
public class WrappedSimpleParticleType extends SimpleParticleType {
public WrappedSimpleParticleType(boolean alwaysShow) {
super(alwaysShow);
}
}

View File

@@ -7,4 +7,5 @@ public interface IPlatformHelper {
boolean isModLoaded(String modId); boolean isModLoaded(String modId);
boolean isDevelopmentEnvironment(); boolean isDevelopmentEnvironment();
} }

View File

@@ -0,0 +1,6 @@
/**
* So, if you got here, most probably you want to see the registration system of this mod.
* Well, you are in the wrong place. This mod uses <a href="https://github.com/Matyrobbrt/RegistrationUtils">RegistrationUtils</a> for
* all its registration needs.
*/
package me.hypherionmc.craterlib.systems.reg;

View File

@@ -25,7 +25,8 @@ public class OptifineUtils {
Class ofConfigClass = Class.forName("net.optifine.Config"); Class ofConfigClass = Class.forName("net.optifine.Config");
Method rrField = ofConfigClass.getMethod("isRenderRegions"); Method rrField = ofConfigClass.getMethod("isRenderRegions");
return (boolean) rrField.invoke(null); return (boolean) rrField.invoke(null);
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException e) {
// Optifine is probably not present. Ignore the error // Optifine is probably not present. Ignore the error
return false; return false;
} catch (Exception e) { } catch (Exception e) {

View File

@@ -39,12 +39,15 @@ public class RenderUtils {
public static int alpha(int pPackedColor) { public static int alpha(int pPackedColor) {
return pPackedColor >>> 24; return pPackedColor >>> 24;
} }
public static int red(int pPackedColor) { public static int red(int pPackedColor) {
return pPackedColor >> 16 & 255; return pPackedColor >> 16 & 255;
} }
public static int green(int pPackedColor) { public static int green(int pPackedColor) {
return pPackedColor >> 8 & 255; return pPackedColor >> 8 & 255;
} }
public static int blue(int pPackedColor) { public static int blue(int pPackedColor) {
return pPackedColor & 255; return pPackedColor & 255;
} }

View File

@@ -0,0 +1,3 @@
accessWidener v1 named
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo

View File

@@ -11,10 +11,13 @@ dependencies {
mappings loom.officialMojangMappings() mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
include 'me.hypherionmc.night-config:toml:3.6.5_custom'
include 'me.hypherionmc.night-config:core:3.6.5_custom'
implementation project(":Common") implementation project(":Common")
} }
loom { loom {
accessWidenerPath = project(":Common").file("src/main/resources/craterlib.aw")
runs { runs {
client { client {
client() client()
@@ -62,12 +65,26 @@ publishing {
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
from components.java 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 { repositories {
maven { 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")
}
} }
} }
} }

View File

@@ -1,11 +1,14 @@
package me.hypherionmc.craterlib; package me.hypherionmc.craterlib;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.server.packs.PackType;
public class CraterLibInitializer implements ModInitializer { public class CraterLibInitializer implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
var resources = ResourceManagerHelper.get(PackType.CLIENT_RESOURCES);
} }
} }

View File

@@ -2,7 +2,6 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "craterlib", "id": "craterlib",
"version": "${version}", "version": "${version}",
"name": "CraterLib", "name": "CraterLib",
"description": "A library mod used by HypherionSA's Mods", "description": "A library mod used by HypherionSA's Mods",
"authors": [ "authors": [
@@ -12,10 +11,8 @@
"homepage": "https://fabricmc.net/", "homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod" "sources": "https://github.com/FabricMC/fabric-example-mod"
}, },
"license": "MIT", "license": "MIT",
"icon": "assets/modid/icon.png", "icon": "assets/modid/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
@@ -29,7 +26,7 @@
"craterlib.mixins.json", "craterlib.mixins.json",
"craterlib.fabric.mixins.json" "craterlib.fabric.mixins.json"
], ],
"accessWidener": "craterlib.aw",
"depends": { "depends": {
"fabricloader": ">=0.12", "fabricloader": ">=0.12",
"fabric": "*", "fabric": "*",

View File

@@ -9,6 +9,9 @@ buildscript {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
} }
} }
plugins {
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
@@ -97,7 +100,22 @@ processResources {
} }
} }
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 ''
}
reobf {
shadowJar {}
}
build.dependsOn reobfShadowJar
reg.configureJarTask(shadowJar)
jar.finalizedBy('reobfJar') jar.finalizedBy('reobfJar')
publishing { publishing {
@@ -106,12 +124,26 @@ publishing {
groupId project.group groupId project.group
artifactId project.archivesBaseName artifactId project.archivesBaseName
version project.version version project.version
artifact jar artifact shadowJar
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 { repositories {
maven { 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")
}
} }
} }
} }
@@ -122,4 +154,4 @@ task copyAllArtifacts(type: Copy) {
include("*.jar") include("*.jar")
} }
build.finalizedBy(copyAllArtifacts); build.finalizedBy(copyAllArtifacts)

View File

@@ -0,0 +1 @@
public net.minecraft.client.renderer.LevelRenderer$RenderChunkInfo

View File

@@ -2,6 +2,24 @@
A library mod used by HypherionSA's mods. Mostly used by Hyper Lighting 2. A library mod used by HypherionSA's mods. Mostly used by Hyper Lighting 2.
***
## Library Features
* Universal Config System (TOML Based)
* Easy Cross Mod-Loader registration System
* Built in Helper Classes for Various minecraft features
* Built in FluidTank and Energy systems for Forge/Fabric (Forge versions are just wrappers).
* Built in Optifine-Compat utilities
* Various utilities for Blockstates, LANG, Math and Rendering
* TODO: Built in Cross Mod-Loader Network system
* TODO: Various GUI widgets and Utilities
* TODO: Cross Mod-Loader Dynamic Lighting
* TODO: Texture Utils
* TODO: Sync Config From Server to Client
***
## Setup Instructions ## Setup Instructions
*Coming Soon* *Coming Soon*

View File

@@ -1,10 +1,31 @@
plugins {
id 'java'
id 'com.matyrobbrt.mc.registrationutils' version '0.2.6'
}
registrationUtils {
group 'me.hypherionmc.craterlib.systems.reg'
projects {
Common { type 'common'; project ':Common' }
Fabric { type 'fabric'; project ':Fabric' }
Forge { type 'forge'; project ':Forge' }
}
}
subprojects { subprojects {
ext {
isSnapshot: false
}
def version_base = "${project.version_major}.${project.version_minor}" def version_base = "${project.version_major}.${project.version_minor}"
version = "${version_base}.${project.version_patch}" version = "${version_base}.${project.version_patch}"
group = project.group
// Jenkins // Jenkins
if (System.getenv('BUILD_NUMBER') != null) { if (System.getenv('BUILD_NUMBER') != null) {
project.isSnapshot = true
version = version_base + "." + System.getenv('BUILD_NUMBER') + "d" version = version_base + "." + System.getenv('BUILD_NUMBER') + "d"
} }
@@ -37,6 +58,15 @@ subprojects {
name = 'Sponge / Mixin' name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/' url = 'https://repo.spongepowered.org/repository/maven-public/'
} }
maven {
name = 'Hypherion Maven'
url = 'https://maven.firstdarkdev.xyz/releases/'
}
}
dependencies {
implementation 'me.hypherionmc.night-config:toml:3.6.5_custom'
implementation 'me.hypherionmc.night-config:core:3.6.5_custom'
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {

View File

@@ -1,7 +1,7 @@
# Project # Project
version_major=1 version_major=1
version_minor=0 version_minor=0
version_patch=0 version_patch=5
group=me.hypherionmc.craterlib group=me.hypherionmc.craterlib
# Common # Common
@@ -10,10 +10,9 @@ common_runs_enabled=false
common_client_run_name=Common Client common_client_run_name=Common Client
common_server_run_name=Common Server common_server_run_name=Common Server
# Forge # Forge
forge_version=40.1.0 forge_version=40.1.0
//forge_ats_enabled=true forge_ats_enabled=true
# Fabric # Fabric
fabric_version=0.51.1+1.18.2 fabric_version=0.51.1+1.18.2