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


Java BlockEnderChest类代码示例

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


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

示例1: getValidVanillaBlockRotations

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.field_150444_as || 
            block == Blocks.field_150472_an || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:29,代码来源:RotationHelper.java

示例2: onBlockRightClick

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
@SubscribeEvent
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event){
    if (event.getWorld().getBlockState(event.getPos()).getBlock() instanceof BlockEnderChest){
        event.setCanceled(true);
        event.getEntityPlayer().openGui(AdventureBags.instance, EnumIDs.GUI_ENDER_BACKPACK.ordinal(),event.getWorld(),(int)event.getEntityPlayer().posX,(int)event.getEntityPlayer().posY,(int)event.getEntityPlayer().posZ);
    }
}
 
开发者ID:RootsTeam,项目名称:AdventureBags,代码行数:8,代码来源:EventHandler.java

示例3: getValidVanillaBlockRotations

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || 
            block instanceof BlockPumpkin ||
            block instanceof BlockFenceGate || 
            block instanceof BlockEndPortalFrame || 
            block instanceof BlockTripWireHook || 
            block instanceof BlockCocoa || 
            block instanceof BlockRailPowered || 
            block instanceof BlockRailDetector || 
            block instanceof BlockStairs || 
            block instanceof BlockChest || 
            block instanceof BlockEnderChest || 
            block instanceof BlockFurnace || 
            block instanceof BlockLadder || 
            block == Blocks.wall_sign || 
            block == Blocks.standing_sign || 
            block instanceof BlockDoor || 
            block instanceof BlockRail ||
            block instanceof BlockButton || 
            block instanceof BlockRedstoneRepeater || 
            block instanceof BlockRedstoneComparator || 
            block instanceof BlockTrapDoor || 
            block instanceof BlockHugeMushroom || 
            block instanceof BlockVine || 
            block instanceof BlockSkull || 
            block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:29,代码来源:RotationHelper.java

示例4: set

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public static void set(IWorldEditor editor, Cardinal dir, Coord pos){
	
	EnumFacing facing = Arrays.asList(Cardinal.directions).contains(dir)
			? Cardinal.facing(Cardinal.reverse(dir))
			: Cardinal.facing(Cardinal.SOUTH);
	
	MetaBlock chest = new MetaBlock(Blocks.ENDER_CHEST);
	chest.withProperty(BlockEnderChest.FACING, facing);
	chest.set(editor, pos);
}
 
开发者ID:Greymerk,项目名称:minecraft-roguelike,代码行数:11,代码来源:EnderChest.java

示例5: drawBlockDamageTexture

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public void drawBlockDamageTexture(Tessellator tessellatorIn, WorldRenderer worldRendererIn, Entity entityIn, float partialTicks)
{
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;

    if (!this.damagedBlocks.isEmpty())
    {
        this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        this.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.markDirty();
        Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator();

        while (iterator.hasNext())
        {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double)blockpos.getX() - d0;
            double d4 = (double)blockpos.getY() - d1;
            double d5 = (double)blockpos.getZ() - d2;
            Block block = this.theWorld.getBlockState(blockpos).getBlock();

            if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull))
            {
                if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
                {
                    iterator.remove();
                }
                else
                {
                    IBlockState iblockstate = this.theWorld.getBlockState(blockpos);

                    if (iblockstate.getBlock().getMaterial() != Material.air)
                    {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
                        blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld);
                    }
                }
            }
        }

        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        this.postRenderDamagedBlocks();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:51,代码来源:RenderGlobal.java

