本文整理汇总了Java中localhost.iillyyaa2033.nmud.core.services.domain.world.Entity.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.remove方法的具体用法?Java Entity.remove怎么用?Java Entity.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类localhost.iillyyaa2033.nmud.core.services.domain.world.Entity
的用法示例。
在下文中一共展示了Entity.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jump
import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
@Override
public void jump(String entityId, String parentId, double[] position) {
Entity child = getById(entityId);
Entity oldpar = getParent(child);
Entity newpar = getById(parentId);
synchronized (child) {
synchronized (oldpar) {
oldpar.remove(child);
}
synchronized (newpar) {
newpar.add(child);
}
}
}
示例2: pickUp
import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
public void pickUp(Entity thing) {
if (client.factory.isVisible(thing)) {
// TODO: заменить на вызов одноименного метода с двумя параметрами
if (creature.isAlive()) {
Entity e = client.domain.getParent(thing);
if (e != null) e.remove(thing);
creature.parts.add(thing);
thing.setPosition(new double[]{0d,0d});
client.send("Взято: " + thing.toString());
client.factory.notifyStateHasChanged();
} else {
client.send(AV_DEAD);
}
}
}
示例3: move
import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //导入方法依赖的package包/类
private void move(Entity e, double[] targetPosition) {
// d("Moving to " + Utils.ats(targetPosition));
double[] newPosition = e.getPosition();
Entity parent = getParent(e);
if (parent != null) {
Entity top;
if (!(parent instanceof DomainEntity)) {
top = recursiveMoveUp(parent, newPosition, targetPosition[0], targetPosition[1], (int) targetPosition[2]);
if (top == null)
top = parent;
} else {
top = parent;
}
// d("Top is " + top + " New position: " + Utils.ats(newPosition));
Entity bottom = recursiveMoveDown(top, newPosition, newPosition[0], newPosition[1], (int)newPosition[2], false);
if (e == bottom)
bottom = null;
// d("Bottom is " + bottom + " New position: " + Utils.ats(newPosition));
if (bottom != null) {
while (!(bottom instanceof ContainerEntity)) {
bottom = getParent(bottom);
}
}
parent.remove(e);
parent.notifyChildCreaturesAboutStateChanged();
e.setPosition(newPosition);
if (bottom != null) {
bottom.add(e);
bottom.notifyChildCreaturesAboutStateChanged();
} else {
top.add(e);
top.notifyChildCreaturesAboutStateChanged();
}
} else {
d("No parent found");
}
}