Handle axe item change as well, update TODO

This commit is contained in:
FlorianMichael 2024-07-04 16:27:00 +02:00
parent 509113c850
commit ae5b490d6b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 27 additions and 15 deletions

View File

@ -42,23 +42,18 @@ import java.util.concurrent.CompletableFuture;
* *
* TODO | Port 1.21 * TODO | Port 1.21
* - ClientPlayerEntity#tickMovement nether portal logic has new screen conditions and changed * - ClientPlayerEntity#tickMovement nether portal logic has new screen conditions and changed
* - horses getInvColumns behaviour * - Entity#interact now handles leashables interface which was previously handled in MobEntity
* - Wolf hasArmor -> interactions * - shouldCancelInteraction condition in ChestBoatEntity#interact is new
* - HangingEntity, ItemFrame, Painting, PrimedTnt * - HangingEntity/ItemFrame/Painting bounding box calculation changed
* - Villager offers are server only now * - PlayerEntity#attack got refactored (?)
* - Player#attack * - LivingEntity#takeKnockback with 1.0E-5F for loop is new
* - Boat floating and interaction * - KnowledgeBookItem#use decrementUnlessCreative is new
* - Entity collide functions and interaction * - JukeboxBlock#onUse override is new (added state.get(HAS_RECORD) condition)
* - LivingEntity#getBlockSpeedFactor, decreaseAirSupply, knockback, travel, getPreciseBodyRotation,
* - Mob interact
* - AxeItem playerHasShieldUseIntent new
* - BucketItem, ChorusFruit, FoodOnAStickItem, KnowledgeBookItem, TridentItem,
* - Jukebox overrides new interaction function
* - SignBlock creative check
* - SolidBucketItem useOn
* - HangingEntity bounding box calculation changes * - HangingEntity bounding box calculation changes
* - BoatEntity#updateVelocity isSpaceEmpty condition new * - BoatEntity#updateVelocity isSpaceEmpty condition new
* - LivingEntity#remove -> activeEffects.clear * - LivingEntity#remove -> added activeEffects.clear call
* - PlayerEntity#tickMovement getSaturationLevel/setSaturationLevel handling is new
* - Check WorldBorder bounds check
* *
* TODO | General * TODO | General
* - Make recipe fixes dynamic instead of a data dump in java classes * - Make recipe fixes dynamic instead of a data dump in java classes
@ -66,6 +61,7 @@ import java.util.concurrent.CompletableFuture;
* - Most CTS protocol features aren't supported (see https://github.com/ViaVersion/ViaFabricPlus/issues/181) * - Most CTS protocol features aren't supported (see https://github.com/ViaVersion/ViaFabricPlus/issues/181)
* - Most CPE features aren't implemented correctly (see https://github.com/ViaVersion/ViaFabricPlus/issues/152) * - Most CPE features aren't implemented correctly (see https://github.com/ViaVersion/ViaFabricPlus/issues/152)
* - Via: 1.13 -> 1.12.2 block entities recode * - Via: 1.13 -> 1.12.2 block entities recode
* - OXYGEN_BONUS 1.21 -> 1.20.5 handling is missing (only visual)
* *
* TODO | Movement * TODO | Movement
* - Collision hit boxes has been changed (https://github.com/ViaVersion/ViaFabricPlus/issues/195) * - Collision hit boxes has been changed (https://github.com/ViaVersion/ViaFabricPlus/issues/195)

View File

@ -25,13 +25,29 @@ import net.minecraft.item.AxeItem;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(AxeItem.class) @Mixin(AxeItem.class)
public abstract class MixinAxeItem { public abstract class MixinAxeItem {
@Shadow
private static boolean shouldCancelStripAttempt(ItemUsageContext context) {
return false;
}
@Redirect(method = "useOnBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/AxeItem;shouldCancelStripAttempt(Lnet/minecraft/item/ItemUsageContext;)Z"))
private boolean neverCancelStripAttempt(ItemUsageContext context) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
return false;
} else {
return shouldCancelStripAttempt(context);
}
}
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
private void disableUse(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) { private void disableUse(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) {