Package pneumaticCraft.common.tileentity

Examples of pneumaticCraft.common.tileentity.TileEntityPressureTube


    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
        if(!world.isRemote) {
            if(player.getCurrentEquippedItem() != null) {
                if(player.getCurrentEquippedItem().getItem() instanceof ItemTubeModule) {
                    TileEntityPressureTube pressureTube = (TileEntityPressureTube)world.getTileEntity(x, y, z);
                    if(pressureTube.modules[par6] == null) {
                        TubeModule module = ModuleRegistrator.getModule(((ItemTubeModule)player.getCurrentEquippedItem().getItem()).moduleName);
                        pressureTube.setModule(module, ForgeDirection.getOrientation(par6));
                        onNeighborBlockChange(world, x, y, z, this);
                        world.notifyBlocksOfNeighborChange(x, y, z, this, ForgeDirection.getOrientation(par6).getOpposite().ordinal());
                        if(!player.capabilities.isCreativeMode) player.getCurrentEquippedItem().stackSize--;
                        world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, Block.soundTypeGlass.getStepResourcePath(), Block.soundTypeGlass.getVolume() * 5.0F, Block.soundTypeGlass.getPitch() * .9F);
                        return true;
View Full Code Here


    }

    public static TubeModule getLookedModule(World world, int x, int y, int z, EntityPlayer player){
        MovingObjectPosition mop = PneumaticCraftUtils.getEntityLookedObject(player);
        if(mop != null && mop.hitInfo instanceof ForgeDirection && (ForgeDirection)mop.hitInfo != ForgeDirection.UNKNOWN) {
            TileEntityPressureTube tube = (TileEntityPressureTube)world.getTileEntity(x, y, z);
            return tube.modules[((ForgeDirection)mop.hitInfo).ordinal()];
        }
        return null;
    }
View Full Code Here

        if(isCloserMOP(origin, bestMOP, mop)) {
            bestMOP = mop;
            bestAABB = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
        }

        TileEntityPressureTube tube = (TileEntityPressureTube)world.getTileEntity(x, y, z);
        for(int i = 0; i < 6; i++) {
            if(tube.sidesConnected[i]) {
                setBlockBounds(boundingBoxes[i]);
                mop = super.collisionRayTrace(world, x, y, z, origin, direction);
                if(isCloserMOP(origin, bestMOP, mop)) {
View Full Code Here

    @Override
    public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){
        if(target.hitInfo == ForgeDirection.UNKNOWN) {
            return super.getPickBlock(target, world, x, y, z);
        } else {
            TileEntityPressureTube tube = (TileEntityPressureTube)world.getTileEntity(x, y, z);
            return new ItemStack(ModuleRegistrator.getModuleItem(tube.modules[((ForgeDirection)target.hitInfo).ordinal()].getType()));
        }
    }
View Full Code Here

    public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z){
        MovingObjectPosition mop = PneumaticCraftUtils.getEntityLookedObject(player);
        if(mop != null && mop.hitInfo instanceof ForgeDirection) {
            if(mop.hitInfo != ForgeDirection.UNKNOWN) {
                if(!world.isRemote) {
                    TileEntityPressureTube tube = (TileEntityPressureTube)world.getTileEntity(x, y, z);
                    if(!player.capabilities.isCreativeMode) {
                        List<ItemStack> drops = tube.modules[((ForgeDirection)mop.hitInfo).ordinal()].getDrops();
                        for(ItemStack drop : drops) {
                            EntityItem entity = new EntityItem(world, x, y, z);
                            entity.setEntityItemStack(drop);
                            world.spawnEntityInWorld(entity);
                        }
                    }
                    tube.setModule(null, (ForgeDirection)mop.hitInfo);
                    onNeighborBlockChange(world, x, y, z, this);
                    world.notifyBlocksOfNeighborChange(x, y, z, this, ((ForgeDirection)mop.hitInfo).getOpposite().ordinal());
                }
                return false;
            }
View Full Code Here

    public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity){
        setBlockBounds(BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MAX_POS, BBConstants.PRESSURE_PIPE_MAX_POS, BBConstants.PRESSURE_PIPE_MAX_POS);
        super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);

        TileEntity te = world.getTileEntity(x, y, z);
        TileEntityPressureTube tePt = (TileEntityPressureTube)te;

        for(int i = 0; i < 6; i++) {
            if(tePt.sidesConnected[i]) {
                setBlockBounds(boundingBoxes[i]);
                super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);
View Full Code Here

    @Override
    public void onBlockAdded(World world, int x, int y, int z){
        super.onBlockAdded(world, x, y, z);
        TileEntity te = world.getTileEntity(x, y, z);
        if(te != null && te instanceof TileEntityPressureTube) {
            TileEntityPressureTube tePt = (TileEntityPressureTube)te;
            tePt.updateConnections(world, x, y, z);
        }
    }
View Full Code Here

    @Override
    public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
        super.onNeighborBlockChange(world, x, y, z, block);
        TileEntity te = world.getTileEntity(x, y, z);
        if(te != null && te instanceof TileEntityPressureTube) {
            TileEntityPressureTube tePt = (TileEntityPressureTube)te;
            tePt.onNeighborBlockChange();
        }
    }
View Full Code Here

     * A randomly called display update to be able to add particles or other items for display
     */
    public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random){
        TileEntity te = par1World.getTileEntity(par2, par3, par4);
        if(te instanceof TileEntityPressureTube) {
            TileEntityPressureTube tePt = (TileEntityPressureTube)te;
            int l = 0;
            for(TubeModule module : tePt.modules)
                if(module != null) l = Math.max(l, module.getRedstoneLevel());
            if(l > 0) {
                // for(int i = 0; i < 4; i++){
View Full Code Here

    @Override
    public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int side){

        TileEntity te = par1IBlockAccess.getTileEntity(par2, par3, par4);
        if(te instanceof TileEntityPressureTube) {
            TileEntityPressureTube tePt = (TileEntityPressureTube)te;
            int redstoneLevel = 0;
            for(int i = 0; i < 6; i++) {
                if(tePt.modules[i] != null) {
                    if((side ^ 1) == i || i != side && tePt.modules[i].isInline()) {//if we are on the same side, or when we have an 'in line' module that is not on the opposite side.
                        redstoneLevel = Math.max(redstoneLevel, tePt.modules[i].getRedstoneLevel());
View Full Code Here

TOP

Related Classes of pneumaticCraft.common.tileentity.TileEntityPressureTube

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.