Search in sources :

Example 91 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class TileEntityKeroseneLamp method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    managingLights.clear();
    NBTTagList lights = tag.getTagList("lights", 10);
    for (int i = 0; i < lights.tagCount(); i++) {
        NBTTagCompound t = lights.getCompoundTagAt(i);
        managingLights.add(new ChunkPosition(t.getInteger("x"), t.getInteger("y"), t.getInteger("z")));
    }
    tank.readFromNBT(tag.getCompoundTag("tank"));
    redstoneMode = tag.getByte("redstoneMode");
    targetRange = tag.getByte("targetRange");
    range = tag.getByte("range");
    sideConnected = ForgeDirection.getOrientation(tag.getByte("sideConnected"));
    readInventoryFromNBT(tag, inventory);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) ChunkPosition(net.minecraft.world.ChunkPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 92 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.

the class TileEntityProgrammer method previewArea.

public boolean previewArea(int widgetX, int widgetY) {
    for (IProgWidget w : progWidgets) {
        if (w.getX() == widgetX && w.getY() == widgetY && w instanceof IAreaProvider) {
            Set<ChunkPosition> area = new HashSet<ChunkPosition>();
            ((IAreaProvider) w).getArea(area);
            AreaShowManager.getInstance().showArea(area, 0x00FF00, this);
        }
    }
    return true;
}
Also used : IAreaProvider(pneumaticCraft.common.progwidgets.IAreaProvider) IProgWidget(pneumaticCraft.common.progwidgets.IProgWidget) ChunkPosition(net.minecraft.world.ChunkPosition) HashSet(java.util.HashSet)

Example 93 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project SecurityCraft by Geforce132.

the class BlockEMPedWire method func_150177_e.

private void func_150177_e(World p_150177_1_, int p_150177_2_, int p_150177_3_, int p_150177_4_) {
    this.func_150175_a(p_150177_1_, p_150177_2_, p_150177_3_, p_150177_4_, p_150177_2_, p_150177_3_, p_150177_4_);
    ArrayList arraylist = new ArrayList(this.field_150179_b);
    this.field_150179_b.clear();
    for (int l = 0; l < arraylist.size(); ++l) {
        ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
        p_150177_1_.notifyBlocksOfNeighborChange(chunkposition.chunkPosX, chunkposition.chunkPosY, chunkposition.chunkPosZ, this);
    }
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition) ArrayList(java.util.ArrayList)

Example 94 with ChunkPosition

use of net.minecraft.world.ChunkPosition in project SecurityCraft by Geforce132.

the class BlockEMPedWire method func_150175_a.

private void func_150175_a(World p_150175_1_, int p_150175_2_, int p_150175_3_, int p_150175_4_, int p_150175_5_, int p_150175_6_, int p_150175_7_) {
    int k1 = p_150175_1_.getBlockMetadata(p_150175_2_, p_150175_3_, p_150175_4_);
    byte b0 = 0;
    int i3 = this.func_150178_a(p_150175_1_, p_150175_5_, p_150175_6_, p_150175_7_, b0);
    this.field_150181_a = false;
    int l1 = p_150175_1_.getStrongestIndirectPower(p_150175_2_, p_150175_3_, p_150175_4_);
    this.field_150181_a = true;
    if (l1 > 0 && l1 > i3 - 1) {
        i3 = l1;
    }
    int i2 = 0;
    for (int j2 = 0; j2 < 4; ++j2) {
        int k2 = p_150175_2_;
        int l2 = p_150175_4_;
        if (j2 == 0) {
            k2 = p_150175_2_ - 1;
        }
        if (j2 == 1) {
            ++k2;
        }
        if (j2 == 2) {
            l2 = p_150175_4_ - 1;
        }
        if (j2 == 3) {
            ++l2;
        }
        if (k2 != p_150175_5_ || l2 != p_150175_7_) {
            i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_, l2, i2);
        }
        if (p_150175_1_.getBlock(k2, p_150175_3_, l2).isNormalCube() && !p_150175_1_.getBlock(p_150175_2_, p_150175_3_ + 1, p_150175_4_).isNormalCube()) {
            if ((k2 != p_150175_5_ || l2 != p_150175_7_) && p_150175_3_ >= p_150175_6_) {
                i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_ + 1, l2, i2);
            }
        } else if (!p_150175_1_.getBlock(k2, p_150175_3_, l2).isNormalCube() && (k2 != p_150175_5_ || l2 != p_150175_7_) && p_150175_3_ <= p_150175_6_) {
            i2 = this.func_150178_a(p_150175_1_, k2, p_150175_3_ - 1, l2, i2);
        }
    }
    if (i2 > i3) {
        i3 = i2 - 1;
    } else if (i3 > 0) {
        --i3;
    } else {
        i3 = 0;
    }
    if (l1 > i3 - 1) {
        i3 = l1;
    }
    if (k1 != i3) {
        p_150175_1_.setBlockMetadataWithNotify(p_150175_2_, p_150175_3_, p_150175_4_, i3, 2);
        this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_ - 1, p_150175_3_, p_150175_4_));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_ + 1, p_150175_3_, p_150175_4_));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_ - 1, p_150175_4_));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_ + 1, p_150175_4_));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_ - 1));
        this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_ + 1));
    }
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition)

Aggregations

ChunkPosition (net.minecraft.world.ChunkPosition)94 ItemStack (net.minecraft.item.ItemStack)16 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 NBTTagList (net.minecraft.nbt.NBTTagList)10 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)9 TileEntity (net.minecraft.tileentity.TileEntity)9 ArrayList (java.util.ArrayList)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 Map (java.util.Map)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 Chunk (net.minecraft.world.chunk.Chunk)4 FluidStack (net.minecraftforge.fluids.FluidStack)4 Stack (java.util.Stack)3 Block (net.minecraft.block.Block)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 IInventory (net.minecraft.inventory.IInventory)3 PathPoint (net.minecraft.pathfinding.PathPoint)3 Vec3 (net.minecraft.util.Vec3)3