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/
# idea
.idea/
*.iml
*.ipr
run/
*.iws
# vscode
.settings/
.vscode/
out/
*.iml
.gradle/
output/
bin/
libs/
.architectury-transformer/
.classpath
.project
# fabric
run/
.idea/
classes/
.metadata
.vscode
.settings
*.launch

115
build.gradle Executable file → Normal file
View File

@@ -1,83 +1,58 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
architectury {
injectInjectables = false
minecraft = rootProject.minecraft_version
}
repositories {
maven { url "https://jitpack.io" }
maven { url "https://api.modrinth.com/maven" }
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
//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}"
subprojects {
apply plugin: "dev.architectury.loom"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
loom {
silentMojangMappingsLicense()
}
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
dependencies {
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 {
inputs.property "version", project.version
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
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 = 17
}
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") {
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.
}
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
repositories {
// 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.
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}
java {
withSourcesJar()
}
}

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;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@@ -12,7 +12,7 @@ public class JukeboxTop extends Block {
private static final BooleanProperty HAS_RECORD = Properties.HAS_RECORD;
public JukeboxTop() {
super(FabricBlockSettings.copy(Blocks.JUKEBOX));
super(AbstractBlock.Settings.copy(Blocks.JUKEBOX));
this.setDefaultState(this.stateManager.getDefaultState().with(HAS_RECORD,false));
}
@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.util.Identifier;
import static eu.midnightdust.visualoverhaul.VisualOverhaul.MOD_ID;
public class FurnaceWoodenPlanksModel extends Model {
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) {
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.RadioJukeboxBlock;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
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 io.github.foundationgames.phonos.block.PhonosBlocks;
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
import net.minecraft.block.Block;
import net.minecraft.client.render.RenderLayer;
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 potionEnchantmentGlint = true;
@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")
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
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());
}
}
@@ -30,7 +30,7 @@ public abstract class MixinSoundSystem {
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
if (soundInstance != null) {
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)) {
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],
"faces": {
"north": {"uv": [0, 0, 5, 7], "texture": "#stand"},
"south": {"uv": [5, 0, 0, 7], "texture": "#stand"}
"north": {"uv": [0, 0, 5, 8], "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],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [5, 0, 0, 7], "texture": "#stand"},
"south": {"uv": [0, 0, 5, 7], "texture": "#stand"}
"north": {"uv": [5, 0, 0, 8], "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],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"faces": {
"north": {"uv": [5, 0, 0, 7], "texture": "#stand"},
"south": {"uv": [0, 0, 5, 7], "texture": "#stand"}
"north": {"uv": [5, 0, 0, 8], "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