Skip to content

Commit

Permalink
update to j16 and mc17
Browse files Browse the repository at this point in the history
  • Loading branch information
WearBlackAllDay committed Jun 9, 2021
1 parent 6fca6ce commit 908b490
Show file tree
Hide file tree
Showing 20 changed files with 108 additions and 114 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

remappedSrc/dimthread/
remappedSrc/**
src/test/**
logs/**
88 changes: 49 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,70 +1,78 @@
plugins {
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
maven { url 'https://jitpack.io' }
}

minecraft {
accessWidener = file("src/main/resources/dimthread.accesswidener")
maven {
url "https://jitpack.io"
}
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

dependencies {
implementation 'com.github.WearBlackAllDay:JavaUtils:ab1e0ad736be1d2c2d74c68fa8e9e40e752f2d18'
include 'com.github.WearBlackAllDay:JavaUtils:ab1e0ad736be1d2c2d74c68fa8e9e40e752f2d18'
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:1.16.5"
mappings "net.fabricmc:yarn:1.16.5+build.6:v2"
modImplementation "net.fabricmc:fabric-loader:0.11.3"
implementation "com.github.wearblackallday:JavaUtils:1b369d41cd"
include"com.github.wearblackallday:JavaUtils:1b369d41cd"

// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

//Fabric api
//modImplementation "net.fabricmc.fabric-api:fabric-api:0.32.5+1.16"
modCompile "net.fabricmc.fabric-api:fabric-game-rule-api-v1:${project.fabric_game_rule_v1_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation"net.fabricmc.fabric-api:fabric-game-rule-api-v1:${project.fabric_game_rule_v1_version}"

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
}

minecraft {
accessWidener = file("src/main/resources/dimthread.accesswidener")
refmapName = "dimthread.refmap.json"
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
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()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

// configure the maven publication
Expand All @@ -81,9 +89,11 @@ publishing {
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.6
minecraft_version=1.17
yarn_mappings=1.17+build.5
loader_version=0.11.3
# Mod Properties
mod_version=1.2.3
maven_group=DimThread
mod_version=1.2.4
maven_group=wearblackallday
archives_base_name=DimThread
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.32.5+1.16
fabric_game_rule_v1_version=1.0.2+f8ac1db295
#fabric_version=0.34.9+1.17
fabric_game_rule_v1_version=1.0.6+a02b4463d5

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-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 0 additions & 31 deletions src/main/java/dimthread/util/CrashInfo.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package dimthread;
package wearblackallday.dimthread;

import dimthread.init.ModGameRules;
import dimthread.thread.IMutableMainThread;
import dimthread.util.ServerManager;
import net.fabricmc.api.ModInitializer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import threading.ThreadPool;
import wearblackallday.dimthread.init.ModGameRules;
import wearblackallday.dimthread.thread.IMutableMainThread;
import wearblackallday.dimthread.util.ServerManager;
import wearblackallday.util.ThreadPool;

public class DimThread implements ModInitializer {

public static final String MOD_ID = "dimthread";
public static final String MOD_ID = "wearblackallday/dimthread";
public static final ServerManager MANAGER = new ServerManager();

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dimthread.gamerule;
package wearblackallday.dimthread.gamerule;

import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -42,5 +42,4 @@ public BoolRule build() {
return new BoolRule(this.name, this.category, GameRuleFactory.createBooleanRule(this.initialValue, this.callback));
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dimthread.gamerule;
package wearblackallday.dimthread.gamerule;

import dimthread.DimThread;
import wearblackallday.dimthread.DimThread;
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
import net.minecraft.world.GameRules;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dimthread.gamerule;
package wearblackallday.dimthread.gamerule;

import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
import net.minecraft.server.MinecraftServer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dimthread.init;
package wearblackallday.dimthread.init;

import dimthread.DimThread;
import dimthread.gamerule.BoolRule;
import dimthread.gamerule.IntRule;
import wearblackallday.dimthread.DimThread;
import wearblackallday.dimthread.gamerule.BoolRule;
import wearblackallday.dimthread.gamerule.IntRule;
import net.minecraft.world.GameRules;

public class ModGameRules {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dimthread.mixin;
package wearblackallday.dimthread.mixin;

import dimthread.DimThread;
import wearblackallday.dimthread.DimThread;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dimthread.mixin;
package wearblackallday.dimthread.mixin;

import dimthread.DimThread;
import dimthread.util.CrashInfo;
import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager;
Expand All @@ -13,7 +11,9 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import threading.ThreadPool;
import wearblackallday.dimthread.DimThread;
import wearblackallday.dimthread.util.CrashInfo;
import wearblackallday.util.ThreadPool;

import java.util.Collections;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dimthread.mixin;
package wearblackallday.dimthread.mixin;

import net.minecraft.block.BlockState;
import net.minecraft.block.RedstoneWireBlock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dimthread.mixin;
package wearblackallday.dimthread.mixin;

import dimthread.DimThread;
import dimthread.thread.IMutableMainThread;
import wearblackallday.dimthread.DimThread;
import wearblackallday.dimthread.thread.IMutableMainThread;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dimthread.mixin;
package wearblackallday.dimthread.mixin;

import dimthread.thread.IMutableMainThread;
import wearblackallday.dimthread.thread.IMutableMainThread;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dimthread.thread;
package wearblackallday.dimthread.thread;

public interface IMutableMainThread {

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/wearblackallday/dimthread/util/CrashInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package wearblackallday.dimthread.util;

import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.crash.CrashException;
import net.minecraft.util.crash.CrashReport;

public record CrashInfo(ServerWorld world, Throwable throwable) {

public void crash(String title) {
CrashReport report = CrashReport.create(this.throwable, title);
this.world.addDetailsToCrashReport(report);
throw new CrashException(report);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dimthread.util;
package wearblackallday.dimthread.util;

import dimthread.init.ModGameRules;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
import threading.ThreadPool;
import wearblackallday.dimthread.init.ModGameRules;
import wearblackallday.util.ThreadPool;

import java.util.Collections;
import java.util.ConcurrentModificationException;
Expand Down Expand Up @@ -37,5 +37,4 @@ public void setThreadCount(MinecraftServer server, GameRules.IntRule value) {
this.threadPools.put(server, new ThreadPool(value.get()));
current.shutdown();
}

}
4 changes: 2 additions & 2 deletions src/main/resources/dimthread.mixins.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"required": true,
"minVersion": "0.8",
"package": "dimthread.mixin",
"compatibilityLevel": "JAVA_8",
"package": "wearblackallday.dimthread.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"EntityMixin",
"MinecraftServerMixin",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"environment": "*",
"entrypoints": {
"main": [
"dimthread.DimThread"
"wearblackallday.dimthread.DimThread"
]
},
"mixins": [
Expand All @@ -18,6 +18,6 @@
"accessWidener": "dimthread.accesswidener",
"depends": {
"fabricloader": ">=0.9.3+build.207",
"minecraft": "1.16.x"
"minecraft": ">=1.16"
}
}

0 comments on commit 908b490

Please sign in to comment.