42 lines
1.6 KiB
Java
42 lines
1.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.renderer.entity.layers;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import net.minecraft.client.model.DolphinModel;
|
|
import net.minecraft.client.renderer.SubmitNodeCollector;
|
|
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
|
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
|
import net.minecraft.client.renderer.entity.state.DolphinRenderState;
|
|
import net.minecraft.client.renderer.item.ItemStackRenderState;
|
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
import net.minecraft.util.Mth;
|
|
|
|
public class DolphinCarryingItemLayer
|
|
extends RenderLayer<DolphinRenderState, DolphinModel> {
|
|
public DolphinCarryingItemLayer(RenderLayerParent<DolphinRenderState, DolphinModel> renderer) {
|
|
super(renderer);
|
|
}
|
|
|
|
@Override
|
|
public void submit(PoseStack poseStack, SubmitNodeCollector submitNodeCollector, int lightCoords, DolphinRenderState state, float yRot, float xRot) {
|
|
ItemStackRenderState item = state.heldItem;
|
|
if (item.isEmpty()) {
|
|
return;
|
|
}
|
|
poseStack.pushPose();
|
|
float y = 1.0f;
|
|
float z = -1.0f;
|
|
float angleXPercent = Mth.abs(state.xRot) / 60.0f;
|
|
if (state.xRot < 0.0f) {
|
|
poseStack.translate(0.0f, 1.0f - angleXPercent * 0.5f, -1.0f + angleXPercent * 0.5f);
|
|
} else {
|
|
poseStack.translate(0.0f, 1.0f + angleXPercent * 0.8f, -1.0f + angleXPercent * 0.2f);
|
|
}
|
|
item.submit(poseStack, submitNodeCollector, lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor);
|
|
poseStack.popPose();
|
|
}
|
|
}
|
|
|