Add Shears ToolActions (#7997)

Make shear interactions extend to subclasses
Add Shears actions for beehive harvesting, pumpkin carving and trip wire disarming
This commit is contained in:
cech12 authored and GitHub committed 2021-08-30 13:42:37 -07:00
1 parent c5a1c90366
commit a336e443f7
31 files changed
+231 -161

No files matched your search

@@ -54,6 +54,11 @@ public class ToolActions
*/
public static final ToolAction SWORD_DIG = ToolAction.get("sword_dig");
/**
* Exposed by shears to allow querying tool behaviours
*/
public static final ToolAction SHEARS_DIG = ToolAction.get("shears_dig");
/**
* Passed onto {@link IForgeBlock#getToolModifiedState} when an axe wants to strip a log
*/
@@ -80,7 +85,25 @@ public class ToolActions
* @see {@link IForgeItem#getSweepHitBox}
*/
public static final ToolAction SWORD_SWEEP = ToolAction.get("sword_sweep");
/**
* This action is exposed by shears and corresponds to a harvest action that is triggered with a right click on a block that supports such behaviour.
* Example: Right click with shears on a beehive with honey level 5 to harvest it
*/
public static final ToolAction SHEARS_HARVEST = ToolAction.get("shears_harvest");
/**
* This action is exposed by shears and corresponds to a carve action that is triggered with a right click on a block that supports such behaviour.
* Example: Right click with shears o a pumpkin to carve it
*/
public static final ToolAction SHEARS_CARVE = ToolAction.get("shears_carve");
/**
* This action is exposed by shears and corresponds to a disarm action that is triggered by breaking a block that supports such behaviour.
* Example: Breaking a trip wire with shears to disarm it.
*/
public static final ToolAction SHEARS_DISARM = ToolAction.get("shears_disarm");
///**
// * Passed onto {@link IForgeBlock#getToolModifiedState} when a hoe wants to turn dirt into soil
// */
@@ -88,9 +111,14 @@ public class ToolActions
// Default actions supported by each tool type
public static final Set<ToolAction> DEFAULT_AXE_ACTIONS = Stream.of(AXE_DIG, AXE_STRIP, AXE_SCRAPE, AXE_WAX_OFF).collect(Collectors.toCollection(Sets::newIdentityHashSet));
public static final Set<ToolAction> DEFAULT_HOE_ACTIONS = Stream.of(HOE_DIG /* TODO: , HOE_TILL */).collect(Collectors.toCollection(Sets::newIdentityHashSet));
public static final Set<ToolAction> DEFAULT_SHOVEL_ACTIONS = Stream.of(SHOVEL_DIG, SHOVEL_FLATTEN).collect(Collectors.toCollection(Sets::newIdentityHashSet));
public static final Set<ToolAction> DEFAULT_PICKAXE_ACTIONS = Stream.of(PICKAXE_DIG).collect(Collectors.toCollection(Sets::newIdentityHashSet));
public static final Set<ToolAction> DEFAULT_SWORD_ACTIONS = Stream.of(SWORD_DIG, SWORD_SWEEP).collect(Collectors.toCollection(Sets::newIdentityHashSet));
public static final Set<ToolAction> DEFAULT_AXE_ACTIONS = of(AXE_DIG, AXE_STRIP, AXE_SCRAPE, AXE_WAX_OFF);
public static final Set<ToolAction> DEFAULT_HOE_ACTIONS = of(HOE_DIG /* TODO: , HOE_TILL */);
public static final Set<ToolAction> DEFAULT_SHOVEL_ACTIONS = of(SHOVEL_DIG, SHOVEL_FLATTEN);
public static final Set<ToolAction> DEFAULT_PICKAXE_ACTIONS = of(PICKAXE_DIG);
public static final Set<ToolAction> DEFAULT_SWORD_ACTIONS = of(SWORD_DIG, SWORD_SWEEP);
public static final Set<ToolAction> DEFAULT_SHEARS_ACTIONS = of(SHEARS_DIG, SHEARS_HARVEST, SHEARS_CARVE, SHEARS_DISARM);
private static Set<ToolAction> of(ToolAction... actions) {
return Stream.of(actions).collect(Collectors.toCollection(Sets::newIdentityHashSet));
}
}