Begin adding working screen to TVs

This commit is contained in:
Andrew-71 2023-08-07 23:03:27 +03:00
parent 8033255f7d
commit 497ae9149b
5 changed files with 86 additions and 12 deletions

View file

@ -4,7 +4,9 @@ import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.minecraft.client.render.RenderLayer;
import su.a71.new_soviet.entity.TVBlockEntity;
import su.a71.new_soviet.registration.NSE_Blocks;
import su.a71.new_soviet.registration.NSE_Custom;
@ -17,5 +19,7 @@ public class NewSovietClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.LAMP, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.CEILING_FAN, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.SIREN, RenderLayer.getCutout());
BlockEntityRendererRegistry.register(NSE_Custom.TV_BLOCK_ENTITY, TVBlockEntityRenderer::new);
}
}

View file

@ -0,0 +1,22 @@
package su.a71.new_soviet;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import su.a71.new_soviet.entity.TVBlockEntity;
@Environment(EnvType.CLIENT)
public class TVBlockEntityRenderer implements BlockEntityRenderer<TVBlockEntity> {
public TVBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {}
@Override
public void render(TVBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.push();
// Rendering stuff here
matrices.pop();
}
}