Search in sources :

Example 11 with DimletType

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");
                }
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ArrayList(java.util.ArrayList) List(java.util.List) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with DimletType

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()]);
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) HashMap(java.util.HashMap) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with DimletType

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()];
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 14 with DimletType

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;
}
Also used : IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) ItemStack(net.minecraft.item.ItemStack) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Example 15 with DimletType

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;
    }
}
Also used : IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Aggregations

DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)19 DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)13 ArrayList (java.util.ArrayList)9 ItemStack (net.minecraft.item.ItemStack)8 List (java.util.List)5 IDimletType (mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType)4 HashMap (java.util.HashMap)3 Counter (mcjty.lib.varia.Counter)2 Settings (mcjty.rftoolsdim.config.Settings)2 ControllerType (mcjty.rftoolsdim.dimensions.types.ControllerType)2 FeatureType (mcjty.rftoolsdim.dimensions.types.FeatureType)2 TerrainType (mcjty.rftoolsdim.dimensions.types.TerrainType)2 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 Slot (net.minecraft.inventory.Slot)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 Map (java.util.Map)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1