Skip to content

Commit

Permalink
change: use mixin for clean projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Sychic committed Feb 15, 2023
1 parent 94582aa commit 9c73ffb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 56 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package club.sk1er.patcher.mixins.features;

import club.sk1er.patcher.asm.external.mods.optifine.RenderTransformer;
import club.sk1er.patcher.config.PatcherConfig;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(RenderSnowball.class)
public class RenderSnowballMixin_CleanProjectiles<T extends Entity> {

@Inject(method = "doRender", at = @At("HEAD"), cancellable = true)
public void patcher$cleanProjectiles(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
if (PatcherConfig.cleanProjectiles && entity.ticksExisted < 2) ci.cancel();
}

//#if MC==10809
@ModifyArg(method = "doRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V", ordinal = 1), index = 0)
public float patcher$fixPerspectiveRendering(float x) {
return RenderTransformer.checkPerspective() * x;
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public ClassTransformer() {
registerTransformer(new RenderXPOrbTransformer());
registerTransformer(new RenderFireballTransformer());
registerTransformer(new RenderFishTransformer());
registerTransformer(new RenderSnowballTransformer());
//#endif
registerTransformer(new RenderGlobalTransformer());
registerTransformer(new RenderPlayerTransformer());
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/patcher.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"features.RenderItemFrameMixin_NametagShadow",
"features.RenderLightningBoltMixin_CancelRender",
"features.RenderManagerMixin_CancelArrowRender",
"features.RenderSnowballMixin_CleanProjectiles",
"features.ScreenShotHelperMixin_ScreenshotManager",
"features.TileEntityEnchantmentTableRendererMixin_CancelRender",
"features.TileEntityEndPortalRendererMixins_CancelRender",
Expand Down

0 comments on commit 9c73ffb

Please sign in to comment.