public EntityMapComponent(ICoreClientAPI capi, LoadedTexture texture, Entity entity) : base(capi) { quadModel = capi.Render.UploadMesh(QuadMeshUtil.GetQuad()); this.Texture = texture; this.entity = entity; }
public BlockEntitySignRenderer(BlockPos pos, ICoreClientAPI api) { this.api = api; this.pos = pos; font = new CairoFont(fontSize, GuiStyle.StandardFontName, new double[] { 0, 0, 0, 0.8 }); font.LineHeightMultiplier = 0.9f; api.Event.RegisterRenderer(this, EnumRenderStage.Opaque, "sign"); MeshData modeldata = QuadMeshUtil.GetQuad(); modeldata.Uv = new float[] { 1, 1, 0, 1, 0, 0, 1, 0 }; modeldata.Rgba = new byte[4 * 4]; modeldata.Rgba.Fill((byte)255); quadModelRef = api.Render.UploadMesh(modeldata); Block block = api.World.BlockAccessor.GetBlock(pos); BlockFacing facing = BlockFacing.FromCode(block.LastCodePart()); if (facing == null) { return; } float wallOffset = block.Variant["attachment"] == "wall" ? 0.22f : 0; switch (facing.Index) { case 0: // N translateX = 0.5f; translateZ = 1 - 0.71f - wallOffset; rotY = 180; break; case 1: // E translateX = 0.71f + wallOffset; translateZ = 0.5f; rotY = 90; break; case 2: // S translateX = 0.5f; translateZ = 0.71f + wallOffset; break; case 3: // W translateX = 1 - 0.71f - wallOffset; translateZ = 0.5f; rotY = 270; break; } }