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


Java ContainerPlayer类代码示例

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


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

示例1: deserialize

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public void deserialize(NBTTagCompound compound, EntityPlayer player) {
    this.originalHealth = compound.getFloat("OriginalHealth");
    this.originalHunger = compound.getInteger("OriginalHunger");
    this.originalSaturation = compound.getFloat("OriginalSaturation");
    this.isPossessing = compound.getBoolean("IsPossessing");
    this.possessAnimation = compound.getInteger("PossessAnimation");
    this.originalX = compound.getDouble("OriginalX");
    this.originalY = compound.getDouble("OriginalY");
    this.originalZ = compound.getDouble("OriginalZ");
    NBTTagList originalInventoryTag = compound.getTagList("OriginalInventory", Constants.NBT.TAG_COMPOUND);
    this.originalInventory = new InventoryPlayer(player);
    this.originalInventory.readFromNBT(originalInventoryTag);
    this.originalInventoryContainer = new ContainerPlayer(this.originalInventory, !player.worldObj.isRemote, player);
    NBTTagList handlerList = compound.getTagList("Handlers", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < handlerList.tagCount(); i++) {
        NBTTagCompound handlerTag = handlerList.getCompoundTagAt(i);
        try {
            EntityPossessHandler possessHandler = PossessHandler.getPossessHandler(new ResourceLocation(handlerTag.getString("Identifier")));
            possessHandler.deserialize(player, handlerTag);
        } catch (Exception e) {
            System.err.println("Failed to load possess handler: " + handlerTag + "! Skipping.");
            e.printStackTrace();
        }
    }
}
 
开发者ID:Fararise,项目名称:Possessed,代码行数:26,代码来源:PossessivePlayer.java

示例2: onUpdate

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
@Override
public void onUpdate(ItemStack itemstack, World world, Entity entity, int metadata, boolean bool) {
	if (itemstack.getTagCompound() == null) {
		itemstack.setTagCompound(new NBTTagCompound());
	}

	if (world.isRemote || !bool) {
		return;
	}

	if (((EntityPlayer) entity).openContainer == null || ((EntityPlayer) entity).openContainer instanceof ContainerPlayer) {
		return;
	}
	if (((EntityPlayer) entity).openContainer instanceof ContainerTeambattleBackpack) {

		ContainerTeambattleBackpack myContainer = (ContainerTeambattleBackpack) ((EntityPlayer) entity).openContainer;
		if (myContainer.updateNotification) {
			myContainer.saveToNBT(itemstack);
			myContainer.updateNotification = false;
		}
	}
}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:23,代码来源:ItemTeambattleBackpack.java

