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());
}
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()));
}
}
}
}
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;
}
}
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));
}
}
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);
}
}
Aggregations