Skip to content

Commit

Permalink
2.0.0 - Config and Smart Leaves resourcepack!
Browse files Browse the repository at this point in the history
  • Loading branch information
Motschen committed Jan 14, 2021
1 parent d762b6c commit 2a2b97f
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 3 deletions.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ dependencies {
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"

modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"){
exclude module: "fabric-api"
}
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}"){
exclude module: "fabric-api"
}
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}"){
exclude module: "fabric-api"
}
include "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
}

processResources {
Expand Down
8 changes: 6 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.10.8

# Mod Properties
mod_version = 1.0.0
mod_version = 2.0.0
maven_group = eu.midnightdust
archives_base_name = cullleaves

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.26.1+1.16
fabric_version=0.26.1+1.16

auto_config_version = 3.3.1
cloth_config_version = 4.8.3
mod_menu_version = 1.14.6+build.31
22 changes: 22 additions & 0 deletions src/main/java/eu/midnightdust/cullleaves/CullLeavesClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package eu.midnightdust.cullleaves;

import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;

public class CullLeavesClient implements ClientModInitializer {
public static CullLeavesConfig CL_CONFIG;

public void onInitializeClient() {
AutoConfig.register(CullLeavesConfig.class, JanksonConfigSerializer::new);
CL_CONFIG = AutoConfig.getConfigHolder(CullLeavesConfig.class).getConfig();

FabricLoader.getInstance().getModContainer("cullleaves").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("cullleaves:smartleaves"), "resourcepacks/smartleaves", modContainer, true);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package eu.midnightdust.cullleaves.config;

import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
import net.minecraft.client.render.entity.PlayerModelPart;

@Config(name = "cullleaves")
public class CullLeavesConfig implements ConfigData {

@ConfigEntry.Gui.PrefixText // Enable/Disable the mod. Requires Chunk Reload (F3 + A).
public boolean enabled = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package eu.midnightdust.cullleaves.config;

import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class ModMenuIntegration implements ModMenuApi {

@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(CullLeavesConfig.class, parent).get();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.midnightdust.cullleaves.mixin;

import eu.midnightdust.cullleaves.CullLeavesClient;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
Expand All @@ -19,6 +20,9 @@ public MixinLeavesBlock(Settings settings) {
@Override
@SuppressWarnings("deprecation")
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
return neighborState.getBlock() instanceof LeavesBlock;
if (CullLeavesClient.CL_CONFIG.enabled) {
return neighborState.getBlock() instanceof LeavesBlock;
}
else return false;
}
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/cullleaves/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"text.autoconfig.cullleaves.title":"Cull Leaves Config",
"text.autoconfig.cullleaves.option.enabled.@PrefixText":"After changing this setting you have to reload all chunks (F3 + A)",
"text.autoconfig.cullleaves.option.enabled":"Enabled"
}
13 changes: 13 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"icon": "assets/cullleaves/icon.png",

"environment": "client",
"entrypoints": {
"client": [
"eu.midnightdust.cullleaves.CullLeavesClient"
],
"modmenu": [
"eu.midnightdust.cullleaves.config.ModMenuIntegration"
]
},

"depends": {
"fabric-resource-loader-v0": "*",
"minecraft": ">=1.16"
},

"mixins": [
"cullleaves.mixins.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -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, 0],
"to": [16, 0, 16],
"faces": {
"up": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "down", "tintindex": 0}
}
},
{
"name": "west",
"from": [0, 0, 0],
"to": [0, 16, 16],
"faces": {
"east": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "west", "tintindex": 0}
}
},
{
"name": "north",
"from": [0, 0, 0],
"to": [16, 16, 0],
"faces": {
"south": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "north", "tintindex": 0}
}
},
{
"name": "east",
"from": [16, 0, 0],
"to": [16, 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, 16],
"to": [16, 16, 16],
"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, 16, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
"faces": {
"down": {"uv": [0, 0, 16, 16], "texture": "#all", "cullface": "up", "tintindex": 0}
}
}
]
}
10 changes: 10 additions & 0 deletions src/main/resources/resourcepacks/smartleaves/license.txt
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions src/main/resources/resourcepacks/smartleaves/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 6,
"description": "§2Makes the leaves look identical to the optifine smart leaves effect"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2a2b97f

Please sign in to comment.