Search in sources :

Example 31 with Int3

use of WayofTime.alchemicalWizardry.api.Int3 in project BloodMagic by WayofTime.

the class RenderReagentConduit method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
    if (tileEntity instanceof TEReagentConduit) {
        int renderCount = ((TEReagentConduit) tileEntity).renderCount;
        float key1 = (tileEntity.xCoord * 54f - tileEntity.yCoord * 38.72f + tileEntity.zCoord * 10.432f);
        float key2 = (tileEntity.xCoord * 21.43f - tileEntity.yCoord * 9.96f + tileEntity.zCoord * 12.8f);
        Int3 colourMap = ((TEReagentConduit) tileEntity).getColour();
        GL11.glPushMatrix();
        Tessellator tessellator = Tessellator.instance;
        this.bindTexture(field_110629_a);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDepthMask(false);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA(colourMap.xCoord, colourMap.yCoord, colourMap.zCoord, 200);
        GL11.glTranslated(d0 + 0.5, d1 + 0.5, d2 + 0.5);
        // Rotate on planar axis
        GL11.glRotatef(tileEntity.getWorldObj().getWorldTime() / 3.0f, 0F, 1F, 0F);
        // Rotate vertical axis
        GL11.glRotatef(renderCount + key1, 0F, 0F, 1F);
        // Rotate cylindrically
        GL11.glRotatef(renderCount * 2f + key2, 1F, 0F, 0F);
        tessellator.setBrightness(240);
        tessellator.addVertexWithUV(-0.5d, 0, -0.5d, 0.0d, 0.0d);
        tessellator.addVertexWithUV(0.5d, 0, -0.5d, 1.0d, 0.0d);
        tessellator.addVertexWithUV(0.5d, 0, 0.5d, 1.0d, 1.0d);
        tessellator.addVertexWithUV(-0.5d, 0, 0.5d, 0.0d, 1.0d);
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
        GL11.glPopMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) Int3(WayofTime.alchemicalWizardry.api.Int3) TEReagentConduit(WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit)

Example 32 with Int3

use of WayofTime.alchemicalWizardry.api.Int3 in project BloodMagic by WayofTime.

the class ItemRitualDiviner method getStoredLocation.

public Int3 getStoredLocation(ItemStack stack) {
    NBTTagCompound tag = stack.getTagCompound();
    if (tag == null || !tag.hasKey("location")) {
        return new Int3(0, 0, 0);
    }
    NBTTagCompound locTag = (NBTTagCompound) tag.getTag("location");
    return Int3.readFromNBT(locTag);
}
Also used : Int3(WayofTime.alchemicalWizardry.api.Int3) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 33 with Int3

use of WayofTime.alchemicalWizardry.api.Int3 in project BloodMagic by WayofTime.

the class SigilFluid method fillItemFromBeastWorld.

