67 lines
2.6 KiB
Java
67 lines
2.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* org.joml.Quaternionfc
|
|
*/
|
|
package net.minecraft.client.renderer.entity;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
|
import net.minecraft.client.renderer.entity.EntityRenderer;
|
|
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
|
import net.minecraft.client.renderer.entity.state.ThrownItemRenderState;
|
|
import net.minecraft.client.renderer.item.ItemModelResolver;
|
|
import net.minecraft.client.renderer.state.CameraRenderState;
|
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.projectile.ItemSupplier;
|
|
import net.minecraft.world.item.ItemDisplayContext;
|
|
import org.joml.Quaternionfc;
|
|
|
|
public class ThrownItemRenderer<T extends Entity>
|
|
extends EntityRenderer<T, ThrownItemRenderState> {
|
|
private final ItemModelResolver itemModelResolver;
|
|
private final float scale;
|
|
private final boolean fullBright;
|
|
|
|
public ThrownItemRenderer(EntityRendererProvider.Context context, float scale, boolean fullBright) {
|
|
super(context);
|
|
this.itemModelResolver = context.getItemModelResolver();
|
|
this.scale = scale;
|
|
this.fullBright = fullBright;
|
|
}
|
|
|
|
public ThrownItemRenderer(EntityRendererProvider.Context context) {
|
|
this(context, 1.0f, false);
|
|
}
|
|
|
|
@Override
|
|
protected int getBlockLightLevel(T entity, BlockPos blockPos) {
|
|
return this.fullBright ? 15 : super.getBlockLightLevel(entity, blockPos);
|
|
}
|
|
|
|
@Override
|
|
public void submit(ThrownItemRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
|
|
poseStack.pushPose();
|
|
poseStack.scale(this.scale, this.scale, this.scale);
|
|
poseStack.mulPose((Quaternionfc)camera.orientation);
|
|
state.item.submit(poseStack, submitNodeCollector, state.lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor);
|
|
poseStack.popPose();
|
|
super.submit(state, poseStack, submitNodeCollector, camera);
|
|
}
|
|
|
|
@Override
|
|
public ThrownItemRenderState createRenderState() {
|
|
return new ThrownItemRenderState();
|
|
}
|
|
|
|
@Override
|
|
public void extractRenderState(T entity, ThrownItemRenderState state, float partialTicks) {
|
|
super.extractRenderState(entity, state, partialTicks);
|
|
this.itemModelResolver.updateForNonLiving(state.item, ((ItemSupplier)entity).getItem(), ItemDisplayContext.GROUND, (Entity)entity);
|
|
}
|
|
}
|
|
|