Skip to content

Commit

Permalink
deprecate objectType and mobType (#53)
Browse files Browse the repository at this point in the history
* deprecate objectType and mobType

it seems they are redundant, as nowhere in mineflayer or flying squid are they set without at the same time also setting displayName to the same value. 
Also, the Entity class fields are really confusing: the entity.type field is of the type "EntityType", while the field entity.entityType is not. I believe these two fields add to the confusion (since they bear no resemblance or analogy to the similarly named entity.entityType field) while also being useless.

* fix lint
  • Loading branch information
Epirito committed Mar 4, 2023
1 parent 1156c9b commit e3aadc7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ module.exports = (registryOrVersion) => {
this.metadata = []
}

get mobType () {
printMobTypeWarning()
return this.displayName
}

set mobType (name) {
printMobTypeWarning()
this.displayName = name
}

get objectType () {
printObjectTypeWarning()
return this.displayName
}

set objectType (name) {
printObjectTypeWarning()
this.displayName = name
}

setEquipment (index, item) {
this.equipment[index] = item
this.heldItem = this.equipment[0]
Expand All @@ -47,3 +67,9 @@ module.exports = (registryOrVersion) => {

return Entity
}
function printMobTypeWarning () {
console.log('Warning: entity.mobType is deprecated. Use entity.displayName instead')
}
function printObjectTypeWarning () {
console.log('Warning: entity.objectType is deprecated. Use entity.displayName instead')
}

0 comments on commit e3aadc7

Please sign in to comment.