use of mcjty.rftoolsdim.dimensions.dimlets.types.DimletType in project RFToolsDimensions by McJty.
the class RealizedDimensionTab method constructDescriptionHelp.
private void constructDescriptionHelp(List list, String descriptionString) {
Map<DimletType, List<DimletKey>> dimletTypeListMap = new HashMap<>();
for (DimletKey descriptor : DimensionDescriptor.parseDescriptionString(descriptionString)) {
DimletType type = descriptor.getType();
if (!dimletTypeListMap.containsKey(type)) {
dimletTypeListMap.put(type, new ArrayList<>());
}
dimletTypeListMap.get(descriptor.getType()).add(descriptor);
}
for (Map.Entry<DimletType, List<DimletKey>> entry : dimletTypeListMap.entrySet()) {
DimletType type = entry.getKey();
List<DimletKey> keys = entry.getValue();
if (keys != null && !keys.isEmpty()) {
if (type == DimletType.DIMLET_DIGIT) {
String digitString = "";
for (DimletKey key : keys) {
digitString += DimletObjectMapping.getDigit(key);
}
list.add(TextFormatting.GREEN + "Digits " + digitString);
} else {
if (keys.size() == 1) {
list.add(TextFormatting.GREEN + type.dimletType.getName() + " 1 dimlet");
} else {
list.add(TextFormatting.GREEN + type.dimletType.getName() + " " + keys.size() + " dimlets");
}
}
}
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.types.DimletType in project RFToolsDimensions by McJty.
the class DimletTypeControllerItem method initModel.
@Override
@SideOnly(Side.CLIENT)
public void initModel() {
Map<DimletType, ModelResourceLocation> models = new HashMap<>();
for (DimletType type : DimletType.values()) {
models.put(type, new ModelResourceLocation(getRegistryName() + calculateUnlocalizedNameSuffix(type), "inventory"));
ModelBakery.registerItemVariants(this, models.get(type));
}
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return models.get(DimletType.values()[stack.getItemDamage()]);
}
});
}
use of mcjty.rftoolsdim.dimensions.dimlets.types.DimletType in project RFToolsDimensions by McJty.
the class KnownDimlet method initModel.
@Override
@SideOnly(Side.CLIENT)
public void initModel() {
ModelResourceLocation[] models = new ModelResourceLocation[DimletType.values().length];
int meta = 0;
for (DimletType type : DimletType.values()) {
models[meta] = new ModelResourceLocation(getRegistryName() + "_" + type.dimletType.getName().toLowerCase(), "inventory");
ModelBakery.registerItemVariants(this, models[meta]);
meta++;
}
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return models[stack.getItemDamage()];
}
});
}
use of mcjty.rftoolsdim.dimensions.dimlets.types.DimletType in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method checkDimletCrafting.
private boolean checkDimletCrafting() {
ItemStack stackBase = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_BASE);
if (ItemStackTools.isEmpty(stackBase)) {
return false;
}
ItemStack stackController = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_CONTROLLER);
if (ItemStackTools.isEmpty(stackController)) {
return false;
}
ItemStack stackTypeController = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_TYPE_CONTROLLER);
if (ItemStackTools.isEmpty(stackTypeController)) {
return false;
}
ItemStack stackMemory = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_MEMORY);
if (ItemStackTools.isEmpty(stackMemory)) {
return false;
}
ItemStack stackEnergy = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_ENERGY);
if (ItemStackTools.isEmpty(stackEnergy)) {
return false;
}
ItemStack stackEssence = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_ESSENCE);
if (ItemStackTools.isEmpty(stackEssence)) {
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.types.DimletType 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