-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90c1832
commit 396f2c8
Showing
10 changed files
with
144 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...n/viafabricplus/injection/mixin/features/entity/interactions/MixinAbstractBoatEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus | ||
* Copyright (C) 2021-2024 the original authors | ||
* - FlorianMichael/EnZaXD <[email protected]> | ||
* - RK_01/RaphiMC | ||
* Copyright (C) 2023-2024 ViaVersion and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions; | ||
|
||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; | ||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.entity.vehicle.AbstractBoatEntity; | ||
import net.minecraft.entity.vehicle.BoatEntity; | ||
import net.minecraft.entity.vehicle.VehicleEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(AbstractBoatEntity.class) | ||
public abstract class MixinAbstractBoatEntity extends VehicleEntity { | ||
|
||
public MixinAbstractBoatEntity(EntityType<?> entityType, World world) { | ||
super(entityType, 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 super.interact(player, hand); | ||
} | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...viafabricplus/injection/mixin/features/entity/riding_offsets/MixinAbstractBoatEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus | ||
* Copyright (C) 2021-2024 the original authors | ||
* - FlorianMichael/EnZaXD <[email protected]> | ||
* - RK_01/RaphiMC | ||
* Copyright (C) 2023-2024 ViaVersion and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.viaversion.viafabricplus.injection.mixin.features.entity.riding_offsets; | ||
|
||
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2; | ||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator; | ||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.vehicle.AbstractBoatEntity; | ||
import net.minecraft.entity.vehicle.VehicleEntity; | ||
import net.minecraft.util.math.Vec3d; | ||
import net.minecraft.world.World; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(AbstractBoatEntity.class) | ||
public abstract class MixinAbstractBoatEntity extends VehicleEntity { | ||
|
||
public MixinAbstractBoatEntity(EntityType<?> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Inject(method = "updatePassengerPosition", at = @At(value = "HEAD"), cancellable = true) | ||
private void updatePassengerPosition1_8(Entity passenger, Entity.PositionUpdater positionUpdater, CallbackInfo ci) { | ||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { | ||
final Vec3d newPosition = EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger).add(this.getPos()); | ||
positionUpdater.accept(passenger, newPosition.x, newPosition.y + EntityRidingOffsetsPre1_20_2.getHeightOffset(passenger), newPosition.z); | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters