MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"fai una spada che una volta stoppata, viene eliminata"
/* This mod creates a sword that is removed from the game once it is stopped in Minecraft Forge. */ public class SelfDestructingSword extends SwordItem { public SelfDestructingSword(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } @Override public boolean onEntitySwing(ItemStack stack, LivingEntity entity) { if (!entity.level.isClientSide) { entity.setItemInHand(Hand.MAIN_HAND, ItemStack.EMPTY); entity.level.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ITEM_BREAK, SoundCategory.PLAYERS, 1.0F, 1.0F); } return true; } } /* Register this item in your item registry. */ public static final RegistryObject<Item> SELF_DESTRUCTING_SWORD = ITEMS.register("self_destructing_sword", () -> new SelfDestructingSword(ItemTier.DIAMOND, 3, -2.4F, new Item.Properties().tab(ItemGroup.TAB_COMBAT)));