Skip to content
Merged

Dev #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ neo_version=26.1.2.75
mod_id=cakesticklib
mod_name=CakeStickLib
mod_license=Ora Et Labora License
mod_version=1.11.1-hotfix1
mod_version=1.11.1-hotfix2
mod_group_id=com.devdyna.cakestick
mod_authors=DevDyna
mod_description=A standalone port of Synergy API to unify most of the code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import java.util.*;

import com.devdyna.cakesticklib.api.factories.plants.*;
import com.devdyna.cakesticklib.setup.registry.LibTags;

import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.BoneMealItem;
import net.minecraft.world.item.ItemStack;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
Expand All @@ -16,16 +19,27 @@ public static void harvestVanillaCrops(PlayerInteractEvent.RightClickBlock event
var level = event.getLevel();
var player = event.getEntity();
var hand = event.getHand();
var item = event.getItemStack();

if (!Harvestable.getConfig())
return;

List<ItemStack> check = VanillaPlants.checkReplant(level, pos,player,hand);
if (player.isSpectator())
return;

if (level.getBlockState(pos).is(LibTags.Blocks.HARVESTABLE_BLACKLIST))
return;

//prevent bonemeal usage conflict
if (!(item.getItem() instanceof BoneMealItem) && hand.equals(InteractionHand.MAIN_HAND)) {
List<ItemStack> check = VanillaPlants.checkReplant(level, pos, player, hand);

if (check != null && hand.equals(InteractionHand.MAIN_HAND))
check.forEach(i -> player.addItem(i));

if (check != null) {
check.forEach(i -> player.addItem(i));
event.setCanceled(true);
event.setCancellationResult(InteractionResult.SUCCESS);
}
}


}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.devdyna.cakesticklib.setup.registry;

import static com.devdyna.cakesticklib.CakeStickLib.MODULE_ID;

import com.devdyna.cakesticklib.CakeStickLib;
import com.devdyna.cakesticklib.api.RegistryUtils;

Expand All @@ -19,6 +21,9 @@ public class Blocks {
public static void register(IEventBus bus) {
}

public static final TagKey<Block> HARVESTABLE_BLACKLIST = RegistryUtils
.tagBlock(MODULE_ID, "harvestable/blacklist");

//storage_blocks
public static final TagKey<Block> STEEL_BLOCK = RegistryUtils
.tagBlock("c", "storage_blocks/steel");
Expand Down
Loading