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


Java EntityPlayer.getItemStackFromSlot方法代码示例

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


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

示例1: playerTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        EntityPlayer player = event.player;
        if (player == mc.player) {
            ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                if (player.world.isRemote) {
                    update(mc.player);
                }
            } else {
                CommonHUDHandler.getHandlerForPlayer(player).ticksExisted = 0;
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:HUDHandler.java

示例2: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemStackIn);
    ItemStack itemstack = playerIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack == null)
    {
        playerIn.setItemStackToSlot(entityequipmentslot, itemStackIn.copy());
        itemStackIn.stackSize = 0;
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemStackIn);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ItemArmor.java

示例3: worldTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void worldTick(World world) {
    counter--;
    if (counter <= 0) {
        counter = MAXTICKS;

        effectCounter--;
        if (effectCounter <= 0) {
            effectCounter = MAXEFFECTSTICKS;
            handleEffects(world);
        }

        tick(world);

        PacketSendCleanAirToClient message = new PacketSendCleanAirToClient(getCleanAir());
        for (EntityPlayer player : world.playerEntities) {
            ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (!helmet.isEmpty() && helmet.getItem() instanceof InformationGlasses) {
                NTBMessages.INSTANCE.sendTo(message, (EntityPlayerMP) player);
            }
        }
    }
    CleanAirManager.getManager().save();
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:24,代码来源:DimensionData.java

示例4: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack);
    ItemStack itemstack1 = worldIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack1.func_190926_b())
    {
        worldIn.setItemStackToSlot(entityequipmentslot, itemstack.copy());
        itemstack.func_190920_e(0);
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemstack);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:ItemElytra.java

示例5: renderWorldLastEvent

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent event) {
    if (!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) return;
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.player;
    double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks();
    double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks();
    double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks();

    GL11.glPushMatrix();
    GL11.glTranslated(-playerX, -playerY, -playerZ);
    ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
        if (((IPressurizable) helmetStack.getItem()).getPressure(helmetStack) > 0F) {
            CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
            if (comHudHandler.ticksExisted > comHudHandler.getStartupTime()) {

                GL11.glDisable(GL11.GL_TEXTURE_2D);

                for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
                    if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked)
                        UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).render3D(event.getPartialTicks());
                }

                GL11.glEnable(GL11.GL_TEXTURE_2D);

            }
        }
    }
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:32,代码来源:HUDHandler.java

