Port to Architectury

This commit is contained in:
Motschen
2022-11-19 16:18:28 +01:00
parent 7fb093de15
commit 258cc3c64e
200 changed files with 1591 additions and 271 deletions

33
.gitignore vendored Executable file → Normal file
View File

@@ -1,25 +1,20 @@
# gradle
.gradle/
out/
classes/
build/ build/
# idea
.idea/
*.iml
*.ipr *.ipr
run/
*.iws *.iws
out/
# vscode *.iml
.gradle/
.settings/ output/
.vscode/
bin/ bin/
libs/
.architectury-transformer/
.classpath .classpath
.project .project
.idea/
# fabric classes/
.metadata
run/ .vscode
.settings
*.launch

115
build.gradle Executable file → Normal file
View File

@@ -1,83 +1,58 @@
plugins { plugins {
id 'fabric-loom' version '0.12-SNAPSHOT' id "architectury-plugin" version "3.4-SNAPSHOT"
id 'maven-publish' id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false
} }
sourceCompatibility = JavaVersion.VERSION_17 architectury {
targetCompatibility = JavaVersion.VERSION_17 injectInjectables = false
minecraft = rootProject.minecraft_version
archivesBaseName = project.archives_base_name }
version = project.mod_version
group = project.maven_group
repositories { repositories {
maven { url "https://jitpack.io" } maven {
maven { url "https://api.modrinth.com/maven" } url = "https://api.modrinth.com/maven"
}
} }
dependencies { subprojects {
//to change the versions see the gradle.properties file apply plugin: "dev.architectury.loom"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" loom {
silentMojangMappingsLicense()
}
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" dependencies {
include "maven.modrinth:midnightlib:${project.midnightlib_version}" minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
//mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:1.19.2+build.3:v2"
}
} }
processResources { allprojects {
inputs.property "version", project.version apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
filesMatching("fabric.mod.json") { archivesBaseName = rootProject.archives_base_name
expand "version": project.version version = rootProject.mod_version
} group = rootProject.maven_group
}
repositories {
tasks.withType(JavaCompile).configureEach { // Add repositories to retrieve artifacts from in here.
// ensure that the encoding is set to UTF-8, no matter what the system default is // You should only use this when depending on other mods because
// this fixes some edge cases with special characters not displaying correctly // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // See https://docs.gradle.org/current/userguide/declaring_repositories.html
// If Javadoc is generated, this must be specified in that task too. // for more information about repositories.
it.options.encoding = "UTF-8" }
// Minecraft 1.17 (21w19a) upwards uses Java 16. tasks.withType(JavaCompile) {
it.options.release = 17 options.encoding = "UTF-8"
} options.release = 17
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task java {
// if it is present. withSourcesJar()
// If you remove this line, sources will not be generated. }
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
// 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
}
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// 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.
}
} }

34
common/build.gradle Normal file
View File

@@ -0,0 +1,34 @@
architectury {
injectInjectables = false
common(rootProject.enabled_platforms.split(","))
}
loom {
}
repositories {
maven { url "https://api.modrinth.com/maven" }
}
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
// Remove the next line if you don't want to depend on the API
//modApi "dev.architectury:architectury:${rootProject.architectury_version}"
}
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -0,0 +1,15 @@
package eu.midnightdust.visualoverhaul;
import eu.midnightdust.visualoverhaul.config.VOConfig;
import net.minecraft.block.Block;
import static eu.midnightdust.visualoverhaul.VisualOverhaul.MOD_ID;
public class VisualOverhaulClient {
public static Block JukeBoxTop;
public static void onInitializeClient() {
VOConfig.init(MOD_ID, VOConfig.class);
}
}

View File

