Skip to content

Commit

Permalink
add Fabric (>=0.96.11+1.20.4) support (Fabric, Quilt)
Browse files Browse the repository at this point in the history
- updated BucketLib to 1.20.4-3.2.0.2
- break temperature can also be configured to be negative (Deactivation by setting a number larger than the hottest fluid)
- changed the config descriptions to be more precisely
  • Loading branch information
cech12 committed May 11, 2024
1 parent cc1e71b commit 2907a54
Show file tree
Hide file tree
Showing 25 changed files with 400 additions and 81 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ body:
- Fabric
- Forge
- NeoForge
- Quilt
validations:
required: true
- type: input
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cicd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,41 @@ jobs:
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
publish-fabric-on-curseforge:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish Fabric on Curseforge
uses: cech12/MinecraftModActions/.github/workflows/publish-curseforge.yml@main
with:
java-version: 17
subproject: fabric
title-prefix: fabric-
curseforge-id: 363799
game-versions: |
1.20.4
release-type: release
loaders: |
fabric
quilt
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
publish-fabric-on-modrinth:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish Fabric on Modrinth
uses: cech12/MinecraftModActions/.github/workflows/publish-modrinth.yml@main
with:
java-version: 17
subproject: fabric
title-prefix: fabric-
modrinth-id: M9G5zpf1
game-versions: |
1.20.4
release-type: release
loaders: |
fabric
quilt
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [1.20.4-5.2.0.0] - 2024-05-11
### Added
- add Fabric (>=0.96.11+1.20.4) support (Fabric, Quilt)

### Changed
- updated BucketLib to 1.20.4-3.2.0.2
- break temperature can also be configured to be negative (Deactivation by setting a number larger than the hottest fluid)
- changed the config descriptions to be more precisely

### Known issues
- Fabric: max stack size of 16 is not taken into account and defaults to 1

