本文整理汇总了Java中net.minecraft.server.EntityItemFrame类的典型用法代码示例。如果您正苦于以下问题:Java EntityItemFrame类的具体用法?Java EntityItemFrame怎么用?Java EntityItemFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityItemFrame类属于net.minecraft.server包,在下文中一共展示了EntityItemFrame类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntityTrackingRange
import net.minecraft.server.EntityItemFrame; //导入依赖的package包/类
/**
* Gets the range an entity should be 'tracked' by players and visible in
* the client.
*
* @param entity
* @param defaultRange Default range defined by Mojang
* @return
*/
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
SpigotWorldConfig config = entity.world.spigotConfig;
int range = defaultRange;
if ( entity instanceof EntityPlayer )
{
range = config.playerTrackingRange;
} else if ( entity.defaultActivationState || entity instanceof EntityGhast )
{
range = defaultRange;
} else if ( entity.activationType == 1 )
{
range = config.monsterTrackingRange;
} else if ( entity.activationType == 2 )
{
range = config.animalTrackingRange;
} else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb )
{
range = config.miscTrackingRange;
}
return Math.min( config.maxTrackingRange, range );
}
示例2: update
import net.minecraft.server.EntityItemFrame; //导入依赖的package包/类
private void update() {
EntityItemFrame old = this.getHandle();
WorldServer world = ((CraftWorld) getWorld()).getHandle();
BlockPosition position = old.getBlockPosition();
EnumDirection direction = old.getDirection();
ItemStack item = old.getItem() != null ? old.getItem().cloneItemStack() : null;
old.die();
EntityItemFrame frame = new EntityItemFrame(world,position,direction);
frame.setItem(item);
world.addEntity(frame);
this.entity = frame;
}
示例3: getEntityTrackingRange
import net.minecraft.server.EntityItemFrame; //导入依赖的package包/类
/**
* Gets the range an entity should be 'tracked' by players and visible in
* the client.
*
* @param entity
* @param defaultRange Default range defined by Mojang
* @return
*/
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
SpigotWorldConfig config = entity.world.spigotConfig;
if ( entity instanceof EntityPlayer )
{
return config.playerTrackingRange;
} else if ( entity.activationType == 1 )
{
return config.monsterTrackingRange;
} else if ( entity instanceof EntityGhast )
{
if ( config.monsterTrackingRange > config.monsterActivationRange )
{
return config.monsterTrackingRange;
} else
{
return config.monsterActivationRange;
}
} else if ( entity.activationType == 2 )
{
return config.animalTrackingRange;
} else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb )
{
return config.miscTrackingRange;
} else
{
return config.otherTrackingRange;
}
}
示例4: CraftItemFrame
import net.minecraft.server.EntityItemFrame; //导入依赖的package包/类
public CraftItemFrame(CraftServer server, EntityItemFrame entity) {
super(server, entity);
}
示例5: getHandle
import net.minecraft.server.EntityItemFrame; //导入依赖的package包/类
@Override
public EntityItemFrame getHandle() {
return (EntityItemFrame) entity;
}