diff --git a/src/main/java/net/serenas/shitmod/Shitmod.java b/src/main/java/net/serenas/shitmod/Shitmod.java index 8ace49b..71ac683 100644 --- a/src/main/java/net/serenas/shitmod/Shitmod.java +++ b/src/main/java/net/serenas/shitmod/Shitmod.java @@ -6,6 +6,8 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.kyrptonaught.customportalapi.api.CustomPortalBuilder; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -70,20 +72,22 @@ public class Shitmod implements ModInitializer { public static final Item KINGSOUL_RIGHT = new kingsoulRight(new Item.Settings().group(Shitmod.CHARMS_GROUP).maxCount(1)); - public static final ToolItem BLAZE_METAL_SWORD = new blazeMetalSword(blazeMetalMaterial.INSTANCE, 5, 3f, new Item.Settings().group(Shitmod.TOOLS_GROUP)); + public static final ToolItem BLAZE_METAL_SWORD = new blazeMetalSword(blazeMetalMaterial.INSTANCE, 5, 3f, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(8000)); - public static final ToolItem BLAZE_METAL_PICKAXE = new blazeMetalPickaxe(blazeMetalMaterial.INSTANCE, 1, -0.5f, new Item.Settings().group(Shitmod.TOOLS_GROUP)); + public static final ToolItem BLAZE_METAL_PICKAXE = new blazeMetalPickaxe(blazeMetalMaterial.INSTANCE, 1, -0.5f, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(8000)); - public static final ToolItem BLAZE_METAL_AXE = new blazeMetalAxe(blazeMetalMaterial.INSTANCE, 8.0f, -1.0f, new Item.Settings().group(Shitmod.TOOLS_GROUP)); + public static final ToolItem BLAZE_METAL_AXE = new blazeMetalAxe(blazeMetalMaterial.INSTANCE, 8.0f, -1.0f, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(8000)); - public static final ToolItem BLAZE_METAL_SHOVEL = new ShovelItem(blazeMetalMaterial.INSTANCE, 1f, 3.0f, new Item.Settings().group(Shitmod.TOOLS_GROUP)); + public static final ToolItem BLAZE_METAL_SHOVEL = new ShovelItem(blazeMetalMaterial.INSTANCE, 1f, 3.0f, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(8000)); - public static final ToolItem BLAZE_METAL_HOE = new blazeMetalHoe(blazeMetalMaterial.INSTANCE, new Item.Settings().group(Shitmod.TOOLS_GROUP)); + public static final ToolItem BLAZE_METAL_HOE = new blazeMetalHoe(blazeMetalMaterial.INSTANCE, new Item.Settings().group(Shitmod.TOOLS_GROUP).maxDamage(8000)); public static final Item BLAZE_METAL_INGOT = new blazeMetalIngot(new Item.Settings().group(Shitmod.GENERAL_GROUP)); public static final Enchantment EXPLOSION_ASPECT = new explosionAspectEnchantment(); + public static final Enchantment EXPLOSIVE_THORNS = new explosiveThornsEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.WEARABLE, new EquipmentSlot[] {EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}); + @Override public void onInitialize() { @@ -138,6 +142,8 @@ public class Shitmod implements ModInitializer { Registry.register(Registry.ENCHANTMENT, new Identifier("shitmod", "explosion_aspect"), EXPLOSION_ASPECT); + Registry.register(Registry.ENCHANTMENT, new Identifier("shitmod", "explosive_thorns"), EXPLOSIVE_THORNS); + CustomPortalBuilder.beginPortal() .frameBlock(Shitmod.FABRIC_BLOCK) .lightWithItem(Shitmod.BLAZE_METAL_INGOT) diff --git a/src/main/java/net/serenas/shitmod/blazeMetalAxe.java b/src/main/java/net/serenas/shitmod/blazeMetalAxe.java index 015d069..89c93d4 100644 --- a/src/main/java/net/serenas/shitmod/blazeMetalAxe.java +++ b/src/main/java/net/serenas/shitmod/blazeMetalAxe.java @@ -20,8 +20,8 @@ public class blazeMetalAxe extends AxeItem { @Override public TypedActionResult use(World World, PlayerEntity PlayerEntity, Hand Hand) { Vec3d looking = PlayerEntity.getRotationVector(); - World.spawnEntity(new FireballEntity(World, PlayerEntity, looking.x, looking.y, looking.z, 5)); - PlayerEntity.getStackInHand(Hand).damage(50,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); + World.spawnEntity(new FireballEntity(World, PlayerEntity, looking.x, looking.y, looking.z, 6)); + PlayerEntity.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); return new TypedActionResult(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand)); } diff --git a/src/main/java/net/serenas/shitmod/blazeMetalSword.java b/src/main/java/net/serenas/shitmod/blazeMetalSword.java index 4bfcfab..3d10c96 100644 --- a/src/main/java/net/serenas/shitmod/blazeMetalSword.java +++ b/src/main/java/net/serenas/shitmod/blazeMetalSword.java @@ -24,7 +24,7 @@ public class blazeMetalSword extends SwordItem { Vec3d looking = PlayerEntity.getRotationVector(); FireballEntity fireball = new FireballEntity(World, PlayerEntity, looking.x, looking.y, looking.z, 5); World.spawnEntity(fireball); - PlayerEntity.getStackInHand(Hand).damage(50,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); + PlayerEntity.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); return new TypedActionResult(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand)); } } diff --git a/src/main/java/net/serenas/shitmod/explosiveThornsEnchantment.java b/src/main/java/net/serenas/shitmod/explosiveThornsEnchantment.java new file mode 100644 index 0000000..8f21260 --- /dev/null +++ b/src/main/java/net/serenas/shitmod/explosiveThornsEnchantment.java @@ -0,0 +1,32 @@ +package net.serenas.shitmod; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion.DestructionType; + +public class explosiveThornsEnchantment extends Enchantment { + + protected explosiveThornsEnchantment(Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes) { + super(weight, type, slotTypes); + } + + @Override + public int getMaxLevel() { + return 5; + } + + + @Override + public void onUserDamaged(LivingEntity user, Entity attacker, int level) { + World World = attacker.world; + Vec3d pos = attacker.getPos(); + World.createExplosion(user, DamageSource.MAGIC, null, pos.x, pos.y, pos.z, 3 * level, false, DestructionType.NONE); + super.onUserDamaged(user, attacker, level); + } +}