zh_cn:tutorial:custom_model
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zh_cn:tutorial:custom_model [2022/03/21 04:12] – [注册模型] solidblock | zh_cn:tutorial:custom_model [2024/01/02 10:31] (current) – [UnbakedModel方法] solidblock | ||
---|---|---|---|
Line 8: | Line 8: | ||
<code java> | <code java> | ||
+ | @Environment(EnvType.CLIENT) | ||
public class FourSidedFurnaceModel implements UnbakedModel, | public class FourSidedFurnaceModel implements UnbakedModel, | ||
</ | </ | ||
Line 20: | Line 21: | ||
}; | }; | ||
private Sprite[] SPRITES = new Sprite[2]; | private Sprite[] SPRITES = new Sprite[2]; | ||
+ | |||
+ | // Some constants to avoid magic numbers, these need to match the SPRITE_IDS | ||
+ | private static final int SPRITE_SIDE = 0; | ||
+ | private static final int SPRITE_TOP = 1; | ||
</ | </ | ||
Line 53: | Line 58: | ||
for(Direction direction : Direction.values()) { | for(Direction direction : Direction.values()) { | ||
- | int spriteIdx = direction == Direction.UP || direction == Direction.DOWN ? 1 : 0; | + | int spriteIdx = direction == Direction.UP || direction == Direction.DOWN ? SPRITE_TOP |
// 将新的面(face)添加到mesh | // 将新的面(face)添加到mesh | ||
emitter.square(direction, | emitter.square(direction, | ||
Line 75: | Line 80: | ||
@Override | @Override | ||
public List< | public List< | ||
- | return | + | return |
} | } | ||
Line 250: | Line 255: | ||
更新我们先前创建的 '' | 更新我们先前创建的 '' | ||
<code java> | <code java> | ||
+ | @Environment(EnvType.CLIENT) | ||
public class TutorialModelProvider implements ModelResourceProvider { | public class TutorialModelProvider implements ModelResourceProvider { | ||
public static final FourSidedFurnaceModel FOUR_SIDED_FURNACE_MODEL = new FourSidedFurnaceModel(); | public static final FourSidedFurnaceModel FOUR_SIDED_FURNACE_MODEL = new FourSidedFurnaceModel(); |
zh_cn/tutorial/custom_model.1647835953.txt.gz · Last modified: 2022/03/21 04:12 by solidblock