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


Java EntityPlayer.getEntityWorld方法代码示例

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


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

示例1: onLivingDeath

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingDeath(LivingDeathEvent event)
{
	/*
	 * Update player experience when they kill a monster. Experience gained is determined from how much health/damage the monsters has.
	 */

	if (event.getSource().getTrueSource() instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
		EntityLivingBase enemy = event.getEntityLiving();
		PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
		
		if (!player.getEntityWorld().isRemote && playerInfo != null)
		{
			addExperience(player, playerInfo, enemy);
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:20,代码来源:EventLivingDeath.java

示例2: usedBy

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean usedBy(EntityPlayer player)
{
    if (!player.canUseCommandBlock())
    {
        return false;
    }
    else
    {
        if (player.getEntityWorld().isRemote)
        {
            player.openEditStructure(this);
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:TileEntityStructure.java

示例3: slotClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Nullable
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
	if (!player.getEntityWorld().isRemote) {
		if (slotId == 1 && getSlot(1) != null && getSlot(1).getHasStack()) {
			listPid.remove(index);
			if (index +1>=totalPictureNum) {
				index--;
			}
			totalPictureNum--;
			if(totalPictureNum==0){
				index=-1;
			}
		}
	}
	ItemStack i = super.slotClick(slotId, dragType, clickTypeIn, player);
	saveToNBT(player);
	return i;
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:19,代码来源:ContainerPictureBook.java

示例4: saveToNBT

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void saveToNBT(EntityPlayer playerIn) {
	if (!playerIn.getEntityWorld().isRemote) {
		String listPidTotal="";
		for(int i=0;i<listPid.size();i++){
			listPidTotal+=listPid.get(i);
			if(i+1<listPid.size()){
				listPidTotal+="%,%";
			}
		}
		//System.out.println(listPid.size());
		ItemStack itemStackBook = playerIn.getActiveItemStack();
		if (itemStackBook != null) {
			NBTTagCompound nbt = new NBTTagCompound();
			nbt.setString("listPid", listPidTotal);
			nbt.setInteger("index", index);
			itemStackBook.setTagCompound(nbt);
		}
	}
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:20,代码来源:ContainerPictureBook.java

示例5: entityInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void entityInteract(EntityInteract event) {
	if (event.getEntityPlayer().getEntityData().hasKey("renderViewCamera")) {
		event.setCanceled(true);
		if (event.getSide().isClient() && event.getHand().equals(EnumHand.MAIN_HAND)
				&& event.getItemStack() == null) {
			System.out.println("EntityInteract,HandType=" + event.getHand());
			ActiveTripod(Minecraft.getMinecraft().thePlayer.getName(),
					((EntityTripod) event.getWorld()
							.getEntityByID(event.getEntityPlayer().getEntityData().getInteger("renderViewCamera")))
									.getDelay());
		}
		return;
	}
	if (event.getTarget() instanceof EntityTripod) {
		Entity target = ((PlayerInteractEvent.EntityInteract) event).getTarget();
		EntityPlayer player = event.getEntityPlayer();
		if (!player.isSneaking()) {
			if (player.inventory.armorInventory[3] != null
					&& player.inventory.armorInventory[3].getItem() instanceof ItemGlassesHelmet) {
				if (player.getEntityWorld().isRemote) {
					// System.out.println("123");
					Minecraft.getMinecraft().setRenderViewEntity(target);
					Minecraft.getMinecraft().ingameGUI.setRecordPlaying(new TextComponentTranslation("chat.tripod.info"), false);
				}
				player.getEntityData().setInteger("renderViewCamera", target.getEntityId());
			}else if(!event.getWorld().isRemote&&event.getHand().equals(EnumHand.MAIN_HAND)){
				player.addChatComponentMessage(new TextComponentTranslation("chat.tripod.mustuseglass"));
			}
		} else {
			player.getEntityData().setInteger("usingGui", target.getEntityId());
			player.openGui(MineCamera.instance, GuiElementLoader.GUI_TRIPOD_CAMERA, target.getEntityWorld(),
					(int) target.posX, (int) target.posY, (int) target.posZ);
		}
	}
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:37,代码来源:EventLoader.java

示例6: tryOpenEditCommandBlock

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean tryOpenEditCommandBlock(EntityPlayer playerIn)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        return false;
    }
    else
    {
        if (playerIn.getEntityWorld().isRemote)
        {
            playerIn.openEditCommandBlock(this);
        }

        return true;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:CommandBlockLogic.java

示例7: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
    protected boolean processInteract(EntityPlayer player, EnumHand hand) {
        if (player.getEntityWorld().isRemote) {
//            player.openGui(MeeCreeps.instance, GuiProxy.GUI_MEECREEP_DISMISS, player.getEntityWorld(), (int) player.posX, (int) player.posY, (int) player.posZ);
            return true;
        } else {
            ServerActionManager manager = ServerActionManager.getManager();
            if (actionId != 0) {
                ActionOptions options = manager.getOptions(actionId);
                if (options != null) {
                    MeeCreepsMessages.INSTANCE.sendTo(new PacketActionOptionToClient(options, GuiProxy.GUI_MEECREEP_DISMISS), (EntityPlayerMP) player);
                    options.setPaused(true);
                }
            }
            return true;
        }
    }
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:18,代码来源:EntityMeeCreeps.java

示例8: tryOpenEditCommandBlock

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean tryOpenEditCommandBlock(EntityPlayer playerIn)
{
    if (!playerIn.canUseCommandBlock())
    {
        return false;
    }
    else
    {
        if (playerIn.getEntityWorld().isRemote)
        {
            playerIn.displayGuiEditCommandCart(this);
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:CommandBlockBaseLogic.java

示例9: handleServerMessage

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public IMessage handleServerMessage(EntityPlayer player, MessageSyncClearList message, MessageContext ctx) {
	if ((player != null) && (message != null) && (ctx != null)) {
		EntityPlayer en = (EntityPlayer) player.getEntityWorld().getEntityByID(message.entityId);
		if (en != null) {
			if (player.getEntityId() == en.getEntityId() && en.getEntityWorld() != null && en.hasCapability(Currency.CART_DATA, null)) {
				CartCapability entityData = en.getCapability(Currency.CART_DATA, null);

				entityData.setCart(NonNullList.withSize(entityData.getSizeInventory(), ItemStack.EMPTY), true);
				List<Float> prices = Arrays.asList(new Float[25]);
				for (int i = 0; i < prices.size(); i++) {
					prices.set(i, (float) 0);
				}
			}
		}
	}
	return null;
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:19,代码来源:MessageSyncClearList.java

示例10: onItemUse

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
	if (!player.getEntityWorld().isRemote)
	{
        return EnumActionResult.SUCCESS;
	}
	
	return EnumActionResult.FAIL;
   }
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:11,代码来源:ItemTest.java

示例11: onContainerClosed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onContainerClosed(EntityPlayer playerIn) {
	super.onContainerClosed(playerIn);
	if(!playerIn.getEntityWorld().isRemote){
		saveToNBT(playerIn);
	}
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:8,代码来源:ContainerCamera.java

示例12: onItemUse

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack stack = player.getHeldItem(hand);
    if (player.getEntityWorld().isRemote) return EnumActionResult.FAIL;
    if (!containsEntity(stack)) return EnumActionResult.FAIL;
    Entity entity = getEntityFromStack(stack, worldIn, true);
    BlockPos blockPos = pos.offset(facing);
    entity.setPositionAndRotation(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5, 0, 0);
    stack.setTagCompound(new NBTTagCompound());
    player.setHeldItem(hand, stack);
    worldIn.spawnEntity(entity);
    if (entity instanceof EntityLiving) ((EntityLiving) entity).playLivingSound();
    return EnumActionResult.SUCCESS;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:15,代码来源:MobImprisonmentToolItem.java

示例13: cancelPortalPair

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void cancelPortalPair(EntityPlayer player, BlockPos selectedBlock) {
    World sourceWorld = player.getEntityWorld();
    TileEntity te = sourceWorld.getTileEntity(selectedBlock);
    if (te instanceof PortalTileEntity) {
        PortalTileEntity source = (PortalTileEntity) te;
        source.setTimeout(10);
    }
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:9,代码来源:TeleportationTools.java

示例14: findSuitablePositionNearPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static BlockPos findSuitablePositionNearPlayer(@Nonnull EntityMeeCreeps meeCreep, @Nonnull EntityPlayer player, double distance) {
    Vec3d playerPos = player.getPositionVector();
    Vec3d entityPos = meeCreep.getPositionVector();

    if (entityPos.distanceTo(playerPos) < (distance * 1.2)) {
        // No need to move
        return meeCreep.getPosition();
    }

    double dx = playerPos.x - entityPos.x;
    double dy = playerPos.x - entityPos.x;
    double dz = playerPos.x - entityPos.x;
    Vec3d v = new Vec3d(-dx, -dy, -dz);
    v = v.normalize();
    Vec3d pos = new Vec3d(playerPos.x + v.x * distance, playerPos.y + v.y * distance, playerPos.z + v.z * distance);
    // First find a good spot at the specific location
    World world = player.getEntityWorld();

    float width = meeCreep.width;
    float eyeHeight = meeCreep.getEyeHeight();

    // First try on the prefered spot
    BlockPos p = scanSuitablePos(new BlockPos(pos.x, pos.y + .5, pos.z), world, width, eyeHeight);
    if (p != null) return p;
    // No good spot to stand on found. Try other spots around the prefered spot
    p = scanAround(pos, world, width, eyeHeight);
    if (p != null) return p;
    // No good spot to stand on found. Try other spots around the player
    p = scanAround(playerPos, world, width, eyeHeight);
    if (p != null) return p;

    // If all else fails we go stand where the player is
    return player.getPosition();
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:35,代码来源:WorkerHelper.java

示例15: executeCommand

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public IChatComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(IChatComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3 getPositionVector()
        {
            return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            TileEntitySign.this.stats.func_179672_a(this, type, amount);
        }
    };

    for (int i = 0; i < this.signText.length; ++i)
    {
        ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle();

        if (chatstyle != null && chatstyle.getChatClickEvent() != null)
        {
            ClickEvent clickevent = chatstyle.getChatClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:63,代码来源:TileEntitySign.java


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