Skip to content

Commit e3aadc7

Browse files
authored
deprecate objectType and mobType (#53)
* 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
1 parent 1156c9b commit e3aadc7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

index.js

+26
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ module.exports = (registryOrVersion) => {
2424
this.metadata = []
2525
}
2626

27+
get mobType () {
28+
printMobTypeWarning()
29+
return this.displayName
30+
}
31+
32+
set mobType (name) {
33+
printMobTypeWarning()
34+
this.displayName = name
35+
}
36+
37+
get objectType () {
38+
printObjectTypeWarning()
39+
return this.displayName
40+
}
41+
42+
set objectType (name) {
43+
printObjectTypeWarning()
44+
this.displayName = name
45+
}
46+
2747
setEquipment (index, item) {
2848
this.equipment[index] = item
2949
this.heldItem = this.equipment[0]
@@ -47,3 +67,9 @@ module.exports = (registryOrVersion) => {
4767

4868
return Entity
4969
}
70+
function printMobTypeWarning () {
71+
console.log('Warning: entity.mobType is deprecated. Use entity.displayName instead')
72+
}
73+
function printObjectTypeWarning () {
74+
console.log('Warning: entity.objectType is deprecated. Use entity.displayName instead')
75+
}

0 commit comments

Comments
 (0)