## [1.20.4-5.1.0.0] - 2024-01-29
- Update to Minecraft 1.20.4 (Forge 49.0.22, Neoforge 20.4.138-beta)
- Update BucketLib to 1.20.4-3.1.0.0
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
[![License](https://img.shields.io/github/license/cech12/CeramicBucket)](http://opensource.org/licenses/MIT)
[![](https://img.shields.io/discord/752506676719910963.svg?style=flat&color=informational&logo=discord&label=Discord)](https://discord.gg/gRUFH5t)

This is a **Minecraft Forge** mod that adds a **Ceramic Bucket** to the game.

Since mod version 3.0.0.0 the library mod [BucketLib](https://www.curseforge.com/minecraft/mc-mods/bucketlib) is required.
This is a Minecraft mod that adds a **Ceramic Bucket** to the game. (Forge, NeoForge, Fabric, Quilt)

![All Buckets](https://raw.githubusercontent.com/cech12/CeramicBucket/1.18/material/all_buckets.png)

## Dependencies

Since mod version 3.0.0.0 the library mod BucketLib ([Github](https://github.com/cech12/BucketLib/), [Curseforge](https://www.curseforge.com/minecraft/mc-mods/bucketlib), [Modrinth](https://modrinth.com/mod/bucketlib)) is required.

The Fabric / Quilt version needs also the following mods:

- Fabric API ([Github](https://github.com/FabricMC/fabric), [Curseforge](https://www.curseforge.com/minecraft/mc-mods/fabric-api), [Modrinth](https://modrinth.com/mod/fabric-api))
- Cloth Config API ([Github](https://github.com/shedaniel/cloth-config), [Curseforge](https://www.curseforge.com/minecraft/mc-mods/cloth-config), [Modrinth](https://modrinth.com/mod/cloth-config))

## Features

Adds 2 items to the game:

* **Unfired Clay Bucket**: Craftable with three clay balls.
Expand Down
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ subprojects {
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)'
url = 'https://maven.blamejared.com'
}
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
}
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -60,8 +64,10 @@ subprojects {
"forge_version": forge_version,
"forge_version_range": forge_version_range,
"forge_loader_version_range": forge_loader_version_range,
//"fabric_version": fabric_version,
//"fabric_loader_version": fabric_loader_version,
"fabric_version": fabric_version,
"fabric_loader_version": fabric_loader_version,
"cloth_config_version": cloth_config_version,
"mod_menu_version": mod_menu_version,
"neoforge_version": neoforge_version,
"neoforge_version_range": neoforge_version_range,
"neoforge_loader_version_range": neoforge_loader_version_range,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.cech12.ceramicbucket.init;

import de.cech12.ceramicbucket.CeramicBucketMod;
import de.cech12.ceramicbucket.Constants;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
Expand All @@ -15,7 +15,7 @@ public static class Fluids {
public static final TagKey<Fluid> CERAMIC_CRACKING = tag("ceramic_cracking");

private static TagKey<Fluid> tag(@Nonnull String name) {
return TagKey.create(Registries.FLUID, new ResourceLocation(CeramicBucketMod.MOD_ID, name));
return TagKey.create(Registries.FLUID, new ResourceLocation(Constants.MOD_ID, name));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@ public interface IConfigHelper {

/** Default value of break temperature */
int BREAK_TEMPERATURE_DEFAULT = 1000;
/** Config description of the break temperature */
String BREAK_TEMPERATURE_DESCRIPTION = "Minimum temperature of fluid at which the Ceramic Bucket breaks when emptied. (default: " + BREAK_TEMPERATURE_DEFAULT + ") (Deactivation by setting a number larger than the hottest fluid)";
/** Minimal value of the break temperature */
int BREAK_TEMPERATURE_MIN = -10000;
/** Maximal value of the break temperature */
int BREAK_TEMPERATURE_MAX = 10000;
/** Default value of durability */
int DURABILITY_DEFAULT = 0;
/** Config description of the durability */
String DURABILITY_DESCRIPTION = "Defines the maximum durability of Ceramic Bucket. (default: " + DURABILITY_DEFAULT + ", 0: deactivates the durability)";
/** Minimal value of the durability */
int DURABILITY_MIN = 0;
/** Maximal value of the durability */
int DURABILITY_MAX = 10000;
/** Default value of fish obtaining option */
boolean FISH_OBTAINING_ENABLED_DEFAULT = true;
/** Config description of the durability */
String FISH_OBTAINING_ENABLED_DESCRIPTION = "Whether or not obtaining fish with a Ceramic Bucket should be enabled. (default: " + FISH_OBTAINING_ENABLED_DEFAULT + ")";
/** Default value of milking option */
boolean MILKING_ENABLED_DEFAULT = true;
/** Config description of the milking option */
String MILKING_ENABLED_DESCRIPTION = "Whether or not milking entities with a Ceramic Bucket should be enabled. (default: " + MILKING_ENABLED_DEFAULT + ")";


/**
Expand Down
29 changes: 28 additions & 1 deletion common/src/main/resources/assets/ceramicbucket/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,32 @@
"item.ceramicbucket.ceramic_bucket": "Ceramic Bucket",
"item.ceramicbucket.ceramic_bucket.entity": "Ceramic Bucket of %s",
"item.ceramicbucket.ceramic_bucket.filled": "Ceramic %s Bucket",
"item.ceramicbucket.unfired_clay_bucket": "Unfired Clay Bucket"
"item.ceramicbucket.unfired_clay_bucket": "Unfired Clay Bucket",

"text.autoconfig.ceramicbucket.title": "Ceramic Bucket Settings",

"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE": "Break temperature",
"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE.@Tooltip[0]": "§6§lBreak temperature",
"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE.@Tooltip[1]": "Minimum temperature of fluid at which the",
"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE.@Tooltip[2]": "Ceramic Bucket breaks when emptied.",
"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE.@Tooltip[3]": "§7§oDeactivation by setting a number larger than the hottest fluid",
"text.autoconfig.ceramicbucket.option.BREAK_TEMPERATURE.@Tooltip[4]": "§7§oDefault: 1000",

"text.autoconfig.ceramicbucket.option.DURABILITY": "Durability",
"text.autoconfig.ceramicbucket.option.DURABILITY.@Tooltip[0]": "§6§lDurability",
"text.autoconfig.ceramicbucket.option.DURABILITY.@Tooltip[1]": "Defines the maximum durability of a Ceramic Bucket.",
"text.autoconfig.ceramicbucket.option.DURABILITY.@Tooltip[2]": "§7§o0: deactivates the durability",
"text.autoconfig.ceramicbucket.option.DURABILITY.@Tooltip[3]": "§7§oDefault: 0",

"text.autoconfig.ceramicbucket.option.FISH_OBTAINING_ENABLED": "Fish obtaining enabled",
"text.autoconfig.ceramicbucket.option.FISH_OBTAINING_ENABLED.@Tooltip[0]": "§6§lFish obtaining enabled",
"text.autoconfig.ceramicbucket.option.FISH_OBTAINING_ENABLED.@Tooltip[1]": "Whether or not obtaining fish with a",
"text.autoconfig.ceramicbucket.option.FISH_OBTAINING_ENABLED.@Tooltip[2]": "Ceramic Bucket should be enabled.",
"text.autoconfig.ceramicbucket.option.FISH_OBTAINING_ENABLED.@Tooltip[3]": "§7§oDefault: true",

"text.autoconfig.ceramicbucket.option.MILKING_ENABLED": "Milking enabled",
"text.autoconfig.ceramicbucket.option.MILKING_ENABLED.@Tooltip[0]": "§6§lMilking enabled",
"text.autoconfig.ceramicbucket.option.MILKING_ENABLED.@Tooltip[1]": "Whether or not milking entities with a",
"text.autoconfig.ceramicbucket.option.MILKING_ENABLED.@Tooltip[2]": "Ceramic Bucket should be enabled.",
"text.autoconfig.ceramicbucket.option.MILKING_ENABLED.@Tooltip[3]": "§7§oDefault: true"
}
68 changes: 68 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
plugins {
id 'java'
id 'idea'
id 'maven-publish'
id 'fabric-loom' version '[1.6.6,1.7)'
}
base {
archivesName = "${mod_id}-fabric"
}

repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
}

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"

modImplementation("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("com.terraformersmc:modmenu:${mod_menu_version}")

modImplementation("com.github.cech12.BucketLib:fabric:${bucketlib_version}")

implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
compileOnly project(":common")
}

loom {
if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
}
mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
}
runs {
client {
client()
setConfigName("Fabric Client")
ideConfigGenerated(true)
runDir("run")
}
server {
server()
setConfigName("Fabric Server")
ideConfigGenerated(true)
runDir("run")
}
}
}

tasks.withType(JavaCompile).configureEach {
source(project(":common").sourceSets.main.allSource)
}
//tasks.withType(Javadoc).configureEach {
// source(project(":common").sourceSets.main.allJava)
//}
//tasks.named("sourcesJar", Jar) {
// from(project(":common").sourceSets.main.allSource)
//}

processResources {
from project(":common").sourceSets.main.resources
}
42 changes: 42 additions & 0 deletions fabric/src/main/java/de/cech12/ceramicbucket/CeramicBucketMod.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package de.cech12.ceramicbucket;

import de.cech12.bucketlib.api.BucketLibApi;
import de.cech12.bucketlib.api.item.UniversalBucketItem;
import de.cech12.ceramicbucket.init.ModTags;
import de.cech12.ceramicbucket.platform.Services;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;

@SuppressWarnings("unused")
public class CeramicBucketMod implements ModInitializer {

public static final ResourceLocation UNFIRED_CLAY_BUCKET_LOCATION = new ResourceLocation(Constants.MOD_ID, "unfired_clay_bucket");
public static final ResourceLocation CERAMIC_BUCKET_LOCATION = new ResourceLocation(Constants.MOD_ID, "ceramic_bucket");

public static final Item UNFIRED_CLAY_BUCKET = Registry.register(BuiltInRegistries.ITEM, UNFIRED_CLAY_BUCKET_LOCATION, new Item(new Item.Properties()));
public static final Item CERAMIC_BUCKET = Registry.register(BuiltInRegistries.ITEM, CERAMIC_BUCKET_LOCATION, new UniversalBucketItem(new UniversalBucketItem.Properties()
.upperCrackingTemperature(Services.CONFIG::getBreakTemperature)
.crackingFluids(ModTags.Fluids.CERAMIC_CRACKING)
.milking(Services.CONFIG::isMilkingEnabled)
.entityObtaining(Services.CONFIG::isFishObtainingEnabled)
.dyeable(14975336)
.durability(Services.CONFIG::getDurability)
));

@Override
public void onInitialize() {
CommonLoader.init();
//register bucket
BucketLibApi.registerBucket(CERAMIC_BUCKET_LOCATION);
//register creative tab
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(content -> {
content.accept(UNFIRED_CLAY_BUCKET);
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.cech12.ceramicbucket.compat;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import de.cech12.ceramicbucket.platform.FabricConfigHelper;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

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

@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(FabricConfigHelper.class, parent).get();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package de.cech12.ceramicbucket.platform;

import de.cech12.ceramicbucket.Constants;
import de.cech12.ceramicbucket.platform.services.IConfigHelper;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;

/**
* The config service implementation for Fabric.
*/
@Config(name = Constants.MOD_ID)
public class FabricConfigHelper implements ConfigData, IConfigHelper {

@ConfigEntry.Gui.Tooltip(count = 5)
@ConfigEntry.BoundedDiscrete(min = BREAK_TEMPERATURE_MIN, max = BREAK_TEMPERATURE_MAX)
public long BREAK_TEMPERATURE = BREAK_TEMPERATURE_DEFAULT;

@ConfigEntry.Gui.Tooltip(count = 4)
@ConfigEntry.BoundedDiscrete(min = DURABILITY_MIN, max = DURABILITY_MAX)
public long DURABILITY = DURABILITY_DEFAULT;

@ConfigEntry.Gui.Tooltip(count = 4)
public boolean FISH_OBTAINING_ENABLED = FISH_OBTAINING_ENABLED_DEFAULT;

@ConfigEntry.Gui.Tooltip(count = 4)
public boolean MILKING_ENABLED = MILKING_ENABLED_DEFAULT;

@Override
public void init() {
AutoConfig.register(FabricConfigHelper.class, Toml4jConfigSerializer::new);
}

private FabricConfigHelper getConfig() {
return AutoConfig.getConfigHolder(FabricConfigHelper.class).getConfig();
}

@Override
public int getBreakTemperature() {
return (int) getConfig().BREAK_TEMPERATURE;
}

@Override
public int getDurability() {
return (int) getConfig().DURABILITY;
}

@Override
public boolean isFishObtainingEnabled() {
return getConfig().FISH_OBTAINING_ENABLED;
}

@Override
public boolean isMilkingEnabled() {
return getConfig().MILKING_ENABLED;
}

}
Loading

0 comments on commit 2907a54

Please sign in to comment.