-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
367 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
common/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/BlockEntityRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.github.ennuil.ok_zoomer.mixin.common; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import io.github.ennuil.ok_zoomer.utils.ZoomUtils; | ||
import io.github.ennuil.ok_zoomer.zoom.Zoom; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; | ||
import net.minecraft.util.Mth; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(BlockEntityRenderer.class) | ||
public interface BlockEntityRendererMixin { | ||
@WrapMethod(method = "getViewDistance") | ||
private int modifyBlockEntityViewDistance(Operation<Integer> original) { | ||
if (!ZoomUtils.canSeeDistantEntities()) { | ||
return original.call(); | ||
} else { | ||
return original.call() * (Zoom.isZooming() ? Math.max(1, Mth.ceil(Zoom.getZoomDivisor())) : 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
common/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/IntegratedServerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.github.ennuil.ok_zoomer.mixin.common; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import io.github.ennuil.ok_zoomer.utils.ZoomUtils; | ||
import io.github.ennuil.ok_zoomer.zoom.Zoom; | ||
import net.minecraft.client.server.IntegratedServer; | ||
import net.minecraft.util.Mth; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(IntegratedServer.class) | ||
public abstract class IntegratedServerMixin { | ||
@WrapMethod(method = "getScaledTrackingDistance") | ||
private int modifyEntityViewDistance(int trackingDistance, Operation<Integer> original) { | ||
if (!ZoomUtils.canSeeDistantEntities()) { | ||
return original.call(trackingDistance); | ||
} else { | ||
return original.call(trackingDistance * (Zoom.isZooming() ? Math.max(1, Mth.ceil(Zoom.getZoomDivisor())) : 1)); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
common/src/main/java/io/github/ennuil/ok_zoomer/mixin/common/LevelRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.ennuil.ok_zoomer.mixin.common; | ||
|
||
import io.github.ennuil.ok_zoomer.utils.ZoomUtils; | ||
import io.github.ennuil.ok_zoomer.zoom.Zoom; | ||
import net.minecraft.client.renderer.LevelRenderer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
@Mixin(LevelRenderer.class) | ||
public abstract class LevelRendererMixin { | ||
@ModifyArg( | ||
method = "collectVisibleEntities", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/entity/Entity;setViewScale(D)V" | ||
) | ||
) | ||
private double modifyViewScale(double original) { | ||
if (!ZoomUtils.canSeeDistantEntities()) { | ||
return original; | ||
} else { | ||
return original * Math.max(1.0, Zoom.isZooming() ? Zoom.getZoomDivisor() : 1.0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.