Fix boat interactions in <= 1.20.6

This commit is contained in:
FlorianMichael 2024-08-04 20:40:36 +02:00
parent 5c61aab8fc
commit 8bda98f594
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 15 additions and 6 deletions

View File

@ -40,9 +40,6 @@ import java.util.concurrent.CompletableFuture;
* - Entity attachment calculation got changed completely
* - Particle handling has slightly changed
*
* TODO | Port 1.21
* - HangingEntity/ItemFrame/Painting bounding box calculation changed
*
* TODO | General
* - Make recipe fixes dynamic instead of a data dump in java classes
* - Window interactions in <= 1.16.5 has changed and can be detected by the server

View File

@ -29,10 +29,13 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.vehicle.BoatEntity;
import net.minecraft.entity.vehicle.VehicleEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
@ -85,6 +88,15 @@ public abstract class MixinBoatEntity extends VehicleEntity {
super(type, world);
}
@Redirect(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/VehicleEntity;interact(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"))
private ActionResult makeNotLeashable(VehicleEntity instance, PlayerEntity player, Hand hand) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
return ActionResult.PASS;
} else {
return instance.interact(player, hand);
}
}
@Redirect(method = "updateVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSpaceEmpty(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Box;)Z"))
private boolean alwaysUpdatePosition(World instance, Entity entity, Box box) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {

View File

@ -112,6 +112,7 @@
"fixes.minecraft.entity.MixinEntityRenderDispatcher",
"fixes.minecraft.entity.MixinItemEntity",
"fixes.minecraft.entity.MixinLivingEntity",
"fixes.minecraft.entity.MixinMobEntity",
"fixes.minecraft.entity.MixinOtherClientPlayerEntity",
"fixes.minecraft.entity.MixinPlayerEntity",
"fixes.minecraft.entity.MixinPlayerEntityRenderer",
@ -135,6 +136,7 @@
"fixes.minecraft.item.MixinItemPlacementContext",
"fixes.minecraft.item.MixinItemRenderer",
"fixes.minecraft.item.MixinItemStack",
"fixes.minecraft.item.MixinKnowledgeBookItem",
"fixes.minecraft.item.MixinShovelItem",
"fixes.minecraft.item.MixinSwordItem",
"fixes.minecraft.network.MixinChatMessageC2SPacket",
@ -205,9 +207,7 @@
"fixes.viaversion.MixinWorldPacketRewriter1_19",
"viabedrock.MixinJoinPackets",
"vialegacy.MixinExtensionProtocolMetadataStorage",
"vialegacy.MixinViaLegacyConfig",
"fixes.minecraft.item.MixinKnowledgeBookItem",
"fixes.minecraft.entity.MixinMobEntity"
"vialegacy.MixinViaLegacyConfig"
],
"injectors": {
"defaultRequire": 1