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


Java EntityPlayer.getEntityData方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getEntityData方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getEntityData方法的具体用法?Java EntityPlayer.getEntityData怎么用?Java EntityPlayer.getEntityData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


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

示例1: onWorldTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
	if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
		return;

	if (EtFuturum.enablePlayerSkinOverlay)
		if (playerLoggedInCooldown != null)
			if (--playerLoggedInCooldown <= 0) {
				for (World world : MinecraftServer.getServer().worldServers)
					for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
						NBTTagCompound nbt = player.getEntityData();
						if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) {
							boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
							EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
						}
					}
				playerLoggedInCooldown = null;
			}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:21,代码来源:ServerEventHandler.java

示例2: checkPlayerDeath

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void checkPlayerDeath(LivingDeathEvent event) {
	
	if (event.getEntityLiving() != null && event.getEntityLiving() instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer)event.getEntityLiving();
		NBTTagCompound tag = player.getEntityData();
		if (tag.hasKey("hasSacrificed") && !tag.getBoolean("hasSacrificed"))
		{
			EntityItem ei = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, new ItemStack(UCItems.heart));
			tag.setBoolean("hasSacrificed", true);
			if (!player.worldObj.isRemote)
				player.worldObj.spawnEntityInWorld(ei);
			return;
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:17,代码来源:UCEventHandlerServer.java

示例3: checkPlayerNBT

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void checkPlayerNBT(PlayerEvent.Clone event) {
	
	if (!event.isWasDeath())
		return;
	
	EntityPlayer old = event.getOriginal();
	EntityPlayer player = event.getEntityPlayer();
	
	NBTTagCompound oldtag = old.getEntityData();
	NBTTagCompound tag = player.getEntityData();
	if (oldtag.hasKey(GrowthSteps.TAG_GROWTHSTAGES)) {
		tag.setTag(GrowthSteps.TAG_GROWTHSTAGES, oldtag.getTagList(GrowthSteps.TAG_GROWTHSTAGES, 10).copy());
	}
	if (oldtag.hasKey("hasSacrificed"))
		tag.setBoolean("hasSacrificed", oldtag.getBoolean("hasSacrificed"));
	if (oldtag.hasKey(SeedBehavior.TAG_ABSTRACT))
		tag.setInteger(SeedBehavior.TAG_ABSTRACT, oldtag.getInteger(SeedBehavior.TAG_ABSTRACT));
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:UCEventHandlerServer.java

示例4: setAbstractCropGrowth

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void setAbstractCropGrowth(EntityPlayer player, boolean add) {
	
	NBTTagCompound tag = player.getEntityData();
	if (!tag.hasKey(TAG_ABSTRACT) && add) {
		tag.setInteger(TAG_ABSTRACT, 1);
		return;
	}
	if (add) {
		tag.setInteger(TAG_ABSTRACT, tag.getInteger(TAG_ABSTRACT) + 1);
	}
	else if (!add) {
		int value = tag.getInteger(TAG_ABSTRACT);
		if (player.worldObj.rand.nextInt(5) == 0)
			tag.setInteger(TAG_ABSTRACT, value - 1);
	}
	if (tag.getInteger(TAG_ABSTRACT) <= 0)
		tag.removeTag(TAG_ABSTRACT);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:19,代码来源:SeedBehavior.java

示例5: canAdvance

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	TileEntity tile = world.getTileEntity(pos);
	if (tile != null && tile instanceof TileFeroxia) {
		TileFeroxia te = (TileFeroxia)tile;
		EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
		if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
			NBTTagCompound tag = player.getEntityData();
			if (!tag.hasKey("hasSacrificed"))
			{
				player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
				tag.setBoolean("hasSacrificed", false);
				return false;
			}
			if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
			{
				tag.removeTag("hasSacrificed");
				world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
				GrowthSteps.generateSteps(player);
				return false;
			}
		}
	}
	return false;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:27,代码来源:GrowthSteps.java

示例6: onDrink

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onDrink(World world, BlockPos pos, FluidStack stack, EntityPlayer player, boolean fromFluidContainer) {
    player.attackEntityFrom(DamageSource.LAVA, 7);
    player.setFire(30);
    NBTTagCompound tag = player.getEntityData();
    tag.setLong("lavaDrink", world.getTotalWorldTime());
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:8,代码来源:LavaStrawHandler.java

示例7: onDrink

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onDrink(World world, BlockPos pos, FluidStack stack, EntityPlayer player, boolean fromFluidContainer) {
    player.extinguish();
    NBTTagCompound tag = player.getEntityData();
    if (tag.hasKey("lavaDrink") && world.getTotalWorldTime() - tag.getLong("lavaDrink") < 120) { //6 Seconds to drink water after drinking lava to create obsidian
        player.entityDropItem(new ItemStack(Blocks.OBSIDIAN), player.getEyeHeight());

        tag.setLong("lavaDrink", 0);
        world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 1.5F, world.rand.nextFloat() * 0.1F + 0.9F);
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:12,代码来源:WaterStrawHandler.java

示例8: setModel

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void setModel(EntityPlayer player) {
	boolean isAlex;

	NBTTagCompound nbt = player.getEntityData();
	if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE))
		isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
	else
		isAlex = PlayerModelManager.isPlayerModelAlex(getEntityTexture(player));

	mainModel = isAlex ? ALEX : STEVE;
	modelBipedMain = (ModelBiped) mainModel;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:13,代码来源:NewRenderPlayer.java

示例9: processCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender sender, String[] args) {
	if (args.length != 1 || !"alex".equals(args[0].toLowerCase()) && !"steve".equals(args[0].toLowerCase()))
		throw new WrongUsageException(getCommandUsage(sender));

	if (sender instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) sender;
		NBTTagCompound nbt = player.getEntityData();
		boolean isAlex = "alex".equals(args[0].toLowerCase());
		nbt.setBoolean(MODEL_KEY, isAlex);
		EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:14,代码来源:SetPlayerModelCommand.java

示例10: getServerTaglist

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static NBTTagList getServerTaglist(int id) {
	
	MinecraftServer ms = FMLCommonHandler.instance().getMinecraftServerInstance();
	if (ms == null)
		return null;
	EntityPlayer player = (EntityPlayer)ms.getEntityWorld().getEntityByID(id);
	if (player != null) {
		NBTTagCompound tag = player.getEntityData();
		if (tag.hasKey(GrowthSteps.TAG_GROWTHSTAGES)) 
		{
			return tag.getTagList(GrowthSteps.TAG_GROWTHSTAGES, 10);
		}
	}
	return null;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:16,代码来源:UCUtils.java


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