本文整理汇总了Java中org.spongepowered.api.entity.EntityTypes.ITEM属性的典型用法代码示例。如果您正苦于以下问题:Java EntityTypes.ITEM属性的具体用法?Java EntityTypes.ITEM怎么用?Java EntityTypes.ITEM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.spongepowered.api.entity.EntityTypes
的用法示例。
在下文中一共展示了EntityTypes.ITEM属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTick
@Override
public void onTick() {
super.onTick();
Vector3i chunkPosition = targetLocation.getChunkPosition();
Optional<Chunk> chunk = targetLocation.getExtent().getChunk(chunkPosition);
if (chunk.isPresent()) {
Chunk chunk1 = chunk.get();
Set<Entity> intersectingEntities = chunk1.getIntersectingEntities(aabb);
for (Entity intersectingEntity : intersectingEntities) {
if (Utils.isLivingEntity(intersectingEntity)) {
if (Utils.canDamage(character, (Living) intersectingEntities)) {
changeGravity(intersectingEntity);
}
} else if (intersectingEntity.getType() == EntityTypes.ITEM) {
changeGravity(intersectingEntity);
}
}
} else {
setDuration(0);
}
}
示例2: getLocationImprint
private Entity getLocationImprint() {
Chunk c = getChunk(castLocation);
for (Entity entity : c.getEntities()) {
if (entity.getLocation().getPosition().distanceSquared(castLocation.getPosition()) <= 4) {
if (entity.getType() == EntityTypes.ITEM) {
Item i = (Item) entity;
Location location = Utils.extractLocationFromItem(i);
if (location == null) {
continue;
}
setTargetLocation(location);
setPrinterCount(4);
return entity;
}
}
}
return null;
}
示例3: removeEntity
@Override
public void removeEntity(WarCuboid cuboid, WarEntity type) {
Location<World> pos1 = getSpongeLocation(cuboid.getCorner1());
for (Entity entity : pos1.getExtent().getEntities()) {
WarLocation loc = getWarLocation(entity.getLocation());
if (!cuboid.contains(loc)) {
continue;
}
WarEntity thisType = WarEntity.UNKNOWN;
if (entity.getType() == EntityTypes.ITEM) {
thisType = WarEntity.ITEM;
}
if (entity.getType() == EntityTypes.PRIMED_TNT) {
thisType = WarEntity.TNT;
}
if (entity.getType() == EntityTypes.ARMOR_STAND || entity.getType() == EntityTypes.PAINTING
|| entity.getType() == EntityTypes.ITEM_FRAME) {
thisType = WarEntity.PROP;
}
if (thisType == type) {
entity.remove();
}
}
}
示例4: updateType
private void updateType(@Nullable Entity entity, EntityType type) {
if(type == EntityTypes.BOAT) {
this.type = 1;
} else if(type == EntityTypes.ITEM) {
this.type = 2;
} else if(type == EntityTypes.AREA_EFFECT_CLOUD) {
this.type = 3;
} else if(type == EntityTypes.RIDEABLE_MINECART) {
this.type = 10;
this.data = Type.RIDEABLE.getId();
} else if(type == EntityTypes.CHESTED_MINECART) {
this.type = 10;
this.data = Type.CHEST.getId();
} else if(type == EntityTypes.FURNACE_MINECART) {
this.type = 10;
this.data = Type.FURNACE.getId();
} else if(type == EntityTypes.TNT_MINECART) {
this.type = 10;
this.data = Type.TNT.getId();
} else if(type == EntityTypes.MOB_SPAWNER_MINECART) {
this.type = 10;
this.data = Type.SPAWNER.getId();
} else if(type == EntityTypes.HOPPER_MINECART) {
this.type = 10;
this.data = Type.HOPPER.getId();
} else if(type == EntityTypes.COMMANDBLOCK_MINECART) {
this.type = 10;
this.data = Type.COMMAND_BLOCK.getId();
} else if(type == EntityTypes.PRIMED_TNT) {
this.type = 50;
} else if(type == EntityTypes.ENDER_CRYSTAL) {
this.type = 51;
} else if(type == EntityTypes.TIPPED_ARROW) {
this.type = 60;
} else if(type == EntityTypes.SNOWBALL) {
this.type = 61;
} else if(type == EntityTypes.EGG) {
this.type = 62;
} else if(type == EntityTypes.FIREBALL) {
this.type = 63;
} else if(type == EntityTypes.SMALL_FIREBALL) {
this.type = 64;
} else if(type == EntityTypes.ENDER_PEARL) {
this.type = 65;
} else if(type == EntityTypes.WITHER_SKULL) {
this.type = 66;
} else if(type == EntityTypes.SHULKER_BULLET) {
this.type = 67;
} else if(type == EntityTypes.LLAMA_SPIT) {
this.type = 68;
} else if(type == EntityTypes.FALLING_BLOCK) {
this.type = 70;
} else if(type == EntityTypes.ITEM_FRAME) {
this.type = 71;
} else if(type == EntityTypes.EYE_OF_ENDER) {
this.type = 72;
} else if(type == EntityTypes.SPLASH_POTION) {
this.type = 73;
} else if(type == EntityTypes.THROWN_EXP_BOTTLE) {
this.type = 75;
} else if(type == EntityTypes.FIREWORK) {
this.type = 76;
} else if(type == EntityTypes.LEASH_HITCH) {
this.type = 77;
} else if(type == EntityTypes.ARMOR_STAND) {
this.type = 78;
} else if(type == EntityTypes.EVOCATION_FANGS) {
this.type = 79;
} else if(type == EntityTypes.FISHING_HOOK) {
this.type = 90;
} else if(type == EntityTypes.SPECTRAL_ARROW) {
this.type = 91;
} else if(type == EntityTypes.DRAGON_FIREBALL) {
this.type = 93;
}
}
示例5: group
@Override
public boolean group(Object lookup, Action action, Action otherAction, Report otherReport)
{
if (!this.equals(otherReport))
{
return false;
}
if (!action.getData(CAUSE).equals(otherAction.getData(CAUSE)))
{
// TODO check same cause better
return false;
}
EntitySnapshot e1 = Recall.entity(action);
EntitySnapshot e2 = Recall.entity(otherAction);
if (e1.getType() != e2.getType())
{
return false;
}
if (e1.getType() == EntityTypes.ITEM)
{
Optional<ItemStackSnapshot> i1 = Recall.entity(otherAction).get(Keys.REPRESENTED_ITEM);
Optional<ItemStackSnapshot> i2 = Recall.entity(action).get(Keys.REPRESENTED_ITEM);
if (!i1.isPresent() && i2.isPresent())
{
return false;
}
if (ItemStackComparators.DEFAULT.compare(
i1.map(ItemStackSnapshot::createStack).orElse(null),
i2.map(ItemStackSnapshot::createStack).orElse(null)) != 0)
{
return false;
}
}
// TODO in short timeframe (minutes? configurable)
return true;
}