norender and rendering improvements

This commit is contained in:
C10udburst
2022-03-18 22:39:50 +01:00
parent b32d679f48
commit 82d1176252
6 changed files with 56 additions and 10 deletions

View File

@@ -0,0 +1,34 @@
package anticope.rejects.mixin;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import anticope.rejects.modules.Rendering;
import meteordevelopment.meteorclient.systems.modules.Modules;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ChestBlockEntityRenderer.class)
public class ChestBlockEntityRendererMixin {
@Shadow private boolean christmas;
@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;FII)V", at = @At("HEAD"), cancellable = true)
public void render1(MatrixStack matrices, VertexConsumer vertices, ModelPart lid, ModelPart latch, ModelPart base, float openFactor, int light, int overlay, CallbackInfo ci) {
Rendering rendering = Modules.get().get(Rendering.class);
if (rendering != null)
this.christmas = rendering.chistmas();
}
@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;FII)V", at = @At("RETURN"))
public void render2(MatrixStack matrices, VertexConsumer vertices, ModelPart lid, ModelPart latch, ModelPart base, float openFactor, int light, int overlay, CallbackInfo ci) {
Rendering rendering = Modules.get().get(Rendering.class);
if (rendering != null)
this.christmas = rendering.chistmas();
}
}

View File

@@ -1,6 +1,7 @@
package anticope.rejects.mixin;
import anticope.rejects.modules.Rendering;
import anticope.rejects.modules.modifier.NoRenderModifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -9,12 +10,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.toast.Toast;
import net.minecraft.client.toast.ToastManager;
import meteordevelopment.meteorclient.systems.modules.Modules;
@Mixin(ToastManager.class)
public class ToastManagerMixin {
@Inject(method="add", at = @At("HEAD"), cancellable = true)
public void preventAdd(Toast toast, CallbackInfo ci) {
if (Modules.get().get(Rendering.class).disableToasts()) ci.cancel();
if (NoRenderModifier.disableToasts()) ci.cancel();
}
}