From 12789ce26fb8e8349f7fa1a89dc77f5a69b3fa20 Mon Sep 17 00:00:00 2001 From: Sunskimmer822 <92886026+Sunskimmer822@users.noreply.github.com> Date: Thu, 3 Mar 2022 07:52:29 -0600 Subject: [PATCH] totem --- .../java/net/serenas/shitmod/Shitmod.java | 8 +++++++ .../serenas/shitmod/totemOfEquivalency.java | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/main/java/net/serenas/shitmod/totemOfEquivalency.java diff --git a/src/main/java/net/serenas/shitmod/Shitmod.java b/src/main/java/net/serenas/shitmod/Shitmod.java index ffed51e..663275b 100644 --- a/src/main/java/net/serenas/shitmod/Shitmod.java +++ b/src/main/java/net/serenas/shitmod/Shitmod.java @@ -38,6 +38,10 @@ public class Shitmod implements ModInitializer { public static final ItemGroup CHARMS_GROUP = FabricItemGroupBuilder.build( new Identifier("shitmod", "charms"), () -> new ItemStack(Shitmod.KINGSOUL_CHARM)); + + public static final ItemGroup GENERAL_GROUP = FabricItemGroupBuilder.build( + new Identifier("shitmod", "general"), + () -> new ItemStack(Shitmod.FABRIC_ITEM)); public static final Item KINGSOUL_CHARM = new kingsoul(new Item.Settings().group(Shitmod.CHARMS_GROUP).maxDamage(500).fireproof()); @@ -53,6 +57,8 @@ public class Shitmod implements ModInitializer { public static final Item UNBREAKABLE_STRENGTH_CHARM = new unbreakableStrengthCharm(new Item.Settings().group(Shitmod.CHARMS_GROUP).fireproof().maxCount(1)); + public static final Item TOTEM_OF_EQUIVALENCY = new totemOfEquivalency(new Item.Settings().group(Shitmod.GENERAL_GROUP).maxCount(1)); + @Override public void onInitialize() { @@ -85,6 +91,8 @@ public class Shitmod implements ModInitializer { Registry.register(Registry.ITEM, new Identifier("shitmod", "unbreakable_strength_charm"), UNBREAKABLE_STRENGTH_CHARM); + Registry.register(Registry.ITEM, new Identifier("shitmod", "totem_of_equivalency"), TOTEM_OF_EQUIVALENCY); + CustomPortalBuilder.beginPortal() .frameBlock(Blocks.DIAMOND_BLOCK) .lightWithItem(Items.ENDER_EYE) diff --git a/src/main/java/net/serenas/shitmod/totemOfEquivalency.java b/src/main/java/net/serenas/shitmod/totemOfEquivalency.java new file mode 100644 index 0000000..34d37c8 --- /dev/null +++ b/src/main/java/net/serenas/shitmod/totemOfEquivalency.java @@ -0,0 +1,22 @@ +package net.serenas.shitmod; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class totemOfEquivalency extends Item { + + public totemOfEquivalency(Settings settings) { + super(settings); + } + + @Override + public TypedActionResult use(World World, PlayerEntity PlayerEntity, Hand Hand) { + PlayerEntity.kill(); + return new TypedActionResult(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand)); + } +}