2018-10-18 13:34:37 +02:00
|
|
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
|
|
|
|
2020-01-28 18:08:56 +01:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
2021-12-04 15:40:09 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
|
2020-01-29 18:18:41 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
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.model.ItemCameraTransforms;
|
2021-12-04 15:40:09 +01:00
|
|
|
import net.minecraft.client.renderer.tileentity.BlockEntityRenderer;
|
|
|
|
import net.minecraft.client.renderer.tileentity.BlockEntityRendererDispatcher;
|
2020-01-29 18:18:41 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2020-09-22 03:17:02 +02:00
|
|
|
import net.minecraft.util.math.vector.Vector3f;
|
2018-10-18 13:34:37 +02:00
|
|
|
|
2021-12-04 15:40:09 +01:00
|
|
|
public class RenderNatureAltar extends BlockEntityRenderer<BlockEntityNatureAltar> {
|
|
|
|
public RenderNatureAltar(BlockEntityRendererDispatcher rendererDispatcherIn) {
|
2020-01-28 18:08:56 +01:00
|
|
|
super(rendererDispatcherIn);
|
|
|
|
}
|
2020-01-21 21:04:44 +01:00
|
|
|
|
2018-10-18 13:34:37 +02:00
|
|
|
@Override
|
2021-12-04 15:40:09 +01:00
|
|
|
public void render(BlockEntityNatureAltar tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
2020-01-21 21:04:44 +01:00
|
|
|
ItemStack stack = tileEntityIn.items.getStackInSlot(0);
|
2018-10-18 13:34:37 +02:00
|
|
|
if (!stack.isEmpty()) {
|
2020-01-29 18:18:41 +01:00
|
|
|
matrixStackIn.push();
|
2020-01-21 21:04:44 +01:00
|
|
|
float time = tileEntityIn.bobTimer + partialTicks;
|
2018-10-18 13:34:37 +02:00
|
|
|
float bob = (float) Math.sin(time / 10F) * 0.1F;
|
2020-01-29 18:18:41 +01:00
|
|
|
matrixStackIn.translate(0.5F, 1.2F + bob, 0.5F);
|
|
|
|
matrixStackIn.rotate(Vector3f.YP.rotationDegrees(time * 3 % 360));
|
|
|
|
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn);
|
|
|
|
matrixStackIn.pop();
|
2018-10-18 13:34:37 +02:00
|
|
|
}
|
2020-01-29 18:18:41 +01:00
|
|
|
}
|
2018-10-18 13:34:37 +02:00
|
|
|
}
|