Skip to content

Commit

Permalink
excavate enchant improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Apr 2, 2024
1 parent 9726cf5 commit 1d5b6fa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/com/lothrazar/cyclic/data/DataTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class DataTags {
public static final INamedTag<Block> VINES = BlockTags.makeWrapperTag("forge:vines");
public static final INamedTag<Block> CACTUS = BlockTags.makeWrapperTag("forge:cactus");
public static final INamedTag<Block> CROP_BLOCKS = BlockTags.makeWrapperTag("forge:crop_blocks");
public static final INamedTag<Block> EXCAVATE_IGNORED = BlockTags.makeWrapperTag("cyclic:ignored/excavate");
public static final INamedTag<Item> FISHING_RODS = ItemTags.makeWrapperTag("forge:fishing_rods");
public static final INamedTag<Item> BOOKS = ItemTags.makeWrapperTag("forge:books");
public static final INamedTag<Item> ANVIL_IMMUNE = ItemTags.makeWrapperTag("cyclic:anvil_immune");
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/lothrazar/cyclic/enchant/EnchantExcavation.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.lothrazar.cyclic.ModCyclic;
import com.lothrazar.cyclic.base.EnchantBase;
import com.lothrazar.cyclic.data.DataTags;
import com.lothrazar.cyclic.registry.EnchantRegistry;
import com.lothrazar.cyclic.util.UtilItemStack;
import java.util.Arrays;
Expand Down Expand Up @@ -64,6 +65,7 @@ public EnchantExcavation(Rarity rarityIn, EnchantmentType typeIn, EquipmentSlotT

public static BooleanValue CFG;
public static final String ID = "excavate";
public static boolean effectiveToolRequired = true; // non-config lets hardcode this actually

@Override
public boolean isEnabled() {
Expand Down Expand Up @@ -105,6 +107,14 @@ public void onBreakEvent(BreakEvent event) {
if (level <= 0) {
return;
}
if (effectiveToolRequired && !ForgeHooks.isToolEffective(world, pos, stackHarvestingWith)) {
ModCyclic.LOGGER.info("excavate trigger cancelled; tool not effective");
return;
}
if (eventState.isIn(DataTags.EXCAVATE_IGNORED)) {
ModCyclic.LOGGER.info("excavate trigger cancelled; see blocktag " + DataTags.EXCAVATE_IGNORED.toString());
return;
}
if (ForgeHooks.canHarvestBlock(eventState, player, world, pos)) {
int harvested = this.harvestSurrounding((World) world, player, pos, block, 1, level, player.swingingHand);
if (harvested > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"#minecraft:shulker_boxes",
{"required":false, "id": "cyclic:crate"},
{"required":false, "id": "minecraft:chest"},
{"required":false, "id": "minecraft:command_block"}
]
}
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@
,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml"
,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node "
,"1.5.22":"Fix #2351 advanced crafting stick not opening. "
,"1.5.23":"Backport #2182 candle model assets. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions if possible. "
,"1.5.23":"Backport #2182 candle model assets. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions if possible #1913. Excavate enchant will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. Excavate enchant will not trigger on anything matching the new block tag [cyclic:ignored/excavate] #2116 "
}
}

0 comments on commit 1d5b6fa

Please sign in to comment.