w4852581
新手开发,使用MC-pre4中示例模型生成的json模型试了下,但是不知为何出现了透明的情况,不知是贴图问题还是其他的,求解



Json代码如下
  1. {
  2.     "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
  3.     "textures": {
  4.         "0": "blocks/log_oak",
  5.         "1": "blocks/cauldron_inner",
  6.         "2": "blocks/cauldron_side",
  7.         "3": "blocks/stone"
  8.     },
  9.     "elements": [
  10.         {
  11.             "name": "log_1",
  12.             "from": [ 0.0, 0.0, 6.499999992549419 ],
  13.             "to": [ 16.0, 3.0, 9.49999999254942 ],
  14.             "faces": {
  15.                 "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  16.                 "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  17.                 "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  18.                 "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  19.                 "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  20.                 "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
  21.             }
  22.         },
  23.         {
  24.             "name": "log_2",
  25.             "from": [ 0.0, 0.0, 6.499999992549419 ],
  26.             "to": [ 16.0, 3.0, 9.49999999254942 ],
  27.             "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -45.0 },
  28.             "faces": {
  29.                 "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  30.                 "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  31.                 "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  32.                 "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  33.                 "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  34.                 "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
  35.             }
  36.         },
  37.         {
  38.             "name": "log_3",
  39.             "from": [ 0.0, 0.0, 6.499999992549419 ],
  40.             "to": [ 16.0, 3.0, 9.49999999254942 ],
  41.             "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
  42.             "faces": {
  43.                 "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  44.                 "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  45.                 "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  46.                 "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  47.                 "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  48.                 "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
  49.             }
  50.         },
  51.         {
  52.             "name": "log_4",
  53.             "from": [ 6.500000007450581, 0.0, 0.0 ],
  54.             "to": [ 9.50000000745058, 3.0, 16.0 ],
  55.             "faces": {
  56.                 "north": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  57.                 "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  58.                 "south": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
  59.                 "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
  60.                 "up": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 16.0 ] },
  61.                 "down": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 16.0 ] }
  62.             }
  63.         },
  64.         {
  65.             "name": "pot_base",
  66.             "from": [ 2.0, 3.0, 2.0 ],
  67.             "to": [ 14.0, 4.0, 14.0 ],
  68.             "faces": {
  69.                 "north": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  70.                 "east": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  71.                 "south": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  72.                 "west": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  73.                 "up": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
  74.                 "down": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 12.0 ] }
  75.             }
  76.         },
  77.         {
  78.             "name": "pot_side_east",
  79.             "from": [ 13.0, 4.0, 2.0 ],
  80.             "to": [ 14.0, 14.0, 14.0 ],
  81.             "faces": {
  82.                 "north": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
  83.                 "east": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 10.0 ] },
  84.                 "south": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
  85.                 "west": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 10.0 ] },
  86.                 "up": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 1.0 ], "rotation": 90 },
  87.                 "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
  88.             }
  89.         },
  90.         {
  91.             "name": "pot_side_west",
  92.             "from": [ 2.0, 4.0, 2.0 ],
  93.             "to": [ 3.0, 14.0, 14.0 ],
  94.             "faces": {
  95.                 "north": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
  96.                 "east": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 10.0 ] },
  97.                 "south": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
  98.                 "west": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 10.0 ] },
  99.                 "up": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 1.0 ], "rotation": 90 },
  100.                 "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
  101.             }
  102.         },
  103.         {
  104.             "name": "pot_side_south",
  105.             "from": [ 3.0, 4.0, 13.0 ],
  106.             "to": [ 13.0, 14.0, 14.0 ],
  107.             "faces": {
  108.                 "north": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
  109.                 "east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
  110.                 "south": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
  111.                 "west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
  112.                 "up": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
  113.                 "down": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] }
  114.             }
  115.         },
  116.         {
  117.             "name": "pot_side_north",
  118.             "from": [ 3.0, 4.0, 2.0 ],
  119.             "to": [ 13.0, 14.0, 3.0 ],
  120.             "faces": {
  121.                 "north": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
  122.                 "east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
  123.                 "south": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
  124.                 "west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
  125.                 "up": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
  126.                 "down": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] }
  127.             }
  128.         },
  129.         {
  130.             "name": "handle_connection_one",
  131.             "from": [ 7.0, 12.0, 14.0 ],
  132.             "to": [ 16.0, 13.0, 15.0 ],
  133.             "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
  134.             "faces": {
  135.                 "north": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  136.                 "east": { "texture": "#3", "uv": [ 0.0, 0.0, -2.0, -2.0 ] },
  137.                 "south": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  138.                 "west": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
  139.                 "up": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  140.                 "down": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] }
  141.             }
  142.         },
  143.         {
  144.             "name": "handle_connection_two",
  145.             "from": [ 7.0, 12.0, 1.0 ],
  146.             "to": [ 16.0, 13.0, 2.0 ],
  147.             "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
  148.             "faces": {
  149.                 "north": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  150.                 "east": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
  151.                 "south": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  152.                 "west": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
  153.                 "up": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
  154.                 "down": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] }
  155.             }
  156.         },
  157.         {
  158.             "name": "handle",
  159.             "from": [ 15.0, 12.0, 2.0 ],
  160.             "to": [ 16.0, 13.0, 14.0 ],
  161.             "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
  162.             "faces": {
  163.                 "north": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
  164.                 "east": { "texture": "#3", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  165.                 "south": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
  166.                 "west": { "texture": "#3", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
  167.                 "up": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 12.0 ] },
  168.                 "down": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
  169.             }
  170.         }
  171.     ]
  172. }
复制代码



耗子
请设置方块为透明方块和非完全方块:

  1.    public boolean isFullCube(IBlockState state)
  2.     {
  3.         return false;
  4.     }

  5.     public boolean isOpaqueCube(IBlockState state)
  6.     {
  7.         return false;
  8.     }
复制代码


如果我的答案有帮助的话,请给我最高的评分。

w4852581
耗子 发表于 2018-9-26 17:53
请设置方块为透明方块和非完全方块:

非完全方块是不是代表其体积<(1*1*1)的意思

耗子
w4852581 发表于 2018-9-26 18:59
非完全方块是不是代表其体积

可以认为它不是普通的六面立方体方块,但你这里似乎是完全的一个立方体碰撞箱。

w4852581
耗子 发表于 2018-9-26 19:11
可以认为它不是普通的六面立方体方块,但你这里似乎是完全的一个立方体碰撞箱。 ...

我之前有查询到物体触发碰撞必须体积<(1*1*1)这个是怎么解释和实现

耗子
w4852581 发表于 2018-9-26 19:21
我之前有查询到物体触发碰撞必须体积
  1. public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
  2.     }
复制代码


覆写上述方法可改变方块的碰撞箱

ruhuasiyu
总感觉和模型贴图的cullface有关?我瞎说的,我也不知道……

Himmelt
好像有一个方法是决定渲染类型的。返回的type是个整数。