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


Java ItemElytra类代码示例

本文整理汇总了Java中net.minecraft.item.ItemElytra的典型用法代码示例。如果您正苦于以下问题:Java ItemElytra类的具体用法?Java ItemElytra怎么用?Java ItemElytra使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateElytra

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
@SuppressWarnings("unused")
private void updateElytra() {
	boolean flag = getFlag(7);
	if (flag && !onGround && !isRiding()) {
		ItemStack item = getFormLiving0(this);
		if (item.getItem() == Items.ELYTRA && ItemElytra.isUsable(item)) {
			flag = true;
			if (!world.isRemote && (ticksElytraFlying + 1) % 20 == 0)
				item.damageItem(1, this);
		} else
			flag = false;
	} else
		flag = false;
	if (!world.isRemote)
		setFlag(7, flag);
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:17,代码来源:ExItemElytra.java

示例2: processEntityAction

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
@Hook("net.minecraft.network.NetHandlerPlayServer#func_147357_a")
public static Hook.Result processEntityAction(NetHandlerPlayServer handler, CPacketEntityAction action) {
	if (action.getAction() == Action.START_FALL_FLYING) {
		PacketThreadUtil.checkThreadAndEnqueue(action, handler, handler.player.getServerWorld());
		handler.player.markPlayerActive();
		if (!handler.player.onGround && handler.player.motionY < 0.0D &&
				!handler.player.isElytraFlying() && !handler.player.isInWater()) {
			ItemStack item = getFormLiving0(handler.player);
			if (item.getItem() == Items.ELYTRA && ItemElytra.isUsable(item))
				handler.player.setElytraFlying();
		} else
			handler.player.clearElytraFlying();
		return Hook.Result.NULL;
	}
	return Hook.Result.VOID;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:17,代码来源:ExItemElytra.java

示例3: acceptStack

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
/**
 * Checks whether the given entity accepts an item for a certain slot
 * 
 * @param entity the entity
 * @param slot the slot to check
 * @param stack the item to check
 * @return whether the entity accepts that item for the slot
 */
private static boolean acceptStack(Entity entity, EntityEquipmentSlot slot, ItemStack stack) {
	if (entity instanceof EntityArmorStand || entity instanceof EntityLiving) {
		if (stack != ItemStack.EMPTY && !EntityLiving.isItemStackInSlot(slot, stack) && slot != EntityEquipmentSlot.HEAD) return false;
		else return true;
	}
	else if (entity instanceof EntityPlayer) {
		if (slot.getSlotType() == EntityEquipmentSlot.Type.ARMOR && stack != ItemStack.EMPTY && stack.getItem() != null) {
			if (!(stack.getItem() instanceof ItemArmor) && !(stack.getItem() instanceof ItemElytra)) {
				if (slot != EntityEquipmentSlot.HEAD) return false;
				else return true;
			}
			else if (EntityLiving.getSlotForItemStack(stack) != slot) return false;
			else return true;
		}
		else return true;
	}
	else return true;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:27,代码来源:TargetSelector.java

示例4: updateElytra

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
/**
 * Called each tick. Updates state for the elytra.
 */
private void updateElytra()
{
    boolean flag = this.getFlag(7);

    if (flag && !this.onGround && !this.isRiding())
    {
        ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

        if (itemstack.getItem() == Items.ELYTRA && ItemElytra.isBroken(itemstack))
        {
            flag = true;

            if (!this.world.isRemote && (this.ticksElytraFlying + 1) % 20 == 0)
            {
                itemstack.damageItem(1, this);
            }
        }
        else
        {
            flag = false;
        }
    }
    else
    {
        flag = false;
    }

    if (!this.world.isRemote)
    {
        this.setFlag(7, flag);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:EntityLivingBase.java

示例5: updateElytra

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
/**
 * Called each tick. Updates state for the elytra.
 */
private void updateElytra()
{
    boolean flag = this.getFlag(7);

    if (flag && !this.onGround && !this.isRiding())
    {
        ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

        if (itemstack != null && itemstack.getItem() == Items.ELYTRA && ItemElytra.isBroken(itemstack))
        {
            flag = true;

            if (!this.worldObj.isRemote && (this.ticksElytraFlying + 1) % 20 == 0)
            {
                itemstack.damageItem(1, this);
            }
        }
        else
        {
            flag = false;
        }
    }
    else
    {
        flag = false;
    }

    if (!this.worldObj.isRemote)
    {
        this.setFlag(7, flag);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:EntityLivingBase.java

示例6: onLivingUpdate_tail

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
@Hook(value = "net.minecraft.client.entity.EntityPlayerSP#func_70636_d", type = Type.TAIL)
public static void onLivingUpdate_tail(EntityPlayerSP player) {
	ItemStack item = getFormLiving0(player);
	KeyBinding jump = Minecraft.getMinecraft().gameSettings.keyBindJump;
	boolean flag = Keyboard.isKeyDown(jump.getKeyCode());
	if (item.getItem() == Items.ELYTRA) {
		if (flag && jump.getKeyConflictContext().isActive() && !HookClient.flag &&
				player.motionY < 0.0D && !player.isElytraFlying() && !player.capabilities.isFlying)
			if (ItemElytra.isUsable(item))
				player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING));
	}
	HookClient.flag = flag;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:14,代码来源:ExItemElytra.java

示例7: canApply

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
@Override
public boolean canApply(ItemStack stack) {
  //anything that goes on your feet
  boolean yes = stack.getItem() == Items.BOOK ||
      stack.getItem() instanceof ItemElytra ||
      (stack.getItem() instanceof ItemArmor)
          && ((ItemArmor) stack.getItem()).armorType == EntityEquipmentSlot.FEET;
  return yes;
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:10,代码来源:EnchantLaunch.java

示例8: shouldExecute

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
@Override
public boolean shouldExecute() {        
    // don't catch if leashed
    if (dragon.getLeashed()) {
        return false;
    }
    
    owner = (EntityPlayer) dragon.getOwner();
    
    // don't catch if ownerless 
    if (owner == null) {
        return false;
    }
    
    // no point in catching players in creative mode
    if (owner.capabilities.isCreativeMode) {
        return false;
    }
    
    // don't catch if already being ridden
    if (dragon.isPassenger(owner)) {
        return false;
    }
    
    // don't catch if owner has a working Elytra equipped
    // note: isBroken() is misleading, it actually checks if the items is usable
    ItemStack itemStack = owner.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
    if (itemStack != null && itemStack.getItem() == Items.ELYTRA && ItemElytra.isBroken(itemStack)) {
        return false;
    }
    
    // don't catch if owner is too far away
    double followRange = getFollowRange();
    if (dragon.getDistanceToEntity(owner) > followRange) {
        return false;
    }
            
    return owner.fallDistance > 4;
}
 
开发者ID:ata4,项目名称:dragon-mounts,代码行数:40,代码来源:EntityAIDragonCatchOwner.java

示例9: replaceItemInInventory

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
    if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.size())
    {
        this.inventory.setInventorySlotContents(inventorySlot, itemStackIn);
        return true;
    }
    else
    {
        EntityEquipmentSlot entityequipmentslot;

        if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.HEAD;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.CHEST;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.LEGS;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.FEET.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.FEET;
        }
        else
        {
            entityequipmentslot = null;
        }

        if (inventorySlot == 98)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, itemStackIn);
            return true;
        }
        else if (inventorySlot == 99)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, itemStackIn);
            return true;
        }
        else if (entityequipmentslot == null)
        {
            int i = inventorySlot - 200;

            if (i >= 0 && i < this.theInventoryEnderChest.getSizeInventory())
            {
                this.theInventoryEnderChest.setInventorySlotContents(i, itemStackIn);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            if (!itemStackIn.func_190926_b())
            {
                if (!(itemStackIn.getItem() instanceof ItemArmor) && !(itemStackIn.getItem() instanceof ItemElytra))
                {
                    if (entityequipmentslot != EntityEquipmentSlot.HEAD)
                    {
                        return false;
                    }
                }
                else if (EntityLiving.getSlotForItemStack(itemStackIn) != entityequipmentslot)
                {
                    return false;
                }
            }

            this.inventory.setInventorySlotContents(entityequipmentslot.getIndex() + this.inventory.mainInventory.size(), itemStackIn);
            return true;
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:79,代码来源:EntityPlayer.java

示例10: replaceItemInInventory

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
    if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.length)
    {
        this.inventory.setInventorySlotContents(inventorySlot, itemStackIn);
        return true;
    }
    else
    {
        EntityEquipmentSlot entityequipmentslot;

        if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.HEAD;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.CHEST;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.LEGS;
        }
        else if (inventorySlot == 100 + EntityEquipmentSlot.FEET.getIndex())
        {
            entityequipmentslot = EntityEquipmentSlot.FEET;
        }
        else
        {
            entityequipmentslot = null;
        }

        if (inventorySlot == 98)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, itemStackIn);
            return true;
        }
        else if (inventorySlot == 99)
        {
            this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, itemStackIn);
            return true;
        }
        else if (entityequipmentslot == null)
        {
            int i = inventorySlot - 200;

            if (i >= 0 && i < this.theInventoryEnderChest.getSizeInventory())
            {
                this.theInventoryEnderChest.setInventorySlotContents(i, itemStackIn);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            if (itemStackIn != null && itemStackIn.getItem() != null)
            {
                if (!(itemStackIn.getItem() instanceof ItemArmor) && !(itemStackIn.getItem() instanceof ItemElytra))
                {
                    if (entityequipmentslot != EntityEquipmentSlot.HEAD)
                    {
                        return false;
                    }
                }
                else if (EntityLiving.getSlotForItemStack(itemStackIn) != entityequipmentslot)
                {
                    return false;
                }
            }

            this.inventory.setInventorySlotContents(entityequipmentslot.getIndex() + this.inventory.mainInventory.length, itemStackIn);
            return true;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:79,代码来源:EntityPlayer.java

示例11: processEntityAction

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
/**
 * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump
 * height of the horse the player is riding
 */
public void processEntityAction(CPacketEntityAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    switch (packetIn.getAction())
    {
        case START_SNEAKING:
            this.playerEntity.setSneaking(true);
            break;
        case STOP_SNEAKING:
            this.playerEntity.setSneaking(false);
            break;
        case START_SPRINTING:
            this.playerEntity.setSprinting(true);
            break;
        case STOP_SPRINTING:
            this.playerEntity.setSprinting(false);
            break;
        case STOP_SLEEPING:
            this.playerEntity.wakeUpPlayer(false, true, true);
            this.targetPos = new Vec3d(this.playerEntity.posX, this.playerEntity.posY, this.playerEntity.posZ);
            break;
        case START_RIDING_JUMP:

            if (this.playerEntity.getRidingEntity() instanceof IJumpingMount)
            {
                IJumpingMount ijumpingmount1 = (IJumpingMount)this.playerEntity.getRidingEntity();
                int i = packetIn.getAuxData();

                if (ijumpingmount1.canJump() && i > 0)
                {
                    ijumpingmount1.handleStartJump(i);
                }
            }

            break;
        case STOP_RIDING_JUMP:

            if (this.playerEntity.getRidingEntity() instanceof IJumpingMount)
            {
                IJumpingMount ijumpingmount = (IJumpingMount)this.playerEntity.getRidingEntity();
                ijumpingmount.handleStopJump();
            }

            break;
        case OPEN_INVENTORY:

            if (this.playerEntity.getRidingEntity() instanceof EntityHorse)
            {
                ((EntityHorse)this.playerEntity.getRidingEntity()).openGUI(this.playerEntity);
            }

            break;
        case START_FALL_FLYING:

            if (!this.playerEntity.onGround && this.playerEntity.motionY < 0.0D && !this.playerEntity.isElytraFlying() && !this.playerEntity.isInWater())
            {
                ItemStack itemstack = this.playerEntity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);

                if (itemstack != null && itemstack.getItem() == Items.ELYTRA && ItemElytra.isBroken(itemstack))
                {
                    this.playerEntity.setElytraFlying();
                }
            }
            else
            {
                this.playerEntity.clearElytraFlying();
            }

            break;
        default:
            throw new IllegalArgumentException("Invalid client command!");
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:80,代码来源:NetHandlerPlayServer.java

示例12: render

import net.minecraft.item.ItemElytra; //导入依赖的package包/类
private void render(EntityPlayer player, double x, double y, double z, float delta) {
	if (!hasCape(player)) {
		return;
	}
	if (player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() instanceof ItemElytra) {
		return;
	}
	Tessellator tes = Tessellator.getInstance();
	BufferBuilder buf = tes.getBuffer();
	buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
	buf.setTranslation(x, y, z);
	for (Quad quad : quads) {
		Quad.Vertex v00 = quad.getV00();
		Quad.Vertex v01 = quad.getV01();
		Quad.Vertex v11 = quad.getV11();
		Quad.Vertex v10 = quad.getV10();
		float v00x = v00.getX(delta);
		float v00y = v00.getY(delta);
		float v00z = v00.getZ(delta);
		float v01x = v01.getX(delta);
		float v01y = v01.getY(delta);
		float v01z = v01.getZ(delta);
		float v11x = v11.getX(delta);
		float v11y = v11.getY(delta);
		float v11z = v11.getZ(delta);
		float v10x = v10.getX(delta);
		float v10y = v10.getY(delta);
		float v10z = v10.getZ(delta);
		float nx = (v11y - v00y) * (v10z - v01z) - (v11z - v00z) * (v10y - v01y);
		float ny = (v10x - v01x) * (v11z - v00z) - (v10z - v01z) * (v11x - v00x);
		float nz = (v11x - v00x) * (v10y - v01y) - (v11y - v00y) * (v10x - v01x);
		float len = MathHelper.sqrt(nx * nx + ny * ny + nz * nz);
		nx /= len;
		ny /= len;
		nz /= len;
		buf.pos(v00x, v00y, v00z)
				.tex(v00.getU(), v00.getV())
				.normal(nx, ny, nz)
				.endVertex();
		buf.pos(v01x, v01y, v01z)
				.tex(v01.getU(), v01.getV())
				.normal(nx, ny, nz)
				.endVertex();
		buf.pos(v11x, v11y, v11z)
				.tex(v11.getU(), v11.getV())
				.normal(nx, ny, nz)
				.endVertex();
		buf.pos(v10x, v10y, v10z)
				.tex(v10.getU(), v10.getV())
				.normal(nx, ny, nz)
				.endVertex();
	}
	buf.setTranslation(0, 0, 0);
	GlStateManager.color(1, 1, 1);
	GlStateManager.disableCull();
	GlStateManager.enableBlend();
	GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);

	ItemStack stack = BaublesSupport.getItem(player, ModItems.CAPE);
	String cape = null;

	if (LibrarianLib.PROXY.getResource(Wizardry.MODID, "textures/capes/cape_" + player.getUniqueID().toString().replace("-", "") + ".png") == null) {
		UUID uuid = ItemNBTHelper.getUUID(stack, "uuid");
		if (uuid != null) {
			RandUtilSeed seed = new RandUtilSeed(uuid.hashCode());
			cape = "cape_normal_" + seed.nextInt(1, 4);
		}
	} else {
		cape = "cape_" + player.getUniqueID().toString().replace("-", "");
	}

	Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Wizardry.MODID, "textures/capes/" + cape + ".png"));

	tes.draw();
	GlStateManager.enableCull();
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:77,代码来源:CapeHandler.java


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