示例3: transferStackInSlot

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
@Hook("net.minecraft.inventory.ContainerPlayer#func_82846_b")
public static final Hook.Result transferStackInSlot(ContainerPlayer container, EntityPlayer player, int index) {
	Slot slot = container.inventorySlots.get(index);
	int id = container.inventorySlots.size();
	if (slot != null && slot.getHasStack()) {
		ItemStack item = slot.getStack();
		if (item.getItem() instanceof IBauble && container.mergeItemStack(item, id - AlchemyBaubles.getBaublesSize(), id, false)) {
			if (item.getCount() == 0)
				slot.putStack(ItemStack.EMPTY);
			else
				slot.onSlotChanged();
			return new Hook.Result(ItemStack.EMPTY);
		}
	}
	return Hook.Result.VOID;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:17,代码来源:CapabilityBauble.java

示例4: syncInventory

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
private void syncInventory(ItemStack stack, int slot)
{
    float checkSize = 5.0F;
    List list = this.owner.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox((float) this.owner.xCoord - checkSize, (float) this.owner.yCoord - checkSize, (float) this.owner.zCoord - checkSize, (float) this.owner.xCoord + 1 + checkSize, (float) this.owner.yCoord + 1 + checkSize, (float) this.owner.zCoord + 1 + checkSize));

    for (Object aList : list)
    {
        EntityPlayer player = (EntityPlayer) aList;
        if (!(player.openContainer instanceof ContainerPlayer))
        {
            for (Slot invSlot : (List<Slot>) player.openContainer.inventorySlots)
            {
                if (invSlot.inventory == inventory && invSlot.slotIndex == slot)
                {
                    ((EntityPlayerMP) player).sendSlotContents(player.openContainer, slot, stack);
                    return;
                }
            }
        }
    }
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:22,代码来源:SortingInventoryHandler.java

示例5: GuiInventoryChooseItem

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public GuiInventoryChooseItem(EnumHandSide handSide, TimelineItemController controller, EntityObj entity)
{
    super(Minecraft.getMinecraft().player);
    this.allowUserInput = true;
    this.controller = controller;
    this.entity = entity;
    this.handSide = handSide;
    this.func_194310_f().func_194303_a(this.width, this.height, Minecraft.getMinecraft(), false, ((ContainerPlayer)this.inventorySlots).craftMatrix);
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:10,代码来源:GuiInventoryChooseItem.java

示例6: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.entityUniqueID = getUUID(gameProfileIn);
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:EntityPlayer.java

示例7: getGridItem

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public static ItemStack getGridItem(int nr) {
    GuiContainer menu = (GuiContainer)getMenu();
    Container slots = menu.inventorySlots;

    if (menu instanceof GuiCrafting) {
        return ((ContainerWorkbench)slots).craftMatrix.getStackInSlot(nr);
    } else if (menu instanceof GuiInventory) {
        return ((ContainerPlayer)slots).craftMatrix.getStackInSlot(nr);
    }

    return null;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:13,代码来源:ZWrapper.java

示例8: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.setUniqueId(getUUID(gameProfileIn));
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.unused180 = 180.0F;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:12,代码来源:EntityPlayer.java

示例9: replaceTotem

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public void replaceTotem(int inventoryIndex) {
    if (Wrapper.getPlayer().openContainer instanceof ContainerPlayer) {
        Wrapper.getMinecraft().playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, Wrapper.getPlayer());
        Wrapper.getMinecraft().playerController.windowClick(0, 45, 0, ClickType.PICKUP, Wrapper.getPlayer());
        Wrapper.getMinecraft().playerController.windowClick(0, inventoryIndex < 9 ? inventoryIndex + 36 : inventoryIndex, 0, ClickType.PICKUP, Wrapper.getPlayer());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:AutoTotem.java

示例10: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World worldIn, GameProfile gameProfileIn)
{
    super(worldIn);
    this.setUniqueId(getUUID(gameProfileIn));
    this.gameProfile = gameProfileIn;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this);
    this.openContainer = this.inventoryContainer;
    BlockPos blockpos = worldIn.getSpawnPoint();
    this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
    this.unused180 = 180.0F;
    this.fireResistance = 20;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:EntityPlayer.java

示例11: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_)
{
	super(p_i45324_1_);
	this.entityUniqueID = func_146094_a(p_i45324_2_);
	this.field_146106_i = p_i45324_2_;
	this.inventoryContainer = new ContainerPlayer(this.inventory, !p_i45324_1_.isRemote, this);
	this.openContainer = this.inventoryContainer;
	this.yOffset = 1.62F;
	ChunkCoordinates chunkcoordinates = p_i45324_1_.getSpawnPoint();
	setLocationAndAngles(chunkcoordinates.posX + 0.5D, chunkcoordinates.posY + 1, chunkcoordinates.posZ + 0.5D, 0.0F, 0.0F);
	this.field_70741_aB = 180.0F;
	this.fireResistance = 20;
	this.eyeHeight = getDefaultEyeHeight();
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:15,代码来源:EntityPlayer.java

示例12: init_ContainerPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
@Hook(value = "net.minecraft.inventory.ContainerPlayer#<init>", type = Hook.Type.TAIL)
public static final void init_ContainerPlayer(ContainerPlayer container, InventoryPlayer inventory, boolean localWorld, EntityPlayer player) {
	InventoryBauble baubles = player.getCapability(AlchemyCapabilityLoader.bauble, null);
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.HEAD,   4, 77, 8 + 0 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.BODY,   5, 77, 8 + 1 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.CHARM,  6, 77, 8 + 2 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.AMULET, 0, 80 + 18 * 1, 8 + 3 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.RING,   1, 80 + 18 * 2, 8 + 3 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.RING,   2, 80 + 18 * 3, 8 + 3 * 18));
	container.addSlotToContainer(new InventoryBauble.SlotBauble(player, baubles, BaubleType.BELT,   3, 80 + 18 * 4, 8 + 3 * 18));
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:12,代码来源:CapabilityBauble.java

示例13: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_)
{
    super(p_i45324_1_);
    this.entityUniqueID = func_146094_a(p_i45324_2_);
    this.field_146106_i = p_i45324_2_;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !p_i45324_1_.isClient, this);
    this.openContainer = this.inventoryContainer;
    this.yOffset = 1.62F;
    ChunkCoordinates var3 = p_i45324_1_.getSpawnPoint();
    this.setLocationAndAngles((double)var3.posX + 0.5D, (double)(var3.posY + 1), (double)var3.posZ + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:14,代码来源:EntityPlayer.java

示例14: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_)
{
    super(p_i45324_1_);
    this.entityUniqueID = func_146094_a(p_i45324_2_);
    this.field_146106_i = p_i45324_2_;
    this.inventoryContainer = new ContainerPlayer(this.inventory, !p_i45324_1_.isRemote, this);
    this.openContainer = this.inventoryContainer;
    this.yOffset = 1.62F;
    ChunkCoordinates chunkcoordinates = p_i45324_1_.getSpawnPoint();
    this.setLocationAndAngles((double)chunkcoordinates.posX + 0.5D, (double)(chunkcoordinates.posY + 1), (double)chunkcoordinates.posZ + 0.5D, 0.0F, 0.0F);
    this.field_70741_aB = 180.0F;
    this.fireResistance = 20;
    this.eyeHeight = this.getDefaultEyeHeight();
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:15,代码来源:EntityPlayer.java

示例15: EntityPlayer

import net.minecraft.inventory.ContainerPlayer; //导入依赖的package包/类
public EntityPlayer(World p_i1752_1_, String p_i1752_2_) {
   super(p_i1752_1_);
   this.field_71092_bJ = p_i1752_2_;
   this.field_71069_bz = new ContainerPlayer(this.field_71071_by, !p_i1752_1_.field_72995_K, this);
   this.field_71070_bA = this.field_71069_bz;
   this.field_70129_M = 1.62F;
   ChunkCoordinates var3 = p_i1752_1_.func_72861_E();
   this.func_70012_b((double)var3.field_71574_a + 0.5D, (double)(var3.field_71572_b + 1), (double)var3.field_71573_c + 0.5D, 0.0F, 0.0F);
   this.field_70741_aB = 180.0F;
   this.field_70174_ab = 20;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:12,代码来源:EntityPlayer.java


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