示例6: drawBlockDamageTexture

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public void drawBlockDamageTexture(Tessellator tessellatorIn, WorldRenderer worldRendererIn, Entity entityIn, float partialTicks)
{
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;

    if (!this.damagedBlocks.isEmpty())
    {
        this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        this.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.markDirty();
        Iterator iterator = this.damagedBlocks.values().iterator();

        while (iterator.hasNext())
        {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double)blockpos.getX() - d0;
            double d4 = (double)blockpos.getY() - d1;
            double d5 = (double)blockpos.getZ() - d2;
            Block block = this.theWorld.getBlockState(blockpos).getBlock();
            boolean flag;

            if (Reflector.ForgeTileEntity_canRenderBreaking.exists())
            {
                boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;

                if (!flag1)
                {
                    TileEntity tileentity = this.theWorld.getTileEntity(blockpos);

                    if (tileentity != null)
                    {
                        flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]);
                    }
                }

                flag = !flag1;
            }
            else
            {
                flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull);
            }

            if (flag)
            {
                if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
                {
                    iterator.remove();
                }
                else
                {
                    IBlockState iblockstate = this.theWorld.getBlockState(blockpos);

                    if (iblockstate.getBlock().getMaterial() != Material.air)
                    {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
                        blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld);
                    }
                }
            }
        }

        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        this.postRenderDamagedBlocks();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:73,代码来源:RenderGlobal.java

示例7: drawBlockDamageTexture

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks)
{
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;

    if (!this.damagedBlocks.isEmpty())
    {
        this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.noColor();
        Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator();

        while (iterator.hasNext())
        {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double)blockpos.getX() - d0;
            double d4 = (double)blockpos.getY() - d1;
            double d5 = (double)blockpos.getZ() - d2;
            Block block = this.theWorld.getBlockState(blockpos).getBlock();
            boolean flag;

            if (Reflector.ForgeTileEntity_canRenderBreaking.exists())
            {
                boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;

                if (!flag1)
                {
                    TileEntity tileentity = this.theWorld.getTileEntity(blockpos);

                    if (tileentity != null)
                    {
                        flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]);
                    }
                }

                flag = !flag1;
            }
            else
            {
                flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull);
            }

            if (flag)
            {
                if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
                {
                    iterator.remove();
                }
                else
                {
                    IBlockState iblockstate = this.theWorld.getBlockState(blockpos);

                    if (iblockstate.getMaterial() != Material.AIR)
                    {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
                        blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld);
                    }
                }
            }
        }

        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        this.postRenderDamagedBlocks();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:73,代码来源:RenderGlobal.java

示例8: drawBlockDamageTexture

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks)
{
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;

    if (!this.damagedBlocks.isEmpty())
    {
        this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.noColor();
        Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator();

        while (iterator.hasNext())
        {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double)blockpos.getX() - d0;
            double d4 = (double)blockpos.getY() - d1;
            double d5 = (double)blockpos.getZ() - d2;
            Block block = this.theWorld.getBlockState(blockpos).getBlock();
            TileEntity te = this.theWorld.getTileEntity(blockpos);
            boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
            if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();

            if (!hasBreak)
            {
                if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
                {
                    iterator.remove();
                }
                else
                {
                    IBlockState iblockstate = this.theWorld.getBlockState(blockpos);

                    if (iblockstate.getMaterial() != Material.AIR)
                    {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
                        blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld);
                    }
                }
            }
        }

        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        this.postRenderDamagedBlocks();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:54,代码来源:RenderGlobal.java

示例9: onItemUse

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
        return EnumActionResult.SUCCESS;

    IBlockState state = worldIn.getBlockState(pos);

    ItemStack stack = playerIn.getHeldItem(hand);
    int id = Enderthing.getIdFromItem(stack);

    Block b = state.getBlock();

    TileEntity te = worldIn.getTileEntity(pos);

    if (b == Blocks.ENDER_CHEST)
    {
        worldIn.setBlockState(pos, Enderthing.enderKeyChest.getDefaultState()
                .withProperty(BlockEnderKeyChest.FACING, state.getValue(BlockEnderChest.FACING))
                .withProperty(BlockEnderKeyChest.PRIVATE, (stack.getMetadata() & 1) != 0));

        te = worldIn.getTileEntity(pos);

        if (te instanceof TileEnderKeyChest)
        {
            ((TileEnderKeyChest) te).setInventoryId(id);
        }

        if (!playerIn.capabilities.isCreativeMode)
            stack.grow(-1);

        return EnumActionResult.SUCCESS;
    }

    if (b == Enderthing.enderKeyChest)
    {
        boolean oldPrivate = state.getValue(BlockEnderKeyChest.PRIVATE);
        if (te instanceof TileEnderKeyChest)
        {
            int oldId = ((TileEnderKeyChest) te).getInventoryId();
            ItemStack oldStack = Enderthing.getLock(oldId, oldPrivate);

            InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), oldStack);
        }

        boolean newPrivate = stack.getMetadata() != 0;

        if (oldPrivate != newPrivate)
        {
            worldIn.setBlockState(pos, state.withProperty(BlockEnderKeyChest.PRIVATE, newPrivate));
            te = worldIn.getTileEntity(pos);
        }

        if (te instanceof TileEnderKeyChest)
        {
            ((TileEnderKeyChest) te).setInventoryId(id >> 4);
        }

        if (!playerIn.capabilities.isCreativeMode)
            stack.grow(-1);

        return EnumActionResult.SUCCESS;
    }

    return EnumActionResult.PASS;
}
 
