2019-01-22 16:10:27 +01:00
|
|
|
package de.ellpeck.naturesaura.entities.render;
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
import com.mojang.blaze3d.platform.GlStateManager;
|
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;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.block.BlockState;
|
|
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
|
|
|
import net.minecraft.client.renderer.entity.MinecartRenderer;
|
2020-01-23 19:20:47 +01:00
|
|
|
import net.minecraft.client.renderer.entity.model.RendererModel;
|
|
|
|
import net.minecraft.client.renderer.model.Model;
|
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");
|
|
|
|
private final ModelMoverMinecart model = new ModelMoverMinecart();
|
|
|
|
|
2019-10-20 22:30:49 +02:00
|
|
|
public RenderMoverMinecart(EntityRendererManager renderManagerIn) {
|
2019-01-22 16:10:27 +01:00
|
|
|
super(renderManagerIn);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-10-20 22:30:49 +02:00
|
|
|
protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) {
|
2019-01-25 21:35:07 +01:00
|
|
|
GlStateManager.pushMatrix();
|
2020-01-23 19:20:47 +01:00
|
|
|
GlStateManager.translatef(0, 22 / 16F, 0);
|
|
|
|
GlStateManager.rotatef(180, 1, 0, 0);
|
2019-01-25 21:35:07 +01:00
|
|
|
this.bindTexture(RES);
|
|
|
|
this.model.render();
|
|
|
|
GlStateManager.popMatrix();
|
|
|
|
}
|
|
|
|
|
2020-01-23 19:20:47 +01:00
|
|
|
private static class ModelMoverMinecart extends Model {
|
2019-01-25 21:35:07 +01:00
|
|
|
|
2020-01-23 19:20:47 +01:00
|
|
|
private final RendererModel box;
|
2019-01-25 21:35:07 +01:00
|
|
|
|
|
|
|
public ModelMoverMinecart() {
|
2020-01-23 19:20:47 +01:00
|
|
|
this.box = new RendererModel(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
|
|
|
|
2019-01-25 21:35:07 +01:00
|
|
|
public void render() {
|
|
|
|
this.box.render(1 / 16F);
|
|
|
|
}
|
2019-01-22 16:10:27 +01:00
|
|
|
}
|
|
|
|
}
|