1
1
package limonblaze .originsclasses .common .registry ;
2
2
3
+ import com .google .common .collect .Sets ;
3
4
import io .github .edwinmindcraft .apoli .api .power .factory .BiEntityCondition ;
4
5
import io .github .edwinmindcraft .apoli .api .power .factory .BlockCondition ;
5
6
import io .github .edwinmindcraft .apoli .api .power .factory .EntityCondition ;
17
18
import net .minecraft .world .item .*;
18
19
import net .minecraft .world .item .enchantment .Enchantments ;
19
20
import net .minecraft .world .level .block .CropBlock ;
21
+ import net .minecraft .world .level .block .SpongeBlock ;
22
+ import net .minecraft .world .level .block .state .BlockBehaviour ;
20
23
import net .minecraft .world .level .block .state .BlockState ;
24
+ import net .minecraftforge .common .ToolAction ;
21
25
import net .minecraftforge .registries .DeferredRegister ;
22
26
import net .minecraftforge .registries .RegistryObject ;
23
27
28
+ import java .util .Set ;
29
+ import java .util .stream .Collectors ;
30
+ import java .util .stream .Stream ;
31
+
32
+ import static net .minecraftforge .common .ToolActions .*;
33
+
24
34
public class OriginsClassesConditions {
25
35
26
36
public static final DeferredRegister <BiEntityCondition <?>> BIENTITY_CONDITIONS = DeferredRegister .create (ApoliRegistries .BIENTITY_CONDITION_KEY , OriginsClasses .MODID );
@@ -33,13 +43,58 @@ public class OriginsClassesConditions {
33
43
34
44
public static final DeferredRegister <ItemCondition <?>> ITEM_CONDITIONS = DeferredRegister .create (ApoliRegistries .ITEM_CONDITION_KEY , OriginsClasses .MODID );
35
45
public static final RegistryObject <SimpleItemCondition > MELEE = ITEM_CONDITIONS .register ("melee" , () ->
36
- new SimpleItemCondition (Enchantments .SHARPNESS ::canEnchant ));
46
+ new SimpleItemCondition ( stack ->
47
+ (
48
+ stack .getDescriptionId ().equals ("item.tetra.modular_single" ) ||
49
+ stack .getDescriptionId ().equals ("item.tetra.modular_double" ) ||
50
+ Enchantments .SHARPNESS .canEnchant (stack )
51
+ )));
52
+ public static final RegistryObject <SimpleItemCondition > SWORD = ITEM_CONDITIONS .register ("sword" , () ->
53
+ new SimpleItemCondition ( stack ->
54
+ (
55
+ stack .getDescriptionId ().equals ("tetra:modular_sword" ) ||
56
+ Enchantments .SHARPNESS .canEnchant (stack ) && !Enchantments .BLOCK_EFFICIENCY .canEnchant (stack )
57
+ )));
37
58
public static final RegistryObject <SimpleItemCondition > RANGE = ITEM_CONDITIONS .register ("range" , () ->
38
- new SimpleItemCondition (stack -> stack .getItem () instanceof ProjectileWeaponItem ));
59
+ new SimpleItemCondition ( stack ->
60
+ (
61
+ stack .getDescriptionId ().equals ("item.tetra.modular_bow" ) ||
62
+ stack .getDescriptionId ().equals ("item.tetra.modular_crossbow" ) ||
63
+ stack .getItem () instanceof ProjectileWeaponItem
64
+ )));
65
+ public static final RegistryObject <SimpleItemCondition > HOE = ITEM_CONDITIONS .register ("hoe" , () ->
66
+ new SimpleItemCondition ( stack ->
67
+ (
68
+ stack .canPerformAction (HOE_DIG )
69
+ )));
70
+ public static final RegistryObject <SimpleItemCondition > PICKAXE = ITEM_CONDITIONS .register ("pickaxe" , () ->
71
+ new SimpleItemCondition ( stack ->
72
+ (
73
+ stack .canPerformAction (PICKAXE_DIG )
74
+ )));
75
+ public static final RegistryObject <SimpleItemCondition > AXE = ITEM_CONDITIONS .register ("axe" , () ->
76
+ new SimpleItemCondition ( stack ->
77
+ (
78
+ stack .canPerformAction (AXE_DIG )
79
+ )));
80
+ public static final RegistryObject <SimpleItemCondition > SHOVEL = ITEM_CONDITIONS .register ("shovel" , () ->
81
+ new SimpleItemCondition ( stack ->
82
+ (
83
+ stack .canPerformAction (SHOVEL_DIG )
84
+ )));
39
85
public static final RegistryObject <SimpleItemCondition > TOOL = ITEM_CONDITIONS .register ("tool" , () ->
40
- new SimpleItemCondition (stack -> stack .getItem () instanceof DiggerItem || stack .getItem () instanceof ShearsItem ));
86
+ new SimpleItemCondition ( stack ->
87
+ (
88
+ stack .getDescriptionId ().equals ("item.tetra.modular_single" ) ||
89
+ stack .getDescriptionId ().equals ("item.tetra.modular_double" ) ||
90
+ stack .getItem () instanceof DiggerItem ||
91
+ stack .getItem () instanceof ShearsItem
92
+ )));
41
93
public static final RegistryObject <SimpleItemCondition > SHIELD = ITEM_CONDITIONS .register ("shield" , () ->
42
- new SimpleItemCondition (stack -> stack .getItem () instanceof ShieldItem ));
94
+ new SimpleItemCondition (stack -> (
95
+ stack .getDescriptionId ().equals ("item.tetra.modular_shield" ) ||
96
+ stack .getItem () instanceof ShieldItem
97
+ )));
43
98
public static final RegistryObject <SimpleItemCondition > HELMET = ITEM_CONDITIONS .register ("helmet" , () ->
44
99
new SimpleItemCondition (stack -> stack .getItem () instanceof ArmorItem armor && armor .getSlot () == EquipmentSlot .HEAD ));
45
100
public static final RegistryObject <SimpleItemCondition > CHESTPLATE = ITEM_CONDITIONS .register ("chestplate" , () ->
0 commit comments