Port to Architectury

Still need to figure out how to register built-in resource packs on forge
This commit is contained in:
Motschen
2022-11-02 18:21:21 +01:00
parent 9e5ff1cb94
commit 54e6d69456
36 changed files with 684 additions and 232 deletions

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,10 @@
package eu.midnightdust.cullleaves;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
public class CullLeavesClient {
public static void onInitializeClient() {
CullLeavesConfig.init("cullleaves", CullLeavesConfig.class);
}
}

View File

@@ -0,0 +1,8 @@
package eu.midnightdust.cullleaves.config;
import eu.midnightdust.lib.config.MidnightConfig;
public class CullLeavesConfig extends MidnightConfig {
@Entry // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
public static boolean enabled = true;
}

View File

@@ -0,0 +1,28 @@
package eu.midnightdust.cullleaves.mixin;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(LeavesBlock.class)
@Environment(EnvType.CLIENT)
public class MixinLeavesBlock extends Block {
public MixinLeavesBlock(Settings settings) {
super(settings);
}
@Override
@SuppressWarnings("deprecation")
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
if (CullLeavesConfig.enabled) {
return neighborState.getBlock() instanceof LeavesBlock;
}
else return false;
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,5 @@
{
"cullleaves.midnightconfig.title":"Cull Leaves Config",
"cullleaves.midnightconfig.enabled.tooltip":"After changing this setting you have to reload all chunks (F3 + A)",
"cullleaves.midnightconfig.enabled":"Enabled"
}

View File

@@ -0,0 +1,5 @@
{
"cullleaves.midnightconfig.title":"Definições do Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip":"Recarregue os chunks (F3 + A) ao alterar essa opção",
"cullleaves.midnightconfig.enabled":"Ativado"
}

View File

@@ -0,0 +1,5 @@
{
"cullleaves.midnightconfig.title":"Настройки Cull Leaves",
"cullleaves.midnightconfig.enabled.tooltip":"После изменения этого параметра необходимо перезагрузить чанки (F3 + A)",
"cullleaves.midnightconfig.enabled":"Включён"
}

View File

@@ -0,0 +1,13 @@
{
"required": true,
"package": "eu.midnightdust.cullleaves.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinLeavesBlock"
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}

View File

@@ -0,0 +1,73 @@
{
"credit": "made by Motschen",
"parent": "block/block",
"textures": {
"particle": "#all"
},
"elements": [
{
"name": "main",
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north", "tintindex": 0},
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east", "tintindex": 0},
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south", "tintindex": 0},
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west", "tintindex": 0},
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up", "tintindex": 0},
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down", "tintindex": 0}
}
},
{
"name": "bottom",
"from": [0, 0.01, 0],
"to": [16, 0.01, 16],
"faces": {
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down", "tintindex": 0}
}
},
{
"name": "west",
"from": [0.01, 0, 0],
"to": [0.01, 16, 16],
"faces": {
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west", "tintindex": 0}
}
},
{
"name": "north",
"from": [0, 0, 0.01],
"to": [16, 16, 0.01],
"faces": {
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north", "tintindex": 0}
}
},
{
"name": "east",
"from": [15.99, 0, 0],
"to": [15.99, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [23, 8, 8]},
"faces": {
"west": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "east", "tintindex": 0}
}
},
{
"name": "south",
"from": [0, 0, 15.99],
"to": [16, 16, 15.99],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 23]},
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "south", "tintindex": 0}
}
},
{
"name": "up",
"from": [0, 15.99, 0],
"to": [16, 15.99, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
"faces": {
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up", "tintindex": 0}
}
}
]
}

View File

@@ -0,0 +1,10 @@
The MIT License
Copyright © 2020 Motschen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 9,
"description": "§2Makes leaves look identical to optifine's smart leaves"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB