当前位置: 首页>>代码示例>>Java>>正文


Java EntitySnapshot类代码示例

本文整理汇总了Java中org.spongepowered.api.entity.EntitySnapshot的典型用法代码示例。如果您正苦于以下问题:Java EntitySnapshot类的具体用法?Java EntitySnapshot怎么用?Java EntitySnapshot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntitySnapshot类属于org.spongepowered.api.entity包,在下文中一共展示了EntitySnapshot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rollback

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public ActionableResult rollback() throws Exception {
    DataView entityData = formatEntityData();

    Optional<EntitySnapshot> snapshot = Prism.getGame().getRegistry().createBuilder(Builder.class).build(entityData);
    if (!snapshot.isPresent()) {
        return ActionableResult.skipped(SkipReason.INVALID);
    }

    Optional<Entity> entity = snapshot.get().restore();
    if (!entity.isPresent()) {
        return ActionableResult.skipped(SkipReason.INVALID);
    }

    // Don't let it burn to death (again?)
    entity.get().get(IgniteableData.class).ifPresent(data -> entity.get().offer(data.fireTicks().set(0)));

    // Heal, it was probably killed.
    entity.get().get(HealthData.class).ifPresent(data -> entity.get().offer(data.health().set(data.maxHealth().get())));

    return ActionableResult.success(new Transaction<>(new SerializableNonExistent(), entity.get()));
}
 
开发者ID:prism,项目名称:Prism,代码行数:23,代码来源:EntityResult.java

示例2: addPassenger

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public boolean addPassenger(org.bukkit.entity.Entity passenger) {
    Entity e = getSpongeEntity();
    List<EntitySnapshot> passengers = e.get(Keys.PASSENGERS).orElse(new ArrayList<>());
    passengers.add(getSpongeEntity(passenger).createSnapshot());
    return getSpongeEntity().offer(Keys.PASSENGERS, passengers).isSuccessful();
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:8,代码来源:LinkedEntity.java

示例3: logEntityChange

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
public void logEntityChange(EntitySnapshot es) throws IOException, SQLException {
    checkState(es.getLocation().isPresent(), "EntitySnapshot does not have attached location");
    super.logChange(RollbackRecord.createEntityChangeRecord(-1,
            es.getUniqueId().orElse(UUID.randomUUID()), // maybe I'm a terrible person for this, idk
            WorldLocationConverter.of(es.getLocation().get()),
            es.getType().getId(), SerializationHelper.serialize(es)));
}
 
开发者ID:caseif,项目名称:Inferno,代码行数:8,代码来源:InfernoRollbackAgent.java

示例4: deserializeEntity

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
private void deserializeEntity(String serial) throws IOException {
    EntitySnapshot es = SerializationHelper.deserialize(EntitySnapshot.class, serial);
    Optional<Entity> entity = es.restore();

    if (!entity.isPresent()) {
        InfernoCore.logVerbose("Failed to restore entity in arena " + getArena().getId() + " with UUID "
                + es.getUniqueId());
    }
}
 
开发者ID:caseif,项目名称:Inferno,代码行数:10,代码来源:InfernoRollbackAgent.java

示例5: EntitySnapshotView

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
public EntitySnapshotView(EntitySnapshot value) {
    super(value);

    this.uuid = value.getUniqueId().orElse(null);
    this.type = value.getType();
    this.transform = value.getTransform().orElse(null);
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:8,代码来源:EntitySnapshotView.java

示例6: Snapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
Snapshot(Int2ObjectMap<Object> parameterValues, Map<Location<World>, BlockSnapshot> blockSnapshots,
        Set<BlockSnapshot> positionlessBlockSnapshots, Set<SlotTransaction> slotTransactions,
        Set<EntitySnapshot> entitySnapshots, CauseStack.Frame causeStackFrame) {
    this.parameterValues = parameterValues;
    this.blockSnapshots = blockSnapshots;
    this.positionlessBlockSnapshots = positionlessBlockSnapshots;
    this.slotTransactions = slotTransactions;
    this.entitySnapshots = entitySnapshots;
    this.causeStackFrame = causeStackFrame;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:BehaviorContextImpl.java

示例7: of

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
public static PoreEntity of(EntitySnapshot snapshot) {
    Optional<UUID> uuid = snapshot.getUniqueId();
    Optional<Entity> entity = snapshot.getTransform().get().getExtent().getEntity(uuid.get());
    if (!entity.isPresent()) {
        return null;
    }
    return PoreEntity.of(entity.get());
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:9,代码来源:PoreEntity.java

示例8: setPassenger

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public boolean setPassenger(org.bukkit.entity.Entity passenger) {
    List<EntitySnapshot> passengers = Collections.singletonList(getSpongeEntity(passenger).createSnapshot());
    return getSpongeEntity().offer(Keys.PASSENGERS, passengers).isSuccessful();
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:6,代码来源:LinkedEntity.java

示例9: createSnapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public EntitySnapshot createSnapshot() {
	return this.player.createSnapshot();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:5,代码来源:PlayerSponge.java

示例10: getEntitySnapshots

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Nonnull
@Override
public List<EntitySnapshot> getEntitySnapshots() throws IllegalStateException {
    return getEntities().stream().map(Entity::createSnapshot).collect(Collectors.toList());
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:6,代码来源:CustomBlockBreakItemDropEvent.java

示例11: restoreSnapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public Optional<Entity> restoreSnapshot(EntitySnapshot snapshot, Vector3d position) {
    checkRange(position);
    return this.extent.restoreSnapshot(snapshot, position);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:SoftBufferExtentViewDownsize.java

示例12: restoreSnapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public Optional<Entity> restoreSnapshot(EntitySnapshot snapshot, Vector3d position) {
    checkRange(position.getX(), position.getY(), position.getZ());
    return this.extent.restoreSnapshot(snapshot, position);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:ExtentViewDownsize.java

示例13: restoreSnapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public Optional<Entity> restoreSnapshot(EntitySnapshot snapshot, Vector3d position) {
    // TODO Auto-generated method stub
    return Optional.empty();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternChunk.java

示例14: restoreSnapshot

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public Optional<Entity> restoreSnapshot(EntitySnapshot snapshot, Vector3d position) {
    // TODO Auto-generated method stub
    return null;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternWorld.java

示例15: withLocation

import org.spongepowered.api.entity.EntitySnapshot; //导入依赖的package包/类
@Override
public EntitySnapshot withLocation(Location<World> location) {
    return null;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternEntitySnapshot.java


注:本文中的org.spongepowered.api.entity.EntitySnapshot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。