Search in sources :

Example 1 with IDimletType

use of mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType in project RFToolsDimensions by McJty.

the class DimensionEditorTileEntity method validateInjectableItemStack.

private ItemStack validateInjectableItemStack() {
    ItemStack itemStack = inventoryHelper.getStackInSlot(DimensionEditorContainer.SLOT_INJECTINPUT);
    if (ItemStackTools.isEmpty(itemStack)) {
        stopInjecting();
        return ItemStackTools.getEmptyStack();
    }
    if (isMatterReceiver(itemStack)) {
        return itemStack;
    }
    if (isTNT(itemStack)) {
        return canDeleteDimension(itemStack);
    }
    DimletKey key = KnownDimletConfiguration.getDimletKey(itemStack);
    DimletType type = key.getType();
    IDimletType itype = type.dimletType;
    if (itype.isInjectable()) {
        return itemStack;
    } else {
        return ItemStackTools.getEmptyStack();
    }
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) ItemStack(net.minecraft.item.ItemStack) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Example 2 with IDimletType

use of mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType in project RFToolsDimensions by McJty.

the class DimensionInformation method injectDimlet.

public void injectDimlet(DimletKey key) {
    DimletType type = key.getType();
    IDimletType itype = type.dimletType;
    if (itype.isInjectable()) {
        addToCost(key);
        itype.inject(key, this);
    }
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType) IDimletType(mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType)

Example 3 with IDimletType

use of mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType 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)

Aggregations

DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)3 IDimletType (mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType)3 DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)2 ItemStack (net.minecraft.item.ItemStack)2