Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bundled index.html for wsmc/Java. Closes GH-33 #37

Merged
merged 5 commits into from
Feb 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ const main = function() {
'voxel-wool': require('voxel-wool'),
'voxel-pumpkin': require('voxel-pumpkin'),
'voxel-blockdata': require('voxel-blockdata'),
'./inert-blocks': require('./inert-blocks'),
'./inert-items': require('./inert-items'),
'voxel-decorative': require('voxel-decorative'),
'voxel-land': require('voxel-land'),
'voxel-flatland': require('voxel-flatland'),
Expand Down Expand Up @@ -120,8 +118,6 @@ const main = function() {
'voxel-wool': {},
'voxel-pumpkin': {},

'./inert-blocks': {}, // misc inanimate opaque solid blocks
'./inert-items': {},
'voxel-decorative': {},
//'voxel-land': {registerBlocks: false},
'voxel-flatland': {block: 'missing'},
Expand Down
15 changes: 15 additions & 0 deletions app/bundled-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE HTML>
<html>
<head>
<title>voxel-clientmc</title>
<style>
body {
background-color: lightgray;
}
</style>
</head>
<body>
<a href="https://github.com/voxel/voxel-clientmc"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"></a>
<script src="bundle.js"></script>
</body>
</html>
32 changes: 0 additions & 32 deletions app/inert-blocks.js

This file was deleted.

33 changes: 0 additions & 33 deletions app/inert-items.js

This file was deleted.

1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ checkout:
- npm install
- (cd app && npm install)
- ./app/node_modules/.bin/browserify app/app.js > app/wsmc/src/main/resources/www/bundle.js
- cp ./app/bundled-index.html app/wsmc/src/main/resources/www/index.html
# build wsmc/Java with the bundled voxel-clientmc
- (cd app/wsmc && mvn package)

Expand Down
35 changes: 25 additions & 10 deletions clientmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,37 @@ class ClientMC extends EventEmitter
this.enable();
}


enable() {
// only begin connecting to server after voxel-engine is initialized,
// Register our own blocks and items which aren't provided by other more specialized plugins
const inertBlockProps = mcData.inertBlockProps;
Object.keys(inertBlockProps).forEach((name) => {
const props = inertBlockProps[name];

this.registry.registerBlock(name, props);
});

const inertItemProps = mcData.inertItemProps;
Object.keys(inertItemProps).forEach((name) => {
const props = inertItemProps[name];

this.registry.registerItem(name, props);
});

// Begin connecting to server after voxel-engine is initialized,
// since it shows chunks (game.showChunk) which requires engine initialization,
// but plugins are "enabled" before the engine fully is
this.game.on('engine-init', this.connectServer.bind(this));
}

disable() {
this.log('voxel-clientmc disabling');
this.game.voxels.removeListener('missingChunk', this.missingChunk);
this.game.plugins.get('voxel-console').widget.removeListener('input', this.onConsoleInput);
this.ws.end();
if (this.clearPositionUpdateTimer) this.clearPositionUpdateTimer();
// TODO: unregister inert items/blocks
}

// TODO: refactor further into modules
connectServer() {
this.log('voxel-clientmc connecting...');
Expand Down Expand Up @@ -160,12 +183,4 @@ class ClientMC extends EventEmitter

this.emit('connectServer');
}

disable() {
this.log('voxel-clientmc disabling');
this.game.voxels.removeListener('missingChunk', this.missingChunk);
this.game.plugins.get('voxel-console').widget.removeListener('input', this.onConsoleInput);
this.ws.end();
if (this.clearPositionUpdateTimer) this.clearPositionUpdateTimer();
}
}