Skip to content

Commit

Permalink
1.20.1 tweaks for package + gradle publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Draylar committed Aug 18, 2023
1 parent 91d1d6d commit 7f7a58d
Show file tree
Hide file tree
Showing 29 changed files with 139 additions and 91 deletions.
57 changes: 42 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'maven-publish'
}

version = project.mod_version + "-" + project.minecraft_version
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

loom {
Expand Down Expand Up @@ -31,34 +31,61 @@ dependencies {
// modImplementation "com.jamieswhiteshirt:reach-entity-attributes:${project.rea_version}"
}

sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}

dependencies {
afterEvaluate {
testmodImplementation sourceSets.main.output
}
}

loom {
runs {
testmodClient {
client()
name = "Test Mod Client"
source sourceSets.testmod
}

testmodServer {
server()
name = "Test Mod Server"
source sourceSets.testmod
}
}
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
// withSourcesJar()
withSourcesJar()
}

jar {
from "LICENSE"
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
// artifact(sourcesJar) {
// builtBy remapSourcesJar
// }
from components.java
}
}
}

// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
repositories {
maven {
name = "draylarRepository"
url = "https://maven.draylar.dev/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ yarn_mappings=1.20.1+build.10
loader_version=0.14.22

# Mod Properties
mod_version=1.9.0
maven_group=draylar
mod_version=1.10.0
maven_group=dev.draylar
archives_base_name=magna

# Dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna;
package dev.draylar.magna;

import draylar.magna.config.MagnaConfig;
import dev.draylar.magna.config.MagnaConfig;
import draylar.omegaconfig.OmegaConfig;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
Expand All @@ -12,12 +12,7 @@ public class Magna implements ModInitializer {

@Override
public void onInitialize() {
// Before loading the test suite, ensure:
// 1. this is a development environment
// 2. REA is installed, which signals this is probably the Magna workspace (REA is also required for testing)
if(FabricLoader.getInstance().isDevelopmentEnvironment() && FabricLoader.getInstance().isModLoaded("reach-entity-attributes")) {
MagnaTest.initialize();
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package draylar.magna.api;
package dev.draylar.magna.api;

import draylar.magna.Magna;
import draylar.magna.impl.MagnaPlayerInteractionManagerExtension;
import dev.draylar.magna.Magna;
import dev.draylar.magna.impl.MagnaPlayerInteractionManagerExtension;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api;
package dev.draylar.magna.api;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
Expand All @@ -16,7 +16,7 @@
import java.util.ArrayList;
import java.util.List;

import static draylar.magna.api.reach.ReachDistanceHelper.getReachDistance;
import static dev.draylar.magna.api.reach.ReachDistanceHelper.getReachDistance;

public interface BlockFinder {
BlockFinder DEFAULT = new BlockFinder() {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api;
package dev.draylar.magna.api;

import net.minecraft.item.ItemStack;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api;
package dev.draylar.magna.api;

import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package draylar.magna.api;
package dev.draylar.magna.api;

import draylar.magna.Magna;
import draylar.magna.api.event.ToolRadiusCallback;
import dev.draylar.magna.api.event.ToolRadiusCallback;
import dev.draylar.magna.item.ExcavatorItem;
import dev.draylar.magna.item.HammerItem;
import dev.draylar.magna.Magna;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
Expand All @@ -15,7 +17,7 @@
* <p>
* Implementers can either make a custom tool using this interface,
* or use one of the provided base item classes,
* {@link draylar.magna.item.HammerItem} and {@link draylar.magna.item.ExcavatorItem}.
* {@link HammerItem} and {@link ExcavatorItem}.
*/
public interface MagnaTool {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package draylar.magna.api.event;
package dev.draylar.magna.api.event;

import draylar.magna.api.MagnaTool;
import draylar.magna.api.optional.MagnaOptionals;
import dev.draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.optional.MagnaOptionals;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.block.BlockState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api.event;
package dev.draylar.magna.api.event;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package draylar.magna.api.optional;
package dev.draylar.magna.api.optional;

import draylar.magna.api.event.ToolMiningSpeedMultiplierCallback;
import draylar.magna.api.event.ToolRadiusCallback;
import draylar.magna.enchantment.CurseOfGigantismEnchantment;
import draylar.magna.item.ExcavatorItem;
import draylar.magna.item.HammerItem;
import dev.draylar.magna.api.event.ToolMiningSpeedMultiplierCallback;
import dev.draylar.magna.api.event.ToolRadiusCallback;
import dev.draylar.magna.enchantment.CurseOfGigantismEnchantment;
import dev.draylar.magna.item.ExcavatorItem;
import dev.draylar.magna.item.HammerItem;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.registry.Registries;
Expand All @@ -25,7 +25,7 @@ public class MagnaOptionals {
* Mods that want this mechanic should opt in. Vanilla Hammers and Vanilla Excavators
* will always opt-in, so you can do it yourself, or rely on them being in the same environment.
* <p>
* The Curse of Gigantism works on all {@link draylar.magna.item.ExcavatorItem} and {@link draylar.magna.item.HammerItem} tools,
* The Curse of Gigantism works on all {@link ExcavatorItem} and {@link HammerItem} tools,
* and will increase the radius of the tool by 1 at the cost of 80% speed.
*/
public static void optInForCurse() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api.optional;
package dev.draylar.magna.api.optional;

import net.minecraft.item.ItemStack;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.api.reach;
package dev.draylar.magna.api.reach;

import net.minecraft.entity.player.PlayerEntity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.config;
package dev.draylar.magna.config;

import draylar.omegaconfig.api.Comment;
import draylar.omegaconfig.api.Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package draylar.magna.enchantment;
package dev.draylar.magna.enchantment;

import draylar.magna.api.optional.MagnaOptionals;
import draylar.magna.api.optional.StackPredicate;
import draylar.magna.item.ExcavatorItem;
import draylar.magna.item.HammerItem;
import dev.draylar.magna.api.optional.MagnaOptionals;
import dev.draylar.magna.api.optional.StackPredicate;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.enchantment.Enchantments;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.impl;
package dev.draylar.magna.impl;

import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package draylar.magna.impl;
package dev.draylar.magna.impl;

public interface MagnaPlayerInteractionManagerExtension {
boolean magna_isMining();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna.item;
package dev.draylar.magna.item;

import draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterial;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna.item;
package dev.draylar.magna.item;

import draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.api.BlockProcessor;
import draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.BlockProcessor;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.api.event.ToolMiningSpeedMultiplierCallback;
import dev.draylar.magna.api.event.ToolMiningSpeedMultiplierCallback;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.api.MagnaTool;
import draylar.magna.impl.MagnaPlayerInteractionManagerExtension;
import dev.draylar.magna.impl.MagnaPlayerInteractionManagerExtension;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.network.ServerPlayerInteractionManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.MagnaTool;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package draylar.magna.mixin;
package dev.draylar.magna.mixin;

import draylar.magna.Magna;
import draylar.magna.api.MagnaTool;
import draylar.magna.api.event.ToolRadiusCallback;
import draylar.magna.config.MagnaConfig;
import dev.draylar.magna.Magna;
import dev.draylar.magna.api.MagnaTool;
import dev.draylar.magna.api.event.ToolRadiusCallback;
import dev.draylar.magna.config.MagnaConfig;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"environment": "*",
"entrypoints": {
"main": [
"draylar.magna.Magna"
"dev.draylar.magna.Magna"
]
},
"custom": {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/magna.mixins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "draylar.magna.mixin",
"package": "dev.draylar.magna.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"BlockMixin",
Expand Down
Loading

0 comments on commit 7f7a58d

Please sign in to comment.