Skip to content

Commit 79e1b9a

Browse files
committed
Better block parsing
1 parent 0d641b2 commit 79e1b9a

File tree

7 files changed

+54
-28
lines changed

7 files changed

+54
-28
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Block=require("prismarine-block")("1.16.3")

coffee/client/module/World/ChunkWorker.coffee

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {CellTerrain} from './CellTerrain.js'
2-
2+
import {Block} from './../Block/Block.js'
33
console.log "CHUNK WORKER STARTED!"
4-
4+
console.log Block
55
class TerrainManager
66
constructor: (options)->
77
@toxelSize=options.toxelSize
@@ -27,15 +27,20 @@ class TerrainManager
2727
[x2,y2]
2828
]
2929
genBlockFace: (type,voxel,pos)->
30-
# toxX=@blocksMapping["debug"]["x"]
31-
# toxY=28-@blocksMapping["debug"]["y"]
32-
if @blocks[voxel] is undefined
30+
xd=new Block.fromStateId voxel
31+
try
32+
toxX=@blocksMapping[xd.name]["x"]
33+
toxY=@blocksMapping[xd.name]["y"]
34+
catch
3335
toxX=@blocksMapping["debug"]["x"]
3436
toxY=28-@blocksMapping["debug"]["y"]
35-
else
36-
blockName=@blocks[voxel]["faces"][type]
37-
toxX=@blocksMapping[blockName]["x"]
38-
toxY=@blocksMapping[blockName]["y"]
37+
# if @blocks[voxel] is undefined
38+
# toxX=@blocksMapping["debug"]["x"]
39+
# toxY=28-@blocksMapping["debug"]["y"]
40+
# else
41+
# blockName=@blocks[voxel]["faces"][type]
42+
# toxX=@blocksMapping[blockName]["x"]
43+
# toxY=@blocksMapping[blockName]["y"]
3944

4045
uv=@getToxel toxX,toxY
4146
switch type

coffee/client/module/index.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {AssetLoader} from './AssetLoader.js'
1010
import {InventoryBar} from './InventoryBar.js'
1111
import {RandomNick} from './RandomNick.js'
1212
import {GUI} from './jsm/libs/dat.gui.module.js'
13-
1413
init = ()->
1514
canvas=document.querySelector '#c'
1615
renderer=new THREE.WebGLRenderer {

src/client/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
<!-- JS -->
22-
<script type="text/javascript" src="/cdn/js/Block.js"></script>
2322
<script type="text/javascript" src="/cdn/js/tween.umd.js"></script>
2423
<script type="text/javascript" src="/cdn/js/jq.js"></script>
2524
<script type="text/javascript" src="/cdn/js/popper.min.js"></script>
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
function Block(){}
12
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
23
module.exports =
34
{
@@ -660527,7 +660528,7 @@ module.exports={
660527660528
module.exports={
660528660529
"$id": "https://example.com/person.schema.json",
660529660530
"$schema": "http://json-schema.org/draft-07/schema#",
660530-
660531+
660531660532
"definitions": {
660532660533

660533660534
"RootNode" : {
@@ -660600,14 +660601,14 @@ module.exports={
660600660601
{"$ref": "#/definitions/ArgumentNode"}
660601660602
]
660602660603
}
660603-
},
660604+
},
660604660605

660605660606
"parser" : {
660606660607
"type" : "object",
660607-
"properties" : {
660608+
"properties" : {
660608660609
"parser" : {
660609660610
"type" : "string"
660610-
},
660611+
},
660611660612
"modifier" : {
660612660613
"type" : ["object","null"]
660613660614
}
@@ -660645,12 +660646,12 @@ module.exports={
660645660646
"type" : "object",
660646660647
"properties": {
660647660648
"graph" : {
660648-
"$ref": "#/definitions/RootNode"
660649+
"$ref": "#/definitions/RootNode"
660649660650
},
660650660651
"parsers" : {
660651660652
"type" : "array",
660652660653
"items" : {
660653-
"$ref": "#/definitions/ParserInfo"
660654+
"$ref": "#/definitions/ParserInfo"
660654660655
}
660655660656
}
660656660657
},
@@ -660849,13 +660850,13 @@ module.exports={
660849660850
"additionalProperties":false
660850660851
}
660851660852
}
660852-
660853+
660853660854
},
660854660855
"required": ["id", "displayName", "stackSize", "name", "foodPoints", "saturation", "effectiveQuality", "saturationRatio"],
660855660856
"additionalProperties":false
660856660857
}
660857660858
}
660858-
660859+
660859660860
},{}],297:[function(require,module,exports){
660860660861
module.exports={
660861660862
"title": "instruments",
@@ -661428,6 +661429,9 @@ function provider ({ Biome, blocks, blocksByStateId, toolMultipliers, shapes, ma
661428661429
}
661429661430

661430661431
},{"minecraft-data":2,"prismarine-biome":305}],307:[function(require,module,exports){
661431-
Block=require("prismarine-block")("1.16.3");
661432+
// Generated by CoffeeScript 2.5.1
661433+
661434+
Block = require("prismarine-block")("1.16.3");
661432661435

661433661436
},{"prismarine-block":306}]},{},[307]);
661437+
export {Block}

src/client/module/Block/Block_mod.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/module/World/ChunkWorker.js

Lines changed: 19 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)