开发者ID:gigaherz,项目名称:Enderthing,代码行数:67,代码来源:ItemEnderLock.java

示例10: getBlockType

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
private static BlockType getBlockType(Block block) {

    if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
        || block instanceof BlockCocoa) {
      return BlockType.BED;
    }
    if(block instanceof BlockRail) {
      return BlockType.RAIL;
    }
    if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
      return BlockType.RAIL_POWERED;
    }
    if(block instanceof BlockStairs) {
      return BlockType.STAIR;
    }
    if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
        || block == Blocks.wall_sign) {
      return BlockType.CHEST;
    }
    if(block == Blocks.standing_sign) {
      return BlockType.SIGNPOST;
    }
    if(block instanceof BlockDoor) {
      return BlockType.DOOR;
    }
    if(block instanceof BlockButton) {
      return BlockType.BUTTON;
    }
    if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
      return BlockType.REDSTONE_REPEATER;
    }
    if(block instanceof BlockTrapDoor) {
      return BlockType.TRAPDOOR;
    }
    if(block instanceof BlockHugeMushroom) {
      return BlockType.MUSHROOM_CAP;
    }
    if(block instanceof BlockVine) {
      return BlockType.VINE;
    }
    if(block instanceof BlockSkull) {
      return BlockType.SKULL;
    }
    if(block instanceof BlockAnvil) {
      return BlockType.ANVIL;
    }
    if(block instanceof BlockLog) {
      return BlockType.LOG;
    }
    if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
      return BlockType.DISPENSER;
    }
    if(block instanceof BlockTorch) {
      return BlockType.TORCH;
    }
    if(block instanceof BlockLever) {
      return BlockType.LEVER;
    }
    if(block instanceof BlockTripWireHook) {
      return BlockType.TRIP_WIRE_HOOK;
    }
    
    return null;
  }
 
开发者ID:SleepyTrousers,项目名称:Structures,代码行数:65,代码来源:RotationHelper.java

