Class ScrollItem
java.lang.Object
net.minecraft.world.item.Item
com.binaris.wizardry.content.item.ScrollItem
- All Implemented Interfaces:
ICastItem,IWorkbenchItem,net.minecraft.world.flag.FeatureElement,net.minecraft.world.level.ItemLike,net.minecraftforge.common.extensions.IForgeItem
Scroll Item!! Fast and easy way to use spells
Compared to wands, scrolls are single use items that allow the player to cast a single spell without any mana/charge cost. They are consumed upon use. You can think of them as disposable spellcasting items.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
net.minecraft.world.item.Item.Properties -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe limit time for a continuous spell cast from a scroll.static final intCooldown applied when a spell cast is canceled by forfeit (or any listener from SpellPreCast/SpellTickCast)Fields inherited from class net.minecraft.world.item.Item
BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(@NotNull net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.level.Level level, @NotNull List<net.minecraft.network.chat.Component> list, @NotNull net.minecraft.world.item.TooltipFlag tooltipFlag) booleancanCast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx) Normally you would call the eventsSpellCastEvent.PreandSpellCastEvent.Tickin order to know when to allow the spell to run, but here you also handle any other conditions to allow casting.booleancanPlace(net.minecraft.world.item.ItemStack stack) booleancast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx) This is where you make all the spell cast handling (normally just instant spells).@NotNull net.minecraft.world.item.ItemStackfinishUsingItem(@NotNull net.minecraft.world.item.ItemStack stack, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.LivingEntity livingEntity) @NotNull SpellgetCurrentSpell(net.minecraft.world.item.ItemStack stack) Gets the current spell selected in the ItemStack.@NotNull net.minecraft.network.chat.ComponentgetName(@NotNull net.minecraft.world.item.ItemStack stack) intgetSpellSlotCount(net.minecraft.world.item.ItemStack stack) intgetUseDuration(@NotNull net.minecraft.world.item.ItemStack stack) booleanisFoil(@NotNull net.minecraft.world.item.ItemStack stack) booleanonApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks) voidonUseTick(@NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.LivingEntity livingEntity, @NotNull net.minecraft.world.item.ItemStack stack, int timeLeft) voidreleaseUsing(@NotNull net.minecraft.world.item.ItemStack stack, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.LivingEntity livingEntity, int timeCharged) booleanshowSpellHUD(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Returns whether the spell HUD should be shown when a player is holding this item.booleanshowTooltip(net.minecraft.world.item.ItemStack stack) @NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack>use(@NotNull net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.world.InteractionHand hand) Methods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, overrideOtherStackedOnMe, overrideStackedOnOther, requiredFeatures, shouldOverrideMultiplayerNbt, toString, useOn, useOnRelease, verifyTagAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface com.binaris.wizardry.api.content.item.ICastItem
getCurrentCooldown, getCurrentMaxCooldown, getNextSpell, getPreviousSpell, getSpells, selectNextSpell, selectPreviousSpell, selectSpell, showSpellsInWorkbenchMethods inherited from interface net.minecraftforge.common.extensions.IForgeItem
canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onInventoryTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimationMethods inherited from interface com.binaris.wizardry.api.content.item.IWorkbenchItem
applyUpgrade, isClearable, onClearButtonPressed
-
Field Details
-
CASTING_TIME
public static final int CASTING_TIMEThe limit time for a continuous spell cast from a scroll.- See Also:
-
COOLDOWN_FORFEIT_TICKS
public static final int COOLDOWN_FORFEIT_TICKSCooldown applied when a spell cast is canceled by forfeit (or any listener from SpellPreCast/SpellTickCast)- See Also:
-
-
Constructor Details
-
ScrollItem
public ScrollItem(net.minecraft.world.item.Item.Properties properties)
-
-
Method Details
-
use
@NotNull public @NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(@NotNull @NotNull net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.world.InteractionHand hand) - Overrides:
usein classnet.minecraft.world.item.Item
-
onUseTick
public void onUseTick(@NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.LivingEntity livingEntity, @NotNull @NotNull net.minecraft.world.item.ItemStack stack, int timeLeft) - Overrides:
onUseTickin classnet.minecraft.world.item.Item
-
canCast
public boolean canCast(net.minecraft.world.item.ItemStack stack, Spell spell, PlayerCastContext ctx) Description copied from interface:ICastItemNormally you would call the eventsSpellCastEvent.PreandSpellCastEvent.Tickin order to know when to allow the spell to run, but here you also handle any other conditions to allow casting. -
cast
Description copied from interface:ICastItemThis is where you make all the spell cast handling (normally just instant spells). For doing the continuous spells you could useItem.onUseTick(Level, LivingEntity, ItemStack, int) -
appendHoverText
public void appendHoverText(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.world.level.Level level, @NotNull @NotNull List<net.minecraft.network.chat.Component> list, @NotNull @NotNull net.minecraft.world.item.TooltipFlag tooltipFlag) - Overrides:
appendHoverTextin classnet.minecraft.world.item.Item
-
finishUsingItem
@NotNull public @NotNull net.minecraft.world.item.ItemStack finishUsingItem(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.LivingEntity livingEntity) - Overrides:
finishUsingItemin classnet.minecraft.world.item.Item
-
releaseUsing
public void releaseUsing(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.LivingEntity livingEntity, int timeCharged) - Overrides:
releaseUsingin classnet.minecraft.world.item.Item
-
getCurrentSpell
Description copied from interface:ICastItemGets the current spell selected in the ItemStack. This is used for client-side rendering or spell selection utils.- Specified by:
getCurrentSpellin interfaceICastItem- Parameters:
stack- The ItemStack to get the current spell from- Returns:
- The current spell selected in the ItemStack
-
showSpellHUD
public boolean showSpellHUD(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Description copied from interface:ICastItemReturns whether the spell HUD should be shown when a player is holding this item. Only called client-side.- Specified by:
showSpellHUDin interfaceICastItem
-
isFoil
public boolean isFoil(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
isFoilin classnet.minecraft.world.item.Item
-
getName
@NotNull public @NotNull net.minecraft.network.chat.Component getName(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
getNamein classnet.minecraft.world.item.Item
-
getUseDuration
public int getUseDuration(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
getUseDurationin classnet.minecraft.world.item.Item
-
showTooltip
public boolean showTooltip(net.minecraft.world.item.ItemStack stack) - Specified by:
showTooltipin interfaceIWorkbenchItem
-
onApplyButtonPressed
public boolean onApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks) - Specified by:
onApplyButtonPressedin interfaceIWorkbenchItem
-
getSpellSlotCount
public int getSpellSlotCount(net.minecraft.world.item.ItemStack stack) - Specified by:
getSpellSlotCountin interfaceIWorkbenchItem
-
canPlace
public boolean canPlace(net.minecraft.world.item.ItemStack stack) - Specified by:
canPlacein interfaceIWorkbenchItem
-