本文整理汇总了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;
}
}
示例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;
}
}
}
示例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));
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
}
示例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;
}
示例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));
}
}
示例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;
}