use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class DimensionEnscriberTileEntity method convertToDimensionDescriptor.
/**
* Convert the dimlets in the inventory to a dimension descriptor.
*/
private DimensionDescriptor convertToDimensionDescriptor(EntityPlayer player) {
List<DimletKey> descriptors = new ArrayList<>();
long forcedSeed = 0;
for (int i = 0; i < DimensionEnscriberContainer.SIZE_DIMLETS; i++) {
ItemStack stack = inventoryHelper.getStackInSlot(i + DimensionEnscriberContainer.SLOT_DIMLETS);
if (!stack.isEmpty()) {
DimletKey key = KnownDimletConfiguration.getDimletKey(stack);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (settings != null) {
// Make sure the dimlet is not blacklisted.
descriptors.add(key);
NBTTagCompound tagCompound = stack.getTagCompound();
if (tagCompound != null && tagCompound.getLong("forcedSeed") != 0) {
forcedSeed = tagCompound.getLong("forcedSeed");
}
inventoryHelper.setStackInSlot(i + DimensionEnscriberContainer.SLOT_DIMLETS, ItemStack.EMPTY);
} else {
Logging.warn(player, "Dimlet " + key.getType().dimletType.getName() + "." + key.getId() + " was not included in the tab because it is blacklisted");
}
}
}
return new DimensionDescriptor(descriptors, forcedSeed);
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class KnownDimlet method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag showExtended) {
super.addInformation(itemStack, player, list, showExtended);
DimletKey key = KnownDimletConfiguration.getDimletKey(itemStack);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (showExtended.isAdvanced()) {
list.add(TextFormatting.GOLD + "Key: " + key.getId());
}
if (settings == null) {
list.add(TextFormatting.WHITE + "Dimlet " + key.getType().dimletType.getName() + "." + key.getId());
list.add(TextFormatting.RED + "This dimlet is blacklisted!");
return;
}
list.add(TextFormatting.BLUE + "Rarity: " + settings.getRarity() + (KnownDimletConfiguration.isCraftable(key) ? " (craftable)" : ""));
list.add(TextFormatting.YELLOW + "Create cost: " + settings.getCreateCost() + " RF/tick");
int maintainCost = settings.getMaintainCost();
if (maintainCost < 0) {
list.add(TextFormatting.YELLOW + "Maintain cost: " + maintainCost + "% RF/tick");
} else {
list.add(TextFormatting.YELLOW + "Maintain cost: " + maintainCost + " RF/tick");
}
list.add(TextFormatting.YELLOW + "Tick cost: " + settings.getTickCost() + " ticks");
if (KnownDimletConfiguration.isSeedDimlet(key)) {
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.getLong("forcedSeed") != 0) {
long forcedSeed = tagCompound.getLong("forcedSeed");
boolean locked = tagCompound.getBoolean("locked");
list.add(TextFormatting.BLUE + "Forced seed: " + forcedSeed + (locked ? " [LOCKED]" : ""));
} else {
list.add(TextFormatting.BLUE + "Right click to copy seed from dimension.");
list.add(TextFormatting.BLUE + "Shift-Right click to lock copied seed.");
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
for (String info : key.getType().dimletType.getInformation()) {
list.add(TextFormatting.WHITE + info);
}
// @todo
// List<String> extra = KnownDimletConfiguration.idToExtraInformation.get(entry.getKey());
// if (extra != null) {
// for (String info : extra) {
// list.add(TextFormatting.YELLOW + info);
// }
// }
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class PacketSyncRules method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
int size = buf.readInt();
rules = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
Filter filter = new Filter(buf);
Settings settings = new Settings(buf);
rules.add(Pair.of(filter, settings));
}
}
Aggregations