mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-21 11:46:49 +01:00
Fix hand swinging in animal/zombie villager entities
If action was previously SUCCESS, we need to change that since SUCCESS_SERVER is only handled on newer servers, if it was previously CONSUME the change can stay.
This commit is contained in:
parent
f1be80bd23
commit
d4a689ccc3
@ -36,6 +36,9 @@ import java.util.concurrent.CompletableFuture;
|
||||
* TODO | Port 1.21.3
|
||||
* - VehicleMovePacket handling now has distance check
|
||||
* - Game options are now only send if they changed
|
||||
* - ArmorStand/MobEntity interaction CONSUME->SUCESS_SERVER
|
||||
* - Illusioner/Sniffer doesn't override visibility bounding box anymore
|
||||
* - AbstractFireabll#shouldRender new
|
||||
*
|
||||
* TODO | Port 1.20.6
|
||||
* - ClientPlayerInteractionManager#interactBlockInternal added new condition
|
||||
|
@ -22,6 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -30,6 +31,15 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(AnimalEntity.class)
|
||||
public abstract class MixinAnimalEntity {
|
||||
|
||||
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;"))
|
||||
private ActionResult.Success swingHand() {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
return ActionResult.SUCCESS_SERVER;
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z"))
|
||||
private boolean changeIsClientCondition(World instance) {
|
||||
return instance.isClient && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15);
|
||||
|
@ -17,23 +17,23 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.VaultBlock;
|
||||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(VaultBlock.class)
|
||||
public abstract class MixinVaultBlock {
|
||||
@Mixin(ZombieVillagerEntity.class)
|
||||
public abstract class MixinZombieVillagerEntity {
|
||||
|
||||
@Redirect(method = "onUseWithItem", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;"))
|
||||
private ActionResult.Success dontSwingHand() {
|
||||
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/util/ActionResult;SUCCESS_SERVER:Lnet/minecraft/util/ActionResult$Success;"))
|
||||
private ActionResult.Success swingHand() {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
|
||||
return ActionResult.CONSUME;
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
return ActionResult.SUCCESS_SERVER;
|
||||
}
|
@ -219,5 +219,8 @@
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
},
|
||||
"mixins": [
|
||||
"fixes.minecraft.entity.MixinZombieVillagerEntity"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user