zh_cn:tutorial:screenhandler
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zh_cn:tutorial:screenhandler [2022/12/09 04:51] – solidblock | zh_cn:tutorial:screenhandler [2023/09/14 01:42] (current) – [ScreenHandler 和 Screen] wjz_p | ||
---|---|---|---|
Line 140: | Line 140: | ||
static { | static { | ||
- | BOX_BLOCK = Registry.register(Registry.BLOCK, BOX, new BoxBlock(FabricBlockSettings.copyOf(Blocks.CHEST))); | + | BOX_BLOCK = Registry.register(Registries.BLOCK, BOX, new BoxBlock(FabricBlockSettings.copyOf(Blocks.CHEST))); |
- | BOX_BLOCK_ITEM = Registry.register(Registry.ITEM, BOX, new BlockItem(BOX_BLOCK, | + | BOX_BLOCK_ITEM = Registry.register(Registries.ITEM, BOX, new BlockItem(BOX_BLOCK, |
//The parameter of build at the very end is always null, do not worry about it | //The parameter of build at the very end is always null, do not worry about it | ||
// 1.17 之前 | // 1.17 之前 | ||
- | BOX_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, | + | BOX_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, |
// 在 1.17 使用 FabricBlockEntityTypeBuilder 而不是 BlockEntityType.Builder | // 在 1.17 使用 FabricBlockEntityTypeBuilder 而不是 BlockEntityType.Builder | ||
- | BOX_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, | + | BOX_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, |
} | } | ||
Line 184: | Line 184: | ||
// 这会将槽位放置在 3×3 网格的正确位置中。这些槽位在客户端和服务器中都存在! | // 这会将槽位放置在 3×3 网格的正确位置中。这些槽位在客户端和服务器中都存在! | ||
- | // 但是这不会渲染槽位的背景,这是 Screens | + | // 但是这不会渲染槽位的背景,这是 Screens |
int m; | int m; | ||
int l; | int l; | ||
Line 251: | Line 251: | ||
@Override | @Override | ||
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { | protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { | ||
- | RenderSystem.setShader(GameRenderer:: | + | RenderSystem.setShader(GameRenderer:: |
RenderSystem.setShaderColor(1.0F, | RenderSystem.setShaderColor(1.0F, | ||
RenderSystem.setShaderTexture(0, | RenderSystem.setShaderTexture(0, | ||
Line 257: | Line 257: | ||
int y = (height - backgroundHeight) / 2; | int y = (height - backgroundHeight) / 2; | ||
drawTexture(matrices, | drawTexture(matrices, | ||
+ | // | ||
} | } | ||
zh_cn/tutorial/screenhandler.1670561465.txt.gz · Last modified: 2022/12/09 04:51 by solidblock