vanilla-fixes

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

DisplayListMixin.java (1576B)


      1 package ambos.vanillafixes.mixin;
      2 
      3 import net.minecraft.client.render.DisplayList;
      4 import org.spongepowered.asm.mixin.Mixin;
      5 import org.spongepowered.asm.mixin.Shadow;
      6 import org.spongepowered.asm.mixin.injection.At;
      7 import org.spongepowered.asm.mixin.injection.Inject;
      8 import org.spongepowered.asm.mixin.injection.ModifyArgs;
      9 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
     10 import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
     11 
     12 import ambos.vanillafixes.VanillaFixes;
     13 
     14 @Mixin(value = DisplayList.class, remap = false)
     15 final class DisplayListMixin {
     16     private double offsetX;
     17     private double offsetY;
     18     private double offsetZ;
     19 
     20     @Shadow
     21     private int posX;
     22 
     23     @Shadow
     24     private int posY;
     25 
     26     @Shadow
     27     private int posZ;
     28 
     29     @Inject(method = "setToPos", at = @At("RETURN"), require = 0)
     30     private void onSetToPos(int blockX, int blockY, int blockZ, double offsetX, double offsetY, double offsetZ,
     31             CallbackInfo ci) {
     32         if (VanillaFixes.JITERRING) {
     33             this.offsetX = offsetX;
     34             this.offsetY = offsetY;
     35             this.offsetZ = offsetZ;
     36         }
     37     }
     38 
     39     @ModifyArgs(method = "call", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V"), require = 0)
     40     private void changeType(Args args) {
     41         if (VanillaFixes.JITERRING) {
     42             args.set(0, (float) ((double) this.posX - this.offsetX));
     43             args.set(1, (float) ((double) this.posY - this.offsetY));
     44             args.set(2, (float) ((double) this.posZ - this.offsetZ));
     45         }
     46     }
     47 }