2019-01-22 16:10:27 +01:00
|
|
|
package de.ellpeck.naturesaura.entities.render;
|
|
|
|
|
2020-01-28 18:08:56 +01:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
2020-01-29 18:18:41 +01:00
|
|
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
2019-01-25 21:35:07 +01:00
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
2019-01-22 16:10:27 +01:00
|
|
|
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
|
2020-01-29 18:18:41 +01:00
|
|
|
import net.minecraft.block.BlockState;
|
2020-01-28 18:08:56 +01:00
|
|
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
2020-01-29 18:18:41 +01:00
|
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
import net.minecraft.client.renderer.Vector3f;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
|
|
|
import net.minecraft.client.renderer.entity.MinecartRenderer;
|
2020-01-29 18:18:41 +01:00
|
|
|
import net.minecraft.client.renderer.model.Model;
|
|
|
|
import net.minecraft.client.renderer.model.ModelRenderer;
|
|
|
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
2019-01-25 21:35:07 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2019-01-22 16:10:27 +01:00
|
|
|
|
2019-10-20 22:30:49 +02:00
|
|
|
public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
2019-01-25 21:35:07 +01:00
|
|
|
|
|
|
|
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/mover_cart.png");
|
2020-01-29 18:18:41 +01:00
|
|
|
private final ModelMoverMinecart model = new ModelMoverMinecart();
|
2019-01-25 21:35:07 +01:00
|
|
|
|
2019-10-20 22:30:49 +02:00
|
|
|
public RenderMoverMinecart(EntityRendererManager renderManagerIn) {
|
2019-01-22 16:10:27 +01:00
|
|
|
super(renderManagerIn);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-01-28 18:08:56 +01:00
|
|
|
public void render(EntityMoverMinecart entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
|
|
|
|
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
|
|
|
|
}
|
|
|
|
|
2020-01-29 18:18:41 +01:00
|
|
|
@Override
|
|
|
|
protected void renderBlockState(EntityMoverMinecart entityIn, float partialTicks, BlockState stateIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
|
|
|
|
matrixStackIn.push();
|
|
|
|
matrixStackIn.translate(0, 22 / 16F, 0);
|
|
|
|
matrixStackIn.translate(0, 0, 1);
|
|
|
|
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(180));
|
|
|
|
this.model.render(matrixStackIn, bufferIn.getBuffer(this.model.getRenderType(RES)), packedLightIn, OverlayTexture.DEFAULT_LIGHT, 1, 1, 1, 1);
|
|
|
|
matrixStackIn.pop();
|
2019-01-25 21:35:07 +01:00
|
|
|
}
|
|
|
|
|
2020-01-23 19:20:47 +01:00
|
|
|
private static class ModelMoverMinecart extends Model {
|
2019-01-25 21:35:07 +01:00
|
|
|
|
2020-01-29 18:18:41 +01:00
|
|
|
private final ModelRenderer box;
|
2019-01-25 21:35:07 +01:00
|
|
|
|
|
|
|
public ModelMoverMinecart() {
|
2020-01-29 18:18:41 +01:00
|
|
|
super(RenderType::entityCutout);
|
|
|
|
this.box = new ModelRenderer(this, 0, 0);
|
2019-01-25 21:35:07 +01:00
|
|
|
this.box.setTextureSize(64, 64);
|
|
|
|
this.box.addBox(0, 0, 0, 16, 24, 16);
|
|
|
|
}
|
2019-01-22 16:10:27 +01:00
|
|
|
|
2020-01-29 18:18:41 +01:00
|
|
|
@Override
|
|
|
|
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
|
|
|
|
this.box.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
|
2019-01-25 21:35:07 +01:00
|
|
|
}
|
2020-01-29 18:18:41 +01:00
|
|
|
}
|
2019-01-22 16:10:27 +01:00
|
|
|
}
|