本教程将会展示几个在世界上渲染方块的例子
RenderJSEvents.AddWorldRender(event => {
event.addWorldRender(context => {
//...
})
})
来增加世界渲染。
#1
RenderJSEvents.AddWorldRender(event => {
event.addWorldRender(context => {
//绘制方块(BlockPos blockPos, BlockState blockState, int BlockLight, int SkyLight,@Nullable RenderType renderType)
RenderJSWorldRender.renderBlock1(new BlockPos(0,0,0),Blocks.GRASS.defaultBlockState(),15,15,null)
})
})
#2
RenderJSEvents.AddWorldRender(event => {
event.addWorldRender(context => {
//绘制方块(BlockPos blockPos, BlockState blockState, int BlockLight, int SkyLight,@Nullable RenderType renderType)
RenderJSWorldRender.renderBlock1(new BlockPos(0,0,0),Blocks.GRASS.defaultBlockState(),15,15,RenderJSWorldRender.getTopLayerType())//RenderType使用这个可以使渲染出来的方块穿透地形
})
})
#3
RenderJSEvents.AddWorldRender(event => {
event.addWorldRender(context => {
//绘制方块边框线(BlockPos blockPos, BlockState blockState,@Nullable RenderType renderType)
RenderJSWorldRender.renderBlockOutLine1(new BlockPos(0,1,0),Blocks.LECTERN.defaultBlockState(),RenderJSWorldRender.getTopLayerLineType())//RenderType使用这个可以使渲染出来的方块穿透地形
})
})