本文整理汇总了Java中com.sk89q.worldedit.entity.BaseEntity类的典型用法代码示例。如果您正苦于以下问题:Java BaseEntity类的具体用法?Java BaseEntity怎么用?Java BaseEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseEntity类属于com.sk89q.worldedit.entity包,在下文中一共展示了BaseEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
public BaseEntity getEntity(org.bukkit.entity.Entity entity)
{
Preconditions.checkNotNull(entity);
CraftEntity craftEntity = (CraftEntity)entity;
net.minecraft.server.v1_10_R1.Entity mcEntity = craftEntity.getHandle();
String id = getEntityId(mcEntity);
if (id != null)
{
NBTTagCompound tag = new NBTTagCompound();
readEntityIntoTag(mcEntity, tag);
return new BaseEntity(id, (CompoundTag)toNative(tag));
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:FaweAdapter_1_10.java
示例2: getEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
public BaseEntity getEntity(org.bukkit.entity.Entity entity)
{
Preconditions.checkNotNull(entity);
CraftEntity craftEntity = (CraftEntity)entity;
Entity mcEntity = craftEntity.getHandle();
String id = getEntityId(mcEntity);
if (id != null) {
NBTTagCompound tag = new NBTTagCompound();
readEntityIntoTag(mcEntity, tag);
CompoundTag weTag = (CompoundTag) toNative(tag);
return new BaseEntity(id, weTag);
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:FaweAdapter_1_12.java
示例3: getEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
public BaseEntity getEntity(org.bukkit.entity.Entity entity)
{
Preconditions.checkNotNull(entity);
CraftEntity craftEntity = (CraftEntity)entity;
net.minecraft.server.v1_9_R2.Entity mcEntity = craftEntity.getHandle();
String id = getEntityId(mcEntity);
if (id != null)
{
NBTTagCompound tag = new NBTTagCompound();
readEntityIntoTag(mcEntity, tag);
return new BaseEntity(id, (CompoundTag)toNative(tag));
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:FaweAdapter_1_9.java
示例4: getEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public BaseEntity getEntity(Entity entity) {
try {
if (classEntity == null) return null;
Object nmsEntity = getHandleEntity.invoke(entity);
String id = getEntityId(nmsEntity);
if (id != null) {
Object tag = newNBTTagCompound.newInstance();
readEntityIntoTag.invoke(nmsEntity, tag);
return new BaseEntity(id, (CompoundTag) toNative(tag));
}
} catch (Throwable e) {
throw new RuntimeException(e);
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:FaweAdapter_All.java
示例5: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public Entity createEntity(final Location loc, final BaseEntity entity) {
if (entity != null) {
CompoundTag tag = entity.getNbtData();
Map<String, Tag> map = ReflectionUtils.getMap(tag.getValue());
map.put("Id", new StringTag(entity.getTypeId()));
ListTag pos = (ListTag) map.get("Pos");
if (pos != null) {
List<Tag> posList = ReflectionUtils.getList(pos.getValue());
posList.set(0, new DoubleTag(loc.getX()));
posList.set(1, new DoubleTag(loc.getY()));
posList.set(2, new DoubleTag(loc.getZ()));
}
queue.setEntity(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), tag);
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:FastWorldEditExtent.java
示例6: getEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public BaseEntity getEntity(org.bukkit.entity.Entity entity) {
checkNotNull(entity);
CraftEntity craftEntity = ((CraftEntity) entity);
Entity mcEntity = craftEntity.getHandle();
String id = getEntityId(mcEntity);
if (id != null) {
NBTTagCompound tag = new NBTTagCompound();
readEntityIntoTag(mcEntity, tag);
return new BaseEntity(id, (CompoundTag) toNative(tag));
} else {
return null;
}
}
开发者ID:sk89q,项目名称:worldedit-adapters,代码行数:18,代码来源:Spigot_v1_12_R1.java
示例7: getState
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public BaseEntity getState() {
net.minecraft.entity.Entity entity = entityRef.get();
if (entity != null) {
String id = EntityList.getEntityString(entity);
if (id != null) {
NBTTagCompound tag = new NBTTagCompound();
entity.writeToNBT(tag);
return new BaseEntity(id, NBTConverter.fromNative(tag));
} else {
return null;
}
} else {
return null;
}
}
开发者ID:nailed,项目名称:nailed,代码行数:17,代码来源:WorldEditEntity.java
示例8: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
World world = getWorld();
net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world);
if (createdEntity != null) {
CompoundTag nativeTag = entity.getNbtData();
if (nativeTag != null) {
NBTTagCompound tag = NBTConverter.toNative(entity.getNbtData());
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.removeTag(name);
}
createdEntity.readFromNBT(tag);
}
createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
world.spawnEntityInWorld(createdEntity);
return new WorldEditEntity(createdEntity);
} else {
return null;
}
}
开发者ID:nailed,项目名称:nailed,代码行数:24,代码来源:WorldEditWorld.java
示例9: createBaseEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public BaseEntity createBaseEntity(Entity entity) {
checkNotNull(entity, "entity");
final ObjectSerializer serializer = ObjectSerializerRegistry.get().get(entity.getClass())
.orElseThrow(() -> new IllegalStateException("Missing object serializer for entity " + entity.getType()));
final DataView dataView = serializer.serialize(entity);
return new BaseEntity(entity.getType().getId(), DataViewNbt.to(dataView));
}
开发者ID:LanternPowered,项目名称:LanternWorldEdit,代码行数:10,代码来源:LanternImplAdapter.java
示例10: applyEntityData
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void applyEntityData(Entity entity, BaseEntity baseEntity) {
final ObjectStore store = ObjectStoreRegistry.get().get(entity.getClass())
.orElseThrow(() -> new IllegalStateException("Missing object store for entity " + entity.getType()));
final CompoundTag tag = baseEntity.getNbtData();
final DataView dataView = tag == null ? DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED) : DataViewNbt.from(tag);
for (String field : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
dataView.remove(DataQuery.of(field));
}
store.deserialize(entity, dataView);
}
开发者ID:LanternPowered,项目名称:LanternWorldEdit,代码行数:13,代码来源:LanternWEWorld.java
示例11: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state)
{
Preconditions.checkNotNull(location);
Preconditions.checkNotNull(state);
CraftWorld craftWorld = (CraftWorld)location.getWorld();
WorldServer worldServer = craftWorld.getHandle();
net.minecraft.server.v1_10_R1.Entity createdEntity = createEntityFromId(state.getTypeId(), craftWorld.getHandle());
if (createdEntity != null)
{
CompoundTag nativeTag = state.getNbtData();
if (nativeTag != null)
{
NBTTagCompound tag = (NBTTagCompound)fromNative(nativeTag);
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
readTagIntoEntity(tag, createdEntity);
}
createdEntity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
worldServer.addEntity(createdEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
return createdEntity.getBukkitEntity();
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:FaweAdapter_1_10.java
示例12: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state)
{
Preconditions.checkNotNull(location);
Preconditions.checkNotNull(state);
CraftWorld craftWorld = (CraftWorld)location.getWorld();
WorldServer worldServer = craftWorld.getHandle();
Entity createdEntity = createEntityFromId(state.getTypeId(), craftWorld.getHandle());
if (createdEntity != null)
{
CompoundTag nativeTag = state.getNbtData();
if (nativeTag != null)
{
NBTTagCompound tag = (NBTTagCompound)fromNative(nativeTag);
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
readTagIntoEntity(tag, createdEntity);
}
createdEntity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
worldServer.addEntity(createdEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
return createdEntity.getBukkitEntity();
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:FaweAdapter_1_12.java
示例13: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state)
{
Preconditions.checkNotNull(location);
Preconditions.checkNotNull(state);
CraftWorld craftWorld = (CraftWorld)location.getWorld();
WorldServer worldServer = craftWorld.getHandle();
net.minecraft.server.v1_9_R2.Entity createdEntity = createEntityFromId(state.getTypeId(), craftWorld.getHandle());
if (createdEntity != null)
{
CompoundTag nativeTag = state.getNbtData();
if (nativeTag != null)
{
NBTTagCompound tag = (NBTTagCompound)fromNative(nativeTag);
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
readTagIntoEntity(tag, createdEntity);
}
createdEntity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
worldServer.addEntity(createdEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
return createdEntity.getBukkitEntity();
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:FaweAdapter_1_9.java
示例14: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity state) {
try {
if (classEntity == null) return null;
World world = location.getWorld();
Object nmsWorld = getHandleWorld.invoke(world);
Object createdEntity = createEntityFromId(state.getTypeId(), nmsWorld);
if (createdEntity != null) {
CompoundTag nativeTag = state.getNbtData();
Map<String, Tag> rawMap = ReflectionUtils.getMap(nativeTag.getValue());
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
rawMap.remove(name);
}
if (nativeTag != null) {
Object tag = fromNative(nativeTag);
readTagIntoEntity.invoke(createdEntity, tag);
}
setLocation.invoke(createdEntity, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
addEntity.invoke(nmsWorld, createdEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
return (Entity) getBukkitEntity.invoke(createdEntity);
}
} catch (Throwable e) {
throw new RuntimeException(e);
}
return null;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:FaweAdapter_All.java
示例15: getState
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public BaseEntity getState() {
Entity entity = entityRef.get();
if (entity != null) {
if (entity instanceof Player) {
return null;
}
CompoundTag tag = NBTConverter.fromNative(entity.namedTag);
return new BaseEntity(entity.getSaveId(), tag);
} else {
return null;
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:14,代码来源:NukkitEntity.java
示例16: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
Entity created = null;
for (AbstractDelegateExtent extent : extents) created = extent.createEntity(location, entity);
return created;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:MultiTransform.java
示例17: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_FAILS);
}
return null;
}
return super.createEntity(location, entity);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:FaweRegionExtent.java
示例18: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public Entity createEntity(final Location location, final BaseEntity entity) {
if (entity == null) {
return null;
}
if (!limit.MAX_ENTITIES()) {
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_ENTITIES);
return null;
}
return super.createEntity(location, entity);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:ProcessedWEExtent.java
示例19: createEntity
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Nullable
@Override
public Entity createEntity(final Location location, final BaseEntity state) {
final Entity entity = super.createEntity(location, state);
if ((state != null)) {
this.changeSet.addEntityCreate(state.getNbtData());
}
return entity;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:HistoryExtent.java
示例20: remove
import com.sk89q.worldedit.entity.BaseEntity; //导入依赖的package包/类
@Override
public boolean remove() {
final Location location = this.entity.getLocation();
final BaseEntity state = this.entity.getState();
final boolean success = this.entity.remove();
if ((state != null) && success) {
HistoryExtent.this.changeSet.addEntityRemove(state.getNbtData());
}
return success;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:HistoryExtent.java
注:本文中的com.sk89q.worldedit.entity.BaseEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论