explosive thorns

This commit is contained in:
Sunskimmer822 2022-03-16 23:12:12 -05:00
parent d56aeaea32
commit 6ef4f76ba4
4 changed files with 46 additions and 8 deletions

View File

@ -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)

View File

@ -20,8 +20,8 @@ public class blazeMetalAxe extends AxeItem {
@Override
public TypedActionResult<ItemStack> 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<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
}

View File

@ -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<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
}
}

View File

@ -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);
}
}