Galacticraft Legacy

Galacticraft Legacy

2M Downloads

[Bug]: Incompatability with mods affecting eye height

ryze312 opened this issue ยท 3 comments

commented

Forge Version

14.23.5.2860

Galacticraft Version

4.0.6

Log or Crash Report

No response

Reproduction steps

  1. Load up any mod that affects eye height (e.g. FillyCam) with GalactiCraft
  2. Eye height modifications are broken

Note that FillyCam is for 1.11 and is mentioned merely as an example. I am currently in progress of porting it on Forge, so I stumbled upon this issue.

commented

It seems that Galacticraft just extends Minecraft's EntityPlayer and replaces it completely. This breaks a ton of things.
In this particular case the super method getEyeHeight of base class is never called, so modifications of the original class (via Mixins or otherwise) don't have any effect.

@Override
public float getEyeHeight()
{
float f = eyeHeight;
if (this.isPlayerSleeping())
{
return 0.2F;
}

Furthermore there seems to be a lot of duplicated code copied straight from the EntityPlayer class. I really doubt this is the proper way.

commented

As far as I can tell Galacticraft doesn't use Mixin, but the way you would do this via Mixins is by redirecting get field instruction to a method call.
This is how it would be done using Mixin:

@Mixin(EntityPlayer.class)
public abstract class MixinEntityPlayer  {
    
    @Redirect(method = "getEyeHeight()F", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/player/EntityPlayer;eyeHeight:F"))
    private float redirectEyeHeight(EntityPlayer player) {
        // Calculate and return custom eye height
    }
}
commented

Almost none of the code in those packages have been changed since Micdoodle8 worked on the project.

But the mod will soon be put into maintenance mode, so I can fully focus on GC5 development on Forge. With that said it will no longer receive new features or compatibility updates. And I will not be introducing Mixins into the mod.