2016-07-22 20:23:51 +02:00
|
|
|
/*
|
|
|
|
* This file ("RenderWorm.java") is part of the Actually Additions mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-07-22 20:23:51 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.entity;
|
|
|
|
|
2021-11-13 20:09:55 +01:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
2021-03-01 21:23:52 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
2016-08-07 13:09:44 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2021-11-13 20:09:55 +01:00
|
|
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
|
|
import net.minecraft.client.renderer.entity.EntityRenderer;
|
|
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
|
|
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
|
|
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
|
|
import net.minecraft.inventory.container.PlayerContainer;
|
2016-07-22 20:23:51 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2021-11-13 20:09:55 +01:00
|
|
|
import net.minecraft.util.Util;
|
|
|
|
import net.minecraft.util.math.vector.Quaternion;
|
2021-02-27 22:44:00 +01:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
2021-11-13 18:02:42 +01:00
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2021-03-01 18:11:34 +01:00
|
|
|
|
2016-07-22 20:23:51 +02:00
|
|
|
|
2021-02-26 22:15:48 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2021-11-13 20:09:55 +01:00
|
|
|
public class RenderWorm extends EntityRenderer<EntityWorm> {
|
2016-07-22 20:23:51 +02:00
|
|
|
|
2017-07-07 22:09:56 +02:00
|
|
|
private static ItemStack stack = ItemStack.EMPTY;
|
|
|
|
|
2021-11-13 20:09:55 +01:00
|
|
|
public RenderWorm(EntityRendererManager p_i46179_1_) {
|
|
|
|
super(p_i46179_1_);
|
2017-07-07 22:09:56 +02:00
|
|
|
}
|
2016-07-22 20:23:51 +02:00
|
|
|
|
2021-11-13 20:09:55 +01:00
|
|
|
public static void fixItemStack() {
|
|
|
|
stack = new ItemStack(ActuallyItems.WORM.get());
|
2016-07-22 20:23:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-11-13 20:09:55 +01:00
|
|
|
public void render(EntityWorm entity, float partialTicks, float p_225623_3_, MatrixStack matrix, IRenderTypeBuffer buffer, int light) {
|
|
|
|
matrix.pushPose();
|
|
|
|
|
|
|
|
matrix.translate(0, 0.7F, 0);
|
|
|
|
double boop = Util.getMillis() / 70D;
|
|
|
|
matrix.mulPose(new Quaternion(-(float) (boop % 360), 0, 1, 0));
|
|
|
|
|
|
|
|
// stack.getDisplayName()
|
|
|
|
Minecraft.getInstance().getItemRenderer().renderStatic(
|
|
|
|
stack, ItemCameraTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer
|
|
|
|
);
|
|
|
|
|
|
|
|
matrix.popPose();
|
2016-07-22 20:23:51 +02:00
|
|
|
}
|
|
|
|
|
2021-11-13 20:09:55 +01:00
|
|
|
// @Override
|
|
|
|
// public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
|
|
|
// GlStateManager.pushMatrix();
|
|
|
|
// this.bindEntityTexture(entity);
|
|
|
|
// GlStateManager.translate(x, y + 0.7F, z);
|
|
|
|
// double boop = Minecraft.getSystemTime() / 70D;
|
|
|
|
// GlStateManager.rotate(-(float) (boop % 360), 0, 1, 0);
|
|
|
|
// GlStateManager.translate(0, 0, 0.4);
|
|
|
|
//
|
|
|
|
// stack.setStackDisplayName(entity.getName());
|
|
|
|
// AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
|
|
|
|
//
|
|
|
|
// GlStateManager.popMatrix();
|
|
|
|
// }
|
|
|
|
|
2016-07-22 20:23:51 +02:00
|
|
|
@Override
|
2021-11-13 20:09:55 +01:00
|
|
|
public ResourceLocation getTextureLocation(EntityWorm pEntity) {
|
|
|
|
return PlayerContainer.BLOCK_ATLAS;
|
2016-07-22 20:23:51 +02:00
|
|
|
}
|
|
|
|
}
|