2019-03-31 23:53:53 +02:00
|
|
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
|
|
|
|
2021-12-15 14:26:42 +01:00
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
|
|
import com.mojang.math.Vector3f;
|
2019-03-31 23:53:53 +02:00
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
2021-12-04 15:40:09 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityProjectileGenerator;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.client.renderer.MultiBufferSource;
|
|
|
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
2021-12-15 16:24:53 +01:00
|
|
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.core.Direction;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2019-03-31 23:53:53 +02:00
|
|
|
|
2019-10-20 22:30:49 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2021-12-15 14:26:42 +01:00
|
|
|
public class RenderProjectileGenerator implements BlockEntityRenderer<BlockEntityProjectileGenerator> {
|
2020-01-28 18:08:56 +01:00
|
|
|
|
2021-12-15 14:26:42 +01:00
|
|
|
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
|
|
|
|
//private final ModelOverlay model = new ModelOverlay();
|
2019-03-31 23:53:53 +02:00
|
|
|
|
2021-12-15 16:24:53 +01:00
|
|
|
public RenderProjectileGenerator(BlockEntityRendererProvider.Context context) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-03-31 23:53:53 +02:00
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
public void render(BlockEntityProjectileGenerator te, float partialTicks, PoseStack stack, MultiBufferSource buffer, int combinedLightIn, int combinedOverlayIn) {
|
|
|
|
stack.pushPose();
|
2019-10-20 22:30:49 +02:00
|
|
|
if (te.nextSide == Direction.NORTH) {
|
2021-12-15 14:26:42 +01:00
|
|
|
stack.mulPose(Vector3f.YP.rotationDegrees(270));
|
2020-01-31 13:42:21 +01:00
|
|
|
stack.translate(-0.002F, 0, -1);
|
2019-10-20 22:30:49 +02:00
|
|
|
} else if (te.nextSide == Direction.EAST) {
|
2021-12-15 14:26:42 +01:00
|
|
|
stack.mulPose(Vector3f.YP.rotationDegrees(180));
|
2020-01-31 13:42:21 +01:00
|
|
|
stack.translate(-1.002F, 0, -1);
|
2019-10-20 22:30:49 +02:00
|
|
|
} else if (te.nextSide == Direction.SOUTH) {
|
2021-12-15 14:26:42 +01:00
|
|
|
stack.mulPose(Vector3f.YP.rotationDegrees(90));
|
2020-01-31 13:42:21 +01:00
|
|
|
stack.translate(-1.002F, 0, 0);
|
2019-03-31 23:53:53 +02:00
|
|
|
} else {
|
2020-01-31 13:42:21 +01:00
|
|
|
stack.translate(-0.002F, 0, 0);
|
2019-03-31 23:53:53 +02:00
|
|
|
}
|
2020-01-25 16:56:04 +01:00
|
|
|
int brightness = 15 << 20 | 15 << 4;
|
2021-12-15 14:26:42 +01:00
|
|
|
//this.model.render(stack, buffer.getBuffer(this.model.getRenderType(RES)), brightness, combinedOverlayIn, 1, 1, 1, 1);
|
|
|
|
stack.popPose();
|
2019-03-31 23:53:53 +02:00
|
|
|
}
|
|
|
|
|
2021-12-15 14:26:42 +01:00
|
|
|
// TODO model rendering
|
|
|
|
/* private static class ModelOverlay extends Model {
|
2019-03-31 23:53:53 +02:00
|
|
|
|
2021-12-15 14:26:42 +01:00
|
|
|
private final ModelPart box;
|
2019-03-31 23:53:53 +02:00
|
|
|
|
|
|
|
public ModelOverlay() {
|
2021-12-15 14:26:42 +01:00
|
|
|
super(RenderType::entityTranslucent);
|
|
|
|
this.box = new ModelPart(this, 0, 0);
|
2019-03-31 23:53:53 +02:00
|
|
|
this.box.setTextureSize(64, 64);
|
2021-12-15 14:26:42 +01:00
|
|
|
this.box.(0, 0, 0, 16, 16, 16);
|
2019-03-31 23:53:53 +02: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-03-31 23:53:53 +02:00
|
|
|
}
|
2021-12-15 14:26:42 +01:00
|
|
|
}*/
|
2019-03-31 23:53:53 +02:00
|
|
|
}
|