forked from Creators-of-Create/Create
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
123 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,76 @@ | ||
package com.simibubi.create; | ||
|
||
import com.simibubi.create.content.equipment.potatoCannon.PotatoProjectileTypeManager; | ||
|
||
import net.minecraft.advancements.critereon.ItemPredicate; | ||
import net.minecraft.core.HolderGetter; | ||
import net.minecraft.core.HolderSet; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.worldgen.BootstrapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.entity.EquipmentSlotGroup; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; | ||
import net.minecraft.world.item.enchantment.LevelBasedValue; | ||
import net.minecraft.world.item.enchantment.effects.SetValue; | ||
import net.minecraft.world.level.storage.loot.predicates.MatchTool; | ||
|
||
public class AllEnchantments { | ||
public static final ResourceKey<Enchantment> | ||
POTATO_RECOVERY = key("potato_recovery"), | ||
CAPACITY = key("capacity"); | ||
|
||
private static ResourceKey<Enchantment> key(String name) { | ||
return ResourceKey.create(Registries.ENCHANTMENT, Create.asResource(name)); | ||
} | ||
|
||
public static void bootstrap(BootstrapContext<Enchantment> context) { | ||
HolderGetter<Item> itemHolderGetter = context.lookup(Registries.ITEM); | ||
|
||
register( | ||
context, | ||
POTATO_RECOVERY, | ||
Enchantment.enchantment( | ||
Enchantment.definition( | ||
HolderSet.direct(AllItems.POTATO_CANNON), | ||
10, | ||
3, | ||
Enchantment.dynamicCost(15, 15), | ||
Enchantment.dynamicCost(45, 15), | ||
1, | ||
EquipmentSlotGroup.MAINHAND | ||
) | ||
).withEffect( | ||
EnchantmentEffectComponents.AMMO_USE, | ||
new SetValue(LevelBasedValue.perLevel(0.0F, 33.3333333333F)), | ||
MatchTool.toolMatches( | ||
ItemPredicate.Builder.item().of( | ||
PotatoProjectileTypeManager.getItems().toArray(Item[]::new) | ||
) | ||
) | ||
) | ||
); | ||
|
||
register( | ||
context, | ||
CAPACITY, | ||
Enchantment.enchantment( | ||
Enchantment.definition( | ||
itemHolderGetter.getOrThrow(AllTags.AllItemTags.PRESSURIZED_AIR_SOURCES.tag), | ||
10, | ||
3, | ||
Enchantment.dynamicCost(15, 15), | ||
Enchantment.dynamicCost(45, 15), | ||
1, | ||
EquipmentSlotGroup.MAINHAND | ||
) | ||
) | ||
); | ||
} | ||
|
||
// fixme waiting for Registrate | ||
/* public static final RegistryEntry<Enchantment, PotatoRecoveryEnchantment> POTATO_RECOVERY = REGISTRATE.object("potato_recovery") | ||
.enchantment(EnchantmentCategory.BOW, PotatoRecoveryEnchantment::new) | ||
.addSlots(EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND) | ||
.lang("Potato Recovery") | ||
.rarity(Rarity.UNCOMMON) | ||
.register(); | ||
public static final RegistryEntry<Enchantment, CapacityEnchantment> CAPACITY = REGISTRATE.object("capacity") | ||
.enchantment(EnchantmentCategory.ARMOR_CHEST, CapacityEnchantment::new) | ||
.addSlots(EquipmentSlot.CHEST) | ||
.lang("Capacity") | ||
.rarity(Rarity.COMMON) | ||
.register();*/ | ||
|
||
public static void register() {} | ||
private static void register(BootstrapContext<Enchantment> context, ResourceKey<Enchantment> key, Enchantment.Builder builder) { | ||
context.register(key, builder.build(key.location())); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
...in/java/com/simibubi/create/content/equipment/potatoCannon/PotatoRecoveryEnchantment.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.