TeamGalacticraft / Galacticraft-Legacy

An advanced Space Dimension Mod for Minecraft
MIT License
72 stars 33 forks source link

[Bug]: Incompatability with mods affecting eye height #170

Closed ryze312 closed 11 months ago

ryze312 commented 11 months ago

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.

ryze312 commented 11 months ago

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. https://github.com/TeamGalacticraft/Galacticraft-Legacy/blob/ff4ebbee20bc2bbd16a3cbf002d20ed69f4689e8/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java#L446-L455

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

ryze312 commented 11 months ago

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
    }
}
ROMVoid95 commented 11 months ago

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.