Skip to content

Commit

Permalink
rename LivingEntity setCurrentHand -> tryStartUsing and add javadoc (#…
Browse files Browse the repository at this point in the history
…653)

rename LivingEntity setCurrentHand -> tryStartUsing and add javadoc

Co-authored-by: ix0rai <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 20, 2025
1 parent c37469f commit d56b453
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mappings/net/minecraft/entity/LivingEntity.mapping
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ CLASS net/minecraft/unmapped/C_usxaxydn net/minecraft/entity/LivingEntity
METHOD m_awmtskvv getAccelerationFactor (F)F
ARG 1 slipperiness
METHOD m_axkhmdzu getDeathSound ()Lnet/minecraft/unmapped/C_avavozay;
METHOD m_ayeajhdm setCurrentHand (Lnet/minecraft/unmapped/C_laxmzoqs;)V
METHOD m_ayeajhdm tryStartUsing (Lnet/minecraft/unmapped/C_laxmzoqs;)V
COMMENT If the passed {@link net.minecraft.util.Hand hand} holds an
COMMENT {@link net.minecraft.item.ItemStack item} and one is not already being used,
COMMENT starts using the held {@link net.minecraft.item.ItemStack item}.
ARG 1 hand
METHOD m_ayqytazn hasLineOfSight (Lnet/minecraft/unmapped/C_astfners;)Z
METHOD m_bftuqrdn onKilledBy (Lnet/minecraft/unmapped/C_usxaxydn;)V
Expand Down

1 comment on commit d56b453

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With commit d56b453, 17 file(s) were updated with 24 line(s) added and 20 removed compared to the latest Quilt Mappings version.

View the diff here:
diff -bur namedTargetSrc/net/minecraft/client/network/ClientPlayerEntity.java namedSrc/net/minecraft/client/network/ClientPlayerEntity.java
--- namedTargetSrc/net/minecraft/client/network/ClientPlayerEntity.java	2025-01-20 23:32:03.958300164 +0000
+++ namedSrc/net/minecraft/client/network/ClientPlayerEntity.java	2025-01-20 23:30:58.182253633 +0000
@@ -813,10 +813,10 @@
     * Mapping not found
     */
    @Override
-   public void setCurrentHand(Hand hand) {
+   public void tryStartUsing(Hand hand) {
       ItemStack lv = this.getStackInHand(hand);
       if (!lv.isEmpty() && !this.isUsingItem()) {
-         super.setCurrentHand(hand);
+         super.tryStartUsing(hand);
          this.usingItem = true;
          this.activeHand = hand;
       }
@@ -857,7 +857,7 @@
          boolean bl = (this.dataTracker.get(LIVING_FLAGS) & 1) > 0;
          Hand lv = (this.dataTracker.get(LIVING_FLAGS) & 2) > 0 ? Hand.OFF_HAND : Hand.MAIN_HAND;
          if (bl && !this.usingItem) {
-            this.setCurrentHand(lv);
+            this.tryStartUsing(lv);
          } else if (!bl && this.usingItem) {
             this.clearActiveItem();
          }
diff -bur namedTargetSrc/net/minecraft/component/type/ConsumableComponent.java namedSrc/net/minecraft/component/type/ConsumableComponent.java
--- namedTargetSrc/net/minecraft/component/type/ConsumableComponent.java	2025-01-20 23:32:03.950300159 +0000
+++ namedSrc/net/minecraft/component/type/ConsumableComponent.java	2025-01-20 23:30:58.174253627 +0000
@@ -93,7 +93,7 @@
       } else {
          boolean bl = this.getConsumeTicks() > 0;
          if (bl) {
-            entity.setCurrentHand(hand);
+            entity.tryStartUsing(hand);
             return ActionResult.CONSUME;
          } else {
             ItemStack lv = this.consume(entity.getWorld(), entity, stack);
diff -bur namedTargetSrc/net/minecraft/entity/ai/brain/task/CrossbowAttackTask.java namedSrc/net/minecraft/entity/ai/brain/task/CrossbowAttackTask.java
--- namedTargetSrc/net/minecraft/entity/ai/brain/task/CrossbowAttackTask.java	2025-01-20 23:32:03.886300115 +0000
+++ namedSrc/net/minecraft/entity/ai/brain/task/CrossbowAttackTask.java	2025-01-20 23:30:58.103253577 +0000
@@ -91,7 +91,7 @@
     */
    private void tickState(E entity, LivingEntity target) {
       if (this.state == CrossbowAttackTask.CrossbowState.UNCHARGED) {
-         entity.setCurrentHand(ProjectileUtil.getHandPossiblyHolding(entity, Items.CROSSBOW));
+         entity.tryStartUsing(ProjectileUtil.getHandPossiblyHolding(entity, Items.CROSSBOW));
          this.state = CrossbowAttackTask.CrossbowState.CHARGING;
          entity.setCharging(true);
       } else if (this.state == CrossbowAttackTask.CrossbowState.CHARGING) {
diff -bur namedTargetSrc/net/minecraft/entity/ai/goal/BowAttackGoal.java namedSrc/net/minecraft/entity/ai/goal/BowAttackGoal.java
--- namedTargetSrc/net/minecraft/entity/ai/goal/BowAttackGoal.java	2025-01-20 23:32:03.785300045 +0000
+++ namedSrc/net/minecraft/entity/ai/goal/BowAttackGoal.java	2025-01-20 23:30:57.995253501 +0000
@@ -202,7 +202,7 @@
                }
             }
          } else if (--this.cooldown <= 0 && this.targetSeeingTicker >= -60) {
-            this.actor.setCurrentHand(ProjectileUtil.getHandPossiblyHolding(this.actor, Items.BOW));
+            this.actor.tryStartUsing(ProjectileUtil.getHandPossiblyHolding(this.actor, Items.BOW));
          }
       }
    }
