Class GPSAreaToolItem
java.lang.Object
net.minecraft.world.item.Item
me.desht.pneumaticcraft.common.item.GPSAreaToolItem
- All Implemented Interfaces:
IPositionProvider,IGPSToolSync,net.minecraft.world.flag.FeatureElement,net.minecraft.world.level.ItemLike,net.minecraftforge.common.extensions.IForgeItem
public class GPSAreaToolItem
extends net.minecraft.world.item.Item
implements IPositionProvider, IGPSToolSync
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.world.item.Item
net.minecraft.world.item.Item.Properties -
Field Summary
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(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level worldIn, List<net.minecraft.network.chat.Component> infoList, net.minecraft.world.item.TooltipFlag par4) booleanWhether or not the rendered positions should be visible through the world.static ProgWidgetAreastatic ProgWidgetAreagetArea(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) static Optional<net.minecraft.core.BlockPos>getGPSLocation(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, int index) List<net.minecraft.core.BlockPos>getRawStoredPositions(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Gets the raw stored positions in this provider.intgetRenderColor(int index) Color that should be used to highlight the stored block positions if & when they are rendered on-screen.List<net.minecraft.core.BlockPos>getStoredPositions(UUID playerId, net.minecraft.world.item.ItemStack stack) Get block position data from the given ItemStack.static StringgetVariable(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, int index) voidinventoryTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world, net.minecraft.world.entity.Entity entity, int slot, boolean heldItem) static voidsetGPSPosAndNotify(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.core.BlockPos pos, int index) static voidsetGPSPosAndNotify(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, net.minecraft.core.BlockPos pos, int index) static voidsetVariable(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, String variable, int index) voidsyncFromClient(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, int index, net.minecraft.core.BlockPos pos, String varName) Called when the GPS (Area) Tool GUI is closed, to send position & variable information to servervoidsyncVariables(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack stack) If the item stores any global variables which the client needs to know about (e.g.net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack>use(net.minecraft.world.level.Level worldIn, net.minecraft.world.entity.player.Player playerIn, net.minecraft.world.InteractionHand handIn) net.minecraft.world.InteractionResultuseOn(net.minecraft.world.item.context.UseOnContext ctx) Methods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, 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 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, shouldCauseReequipAnimation
-
Constructor Details
-
GPSAreaToolItem
public GPSAreaToolItem()
-
-
Method Details
-
useOn
public net.minecraft.world.InteractionResult useOn(net.minecraft.world.item.context.UseOnContext ctx) - Overrides:
useOnin classnet.minecraft.world.item.Item
-
use
public net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(net.minecraft.world.level.Level worldIn, net.minecraft.world.entity.player.Player playerIn, net.minecraft.world.InteractionHand handIn) - Overrides:
usein classnet.minecraft.world.item.Item
-
setGPSPosAndNotify
public static void setGPSPosAndNotify(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, net.minecraft.core.BlockPos pos, int index) -
setGPSPosAndNotify
public static void setGPSPosAndNotify(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.core.BlockPos pos, int index) -
appendHoverText
public void appendHoverText(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level worldIn, List<net.minecraft.network.chat.Component> infoList, net.minecraft.world.item.TooltipFlag par4) - Overrides:
appendHoverTextin classnet.minecraft.world.item.Item
-
inventoryTick
public void inventoryTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world, net.minecraft.world.entity.Entity entity, int slot, boolean heldItem) - Overrides:
inventoryTickin classnet.minecraft.world.item.Item
-
getArea
@Nonnull public static ProgWidgetArea getArea(UUID playerId, net.minecraft.world.item.ItemStack stack) -
getArea
public static ProgWidgetArea getArea(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) -
getGPSLocation
public static Optional<net.minecraft.core.BlockPos> getGPSLocation(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, int index) -
setVariable
public static void setVariable(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, String variable, int index) -
getVariable
public static String getVariable(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack gpsTool, int index) -
syncVariables
public void syncVariables(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack stack) Description copied from interface:IPositionProviderIf the item stores any global variables which the client needs to know about (e.g. for area rendering), override this method to sync their values to the client. This method is called server-side when an item in any player's inventory (which implementsIPositionProvider) changes in any way.See
IMiscHelpers.syncGlobalVariable(ServerPlayer, String)for a convenience method to send the necessary sync packet.- Specified by:
syncVariablesin interfaceIPositionProvider- Parameters:
player- the player to sync tostack- the itemstack
-
getStoredPositions
public List<net.minecraft.core.BlockPos> getStoredPositions(UUID playerId, @Nonnull net.minecraft.world.item.ItemStack stack) Description copied from interface:IPositionProviderGet block position data from the given ItemStack. It is up to the implementor to decide how the block positions should be stored on the itemstack and in what order they should be returned.- Specified by:
getStoredPositionsin interfaceIPositionProvider- Parameters:
playerId- the player, for player-global variable context (may be null)stack- the itemstack- Returns:
- a list of block positions that has been retrieved from the itemstack
-
getRawStoredPositions
public List<net.minecraft.core.BlockPos> getRawStoredPositions(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Description copied from interface:IPositionProviderGets the raw stored positions in this provider. E.g. for the GPS Area Tool, just the two clicked positions, not the whole set of positions defined by the tool's area type.- Specified by:
getRawStoredPositionsin interfaceIPositionProvider- Parameters:
player- the player, for player-global variable contextstack- the itemstack- Returns:
- the raw positions stored on the itemstack
-
getRenderColor
public int getRenderColor(int index) Description copied from interface:IPositionProviderColor that should be used to highlight the stored block positions if & when they are rendered on-screen.- Specified by:
getRenderColorin interfaceIPositionProvider- Parameters:
index- the index in the list returned by getStoredPositions()- Returns:
- a color in ARGB format, or 0 to skip rendering completely
-
disableDepthTest
public boolean disableDepthTest()Description copied from interface:IPositionProviderWhether or not the rendered positions should be visible through the world.- Specified by:
disableDepthTestin interfaceIPositionProvider- Returns:
- true if visible through the world, false if not.
-
syncFromClient
public void syncFromClient(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, int index, net.minecraft.core.BlockPos pos, String varName) Description copied from interface:IGPSToolSyncCalled when the GPS (Area) Tool GUI is closed, to send position & variable information to server- Specified by:
syncFromClientin interfaceIGPSToolSync- Parameters:
player- the playerstack- the gps (area) tool itemstackindex- index of the pos & var (ignore for GPS Tool)pos- the new position for this indexvarName- the new variable name for this index (empty string if absent)
-