mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 14:01:13 +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} = {}) => {
|
||||
if(actionId == 3) {
|
||||
player.setMetadata([{"key":0,"type":0,"value": 0x08}]);
|
||||
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x08}]);
|
||||
} else if(actionId == 4) {
|
||||
player.setMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||
} else if(actionId == 0) {
|
||||
player.setMetadata([{"key":0,"type":0,"value": 0x02}]);
|
||||
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x02}]);
|
||||
player.crouching = true;
|
||||
} else if(actionId == 1) {
|
||||
player.setMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||
player.setAndUpdateMetadata([{"key":0,"type":0,"value": 0x00}]);
|
||||
player.crouching = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ module.exports.player=function(player,serv)
|
|||
|
||||
function creativeDigging(location)
|
||||
{
|
||||
console.log('creative');
|
||||
return player.changeBlock(location,0,0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,14 +162,18 @@ module.exports.entity=function(entity,serv){
|
|||
entity.updateAndSpawn();
|
||||
});
|
||||
|
||||
entity.setMetadata = (data) => {
|
||||
entity.sendMetadata = (data) => {
|
||||
serv._writeNearby('entity_metadata', {
|
||||
entityId: entity.id,
|
||||
metadata: data
|
||||
}, entity);
|
||||
entity.metadata = data;
|
||||
};
|
||||
|
||||
entity.setAndUpdateMetadata = (data) => {
|
||||
entity.metadata = data;
|
||||
entity.sendMetadata(data);
|
||||
}
|
||||
|
||||
entity.destroy = () => {
|
||||
serv.destroyEntity(entity);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ module.exports.player=function(player,serv) {
|
|||
player.spawnEntity = entity => {
|
||||
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
||||
if (typeof entity.itemId != 'undefined') {
|
||||
entity.setMetadata([{
|
||||
entity.sendMetadata([{
|
||||
"key": 10,
|
||||
"type": 5,
|
||||
"value": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue