User Tools

Site Tools


zh_cn:tutorial:custom_model

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zh_cn:tutorial:custom_model [2022/03/21 04:15] solidblockzh_cn:tutorial:custom_model [2024/01/02 10:31] (current) – [UnbakedModel方法] solidblock
Line 21: 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;
 </code> </code>
  
Line 54: Line 58:
  
         for(Direction direction : Direction.values()) {         for(Direction direction : Direction.values()) {
-            int spriteIdx = direction == Direction.UP || direction == Direction.DOWN ? 0;+            int spriteIdx = direction == Direction.UP || direction == Direction.DOWN ? SPRITE_TOP SPRITE_SIDE;
             // 将新的面(face)添加到mesh             // 将新的面(face)添加到mesh
             emitter.square(direction, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f);             emitter.square(direction, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f);
Line 76: Line 80:
     @Override     @Override
     public List<BakedQuad> getQuads(BlockState state, Direction face, Random random) {     public List<BakedQuad> getQuads(BlockState state, Direction face, Random random) {
-        return null; // 不需要,因为我们使用的是FabricBakedModel+        return Collections.emptyList(); // 不需要,因为我们使用的是 FabricBakedModel
     }     }
  
zh_cn/tutorial/custom_model.1647836102.txt.gz · Last modified: 2022/03/21 04:15 by solidblock