use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class TimeAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null) {
if (tagCompound.hasKey("angle") && tagCompound.getFloat("angle") > -0.001f) {
float angle = tagCompound.getFloat("angle");
DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
String name = KnownDimletConfiguration.getDisplayName(key);
if (name == null) {
name = "<unknown>";
}
list.add(TextFormatting.GREEN + "Dimlet: " + name + " (" + angle + ")");
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
int timeout = tagCompound.getInteger("registerTimeout");
list.add(TextFormatting.GREEN + "Timeout: " + timeout);
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block outside and give it a redstone");
list.add(TextFormatting.WHITE + "signal around the time that you want to absorb.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimensionEnscriberTileEntity method convertToDimensionDescriptor.
/**
* Convert the dimlets in the inventory to a dimension descriptor.
*/
private DimensionDescriptor convertToDimensionDescriptor() {
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 (ItemStackTools.isValid(stack)) {
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, ItemStackTools.getEmptyStack());
}
return new DimensionDescriptor(descriptors, forcedSeed);
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class GuiEssencePainter method extractModifiersForType.
private List<DimletKey> extractModifiersForType(List<DimletKey> modifiers, DimletType type) {
List<DimletKey> modifiersForType = new ArrayList<>();
int i = 0;
while (i < modifiers.size()) {
DimletKey modifier = modifiers.get(i);
if (type.dimletType.isModifiedBy(modifier.getType())) {
modifiersForType.add(modifier);
modifiers.remove(i);
} else {
i++;
}
}
return modifiersForType;
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method checkDimletCrafting.
private boolean checkDimletCrafting() {
ItemStack stackBase = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_BASE);
if (stackBase.isEmpty()) {
return false;
}
ItemStack stackController = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_CONTROLLER);
if (stackController.isEmpty()) {
return false;
}
ItemStack stackTypeController = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_TYPE_CONTROLLER);
if (stackTypeController.isEmpty()) {
return false;
}
ItemStack stackMemory = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_MEMORY);
if (stackMemory.isEmpty()) {
return false;
}
ItemStack stackEnergy = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_ENERGY);
if (stackEnergy.isEmpty()) {
return false;
}
ItemStack stackEssence = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_ESSENCE);
if (stackEssence.isEmpty()) {
return false;
}
DimletType type = DimletType.values()[stackTypeController.getItemDamage()];
IDimletType itype = type.dimletType;
DimletKey key = itype.attemptDimletCrafting(stackController, stackMemory, stackEnergy, stackEssence);
if (key != null) {
inventoryHelper.setInventorySlotContents(1, DimletWorkbenchContainer.SLOT_OUTPUT, KnownDimletConfiguration.getDimletStack(key));
return true;
}
return false;
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method readRestorableFromNBT.
@Override
public void readRestorableFromNBT(NBTTagCompound tagCompound) {
super.readRestorableFromNBT(tagCompound);
readBufferFromNBT(tagCompound, inventoryHelper);
extracting = tagCompound.getInteger("extracting");
extractMode = tagCompound.getBoolean("extractMode");
idToExtract = null;
if (tagCompound.hasKey("extKtype")) {
DimletType type = DimletType.getTypeByOpcode(tagCompound.getString("extKtype"));
idToExtract = new DimletKey(type, tagCompound.getString("extDkey"));
} else {
idToExtract = null;
}
}
Aggregations