示例6: enabledForPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static boolean enabledForPlayer(EntityPlayer player) {
    ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (!helmet.isEmpty()) {
        return enabledForStacks(ItemPneumaticArmor.getUpgradeStacks(helmet));
    } else {
        return false;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:DroneDebugUpgradeHandler.java

示例7: indicateToListeningPlayers

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Sends particle spawn packets to any close player that has a charged pneumatic helmet with entity tracker.
 *
 * @param pos
 */
protected void indicateToListeningPlayers(BlockPos pos) {
    for (EntityPlayer player : drone.world().playerEntities) {
        ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
        if (helmet.getItem() == Itemss.PNEUMATIC_HELMET && ItemPneumaticArmor.getUpgrades(EnumUpgrade.ENTITY_TRACKER, helmet) > 0
                && ((IPressurizable) Itemss.PNEUMATIC_HELMET).getPressure(helmet) > 0) {
            NetworkHandler.sendTo(new PacketSpawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0, 0), (EntityPlayerMP) player);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:15,代码来源:DroneAIBlockInteraction.java

示例8: handleServerSide

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void handleServerSide(PacketUpdateSearchStack message, EntityPlayer player) {
    ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (!helmetStack.isEmpty()) {
        NBTTagCompound tag = NBTUtil.getCompoundTag(helmetStack, "SearchStack");
        tag.setInteger("itemID", message.itemId);
        tag.setInteger("itemDamage", message.itemDamage);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:PacketUpdateSearchStack.java

示例9: handleServerSide

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void handleServerSide(PacketCoordTrackUpdate message, EntityPlayer player) {
    ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (!stack.isEmpty()) {
        NBTTagCompound tag = NBTUtil.getCompoundTag(stack, "CoordTracker");
        tag.setInteger("dimID", message.dimensionID);
        NBTUtil.setPos(tag, message.pos);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:PacketCoordTrackUpdate.java

示例10: tickEnd

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEnd(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        EntityPlayer player = event.player;
        if (this == PneumaticCraftRepressurized.proxy.getCommonHudHandler()) {
            getHandlerForPlayer(player).tickEnd(event);
        } else {
            ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                helmetPressure = ((IPressurizable) helmetStack.getItem()).getPressure(helmetStack);
                if (ticksExisted == 0) {
                    checkHelmetInventory(helmetStack);
                }
                ticksExisted++;
                if (!player.world.isRemote) {
                    if (ticksExisted > getStartupTime() && !player.capabilities.isCreativeMode) {
                        ((IPressurizable) helmetStack.getItem()).addAir(helmetStack, (int) -UpgradeRenderHandlerList.instance().getAirUsage(player, false));
                    }
                }

            } else {
                ticksExisted = 0;
            }
            if (!player.world.isRemote) handleHacking(player);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:CommonHUDHandler.java

示例11: takeDamage

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void takeDamage(EntityPlayer player, DamageSource source, float amount)
{
	final float baseAmount = amount;
	IExPPlayer data = IExPPlayer.of(player);
	List<DamageMapping> mappings = ExPDamageMappings.provide(source);
	BodyPart part = WeightedRandom.getRandomItem(player.world.rand, mappings).getPart();
	EntityEquipmentSlot armorCheck = part == BodyPart.HEAD ? EntityEquipmentSlot.HEAD : part == BodyPart.ARM_LEFT || part == BodyPart.ARM_RIGHT || part == BodyPart.BODY ? EntityEquipmentSlot.CHEST : player.world.rand.nextBoolean() ? EntityEquipmentSlot.LEGS : EntityEquipmentSlot.FEET;
	ItemStack armorStack = player.getItemStackFromSlot(armorCheck);
	if (!armorStack.isEmpty())
	{
		amount = handleArmorProtection(player, source, amount, armorStack, part, armorCheck);
	}
	
	float partDamage = player.world.rand.nextFloat();
	// No damage reduction was applied, player has no armor
	if (baseAmount == amount)
	{
		partDamage *= 10;
	}
	
	data.setState(part, Math.max(0, data.getState(part) - partDamage));
	// TODO bleeding, bones breaking
	float actualDamage = amount * (200 + player.world.rand.nextFloat() * 50 - player.world.rand.nextFloat() * 50);
	data.setHealth(data.getCurrentHealth() - actualDamage, true, true);
	
	// Player died
	if (data.getCurrentHealth() <= 0)
	{
		player.sendMessage(source.getDeathMessage(player));
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:32,代码来源:PlayerManager.java

示例12: update

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void update() {

	if (worldObj.isRemote)
		return;
	
	if (this.worldObj.getTotalWorldTime() % 10L != 0)
		return;
	
	boolean wasLooking = this.isLooking();
	int range = 10;
	List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
	
	boolean looker = false;
	for (EntityPlayer player : players) {
		ItemStack helm = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
		if (helm != null && helm.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
			continue;
		
		RayTraceResult rtr = this.rayTraceFromEntity(worldObj, player, true, range);
		if (rtr != null && rtr.getBlockPos() != null && rtr.getBlockPos().equals(getPos())) {
			looker = true;
			break;
		}
		if (!wasLooking && ((WeepingBells)worldObj.getBlockState(getPos()).getBlock()).isWeepingCropGrown(worldObj.getBlockState(getPos())) && !player.capabilities.isCreativeMode) {
			if (getTarget(worldObj, getPos()).canEntityBeSeen(player)) {
				player.attackEntityFrom(DamageSource.outOfWorld, 1.0F);
			}
		}
	}
	if (looker != wasLooking && !worldObj.isRemote)
		setLooking(looker);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:34,代码来源:TileShyPlant.java

示例13: render2D

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void render2D(float partialTicks) {
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    EntityPlayer player = minecraft.player;
    ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    if (minecraft.inGameHasFocus && helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
        ScaledResolution sr = new ScaledResolution(minecraft);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glColor4d(0, 1, 0, 0.8D);
        CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
        if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) {
            // blockTrackInfo = null;
            gaveEmptyWarning = false;
            gaveNearlyEmptyWarning = false;
            RenderProgressBar.render(sr.getScaledWidth() / 2, 10, sr.getScaledWidth() - 10, 30, -90F, comHudHandler.ticksExisted * 100 / comHudHandler.getStartupTime());
        } else {

            if (comHudHandler.helmetPressure < 0.05F && !gaveEmptyWarning) {
                addMessage(new ArmorMessage("The helmet is out of air!", new ArrayList<String>(), 100, 0x70FF0000));
                gaveEmptyWarning = true;
            }
            if (comHudHandler.helmetPressure > 0.2F && comHudHandler.helmetPressure < 0.5F && !gaveNearlyEmptyWarning) {
                addMessage(new ArmorMessage("The helmet almost out of air!", new ArrayList<String>(), 60, 0x70FF0000));
                gaveNearlyEmptyWarning = true;
            }
            if (GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) {
                for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
                    IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
                    if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()).checked) {
                        IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat();
                        if (stat != null) {
                            stat.render(-1, -1, partialTicks);
                        }
                        upgradeRenderHandler.render2D(partialTicks, comHudHandler.helmetPressure > 0F);
                    }
                }
            }
        }

        // render every item in the list.
        for (ArmorMessage message : messageList) {
            message.renderMessage(minecraft.fontRenderer, partialTicks);
        }

        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime())
            minecraft.fontRenderer.drawString(CommonHUDHandler.getHandlerForPlayer().ticksExisted * 100 / comHudHandler.getStartupTime() + "%", sr.getScaledWidth() * 3 / 4 - 8, 16, 0x000000);
    } else if (helmetStack.isEmpty()) {
        messageList.clear();
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:58,代码来源:HUDHandler.java

示例14: getPlayerHackLevel

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private int getPlayerHackLevel(EntityPlayer player) {
    ItemStack armorStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
    return armorStack.getItem() == Itemss.PNEUMATIC_HELMET ? ItemPneumaticArmor.getUpgrades(EnumUpgrade.SECURITY, armorStack) : 0;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:5,代码来源:BlockSecurityStation.java

示例15: InventorySearch

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public InventorySearch(EntityPlayer player) {
    helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:4,代码来源:InventorySearch.java


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