Skip to content

Commit

Permalink
Adapt to Eyeblossom
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCartes committed Nov 29, 2024
1 parent 2fa2035 commit 3e769bd
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: "${{ runner.os }}-glowing-torchflower-${{ hashFiles('**/*.gradle*') }}"
key: "${{ runner.os }}-glowing-eyeblossom-${{ hashFiles('**/*.gradle*') }}"
restore-keys: |
${{ runner.os }}-glowing-torchflower-
${{ runner.os }}-glowing-eyeblossom-
- name: Build
run: ./gradlew build
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
## Glowing Torchflower
## Glowing Eyeblossom

Works better when installed on both the server and the client

[CurseForge](https://www.curseforge.com/minecraft/mc-mods/glowing-torchflower), [Modrinth](https://modrinth.com/mod/glowing-torchflower)
[CurseForge](https://www.curseforge.com/minecraft/mc-mods/glowing-eyeblossom), [Modrinth](https://modrinth.com/mod/glowing-eyeblossom)

[Discord](https://discord.gg/UY4nhvUzaK)


### Ligth level
- Torchflower: 12
- Torchflower in pot: 14
- Torchflower crop, small: 3
- Torchflower crop, medium: 7
- Torchflower crop, big: 12
### Light level
- Open Eyeblossom: 12
- Open Eyeblossom in the pot: 14
- Closed Eyeblossom: 3
- Closed Eyeblossom in the pot: 3

### Config
You can change the light level of the Eyeblossom in the config file.
The config file is located in the `<game directory>/config/GlowingEyeblossom/main.conf`.

![screenshot.png](screenshot.png)
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ modrinth {
versionNumber.set("${project.version}")
versionName = "[1.21.2, 1.21.3] ${project.version}"
versionType = "release"
changelog.set("Release notes:\nhttps://github.com/NikitaCartes/Glowing-Torchflower/releases/tag/${project.version}")
changelog.set("Release notes:\nhttps://github.com/NikitaCartes/Glowing-Eyeblossom/releases/tag/${project.version}")
uploadFile = remapJar
gameVersions.addAll("1.21.2", "1.21.3")
loaders = ["fabric", "quilt"]
Expand All @@ -72,7 +72,7 @@ curseforge {
project {
id = "827288"
changelogType = "markdown"
changelog = "Release notes:\nhttps://github.com/NikitaCartes/Glowing-Torchflower/releases/tag/${project.version}"
changelog = "Release notes:\nhttps://github.com/NikitaCartes/Glowing-Eyeblossom/releases/tag/${project.version}"
releaseType = "release"

addGameVersion("Fabric")
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mod_name=Glowing Torchflower
mod_id=glowing-torchflower
mod_name=Glowing Eyeblossom
mod_id=glowing-eyeblossom
mod_version=1.2.0

minecraft_version=1.21.2
yarn_mappings=1.21.2+build.1
loader_version=0.16.7
minecraft_version=1.21.4-rc1
yarn_mappings=1.21.4-rc1+build.1
loader_version=0.16.9

hocon_version=4.1.2
commons_text_version=1.10.0
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.nikitacartes.glowingtorchflower.config;
package xyz.nikitacartes.glowingeyeblossom.config;

import net.fabricmc.loader.api.FabricLoader;
import org.spongepowered.configurate.ConfigurateException;
Expand All @@ -17,7 +17,7 @@ public abstract class ConfigTemplate {
private transient final Pattern pattern = Pattern.compile("^[^$\"{}\\[\\]:=,+#`^?!@*&\\\\\\s/]+");
transient final String configPath;
public static Path gameDirectory = FabricLoader.getInstance().getGameDir();
private static String modName = "GlowingTorchflower";
private static String modName = "GlowingEyeblossom";

ConfigTemplate(String configPath) {
this.configPath = configPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.nikitacartes.glowingtorchflower.config;
package xyz.nikitacartes.glowingeyeblossom.config;

import com.google.common.io.Resources;
import org.apache.commons.text.StringSubstitutor;
Expand All @@ -13,10 +13,11 @@

@ConfigSerializable
public class MainConfigV1 extends ConfigTemplate {
public int torchflowerBrightness = 12;
public int torchflowerPotBrightness = 14;
public int torchflowerStage1Brightness = 3;
public int torchflowerStage2Brightness = 7;
public int openEyeblossomBrightness = 12;
public int closedEyeblossomBrightness = 3;
public int openEyeblossomFlowerpotBrightness = 14;
public int closedEyeblossomFlowerpotBrightness = 3;

public String configVersion = "1";

public MainConfigV1() {
Expand All @@ -34,10 +35,10 @@ public static MainConfigV1 load() {

protected String handleTemplate() throws IOException {
Map<String, String> configValues = new HashMap<>();
configValues.put("torchflowerBrightness", wrapIfNecessary(torchflowerBrightness));
configValues.put("torchflowerPotBrightness", wrapIfNecessary(torchflowerPotBrightness));
configValues.put("torchflowerStage1Brightness", wrapIfNecessary(torchflowerStage1Brightness));
configValues.put("torchflowerStage2Brightness", wrapIfNecessary(torchflowerStage2Brightness));
configValues.put("openEyeblossomBrightness", wrapIfNecessary(openEyeblossomBrightness));
configValues.put("closedEyeblossomBrightness", wrapIfNecessary(closedEyeblossomBrightness));
configValues.put("openEyeblossomFlowerpotBrightness", wrapIfNecessary(openEyeblossomFlowerpotBrightness));
configValues.put("closedEyeblossomFlowerpotBrightness", wrapIfNecessary(closedEyeblossomFlowerpotBrightness));
configValues.put("configVersion", wrapIfNecessary(configVersion));
String configTemplate = Resources.toString(getResource("config/" + configPath), UTF_8);
return new StringSubstitutor(configValues).replace(configTemplate);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package xyz.nikitacartes.glowingtorchflower.mixin;
package xyz.nikitacartes.glowingeyeblossom.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Blocks;
import net.minecraft.block.TorchflowerBlock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Slice;
import xyz.nikitacartes.glowingtorchflower.config.MainConfigV1;
import xyz.nikitacartes.glowingeyeblossom.config.MainConfigV1;

@Mixin(Blocks.class)
public class BlocksMixin {
Expand All @@ -20,40 +19,45 @@ public class BlocksMixin {
at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/AbstractBlock$Settings;create()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 0),
slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=torchflower")))
private static AbstractBlock.Settings modifyTorchflower(AbstractBlock.Settings properties) {
slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=open_eyeblossom")))
private static AbstractBlock.Settings modifyEyeblossom(AbstractBlock.Settings properties) {
if (config == null) {
config = MainConfigV1.load();
}
return properties.luminance(blockState -> config.torchflowerBrightness);
return properties.luminance(blockState -> config.openEyeblossomBrightness);
}

@ModifyExpressionValue(method = "<clinit>",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/Blocks;createFlowerPotSettings()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 1))
private static AbstractBlock.Settings modifyPottedTorchflower(AbstractBlock.Settings properties) {
target = "Lnet/minecraft/block/AbstractBlock$Settings;create()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 0),
slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=closed_eyeblossom")))
private static AbstractBlock.Settings modifyClosedEyeblossom(AbstractBlock.Settings properties) {
if (config == null) {
config = MainConfigV1.load();
}
return properties.luminance(blockState -> config.torchflowerPotBrightness);
return properties.luminance(blockState -> config.closedEyeblossomBrightness);
}

@ModifyExpressionValue(method = "<clinit>",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/AbstractBlock$Settings;create()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 0),
slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=torchflower_crop")))
private static AbstractBlock.Settings modifyTorchflowerCrop(AbstractBlock.Settings properties) {
target = "Lnet/minecraft/block/Blocks;createFlowerPotSettings()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 36))
private static AbstractBlock.Settings modifyPottedEyeblossom(AbstractBlock.Settings properties) {
if (config == null) {
config = MainConfigV1.load();
}

return properties.luminance(blockState -> switch (blockState.get(TorchflowerBlock.AGE)) {
case 0 -> config.torchflowerStage1Brightness;
case 1 -> config.torchflowerStage2Brightness;
default -> config.torchflowerBrightness;
});
return properties.luminance(blockState -> config.openEyeblossomFlowerpotBrightness);
}

@ModifyExpressionValue(method = "<clinit>",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/Blocks;createFlowerPotSettings()Lnet/minecraft/block/AbstractBlock$Settings;",
ordinal = 37))
private static AbstractBlock.Settings modifyPottedClosedEyeblossom(AbstractBlock.Settings properties) {
if (config == null) {
config = MainConfigV1.load();
}
return properties.luminance(blockState -> config.closedEyeblossomFlowerpotBrightness);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
23 changes: 11 additions & 12 deletions src/main/resources/config/main.conf
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
## ##
## Glowing Torchflower ##
## Glowing Eyeblossom ##
## Main Configuration ##
## ##

# Brightness of the fully grown torchflower
# Brightness of the open eyeblossom
# Default: 12
torchflower-brightness: ${torchflowerBrightness}
open-eyeblossom-brightness: ${openEyeblossomBrightness}

# Brightness of the torchflower in flowerpot
# Brightness of the closed eyeblossom
# Default: 3
closed-eyeblossom-brightness: ${closedEyeblossomBrightness}

# Brightness of the open eyeblossom in flowerpot
# Default: 14
torchflower-pot-brightness: ${torchflowerPotBrightness}
open-eyeblossom-flowerpot-brightness: ${openEyeblossomFlowerpotBrightness}

# Torchflower has three stages of growth (third stage is fully grown)
# Brightness of the first stage
# Brightness of the closed eyeblossom in flowerpot
# Default: 3
torchflower-stage1-brightness: ${torchflowerStage1Brightness}

# Brightness of the second stage
# Default: 7
torchflower-stage2-brightness: ${torchflowerStage2Brightness}
closed-eyeblossom-flowerpot-brightness: ${closedEyeblossomFlowerpotBrightness}

# Config Version. Used for automatic migration of config files.
# Do not change this value manually.
Expand Down
16 changes: 8 additions & 8 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"schemaVersion": 1,
"id": "glowing-torchflower",
"id": "glowing-eyeblossom",
"version": "${version}",
"name": "Glowing Torchflower",
"description": "Make Torchflower glow",
"name": "Glowing Eyeblossom",
"description": "Make Eyeblossom glow",
"authors": [
"NikitaCartes"
],
"contact": {
"homepage": "https://github.com/NikitaCartes/Glowing-Torchflower",
"sources": "https://github.com/NikitaCartes/Glowing-Torchflower",
"issues": "https://github.com/NikitaCartes/Glowing-Torchflower/issues"
"homepage": "https://github.com/NikitaCartes/Glowing-Eyeblossom",
"sources": "https://github.com/NikitaCartes/Glowing-Eyeblossom",
"issues": "https://github.com/NikitaCartes/Glowing-Eyeblossom/issues"
},
"license": "MIT",
"icon": "assets/glowing-torchflower/icon.png",
"icon": "assets/glowing-eyeblossom/icon.png",
"environment": "*",
"mixins": [
"glowing-torchflower.mixins.json"
"glowing-eyeblossom.mixins.json"
],
"depends": {
"fabricloader": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "xyz.nikitacartes.glowingtorchflower.mixin",
"package": "xyz.nikitacartes.glowingeyeblossom.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"BlocksMixin"
Expand Down

0 comments on commit 3e769bd

Please sign in to comment.