diff -bur namedTargetSrc/net/minecraft/entity/ai/goal/CrossbowAttackGoal.java namedSrc/net/minecraft/entity/ai/goal/CrossbowAttackGoal.java
--- namedTargetSrc/net/minecraft/entity/ai/goal/CrossbowAttackGoal.java	2025-01-20 23:32:03.886300115 +0000
+++ namedSrc/net/minecraft/entity/ai/goal/CrossbowAttackGoal.java	2025-01-20 23:30:58.103253577 +0000
@@ -162,7 +162,7 @@
          this.actor.getLookControl().lookAt(lv, 30.0F, 30.0F);
          if (this.stage == CrossbowAttackGoal.Stage.UNCHARGED) {
             if (!bl3) {
-               this.actor.setCurrentHand(ProjectileUtil.getHandPossiblyHolding(this.actor, Items.CROSSBOW));
+               this.actor.tryStartUsing(ProjectileUtil.getHandPossiblyHolding(this.actor, Items.CROSSBOW));
                this.stage = CrossbowAttackGoal.Stage.CHARGING;
                this.actor.setCharging(true);
             }
diff -bur namedTargetSrc/net/minecraft/entity/ai/goal/HoldInHandsGoal.java namedSrc/net/minecraft/entity/ai/goal/HoldInHandsGoal.java
--- namedTargetSrc/net/minecraft/entity/ai/goal/HoldInHandsGoal.java	2025-01-20 23:32:03.997300191 +0000
+++ namedSrc/net/minecraft/entity/ai/goal/HoldInHandsGoal.java	2025-01-20 23:30:58.233253669 +0000
@@ -68,7 +68,7 @@
    @Override
    public void start() {
       this.actor.equipStack(EquipmentSlot.MAINHAND, this.item.copy());
-      this.actor.setCurrentHand(Hand.MAIN_HAND);
+      this.actor.tryStartUsing(Hand.MAIN_HAND);
    }
 
    /**
diff -bur namedTargetSrc/net/minecraft/entity/LivingEntity.java namedSrc/net/minecraft/entity/LivingEntity.java
--- namedTargetSrc/net/minecraft/entity/LivingEntity.java	2025-01-20 23:32:03.972300174 +0000
+++ namedSrc/net/minecraft/entity/LivingEntity.java	2025-01-20 23:30:58.196253643 +0000
@@ -4749,10 +4749,14 @@
    }
 
    /**
+    * If the passed {@link net.minecraft.util.Hand hand} holds an
+    * {@link net.minecraft.item.ItemStack item} and one is not already being used,
+    * starts using the held {@link net.minecraft.item.ItemStack item}.
+    * 
     * @mapping {@literal hashed m_ayeajhdm Lnet/minecraft/unmapped/C_usxaxydn;m_ayeajhdm(Lnet/minecraft/unmapped/C_laxmzoqs;)V}
-    * @mapping {@literal named setCurrentHand Lnet/minecraft/entity/LivingEntity;setCurrentHand(Lnet/minecraft/util/Hand;)V}
+    * @mapping {@literal named tryStartUsing Lnet/minecraft/entity/LivingEntity;tryStartUsing(Lnet/minecraft/util/Hand;)V}
     */
-   public void setCurrentHand(Hand hand) {
+   public void tryStartUsing(Hand hand) {
       ItemStack lv = this.getStackInHand(hand);
       if (!lv.isEmpty() && !this.isUsingItem()) {
          this.activeItemStack = lv;
diff -bur namedTargetSrc/net/minecraft/entity/mob/DrownedEntity.java namedSrc/net/minecraft/entity/mob/DrownedEntity.java
--- namedTargetSrc/net/minecraft/entity/mob/DrownedEntity.java	2025-01-20 23:32:03.808300061 +0000
+++ namedSrc/net/minecraft/entity/mob/DrownedEntity.java	2025-01-20 23:30:58.016253516 +0000
@@ -666,7 +666,7 @@
       public void start() {
          super.start();
          this.drowned.setAttacking(true);
-         this.drowned.setCurrentHand(Hand.MAIN_HAND);
+         this.drowned.tryStartUsing(Hand.MAIN_HAND);
       }
 
       /**
diff -bur namedTargetSrc/net/minecraft/item/BowItem.java namedSrc/net/minecraft/item/BowItem.java
--- namedTargetSrc/net/minecraft/item/BowItem.java	2025-01-20 23:32:04.058300233 +0000
+++ namedSrc/net/minecraft/item/BowItem.java	2025-01-20 23:30:58.328253736 +0000
@@ -125,7 +125,7 @@
       if (!player.isInCreativeMode() && !bl) {
          return ActionResult.FAIL;
       } else {
-         player.setCurrentHand(hand);
+         player.tryStartUsing(hand);
          return ActionResult.CONSUME;
       }
    }
diff -bur namedTargetSrc/net/minecraft/item/BrushItem.java namedSrc/net/minecraft/item/BrushItem.java
--- namedTargetSrc/net/minecraft/item/BrushItem.java	2025-01-20 23:32:03.915300135 +0000
+++ namedSrc/net/minecraft/item/BrushItem.java	2025-01-20 23:30:58.137253601 +0000
@@ -56,7 +56,7 @@
    public ActionResult useOnBlock(ItemUsageContext context) {
       PlayerEntity lv = context.getPlayer();
       if (lv != null && this.getHitResult(lv).getType() == HitResult.Type.BLOCK) {
-         lv.setCurrentHand(context.getHand());
+         lv.tryStartUsing(context.getHand());
       }
 
       return ActionResult.CONSUME;
diff -bur namedTargetSrc/net/minecraft/item/BundleItem.java namedSrc/net/minecraft/item/BundleItem.java
--- namedTargetSrc/net/minecraft/item/BundleItem.java	2025-01-20 23:32:04.047300225 +0000
+++ namedSrc/net/minecraft/item/BundleItem.java	2025-01-20 23:30:58.310253724 +0000
@@ -178,7 +178,7 @@
     */
    @Override
    public ActionResult use(World world, PlayerEntity player, Hand hand) {
-      player.setCurrentHand(hand);
+      player.tryStartUsing(hand);
       return ActionResult.SUCCESS;
    }
 
diff -bur namedTargetSrc/net/minecraft/item/CrossbowItem.java namedSrc/net/minecraft/item/CrossbowItem.java
--- namedTargetSrc/net/minecraft/item/CrossbowItem.java	2025-01-20 23:32:03.970300172 +0000
+++ namedSrc/net/minecraft/item/CrossbowItem.java	2025-01-20 23:30:58.197253644 +0000
@@ -134,7 +134,7 @@
       } else if (!player.getArrowType(lv).isEmpty()) {
          this.charged = false;
          this.loaded = false;
-         player.setCurrentHand(hand);
+         player.tryStartUsing(hand);
          return ActionResult.CONSUME;
       } else {
          return ActionResult.FAIL;
diff -bur namedTargetSrc/net/minecraft/item/EnderEyeItem.java namedSrc/net/minecraft/item/EnderEyeItem.java
--- namedTargetSrc/net/minecraft/item/EnderEyeItem.java	2025-01-20 23:32:04.047300225 +0000
+++ namedSrc/net/minecraft/item/EnderEyeItem.java	2025-01-20 23:30:58.310253724 +0000
@@ -95,7 +95,7 @@
       if (lv2.getType() == HitResult.Type.BLOCK && world.getBlockState(lv2.getBlockPos()).isOf(Blocks.END_PORTAL_FRAME)) {
          return ActionResult.PASS;
       } else {
-         player.setCurrentHand(hand);
+         player.tryStartUsing(hand);
          if (world instanceof ServerWorld lv3) {
             BlockPos lv4 = lv3.findFirstPos(StructureTags.EYE_OF_ENDER_LOCATED, player.getBlockPos(), 100, false);
             if (lv4 == null) {
diff -bur namedTargetSrc/net/minecraft/item/InstrumentItem.java namedSrc/net/minecraft/item/InstrumentItem.java
--- namedTargetSrc/net/minecraft/item/InstrumentItem.java	2025-01-20 23:32:03.919300138 +0000
+++ namedSrc/net/minecraft/item/InstrumentItem.java	2025-01-20 23:30:58.141253604 +0000
@@ -82,7 +82,7 @@
       Optional<? extends Holder<Instrument>> optional = this.getInstrument(lv, player.getRegistryManager());
       if (optional.isPresent()) {
          Instrument lv2 = (Instrument)((Holder)optional.get()).getValue();
-         player.setCurrentHand(hand);
+         player.tryStartUsing(hand);
          playSound(world, player, lv2);
          player.getItemCooldownManager().set(lv, MathHelper.floor(lv2.duration() * 20.0F));
          player.incrementStat(Stats.USED.getOrCreateStat(this));
diff -bur namedTargetSrc/net/minecraft/item/ItemUsage.java namedSrc/net/minecraft/item/ItemUsage.java
--- namedTargetSrc/net/minecraft/item/ItemUsage.java	2025-01-20 23:32:04.062300236 +0000
+++ namedSrc/net/minecraft/item/ItemUsage.java	2025-01-20 23:30:58.335253741 +0000
@@ -16,7 +16,7 @@
     * @mapping {@literal named consumeHeldItem Lnet/minecraft/item/ItemUsage;consumeHeldItem(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;}
     */
    public static ActionResult consumeHeldItem(World world, PlayerEntity player, Hand hand) {
-      player.setCurrentHand(hand);
+      player.tryStartUsing(hand);
       return ActionResult.CONSUME;
    }
 
diff -bur namedTargetSrc/net/minecraft/item/ShieldItem.java namedSrc/net/minecraft/item/ShieldItem.java
--- namedTargetSrc/net/minecraft/item/ShieldItem.java	2025-01-20 23:32:04.052300229 +0000
+++ namedSrc/net/minecraft/item/ShieldItem.java	2025-01-20 23:30:58.317253729 +0000
@@ -73,7 +73,7 @@
     */
    @Override
    public ActionResult use(World world, PlayerEntity player, Hand hand) {
-      player.setCurrentHand(hand);
+      player.tryStartUsing(hand);
       return ActionResult.CONSUME;
    }
 }
diff -bur namedTargetSrc/net/minecraft/item/TridentItem.java namedSrc/net/minecraft/item/TridentItem.java
--- namedTargetSrc/net/minecraft/item/TridentItem.java	2025-01-20 23:32:03.892300119 +0000
+++ namedSrc/net/minecraft/item/TridentItem.java	2025-01-20 23:30:58.108253581 +0000
@@ -173,7 +173,7 @@
       } else if (EnchantmentHelper.getTridentSpinAttackStrength(lv, player) > 0.0F && !player.isTouchingWaterOrRain()) {
          return ActionResult.FAIL;
       } else {
-         player.setCurrentHand(hand);
+         player.tryStartUsing(hand);
          return ActionResult.CONSUME;
       }
    }

Please sign in to comment.