mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
Fix isSitting()/setSitting(), add isTame()/setTame()/getOwner()/setOwner() methods
This commit is contained in:
parent
cd3c8fcfc8
commit
02d7f32e8f
@ -4,6 +4,7 @@ package org.bukkit.craftbukkit.entity;
|
|||||||
import net.minecraft.server.EntityWolf;
|
import net.minecraft.server.EntityWolf;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
|
import net.minecraft.server.PathEntity;
|
||||||
|
|
||||||
public class CraftWolf extends CraftAnimals implements Wolf {
|
public class CraftWolf extends CraftAnimals implements Wolf {
|
||||||
public CraftWolf(CraftServer server, EntityWolf wolf) {
|
public CraftWolf(CraftServer server, EntityWolf wolf) {
|
||||||
@ -26,6 +27,32 @@ public class CraftWolf extends CraftAnimals implements Wolf {
|
|||||||
getHandle().setSitting(sitting);
|
getHandle().setSitting(sitting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTame() {
|
||||||
|
return getHandle().m_();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTame(boolean tame) {
|
||||||
|
getHandle().d(tame);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return getHandle().x();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(String player) {
|
||||||
|
EntityWolf e = getHandle();
|
||||||
|
|
||||||
|
if ((player != null) && (player.length() > 0)) {
|
||||||
|
e.d(true); /* Make him tame */
|
||||||
|
e.a((PathEntity)null); /* Clear path */
|
||||||
|
e.a(player); /* Set owner */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
e.d(false); /* Make him not tame */
|
||||||
|
e.a(""); /* Clear owner */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityWolf getHandle() {
|
public EntityWolf getHandle() {
|
||||||
return (EntityWolf) entity;
|
return (EntityWolf) entity;
|
||||||
@ -33,6 +60,6 @@ public class CraftWolf extends CraftAnimals implements Wolf {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftWolf[anger=" + isAngry() + ",owner=" + getTarget() + "]";
|
return "CraftWolf[anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTame() + ",sitting=" + isSitting() + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user