mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 11:40:46 +00:00
Fixing metadata, almost done!
This commit is contained in:
parent
180799e045
commit
a02983c2bd
4 changed files with 11 additions and 8 deletions
|
|
@ -8,14 +8,14 @@ module.exports.player=function(player)
|
||||||
|
|
||||||
player._client.on("entity_action", ({actionId} = {}) => {
|
player._client.on("entity_action", ({actionId} = {}) => {
|
||||||
if(actionId == 3) {
|
if(actionId == 3) {
|
||||||
player.setMetadata([{"key":0,"type":0,"value": 0x08}]);
|
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x08}]);
|
||||||
} else if(actionId == 4) {
|
} else if(actionId == 4) {
|
||||||
player.setMetadata([{"key":0,"type":0,"value": 0x00}]);
|
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||||
} else if(actionId == 0) {
|
} else if(actionId == 0) {
|
||||||
player.setMetadata([{"key":0,"type":0,"value": 0x02}]);
|
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x02}]);
|
||||||
player.crouching = true;
|
player.crouching = true;
|
||||||
} else if(actionId == 1) {
|
} else if(actionId == 1) {
|
||||||
player.setMetadata([{"key":0,"type":0,"value": 0x00}]);
|
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||||
player.crouching = false;
|
player.crouching = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@ module.exports.player=function(player,serv)
|
||||||
|
|
||||||
function creativeDigging(location)
|
function creativeDigging(location)
|
||||||
{
|
{
|
||||||
console.log('creative');
|
|
||||||
return player.changeBlock(location,0,0);
|
return player.changeBlock(location,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,14 +162,18 @@ module.exports.entity=function(entity,serv){
|
||||||
entity.updateAndSpawn();
|
entity.updateAndSpawn();
|
||||||
});
|
});
|
||||||
|
|
||||||
entity.setMetadata = (data) => {
|
entity.sendMetadata = (data) => {
|
||||||
serv._writeNearby('entity_metadata', {
|
serv._writeNearby('entity_metadata', {
|
||||||
entityId: entity.id,
|
entityId: entity.id,
|
||||||
metadata: data
|
metadata: data
|
||||||
}, entity);
|
}, entity);
|
||||||
entity.metadata = data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
entity.setAndUpdateMetadata = (data) => {
|
||||||
|
entity.metadata = data;
|
||||||
|
entity.sendMetadata(data);
|
||||||
|
}
|
||||||
|
|
||||||
entity.destroy = () => {
|
entity.destroy = () => {
|
||||||
serv.destroyEntity(entity);
|
serv.destroyEntity(entity);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ module.exports.player=function(player,serv) {
|
||||||
player.spawnEntity = entity => {
|
player.spawnEntity = entity => {
|
||||||
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
||||||
if (typeof entity.itemId != 'undefined') {
|
if (typeof entity.itemId != 'undefined') {
|
||||||
entity.setMetadata([{
|
entity.sendMetadata([{
|
||||||
"key": 10,
|
"key": 10,
|
||||||
"type": 5,
|
"type": 5,
|
||||||
"value": {
|
"value": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue