parent
ce28c1c609
commit
30995c0cc3
@ -0,0 +1,29 @@
|
||||
package com.thebrokenrail.gulliverreloaded.mixin;
|
||||
|
||||
import com.thebrokenrail.gulliverreloaded.ScaledEntity;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(Camera.class)
|
||||
public abstract class MixinCamera {
|
||||
@Shadow
|
||||
private Entity focusedEntity;
|
||||
@Shadow
|
||||
protected abstract double clipToSpace(double distance);
|
||||
@Shadow
|
||||
protected abstract void moveBy(double x, double y, double z);
|
||||
|
||||
@Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(D)D"))
|
||||
public double onUpdateClipToSpaceProxy(Camera obj, double distance) {
|
||||
float scale = focusedEntity instanceof ScaledEntity ? ((ScaledEntity) focusedEntity).getScale() : 1f;
|
||||
return clipToSpace(distance * scale);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.thebrokenrail.gulliverreloaded.mixin;
|
||||
|
||||
import com.thebrokenrail.gulliverreloaded.ScaledEntity;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(InventoryScreen.class)
|
||||
public class MixinInventoryScreen {
|
||||
@ModifyVariable(at = @At("HEAD"), method = "drawEntity", argsOnly = true, index = 2)
|
||||
private static int adjustEntitySize(int initial, int x, int y, int size, float mouseX, float mouseY, LivingEntity entity) {
|
||||
if (entity instanceof ScaledEntity) {
|
||||
return (int) (initial / ((ScaledEntity) entity).getScale());
|
||||
} else {
|
||||
return initial;
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 342 B |
Loading…
Reference in new issue