-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathEntityRenderDispatcherMixin.java
More file actions
34 lines (30 loc) · 1.61 KB
/
EntityRenderDispatcherMixin.java
File metadata and controls
34 lines (30 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.denizenscript.clientizen.mixin.render;
import com.denizenscript.clientizen.scripts.commands.AttachCommand;
import net.minecraft.client.render.Frustum;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.world.WorldView;
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.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(EntityRenderDispatcher.class)
public class EntityRenderDispatcherMixin {
@Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true)
private <E extends Entity> void clientizen$cancelRenderIfAttached(
E entity, Frustum frustum, double x, double y, double z, CallbackInfoReturnable<Boolean> cir) {
if (AttachCommand.attachedEntities.containsKey(entity.getUuid())) {
cir.setReturnValue(false);
}
}
@Inject(method = "renderShadow", at = @At("HEAD"), cancellable = true)
private static void clientizen$cancelAttachShadow(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Entity entity, float opacity, float tickDelta, WorldView world, float radius, CallbackInfo ci) {
AttachCommand.AttachData data = AttachCommand.attachedEntities.get(entity.getUuid());
if (data != null && data.noShadow()) {
ci.cancel();
}
}
}