Skip to content

Commit

Permalink
merge to 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed May 9, 2023
1 parent 64fb2a2 commit a01d592
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### Features

### Fixes
- (#31) Add a config option to modify the amount of hugner used when harvesting, and make the hunger used more balanced.

Closed Issues: None
Closed Issues: #31

[Full Changelog](https://github.com/JamCoreModding/RightClickHarvest/compare/...)
[Full Changelog](https://github.com/JamCoreModding/right-click-harvest/compare/3.1.0+1.19.3...3.1.1+1.19.3)
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true

mod_version=3.1.0+1.19.3
release_name=V3.1.0 [1.19.3]
mod_version=3.1.1+1.19.3
release_name=V3.1.1 [1.19.3]
archive_base_name=right-click-harvest
supported_versions=1.19.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import io.github.jamalam360.rightclickharvest.config.Config;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
Expand All @@ -44,6 +43,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvents;
Expand Down Expand Up @@ -102,7 +102,7 @@ private static ActionResult onBlockUse(PlayerEntity player, World world, Hand ha
}

if (state.isIn(HOE_REQUIRED) && Config.requireHoe) {
if (!stack.isIn(ConventionalItemTags.HOES)) {
if (!stack.isIn(ItemTags.HOES)) {
return ActionResult.PASS;
}
}
Expand All @@ -113,7 +113,7 @@ private static ActionResult onBlockUse(PlayerEntity player, World world, Hand ha

if (state.getBlock() instanceof CocoaBlock || state.getBlock() instanceof CropBlock || state.getBlock() instanceof NetherWartBlock) {
if (isMature(state)) {
if (initialCall && Config.harvestInRadius && !state.isIn(RADIUS_HARVEST_BLACKLIST) && stack.isIn(ConventionalItemTags.HOES)) {
if (initialCall && Config.harvestInRadius && !state.isIn(RADIUS_HARVEST_BLACKLIST) && stack.isIn(ItemTags.HOES)) {
int radius = 0;
boolean circle = false;

Expand Down Expand Up @@ -156,8 +156,9 @@ private static ActionResult onBlockUse(PlayerEntity player, World world, Hand ha
stack.damage(1, player, (entity) -> entity.sendToolBreakStatus(hand));
}

if (Config.useHunger && player.world.random.nextBoolean()) {
player.addExhaustion(1.5f);
if (Config.useHunger) {
// Regular block breaking causes 0.005f exhaustion
player.addExhaustion(0.005f * Config.hungerLevel.modifier);
}
} else {
player.playSound(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,19 @@ public class Config extends JamLibConfig {

@Entry
public static boolean useHunger = true;

@Entry
public static HungerLevel hungerLevel = HungerLevel.NORMAL;

public enum HungerLevel {
LOW(0.5f),
NORMAL(1.0f),
HIGH(1.5f);

public final float modifier;

HungerLevel(float modifier) {
this.modifier = modifier;
}
}
}

0 comments on commit a01d592

Please sign in to comment.