use of mekanism.common.util.TransporterUtils in project Mekanism by mekanism.
the class TileComponentEjector method read.
@Override
public void read(CompoundNBT nbtTags) {
if (nbtTags.contains(NBTConstants.COMPONENT_EJECTOR, NBT.TAG_COMPOUND)) {
CompoundNBT ejectorNBT = nbtTags.getCompound(NBTConstants.COMPONENT_EJECTOR);
strictInput = ejectorNBT.getBoolean(NBTConstants.STRICT_INPUT);
NBTUtils.setEnumIfPresent(ejectorNBT, NBTConstants.COLOR, TransporterUtils::readColor, color -> outputColor = color);
// Input colors
for (int i = 0; i < EnumUtils.DIRECTIONS.length; i++) {
int index = i;
NBTUtils.setEnumIfPresent(ejectorNBT, NBTConstants.COLOR + index, TransporterUtils::readColor, color -> inputColors[index] = color);
}
}
}
use of mekanism.common.util.TransporterUtils in project Mekanism by mekanism.
the class TileEntityLogisticalSorter method loadGeneralPersistentData.
@Override
protected void loadGeneralPersistentData(CompoundNBT data) {
super.loadGeneralPersistentData(data);
NBTUtils.setEnumIfPresent(data, NBTConstants.COLOR, TransporterUtils::readColor, color -> this.color = color);
autoEject = data.getBoolean(NBTConstants.EJECT);
roundRobin = data.getBoolean(NBTConstants.ROUND_ROBIN);
singleItem = data.getBoolean(NBTConstants.SINGLE_ITEM);
filters.clear();
if (data.contains(NBTConstants.FILTERS, NBT.TAG_LIST)) {
ListNBT tagList = data.getList(NBTConstants.FILTERS, NBT.TAG_COMPOUND);
for (int i = 0; i < tagList.size(); i++) {
IFilter<?> filter = BaseFilter.readFromNBT(tagList.getCompound(i));
if (filter instanceof SorterFilter) {
filters.add((SorterFilter<?>) filter);
}
}
}
}
Aggregations