mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-02 08:59:31 +01:00
Re-implemented Entity changes
This commit is contained in:
parent
7078b18f18
commit
7bbc8bf830
@ -40,9 +40,6 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.File;
|
||||
|
||||
/*
|
||||
* TODO | Port
|
||||
* - AllayEntity, VexEntity and BoatEntity height offsets are missing?
|
||||
*
|
||||
* TODO | General
|
||||
* - Check if relevant for protocol translation: TakeItemEntityPacket isEmpty case (1.20 -> 1.20.1 change)
|
||||
* - Window interactions in <= 1.16.5 has changed and can be detected by the server
|
||||
|
@ -17,8 +17,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.mob.PathAwareEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.passive.AllayEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -27,12 +29,16 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(AllayEntity.class)
|
||||
public class MixinAllayEntity {
|
||||
|
||||
// @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
// public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
// cir.setReturnValue(0.0);
|
||||
// }
|
||||
// }
|
||||
public abstract class MixinAllayEntity extends PathAwareEntity {
|
||||
|
||||
protected MixinAllayEntity(EntityType<? extends PathAwareEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Inject(method = "getUnscaledRidingOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,23 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.joml.Vector3f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(BoatEntity.class)
|
||||
public class MixinBoatEntity {
|
||||
|
||||
// @ModifyConstant(method = "getMountedHeightOffset", constant = @Constant(doubleValue = 0.25))
|
||||
// public double modifyConstant(double constant) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
// return 0.3;
|
||||
// }
|
||||
// return constant;
|
||||
// }
|
||||
@Inject(method = "getPassengerAttachmentPos", at = @At("TAIL"), cancellable = true, locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
public void modifyDimensionHeight(Entity passenger, EntityDimensions dimensions, float scaleFactor, CallbackInfoReturnable<Vector3f> cir, float f) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
cir.setReturnValue(new Vector3f(0F, 0.3F, f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
@ -36,10 +35,10 @@ public class MixinVexEntity extends HostileEntity {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
// @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
// public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
// cir.setReturnValue(0.0);
|
||||
// }
|
||||
// }
|
||||
@Inject(method = "getUnscaledRidingOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user