示例11: getValidVanillaBlockRotations

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
{
    return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:5,代码来源:RotationHelper.java

示例12: onItemRightClick

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
/**public String getTextureFile()
{
	return CommonProxy.ITEMS_PNG;
}**/

public ItemStack onItemRightClick(ItemStack myStack, World myWorld, EntityPlayer myPlayer) 
{
	if (!myWorld.isRemote)
	{
		if(!myPlayer.isSneaking())
		{
		    openGui(0, myPlayer, (int)myPlayer.posX, (int)myPlayer.posY, (int)myPlayer.posZ);
		    //myPlayer.openGui(AdvancedBackpackMod.instance, 0, myPlayer.worldObj, (int)myPlayer.posX, (int)myPlayer.posY, (int)myPlayer.posZ);
		}
		else
		{
			//System.out.println("player is sneaking, use shared inventory mode for backpackbase");
			MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(myWorld, myPlayer, true);
			if (movingobjectposition != null)
			{
				if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
	            {
	                int i = movingobjectposition.blockX;
	                int j = movingobjectposition.blockY;
	                int k = movingobjectposition.blockZ;
	                
	               if (myWorld.getBlockTileEntity(i, j, k) != null)
	               {
	            	   if (BlockContainer.class.isAssignableFrom(((Object)myWorld.getBlockTileEntity(i,  j, k).getBlockType()).getClass()))
	            	   {
	            		   //System.out.println("this is a subclass of BlockContainer");
	            		   try 
	            		   {
	            			   IInventory testInv = (IInventory) myWorld.getBlockTileEntity(i, j, k);
	            			   //System.out.println(Block.blocksList[myWorld.getBlockId(i, j, k)].getUnlocalizedName());
	            			   //System.out.println(Block.blocksList[myWorld.getBlockId(i, j, k)].getLocalizedName());
		            		   //System.out.println("inventory size = " + testInv.getSizeInventory());
		            		   if (checkContainer(Block.blocksList[myWorld.getBlockId(i, j, k)].getUnlocalizedName()))
		            		   {
		            		       openGui(1, myPlayer, i, j, k);
		            		   }
	            		   }
	            		   catch(ClassCastException e)
	            		   {
	            			   //System.out.println("has no IInventory");
	            			   //System.out.println(myWorld.getBlockTileEntity(i,  j, k));
	            			   //System.out.println(myWorld.getBlockTileEntity(i, j, k).getBlockType());
	            			   //System.out.println(myWorld.getBlockTileEntity(i, j, k).getBlockType().getClass());
	            		   }
	            		   if (BlockEnderChest.class.isAssignableFrom(((Object)myWorld.getBlockTileEntity(i,  j, k).getBlockType()).getClass()))
	            		   {
	            		       //System.out.println("this is a vanilla enderchest");
	            		       openGui(2, myPlayer, i, j, k);
	            		   }
	            	   }

	               }
	               else
	               {
	                   //System.out.println("has no tileentity");
	               }
	            }
			}
		}
	}		
	return myStack;
}
 
开发者ID:Mr-J,项目名称:AdvancedBackpackMod,代码行数:68,代码来源:ItemBackpackBase.java

示例13: drawBlockDamageTexture

import net.minecraft.block.BlockEnderChest; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer vertexBuffer, Entity entityIn, float partialTicks, World world, List<BlockPos> blocks) {
   	double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks;
   	double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks;
   	double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks;

   	TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
   	float curBlockDamageMP = ObfuscationReflectionHelper.getPrivateValue(PlayerControllerMP.class, Minecraft.getMinecraft().playerController, 4);
   	int progress = (int) (curBlockDamageMP * 10f) - 1; // 0-10

   	if(progress < 0) {
   		return;
   	}

   	renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
   	//preRenderDamagedBlocks BEGIN
   	GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0);
   	GlStateManager.enableBlend();
   	GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
   	GlStateManager.doPolygonOffset(-3.0F, -3.0F);
   	GlStateManager.enablePolygonOffset();
   	GlStateManager.alphaFunc(516, 0.1F);
   	GlStateManager.enableAlpha();
   	GlStateManager.pushMatrix();
   	//preRenderDamagedBlocks END

   	vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
   	vertexBuffer.setTranslation(-d0, -d1, -d2);
   	vertexBuffer.noColor();

   	for(BlockPos blockpos : blocks) {
   		blockpos.getX();
   		blockpos.getY();
   		blockpos.getZ();
   		Block block = world.getBlockState(blockpos).getBlock();
   		TileEntity te = world.getTileEntity(blockpos);
   		boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest
   				|| block instanceof BlockSign || block instanceof BlockSkull;
   		if(!hasBreak) {
   			hasBreak = te != null && te.canRenderBreaking();
   		}

   		if(!hasBreak) {
   			IBlockState iblockstate = world.getBlockState(blockpos);

   			if(iblockstate.getBlock().getMaterial(iblockstate) != Material.AIR) {
   				TextureAtlasSprite textureatlassprite = RenderUtil.getSprite("minecraft:blocks/destroy_stage_"+progress)/*ClientProxy.destroyBlockIcons[progress]*/;
   				BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
   				blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, world);
   			}
   		}
   	}

   	tessellatorIn.draw();
   	vertexBuffer.setTranslation(0.0D, 0.0D, 0.0D);
   	// postRenderDamagedBlocks BEGIN
   	GlStateManager.disableAlpha();
   	GlStateManager.doPolygonOffset(0.0F, 0.0F);
   	GlStateManager.disablePolygonOffset();
   	GlStateManager.enableAlpha();
   	GlStateManager.depthMask(true);
   	GlStateManager.popMatrix();
   	// postRenderDamagedBlocks END
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:65,代码来源:ClientEventHandler.java


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