vanilla-fixes

Minecraft: Better than Adventure! mod that fixes some issues
git clone git://memoryshards.xyz/vanilla-fixes.git
Log | Files | Refs | README | LICENSE

commit 6e8abcca8f04ab96a366b02c70e18be1fe71f0c7
parent 762fb7b76b847ed54670d3cc9d9d01cf634f9f78
Author: Amb0s <ambos@disroot.org>
Date:   Sat, 10 Oct 2020 08:28:24 +0200

Fixed boats

- Boats drop themselves
- Boats don't break due to high velocity

Diffstat:
Asrc/main/java/ambos/vanillafixes/mixin/BoatMixin.java | 37+++++++++++++++++++++++++++++++++++++
Msrc/main/resources/vanillafixes.mixins.json | 1+
2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/main/java/ambos/vanillafixes/mixin/BoatMixin.java b/src/main/java/ambos/vanillafixes/mixin/BoatMixin.java @@ -0,0 +1,37 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.entity.Boat; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ItemEntity; +import net.minecraft.item.ItemType; +import net.minecraft.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Boat.class) +abstract class BoatMixin extends Entity { + public boolean field_1624; + + public BoatMixin(Level level) { + super(level); + } + + @Inject(method = "<init>", at = @At("RETURN")) + private void onInit(CallbackInfo ci) { + field_1624 = false; + } + + @Redirect(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Boat;dropItem(IIF)Lnet/minecraft/entity/ItemEntity;")) + private ItemEntity onDropItem(Boat boat, int i, int j, float f) { + return null; + } + + @Inject(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Boat;remove()V"), cancellable = true) + private void dropBoat(CallbackInfoReturnable<Boolean> ci) { + this.dropItem(ItemType.boat.id, 1, 0.0F); + } +} diff --git a/src/main/resources/vanillafixes.mixins.json b/src/main/resources/vanillafixes.mixins.json @@ -7,6 +7,7 @@ ], "client": [ "AbstractClientPlayerMixin", + "BoatMixin", "class_472Mixin", "class_520Mixin", "ClientPlayNetworkHandlerMixin",