Skip to content

Commit

Permalink
[ciskip]
Browse files Browse the repository at this point in the history
Project modernization, round 1
  • Loading branch information
Flanks255 committed Dec 7, 2024
1 parent c02695b commit 85229c3
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 70 deletions.
115 changes: 82 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.155'
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
id 'net.neoforged.moddev' version '1.0.23'
id "me.modmuss50.mod-publish-plugin" version "0.7.4"
}

repositories {
maven { url = 'https://maven.creeperhost.net/' }
maven { url = 'https://www.cursemaven.com' }
maven { url = 'https://maven.theillusivec4.top/' }
maven { url = 'https://maven.saps.dev/releases' }
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}

def ENV = System.getenv()
Expand All @@ -21,45 +18,73 @@ base {
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceSets.main.resources { srcDir 'src/generated/resources' }
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')

runs {
// applies to all the run configs below
configureEach {
//Limit ram usage for the dev environment to 4GB
jvmArgument '-Xmx8G'

modSource project.sourceSets.main
neoForge {
version = project.neo_version
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.hasProperty("parchment_minecraft_version") ? project.parchment_minecraft_version : project.minecraft_version
}

client {
systemProperty 'neoforge.enabledGameTestNamespaces', "simplyutilities"
programArguments.addAll('--width', '1280', '--height', '720')
if (ENV.MCDEVUSER) {
programArguments.addAll('--username', ENV.MCDEVUSER)
runs {
client {
client()
systemProperty 'neoforge.enabledGameTestNamespaces', "simplyutilities"
programArguments.addAll('--width', '1280', '--height', '720')
if (ENV.MCDEVUSER) {
programArguments.addAll('--username', ENV.MCDEVUSER)
}
if (ENV.MCDEVUUID) {
programArguments.addAll('--uuid', ENV.MCDEVUUID)
}
}
if (ENV.MCDEVUUID) {
programArguments.addAll('--uuid', ENV.MCDEVUUID)

server {
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', "simplyutilities"
}
}

server {
systemProperty 'neoforge.enabledGameTestNamespaces', "simplyutilities"
programArgument '--nogui'
}
gameTestServer {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', "simplyutilities"
}

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', "simplyutilities"
data {
data()
programArguments.addAll '--mod', "simplyutilities", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
configureEach { run ->
jvmArgument '-Xmx8G'
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
}
}
}

data {
programArguments.addAll '--mod', "simplyutilities", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
mods {
"simplyutilities" {
sourceSet(sourceSets.main)
}
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')

configurations {
runtimeClasspath.extendsFrom localRuntime
}

repositories {
maven { url = 'https://maven.creeperhost.net/' }
maven { url = 'https://www.cursemaven.com' }
maven { url = 'https://maven.theillusivec4.top/' }
maven { url = 'https://maven.saps.dev/releases' }
}


dependencies {
implementation "net.neoforged:neoforge:${neo_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
Expand All @@ -71,6 +96,7 @@ dependencies {
}

jar {
group = 'artifact'
manifest {
attributes([
"Specification-Title": "simplyutilities",
Expand All @@ -82,8 +108,24 @@ jar {
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
from sourceSets.main.output
}

var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
loader_version:loader_version,
mod_version:mod_version
]

inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}

sourceSets.main.resources.srcDir generateModMetadata
neoForge.ideSyncTask generateModMetadata

publishing {
publications {
register('mavenJava', MavenPublication) {
Expand Down Expand Up @@ -123,4 +165,11 @@ publishMods {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false
mod_version=0.6.5
minecraft_version=1.21
neo_version=21.0.112-beta
neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.06.23
jei_version=19.4.0.28
minecraft_version=1.21.1
loader_version=[4,)
neo_version=21.1.84
parchment_minecraft_version=1.21
parchment_mappings_version=2024.06.23
jei_version=19.21.0.247
curseforge_id=415936
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-07-19T21:47:10.5317872 Item Models: simplyutilities
// 1.21.1 2024-12-07T13:31:59.1677979 Item Models: simplyutilities
6c355604c53d0263e344661822f01a522ed7aa9a assets/simplyutilities/models/item/charcoal_block.json
ec2acefa442ea24bcb7935bf44e66178acb7212c assets/simplyutilities/models/item/ender_inhibitor.json
73d35ad34ca9262d4109862f2ba8bec44f81efa1 assets/simplyutilities/models/item/ender_pearl_block.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.21 2024-07-26T18:27:45.2930152 Tags for minecraft:item mod id simplyutilities
// 1.21.1 2024-12-07T13:31:59.1373214 Tags for minecraft:item mod id simplyutilities
452fc54f64f1176ec3a9dfc0140e6382ca235945 data/c/tags/item/storage_blocks/charcoal.json
b0da5d335188e63ed39564a901e45cf8442c7f4d data/c/tags/item/storage_blocks/ender_pearl.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-07-19T21:47:10.5327945 Tags for minecraft:entity_type mod id simplyutilities
// 1.21.1 2024-12-07T13:31:59.1686854 Tags for minecraft:entity_type mod id simplyutilities
35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/simplyutilities/tags/entity_type/no_griefing.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-07-19T21:47:10.5297807 Loot Tables
// 1.21.1 2024-12-07T13:31:59.1566606 Loot Tables
7851c3c19df5391c833417117af23ccd06e8d71b data/simplyutilities/loot_table/blocks/charcoal_block.json
e38d40185129dc562687c1301ede33d3885dc006 data/simplyutilities/loot_table/blocks/ender_inhibitor.json
60d669e60015fae0200787a344c6f2d6f3d935b0 data/simplyutilities/loot_table/blocks/ender_pearl_block.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-07-19T21:47:10.5317872 Tags for minecraft:block mod id simplyutilities
// 1.21.1 2024-12-07T13:31:59.1686854 Tags for minecraft:block mod id simplyutilities
41a4a9cea4e9841e6daf8b599c68a12a09535ef0 data/minecraft/tags/block/mineable/pickaxe.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-07-19T21:47:10.5307877 Recipes
// 1.21.1 2024-12-07T13:31:59.1576624 Recipes
37ffa1af735047d37e99f15c53f15947bee0a38e data/simplyutilities/recipe/charcoal_block.json
334c8fd516ecbb62300acb2bb36b944ed051c255 data/simplyutilities/recipe/charcoal_from_block.json
da4ad5255e0fc36c51be11f4ed01327dcadce166 data/simplyutilities/recipe/chests_from_logs.json
Expand All @@ -12,5 +12,5 @@ ecd47bf4c5a82ea475e264acc4723450365095c7 data/simplyutilities/recipe/leather_fro
3c294d6d3537df701069693e5a331f7da1bdccf8 data/simplyutilities/recipe/mini_charcoal.json
4bb8f61aaffac4a77edaab7c57674cf15ae3c923 data/simplyutilities/recipe/mini_coal.json
0be28a5689cc82f4d186f79ad7b614e8695792e6 data/simplyutilities/recipe/online_detector.json
aa768ea1e1f93595eb887ba473c6320b93372547 data/simplyutilities/recipe/sticky_piston.json
c140c38d2bfddc9dab9a76e0e13d79f26fc667e1 data/simplyutilities/recipe/sticky_piston.json
28f9c5ac0f4182fea7f79473fd51bb9914cc364d data/simplyutilities/recipe/stick_from_logs.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-07-19T21:47:10.5317872 Languages: en_us for mod: simplyutilities
// 1.21.1 2024-12-07T13:31:59.1686854 Languages: en_us for mod: simplyutilities
ffb6913759d2e3e0d3a5b2eceecf012767f280f2 assets/simplyutilities/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-07-19T21:47:10.5297807 Block States: simplyutilities
// 1.21.1 2024-12-07T13:31:59.1383272 Block States: simplyutilities
e14a80fd2df4ba23810b1df1becd2d27b50cf47c assets/simplyutilities/blockstates/charcoal_block.json
5737280c1a70c9d14633ea52baf399f460afbcdf assets/simplyutilities/blockstates/ender_inhibitor.json
d4b7715f90ac2be563c6a56aad87836ef7c72989 assets/simplyutilities/blockstates/ender_pearl_block.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"category": "misc",
"key": {
"x": {
"tag": "c:slimeballs"
"tag": "c:slime_balls"
},
"y": {
"item": "minecraft:piston"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static int debug(CommandContext<CommandSourceStack> ctx) throws CommandSy
ctx.getSource().sendFailure(Component.translatable("message.su.debug.hand.noitem"));
return 0;
}
//SimplyUtilities.NETWORK.send(PacketDistributor.PLAYER.with(()-> player), new OpenDebugHandMessage(player.getMainHandItem()));
//PacketDistributor.sendToPlayer(player, new OpenDebugHandPacket(player.getMainHandItem()));
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.component.TypedDataComponent;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
Expand All @@ -31,7 +31,7 @@ public DebugScreen(ItemStack serverStack) {
enum viewTab {
BASIC,
TAGS,
NBT,
COMPONENTS,
CLASSES
}
viewTab currentTab = viewTab.BASIC;
Expand All @@ -54,7 +54,7 @@ protected void init() {

addWidget(new ViewButton(this,guiLeft + 20, guiTop + 3, 56, 10, Component.literal("Basic"), viewTab.BASIC, tabClick));
addWidget(new ViewButton(this,guiLeft + 76, guiTop + 3, 56, 10, Component.literal("Tags"), viewTab.TAGS, tabClick));
addWidget(new ViewButton(this,guiLeft + 132, guiTop + 3, 56, 10, Component.literal("NBT Data"), viewTab.NBT, tabClick));
addWidget(new ViewButton(this,guiLeft + 132, guiTop + 3, 56, 10, Component.literal("Data Components"), viewTab.COMPONENTS, tabClick));
addWidget(new ViewButton(this,guiLeft + 188, guiTop + 3, 56, 10, Component.literal("Class info"), viewTab.CLASSES, tabClick));
}

Expand All @@ -63,7 +63,6 @@ public void renderBackground(GuiGraphics gg, int mouseX, int mouseY, float parti
super.renderBackground(gg, mouseX, mouseY, partialTicks);

gg.blit(GUI, guiLeft, guiTop, 0,0, 256, 220, 256, 256);

}

@Override
Expand All @@ -88,17 +87,12 @@ public void render(@Nonnull GuiGraphics gg, int mouseX, int mouseY, float partia
y+=10;
}
break;
case NBT:
if (stack.has(DataComponents.CUSTOM_DATA)) {
/* String lineList[] = stack.getTag().getPrettyDisplay(" ", 1).getString().split("\n");
int y = guiTop + 24;
for (String line : lineList) {
drawString(matrixStack, font,new TextComponent(line), guiLeft + 8, y, 0xFFFFFF);
y += 10;
}*/
case COMPONENTS:
int yy = guiTop + 24;
for (TypedDataComponent<?> component : stack.getComponents()) {
gg.drawString(font, font.substrByWidth(FormattedText.of(component.toString()), xSize - 16).getString(),guiLeft + 8, yy, 0xFFFFFF);
yy += 10;
}
else
gg.drawString(font, "NBT: None" ,guiLeft + 8, guiTop + 24, 0xFFFFFF);
break;
case CLASSES:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import com.flanks255.simplyutilities.SUBlocks;
import com.flanks255.simplyutilities.SUItems;
import com.flanks255.simplyutilities.SUTags;
import com.flanks255.simplyutilities.SimplyUtilities;
import com.flanks255.simplyutilities.utils.MiscUtils;
import com.flanks255.simplyutilities.utils.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
Expand Down Expand Up @@ -57,7 +55,7 @@ protected void buildRecipes(@Nonnull RecipeOutput theirOutput) {
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.STICKY_PISTON)
.pattern("x")
.pattern("y")
.define('x', Tags.Items.SLIMEBALLS)
.define('x', Tags.Items.SLIME_BALLS)
.define('y', Items.PISTON)
.showNotification(false)
.unlockedBy("hasSlimeBall", has(Items.SLIME_BALL))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
modLoader="javafml"
loaderVersion="[2,)"
loaderVersion="${loader_version}"
license="MIT"
[[mods]]
modId="simplyutilities"
version="${file.jarVersion}"
version="${mod_version}"
displayName="Simply Utilities"
# logoFile="examplemod.png" #optional
credits="" #optional
authors="Flanks255"
description='''
A collection of small commands and useful things.
'''
[[accessTransformers]]
file="META-INF/accesstransformer.cfg"

0 comments on commit 85229c3

Please sign in to comment.