本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getExtendedProperties方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getExtendedProperties方法的具体用法?Java EntityPlayer.getExtendedProperties怎么用?Java EntityPlayer.getExtendedProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getExtendedProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos,
IBlockState state, EntityPlayer player, EnumFacing side, float hitX,
float hitY, float hitZ)
{
TileLaserRelay ent = (TileLaserRelay)world.getTileEntity(pos);
PlayerProperties props = (PlayerProperties)player.getExtendedProperties(PlayerProperties.ID);
if(props != null){
if(props.p_link != null){ // already linking, try to link to this one
if(!world.isRemote)
ent.toggleConnectFrom(props.p_link);
props.p_link = null;
}
else{ //not linking, add current coords
props.p_link = new BlockPos(pos);
}
}
return true;
}
示例2: onWorldLastRender
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldLastRender(RenderWorldLastEvent evt)
{
World world = Minecraft.getMinecraft().theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.partialTicks;
double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.partialTicks;
double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.partialTicks;
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
GL11.glTranslated(-x, -y, -z);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
int shade_model = GL11.glGetInteger(GL11.GL_SHADE_MODEL);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GL11.glLineWidth(3);
GL11.glBegin(GL11.GL_LINES);
//display link process
PlayerProperties props = (PlayerProperties)player.getExtendedProperties(PlayerProperties.ID);
if(props != null && props.p_link != null
&& props.p_link.distanceSq(x,y+1,z) <= FundamentalChemistry.MAX_RELAY_DISTANCE-1f){ //distance check with some margin
GlStateManager.color(0f,1f,0.5f,1f);
GL11.glVertex3d(props.p_link.getX()+0.5, props.p_link.getY()+FundamentalChemistry.LASER_HEIGHT, props.p_link.getZ()+0.5);
GlStateManager.color(0f,0.5f,1f,1f);
GL11.glVertex3d(x, y+1, z);
}
for(TileEntity te : world.loadedTileEntityList){
if(te instanceof TileLaserRelay){
TileLaserRelay ent = (TileLaserRelay)te;
// change matrix for absolute coordinates
BlockPos cpos = ent.getPos();
for(BlockPos pos : ent.inputs){
TileEntity ce = te.getWorld().getTileEntity(pos);
if(ce != null && ce instanceof TileLaserRelay && (player.getPosition().distanceSq(pos.getX(),pos.getY(),pos.getZ()) <= 500
|| player.getPosition().distanceSq(cpos.getX(),cpos.getY(),cpos.getZ()) <= 500)){
//add height shift if it is a circular connections
TileLaserRelay cent = (TileLaserRelay)ce;
float shift = 0;
if(cent.inputs.contains(cpos) && cpos.hashCode() < pos.hashCode())
shift = 1/16.0f*2;
//draw connection
GlStateManager.color(0f,0.5f,1f,1f);
GL11.glVertex3d(cpos.getX()+0.5, cpos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, cpos.getZ()+0.5);
GlStateManager.color(0f,1f,0.5f,1f);
GL11.glVertex3d(pos.getX()+0.5, pos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, pos.getZ()+0.5);
}
}
}
}
GL11.glEnd();
GlStateManager.shadeModel(shade_model);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
示例3: get
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Returns the players currency instance.
* @param player
* The player to get the currency instance from.
*/
public static final PlayerRoleplayMode get(EntityPlayer player)
{
return (PlayerRoleplayMode) player.getExtendedProperties(EXT_PROP_NAME);
}