Search in sources :

Example 1 with FillerPattern

use of buildcraft.core.builders.patterns.FillerPattern in project BuildCraft by BuildCraft.

the class GuiFiller method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) throws IOException {
    super.actionPerformed(button);
    if (button.id == 0 && !filler.isPatternLocked()) {
        filler.currentPattern = (FillerPattern) FillerManager.registry.getPreviousPattern(filler.currentPattern);
    } else if (button.id == 1 && !filler.isPatternLocked()) {
        filler.currentPattern = (FillerPattern) FillerManager.registry.getNextPattern(filler.currentPattern);
    } else if (button.id == 2) {
        filler.setExcavate(!filler.isExcavate());
        buttonList.set(2, getExcavateButton());
        BuildCraftCore.instance.sendToServer(new PacketCommand(filler, "setFlags", new CommandWriter() {

            @Override
            public void write(ByteBuf data) {
                data.writeBoolean(filler.isExcavate());
            }
        }));
    }
    filler.rpcSetPatternFromString(filler.currentPattern.getUniqueTag());
}
Also used : PacketCommand(buildcraft.core.lib.network.command.PacketCommand) CommandWriter(buildcraft.core.lib.network.command.CommandWriter) ByteBuf(io.netty.buffer.ByteBuf) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Example 2 with FillerPattern

use of buildcraft.core.builders.patterns.FillerPattern in project BuildCraft by BuildCraft.

the class BuildersActionProvider method addExternalActions.

@Override
public void addExternalActions(Collection<IActionExternal> actions, EnumFacing side, TileEntity tile) {
    if (tile instanceof TileFiller) {
        for (IFillerPattern p : FillerManager.registry.getPatterns()) {
            if (p instanceof FillerPattern) {
                FillerPattern pattern = (FillerPattern) p;
                if (!actionMap.containsKey(p.getUniqueTag())) {
                    actionMap.put(p.getUniqueTag(), ActionFiller.getForPattern(pattern));
                }
                actions.add(actionMap.get(p.getUniqueTag()));
            }
        }
    }
}
Also used : TileFiller(buildcraft.builders.TileFiller) IFillerPattern(buildcraft.api.filler.IFillerPattern) IFillerPattern(buildcraft.api.filler.IFillerPattern) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Example 3 with FillerPattern

use of buildcraft.core.builders.patterns.FillerPattern in project BuildCraft by BuildCraft.

the class BlockFiller method getActualState.

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess access, BlockPos pos) {
    state = super.getActualState(state, access, pos);
    TileEntity tile = access.getTileEntity(pos);
    if (tile instanceof TileFiller) {
        FillerPattern pattern = ((TileFiller) tile).currentPattern;
        if (pattern == null) {
            return state;
        } else {
            state = state.withProperty(FILLER_PATTERN, pattern.type);
            return state;
        }
    } else {
        return state;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Example 4 with FillerPattern

use of buildcraft.core.builders.patterns.FillerPattern in project BuildCraft by BuildCraft.

the class ActionFiller method resetMap.

public static void resetMap() {
    actions.clear();
    for (IFillerPattern pattern : FillerManager.registry.getPatterns()) {
        FillerPattern fil = (FillerPattern) pattern;
        actions.put(fil, new ActionFiller(fil));
    }
}
Also used : IFillerPattern(buildcraft.api.filler.IFillerPattern) IFillerPattern(buildcraft.api.filler.IFillerPattern) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Example 5 with FillerPattern

use of buildcraft.core.builders.patterns.FillerPattern in project BuildCraft by BuildCraft.

the class TileFiller method readData.

@Override
public void readData(ByteBuf data) {
    super.readData(data);
    box.readData(data);
    int flags = data.readUnsignedByte();
    done = (flags & 1) > 0;
    excavate = (flags & 2) > 0;
    patternLocked = (flags & 4) > 0 ? 2 : 0;
    FillerPattern pattern = (FillerPattern) FillerManager.registry.getPattern(NetworkUtils.readUTF(data));
    NBTTagCompound parameterData = NetworkUtils.readNBT(data);
    readParametersFromNBT(parameterData);
    if (setPattern(pattern, isPatternLocked())) {
        worldObj.markBlockForUpdate(pos);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) FillerPattern(buildcraft.core.builders.patterns.FillerPattern)

Aggregations

FillerPattern (buildcraft.core.builders.patterns.FillerPattern)5 IFillerPattern (buildcraft.api.filler.IFillerPattern)2 TileFiller (buildcraft.builders.TileFiller)1 CommandWriter (buildcraft.core.lib.network.command.CommandWriter)1 PacketCommand (buildcraft.core.lib.network.command.PacketCommand)1 ByteBuf (io.netty.buffer.ByteBuf)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1