Java 类net.minecraft.tileentity.TileEntityShulkerBox 实例源码

项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:ModelAdapterShulkerBox.java   
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize)
{
    TileEntityRendererDispatcher tileentityrendererdispatcher = TileEntityRendererDispatcher.instance;
    TileEntitySpecialRenderer tileentityspecialrenderer = tileentityrendererdispatcher.getSpecialRendererByClass(TileEntityShulkerBox.class);

    if (!(tileentityspecialrenderer instanceof TileEntityShulkerBoxRenderer))
    {
        return null;
    }
    else
    {
        if (tileentityspecialrenderer.getEntityClass() == null)
        {
            tileentityspecialrenderer = new TileEntityShulkerBoxRenderer((ModelShulker)modelBase);
            tileentityspecialrenderer.setRendererDispatcher(tileentityrendererdispatcher);
        }

        if (!Reflector.TileEntityShulkerBoxRenderer_model.exists())
        {
            Config.warn("Field not found: TileEntityShulkerBoxRenderer.model");
            return null;
        }
        else
        {
            Reflector.setFieldValue(tileentityspecialrenderer, Reflector.TileEntityShulkerBoxRenderer_model, modelBase);
            return tileentityspecialrenderer;
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
    this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:Backmemed    文件:Bootstrap.java   
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    Block block = Block.getBlockFromItem(stack.getItem());
    World world = source.getWorld();
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    BlockPos blockpos = source.getBlockPos().offset(enumfacing);
    this.field_190911_b = world.func_190527_a(block, blockpos, false, EnumFacing.DOWN, (Entity)null);

    if (this.field_190911_b)
    {
        EnumFacing enumfacing1 = world.isAirBlock(blockpos.down()) ? enumfacing : EnumFacing.UP;
        IBlockState iblockstate = block.getDefaultState().withProperty(BlockShulkerBox.field_190957_a, enumfacing1);
        world.setBlockState(blockpos, iblockstate);
        TileEntity tileentity = world.getTileEntity(blockpos);
        ItemStack itemstack = stack.splitStack(1);

        if (itemstack.hasTagCompound())
        {
            ((TileEntityShulkerBox)tileentity).func_190586_e(itemstack.getTagCompound().getCompoundTag("BlockEntityTag"));
        }

        if (itemstack.hasDisplayName())
        {
            ((TileEntityShulkerBox)tileentity).func_190575_a(itemstack.getDisplayName());
        }

        world.updateComparatorOutputLevel(blockpos, iblockstate.getBlock());
    }

    return stack;
}
项目:Backmemed    文件:BlockShulkerBox.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    if (stack.hasDisplayName())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityShulkerBox)
        {
            ((TileEntityShulkerBox)tileentity).func_190575_a(stack.getDisplayName());
        }
    }
}
项目:Backmemed    文件:BlockShulkerBox.java   
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityShulkerBox)
    {
        TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox)tileentity;

        if (!tileentityshulkerbox.func_190590_r() && tileentityshulkerbox.func_190582_F())
        {
            ItemStack itemstack = new ItemStack(Item.getItemFromBlock(this));
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
            nbttagcompound.setTag("BlockEntityTag", ((TileEntityShulkerBox)tileentity).func_190580_f(nbttagcompound1));
            itemstack.setTagCompound(nbttagcompound);

            if (tileentityshulkerbox.hasCustomName())
            {
                itemstack.setStackDisplayName(tileentityshulkerbox.getName());
                tileentityshulkerbox.func_190575_a("");
            }

            spawnAsEntity(worldIn, pos, itemstack);
        }

        worldIn.updateComparatorOutputLevel(pos, state.getBlock());
    }

    super.breakBlock(worldIn, pos, state);
}
项目:Backmemed    文件:BlockShulkerBox.java   
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
    ItemStack itemstack = super.getItem(worldIn, pos, state);
    TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox)worldIn.getTileEntity(pos);
    NBTTagCompound nbttagcompound = tileentityshulkerbox.func_190580_f(new NBTTagCompound());

    if (!nbttagcompound.hasNoTags())
    {
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
    }

    return itemstack;
}
项目:wizards-of-lua    文件:BlocksModule.java   
private void patch(TileEntity tileEntity, NBTTagCompound origData) {
  if (tileEntity instanceof TileEntityShulkerBox) {
    if (origData.getTag("Items") == null) {
      origData.setTag("Items", new NBTTagList());
    }
  }
}
项目:Backmemed    文件:StorageESP.java   
@Override
public void onRender() {
    if(isEnabled()) {
        for (Object o : Wrapper.getWorld().loadedTileEntityList) {
            if (o instanceof TileEntityChest) {
                TileEntityChest chest = (TileEntityChest) o;
                this.drawChestESP(chest, chest.getPos().getX(), chest.getPos().getY(), chest.getPos().getZ());
            }
            if (o instanceof TileEntityEnderChest) {
                TileEntityEnderChest enderChest = (TileEntityEnderChest) o;
                this.drawEnderChestESP(enderChest, enderChest.getPos().getX(), enderChest.getPos().getY(), enderChest.getPos().getZ());
            }
            if (o instanceof TileEntityFurnace) {
                TileEntityFurnace furnace = (TileEntityFurnace) o;
                RenderUtils.blockESP(furnace.getPos(), Color.white, 1.0, 1.0);
            }
            if (o instanceof TileEntityDispenser) {
                TileEntityDispenser dispenser = (TileEntityDispenser) o;
                RenderUtils.blockESP(dispenser.getPos(), Color.white, 1.0, 1.0);
            }
            if (o instanceof TileEntityDropper) {
                TileEntityDropper dropper = (TileEntityDropper) o;
                RenderUtils.blockESP(dropper.getPos(), Color.white, 1.0, 1.0);
            }
            if (o instanceof TileEntityHopper) {
                TileEntityHopper hopper = (TileEntityHopper) o;
                RenderUtils.blockESP(hopper.getPos(), Color.white, 1.0, 1.0);
            }
            if (o instanceof TileEntityShulkerBox) {
                TileEntityShulkerBox shulker = (TileEntityShulkerBox) o;
                RenderUtils.blockESP(shulker.getPos(), Color.yellow, 1.0, 1.0);
            }

        }
        for (Entity e: Wrapper.getWorld().loadedEntityList) {
            if (e instanceof EntityMinecartChest) {
                RenderUtils.blockESP(e.getPosition(), Color.green, 1.0, 1.0);
            }
            if (e instanceof EntityMinecartFurnace || e instanceof EntityMinecartHopper) {
                RenderUtils.blockESP(e.getPosition(), Color.white, 1.0, 1.0);
            }
        }
    }
}
项目:Backmemed    文件:ModelAdapterShulkerBox.java   
public ModelAdapterShulkerBox()
{
    super(TileEntityShulkerBox.class, "shulker_box", 0.0F);
}
项目:Backmemed    文件:BlockShulkerBox.java   
/**
 * Returns a new instance of a block's tile entity class. Called on placing the block.
 */
