新手开发,使用MC-pre4中示例模型生成的json模型试了下,但是不知为何出现了透明的情况,不知是贴图问题还是其他的,求解
Json代码如下
复制代码
Json代码如下
- {
- "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
- "textures": {
- "0": "blocks/log_oak",
- "1": "blocks/cauldron_inner",
- "2": "blocks/cauldron_side",
- "3": "blocks/stone"
- },
- "elements": [
- {
- "name": "log_1",
- "from": [ 0.0, 0.0, 6.499999992549419 ],
- "to": [ 16.0, 3.0, 9.49999999254942 ],
- "faces": {
- "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
- }
- },
- {
- "name": "log_2",
- "from": [ 0.0, 0.0, 6.499999992549419 ],
- "to": [ 16.0, 3.0, 9.49999999254942 ],
- "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -45.0 },
- "faces": {
- "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
- }
- },
- {
- "name": "log_3",
- "from": [ 0.0, 0.0, 6.499999992549419 ],
- "to": [ 16.0, 3.0, 9.49999999254942 ],
- "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
- "faces": {
- "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }
- }
- },
- {
- "name": "log_4",
- "from": [ 6.500000007450581, 0.0, 0.0 ],
- "to": [ 9.50000000745058, 3.0, 16.0 ],
- "faces": {
- "north": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "south": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
- "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 3.0 ] },
- "up": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 16.0 ] },
- "down": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 16.0 ] }
- }
- },
- {
- "name": "pot_base",
- "from": [ 2.0, 3.0, 2.0 ],
- "to": [ 14.0, 4.0, 14.0 ],
- "faces": {
- "north": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "east": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "south": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "west": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "up": { "texture": "#1", "uv": [ 2.0, 2.0, 14.0, 14.0 ] },
- "down": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 12.0 ] }
- }
- },
- {
- "name": "pot_side_east",
- "from": [ 13.0, 4.0, 2.0 ],
- "to": [ 14.0, 14.0, 14.0 ],
- "faces": {
- "north": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
- "east": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 10.0 ] },
- "south": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
- "west": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 10.0 ] },
- "up": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 1.0 ], "rotation": 90 },
- "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
- }
- },
- {
- "name": "pot_side_west",
- "from": [ 2.0, 4.0, 2.0 ],
- "to": [ 3.0, 14.0, 14.0 ],
- "faces": {
- "north": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
- "east": { "texture": "#2", "uv": [ 0.0, 0.0, 12.0, 10.0 ] },
- "south": { "texture": "#2", "uv": [ 1.0, 0.0, 2.0, 10.0 ] },
- "west": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 10.0 ] },
- "up": { "texture": "#2", "uv": [ 2.0, 0.0, 14.0, 1.0 ], "rotation": 90 },
- "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
- }
- },
- {
- "name": "pot_side_south",
- "from": [ 3.0, 4.0, 13.0 ],
- "to": [ 13.0, 14.0, 14.0 ],
- "faces": {
- "north": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
- "east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
- "south": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
- "west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
- "up": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
- "down": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] }
- }
- },
- {
- "name": "pot_side_north",
- "from": [ 3.0, 4.0, 2.0 ],
- "to": [ 13.0, 14.0, 3.0 ],
- "faces": {
- "north": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
- "east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
- "south": { "texture": "#2", "uv": [ 3.0, 0.0, 13.0, 10.0 ] },
- "west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 10.0 ] },
- "up": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] },
- "down": { "texture": "#2", "uv": [ 0.0, 0.0, 10.0, 1.0 ] }
- }
- },
- {
- "name": "handle_connection_one",
- "from": [ 7.0, 12.0, 14.0 ],
- "to": [ 16.0, 13.0, 15.0 ],
- "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
- "faces": {
- "north": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "east": { "texture": "#3", "uv": [ 0.0, 0.0, -2.0, -2.0 ] },
- "south": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "west": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
- "up": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "down": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] }
- }
- },
- {
- "name": "handle_connection_two",
- "from": [ 7.0, 12.0, 1.0 ],
- "to": [ 16.0, 13.0, 2.0 ],
- "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
- "faces": {
- "north": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "east": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
- "south": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "west": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
- "up": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] },
- "down": { "texture": "#3", "uv": [ 0.0, 0.0, 9.0, 1.0 ] }
- }
- },
- {
- "name": "handle",
- "from": [ 15.0, 12.0, 2.0 ],
- "to": [ 16.0, 13.0, 14.0 ],
- "rotation": { "origin": [ 8.0, 13.0, 8.0 ], "axis": "z", "angle": -22.5 },
- "faces": {
- "north": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
- "east": { "texture": "#3", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "south": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
- "west": { "texture": "#3", "uv": [ 0.0, 0.0, 12.0, 1.0 ] },
- "up": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 12.0 ] },
- "down": { "texture": "#3", "uv": [ 0.0, 0.0, 1.0, 12.0 ] }
- }
- }
- ]
- }
请设置方块为透明方块和非完全方块:
复制代码
如果我的答案有帮助的话,请给我最高的评分。
- public boolean isFullCube(IBlockState state)
- {
- return false;
- }
- public boolean isOpaqueCube(IBlockState state)
- {
- return false;
- }
如果我的答案有帮助的话,请给我最高的评分。
耗子 发表于 2018-9-26 17:53
请设置方块为透明方块和非完全方块:
非完全方块是不是代表其体积<(1*1*1)的意思
w4852581 发表于 2018-9-26 18:59
非完全方块是不是代表其体积
可以认为它不是普通的六面立方体方块,但你这里似乎是完全的一个立方体碰撞箱。
耗子 发表于 2018-9-26 19:11
可以认为它不是普通的六面立方体方块,但你这里似乎是完全的一个立方体碰撞箱。 ...
我之前有查询到物体触发碰撞必须体积<(1*1*1)这个是怎么解释和实现
w4852581 发表于 2018-9-26 19:21
我之前有查询到物体触发碰撞必须体积
- public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
- }
覆写上述方法可改变方块的碰撞箱
总感觉和模型贴图的cullface有关?我瞎说的,我也不知道……
好像有一个方法是决定渲染类型的。返回的type是个整数。