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


Java EntityPlayer.getExtendedProperties方法代码示例

本文整理汇总了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;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:23,代码来源:BlockLaserRelay.java

示例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();
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:74,代码来源:ClientEventHandler.java

示例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);
}
 
开发者ID:Zundrel,项目名称:Ye-Olde-Chat,代码行数:10,代码来源:PlayerRoleplayMode.java


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