@@ -1,6 +1,6 @@
package eu.midnightdust.visualoverhaul.block; package eu.midnightdust.visualoverhaul.block;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -12,7 +12,7 @@ public class JukeboxTop extends Block {
private static final BooleanProperty HAS_RECORD = Properties.HAS_RECORD; private static final BooleanProperty HAS_RECORD = Properties.HAS_RECORD;
public JukeboxTop() { public JukeboxTop() {
super(FabricBlockSettings.copy(Blocks.JUKEBOX)); super(AbstractBlock.Settings.copy(Blocks.JUKEBOX));
this.setDefaultState(this.stateManager.getDefaultState().with(HAS_RECORD,false)); this.setDefaultState(this.stateManager.getDefaultState().with(HAS_RECORD,false));
} }
@Override @Override

View File

@@ -7,9 +7,11 @@ import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import static eu.midnightdust.visualoverhaul.VisualOverhaul.MOD_ID;
public class FurnaceWoodenPlanksModel extends Model { public class FurnaceWoodenPlanksModel extends Model {
private static ModelPart bb_main; private static ModelPart bb_main;
public static final EntityModelLayer WOODEN_PLANKS_MODEL_LAYER = new EntityModelLayer(new Identifier("visualoverhaul", "wooden_planks"), "main"); public static final EntityModelLayer WOODEN_PLANKS_MODEL_LAYER = new EntityModelLayer(new Identifier(MOD_ID, "wooden_planks"), "main");
public FurnaceWoodenPlanksModel(ModelPart root) { public FurnaceWoodenPlanksModel(ModelPart root) {
super(RenderLayer::getEntitySolid); super(RenderLayer::getEntitySolid);

View File

@@ -2,7 +2,6 @@ package eu.midnightdust.visualoverhaul.compat.phonos.block;
//import io.github.foundationgames.phonos.block.PhonosBlocks; //import io.github.foundationgames.phonos.block.PhonosBlocks;
//import io.github.foundationgames.phonos.block.RadioJukeboxBlock; //import io.github.foundationgames.phonos.block.RadioJukeboxBlock;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;

View File

@@ -2,7 +2,6 @@ package eu.midnightdust.visualoverhaul.compat.phonos.init;
//import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop; //import eu.midnightdust.visualoverhaul.compat.phonos.block.RadioJukeboxTop;
//import io.github.foundationgames.phonos.block.PhonosBlocks; //import io.github.foundationgames.phonos.block.PhonosBlocks;
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;

View File

@@ -13,4 +13,5 @@ public class VOConfig extends MidnightConfig {
@Client @Entry public static boolean coloredLilypad = true; @Client @Entry public static boolean coloredLilypad = true;
@Client @Entry public static boolean potionEnchantmentGlint = true; @Client @Entry public static boolean potionEnchantmentGlint = true;
@Client @Entry(name = "Debug") public static boolean debug = false; @Client @Entry(name = "Debug") public static boolean debug = false;
@Client @Entry @Hidden public static boolean firstLaunch = true;
} }

View File

@@ -21,7 +21,7 @@ public abstract class MixinSoundSystem {
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V") @Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) { public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) { if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
jukeboxPos = new BlockPos(soundInstance.getX(),soundInstance.getY(),soundInstance.getZ()); jukeboxPos = new BlockPos(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
SoundTest.soundPos.put(jukeboxPos, soundInstance.getId()); SoundTest.soundPos.put(jukeboxPos, soundInstance.getId());
} }
} }
@@ -30,7 +30,7 @@ public abstract class MixinSoundSystem {
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) { public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
if (soundInstance != null) { if (soundInstance != null) {
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) { if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
jukeboxPos = new BlockPos(soundInstance.getX(), soundInstance.getY(), soundInstance.getZ()); jukeboxPos = new BlockPos(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
if (SoundTest.soundPos.containsKey(jukeboxPos)) { if (SoundTest.soundPos.containsKey(jukeboxPos)) {
SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId()); SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId());
} }

View File

@@ -0,0 +1,2 @@
{
}

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -14,11 +14,11 @@
} }
}, },
{ {
"from": [11, 9, 8], "from": [11, 8, 8],
"to": [16, 16, 8], "to": [16, 16, 8],
"faces": { "faces": {
"north": {"uv": [0, 0, 5, 7], "texture": "#stand"}, "north": {"uv": [0, 0, 5, 8], "texture": "#stand"},
"south": {"uv": [5, 0, 0, 7], "texture": "#stand"} "south": {"uv": [5, 0, 0, 8], "texture": "#stand"}
} }
} }
] ]

View File

@@ -15,12 +15,12 @@
} }
}, },
{ {
"from": [-0.41, 9, 8], "from": [-0.41, 8, 8],
"to": [4.59, 16, 8], "to": [4.59, 16, 8],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"faces": { "faces": {
"north": {"uv": [5, 0, 0, 7], "texture": "#stand"}, "north": {"uv": [5, 0, 0, 8], "texture": "#stand"},
"south": {"uv": [0, 0, 5, 7], "texture": "#stand"} "south": {"uv": [0, 0, 5, 8], "texture": "#stand"}
} }
} }
] ]

View File

@@ -15,12 +15,12 @@
} }
}, },
{ {
"from": [-0.41, 9, 8], "from": [-0.41, 8, 8],
"to": [4.59, 16, 8], "to": [4.59, 16, 8],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"faces": { "faces": {
"north": {"uv": [5, 0, 0, 7], "texture": "#stand"}, "north": {"uv": [5, 0, 0, 8], "texture": "#stand"},
"south": {"uv": [0, 0, 5, 7], "texture": "#stand"} "south": {"uv": [0, 0, 5, 8], "texture": "#stand"}
} }
} }
] ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Some files were not shown because too many files have changed in this diff Show More