public ItemStack fillItemFromBeastWorld(ItemStack container, World world, EntityPlayer player, boolean forceFill) {
    if (world.isRemote) {
        return container;
    }
    int range = 5;
    float f = 1.0F;
    boolean flag = true;
    MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, flag);
    if (movingobjectposition == null) {
        return container;
    } else {
        if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
            int x = movingobjectposition.blockX;
            int y = movingobjectposition.blockY;
            int z = movingobjectposition.blockZ;
            if (!world.canMineBlock(player, x, y, z)) {
                return container;
            }
            if (!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, container)) {
                return container;
            }
            boolean[][][] boolList = new boolean[range * 2 + 1][range * 2 + 1][range * 2 + 1];
            for (int i = 0; i < 2 * range + 1; i++) {
                for (int j = 0; j < 2 * range + 1; j++) {
                    for (int k = 0; k < 2 * range + 1; k++) {
                        boolList[i][j][k] = false;
                    }
                }
            }
            List<Int3> positionList = new ArrayList();
            boolList[range][range][range] = true;
            positionList.add(new Int3(range, range, range));
            boolean isReady = false;
            while (!isReady) {
                isReady = true;
                for (int i = 0; i < 2 * range + 1; i++) {
                    for (int j = 0; j < 2 * range + 1; j++) {
                        for (int k = 0; k < 2 * range + 1; k++) {
                            if (boolList[i][j][k]) {
                                if (i - 1 >= 0 && !boolList[i - 1][j][k]) {
                                    Block block = world.getBlock(x - range + i - 1, y - range + j, z - range + k);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i - 1][j][k] = true;
                                        positionList.add(new Int3(i - 1, j, k));
                                        isReady = false;
                                    }
                                }
                                if (j - 1 >= 0 && !boolList[i][j - 1][k]) {
                                    Block block = world.getBlock(x - range + i, y - range + j - 1, z - range + k);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i][j - 1][k] = true;
                                        positionList.add(new Int3(i, j - 1, k));
                                        isReady = false;
                                    }
                                }
                                if (k - 1 >= 0 && !boolList[i][j][k - 1]) {
                                    Block block = world.getBlock(x - range + i, y - range + j, z - range + k - 1);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i][j][k - 1] = true;
                                        positionList.add(new Int3(i, j, k - 1));
                                        isReady = false;
                                    }
                                }
                                if (i + 1 <= 2 * range && !boolList[i + 1][j][k]) {
                                    Block block = world.getBlock(x - range + i + 1, y - range + j, z - range + k);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i + 1][j][k] = true;
                                        positionList.add(new Int3(i + 1, j, k));
                                        isReady = false;
                                    }
                                }
                                if (j + 1 <= 2 * range && !boolList[i][j + 1][k]) {
                                    Block block = world.getBlock(x - range + i, y - range + j + 1, z - range + k);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i][j + 1][k] = true;
                                        positionList.add(new Int3(i, j + 1, k));
                                        isReady = false;
                                    }
                                }
                                if (k + 1 <= 2 * range && !boolList[i][j][k + 1]) {
                                    Block block = world.getBlock(x - range + i, y - range + j, z - range + k + 1);
                                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                                    if (fluid != null) {
                                        boolList[i][j][k + 1] = true;
                                        positionList.add(new Int3(i, j, k + 1));
                                        isReady = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            for (Int3 pos : positionList) {
                int i = pos.xCoord;
                int j = pos.yCoord;
                int k = pos.zCoord;
                if (!boolList[i][j][k]) {
                    continue;
                }
                if (world.getBlock(x + i - range, y + j - range, z + k - range) != null && world.getBlock(x + i - range, y + j - range, z + k - range).getMaterial() instanceof MaterialLiquid) {
                    // world.setBlockToAir(x+i-range, y+j-range, z+k-range);
                    Block block = world.getBlock(x + i - range, y + j - range, z + k - range);
                    if (block == null) {
                        continue;
                    }
                    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
                    AlchemicalWizardry.logger.info("x: " + (i - range) + " y: " + (j - range) + " z: " + (k - range));
                    if (fluid == null || world.getBlockMetadata(x + i - range, y + j - range, z + k - range) != 0) {
                        continue;
                    }
                    FluidStack fillStack = new FluidStack(fluid, 1000);
                    int amount = this.fill(container, fillStack, false);
                    if ((amount > 0 && forceFill) || (amount >= 1000 && !forceFill)) {
                        {
                            world.setBlockToAir(x + i - range, y + j - range, z + k - range);
                        }
                        this.fill(container, new FluidStack(fluid, 1000), true);
                    }
                }
            }
        }
        return container;
    }
}
Also used : MovingObjectPosition(net.minecraft.util.MovingObjectPosition) Int3(WayofTime.alchemicalWizardry.api.Int3) ArrayList(java.util.ArrayList) Block(net.minecraft.block.Block) MaterialLiquid(net.minecraft.block.material.MaterialLiquid)

Example 34 with Int3

use of WayofTime.alchemicalWizardry.api.Int3 in project BloodMagic by WayofTime.

the class ItemAttunedCrystal method addInformation.

@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    par3List.add(StatCollector.translateToLocal("tooltip.attunedcrystal.desc1"));
    par3List.add(StatCollector.translateToLocal("tooltip.attunedcrystal.desc2"));
    if (!(par1ItemStack.getTagCompound() == null)) {
        Reagent reagent = this.getReagent(par1ItemStack);
        if (reagent != null) {
            par3List.add(StatCollector.translateToLocal("tooltip.reagent.selectedreagent") + " " + reagent.name);
        }
        if (this.getHasSavedCoordinates(par1ItemStack)) {
            par3List.add("");
            Int3 coords = this.getCoordinates(par1ItemStack);
            par3List.add(StatCollector.translateToLocal("tooltip.alchemy.coords") + " " + coords.xCoord + ", " + coords.yCoord + ", " + coords.zCoord);
            par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimension(par1ItemStack));
        }
    }
}
Also used : Int3(WayofTime.alchemicalWizardry.api.Int3)

Aggregations

Int3 (WayofTime.alchemicalWizardry.api.Int3)34 TileEntity (net.minecraft.tileentity.TileEntity)10 LinkedList (java.util.LinkedList)7 Block (net.minecraft.block.Block)6 NBTTagList (net.minecraft.nbt.NBTTagList)6 World (net.minecraft.world.World)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 List (java.util.List)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 IInventory (net.minecraft.inventory.IInventory)4 ItemStack (net.minecraft.item.ItemStack)4 GridSpace (WayofTime.alchemicalWizardry.common.demonVillage.GridSpace)3 DemonBuilding (WayofTime.alchemicalWizardry.common.demonVillage.DemonBuilding)2 DemonVillagePath (WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath)2 Int3AndBool (WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath.Int3AndBool)2 GridSpaceHolder (WayofTime.alchemicalWizardry.common.demonVillage.GridSpaceHolder)2 TEDemonPortal (WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal)2