public TileEntity createNewTileEntity(World worldIn, int meta)
{
    return new TileEntityShulkerBox(this.field_190958_b);
}
项目:Backmemed    文件:BlockShulkerBox.java   
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else if (playerIn.isSpectator())
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityShulkerBox)
        {
            EnumFacing enumfacing = (EnumFacing)state.getValue(field_190957_a);
            boolean flag;

            if (((TileEntityShulkerBox)tileentity).func_190591_p() == TileEntityShulkerBox.AnimationStatus.CLOSED)
            {
                AxisAlignedBB axisalignedbb = FULL_BLOCK_AABB.addCoord((double)(0.5F * (float)enumfacing.getFrontOffsetX()), (double)(0.5F * (float)enumfacing.getFrontOffsetY()), (double)(0.5F * (float)enumfacing.getFrontOffsetZ())).func_191195_a((double)enumfacing.getFrontOffsetX(), (double)enumfacing.getFrontOffsetY(), (double)enumfacing.getFrontOffsetZ());
                flag = !worldIn.collidesWithAnyBlock(axisalignedbb.offset(pos.offset(enumfacing)));
            }
            else
            {
                flag = true;
            }

            if (flag)
            {
                playerIn.addStat(StatList.field_191272_ae);
                playerIn.displayGUIChest((IInventory)tileentity);
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}
项目:Backmemed    文件:BlockShulkerBox.java   
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
    TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox)worldIn.getTileEntity(pos);
    tileentityshulkerbox.func_190579_a(player.capabilities.isCreativeMode);
    tileentityshulkerbox.fillWithLoot(player);
}
项目:Backmemed    文件:BlockShulkerBox.java   
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
    TileEntity tileentity = source.getTileEntity(pos);
    return tileentity instanceof TileEntityShulkerBox ? ((TileEntityShulkerBox)tileentity).func_190584_a(state) : FULL_BLOCK_AABB;
}