Search in sources :

Example 6 with StackAtPosition

use of buildcraft.core.StackAtPosition in project BuildCraft by BuildCraft.

the class BuildingItem method initialize.

public void initialize() {
    if (!initialized) {
        Vec3d vec = destination.subtract(origin);
        double size = vec.lengthVector();
        maxLifetime = (float) size * 4;
        maxHeight = size / 2;
        // The below computation is a much simpler version of the long commented out code. Hopefully it works :P
        velocity = Utils.multiply(vec, 1 / maxLifetime);
        if (stacksToDisplay.size() == 0) {
            StackAtPosition sPos = new StackAtPosition();
            sPos.stack = new ItemStack(BuildCraftCore.decoratedBlock);
            stacksToDisplay.add(sPos);
        }
        initialized = true;
    }
}
Also used : StackAtPosition(buildcraft.core.StackAtPosition) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d)

Example 7 with StackAtPosition

use of buildcraft.core.StackAtPosition in project BuildCraft by BuildCraft.

the class BuildingItem method setStacksToDisplay.

public void setStacksToDisplay(List<ItemStack> stacks) {
    if (stacks != null) {
        for (ItemStack s : stacks) {
            for (int i = 0; i < s.stackSize; ++i) {
                StackAtPosition sPos = new StackAtPosition();
                sPos.stack = s.copy();
                sPos.stack.stackSize = 1;
                stacksToDisplay.add(sPos);
            }
        }
    }
}
Also used : StackAtPosition(buildcraft.core.StackAtPosition) ItemStack(net.minecraft.item.ItemStack)

Example 8 with StackAtPosition

use of buildcraft.core.StackAtPosition in project BuildCraft by BuildCraft.

the class BuildingItem method getStacks.

public LinkedList<StackAtPosition> getStacks() {
    int d = 0;
    for (StackAtPosition s : stacksToDisplay) {
        float stackLife = lifetimeDisplay - d;
        if (stackLife <= maxLifetime && stackLife > 0) {
            s.pos = getDisplayPosition(stackLife);
            s.display = true;
        } else {
            s.display = false;
        }
        d += ITEMS_SPACE;
    }
    return stacksToDisplay;
}
Also used : StackAtPosition(buildcraft.core.StackAtPosition)

Aggregations

StackAtPosition (buildcraft.core.StackAtPosition)8 MappingRegistry (buildcraft.api.blueprints.MappingRegistry)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 IBakedModel (net.minecraft.client.resources.model.IBakedModel)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 Vec3d (net.minecraft.util.math.Vec3d)1