Search in sources :

Example 11 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class MT method stone.

/**
 * Making the Table a little bit more overviewable. DO NOT USE THESE FUNCTIONS YOURSELF!!! Use "OreDictMaterial.createMaterial(YOUR-ID-AS-SPECIFIED-IN-THE-ID-RANGES, OREDICT-NAME, LOCALISED-NAME)"
 */
static OreDictMaterial stone(int aID, String aNameOreDict, TextureSet[] aSets, long aR, long aG, long aB, long aA, Object... aRandomData) {
    OreDictMaterial rMaterial = create(aID, aNameOreDict, aSets, aR, aG, aB, aA, aRandomData, G_STONE, ANY.Stone, STONE, BRITTLE, MORTAR, FURNACE, EXTRUDER, EXTRUDER_SIMPLE);
    String tStone = "stone" + rMaterial.mNameInternal;
    OreDictManager.INSTANCE.addAutoBlackListing(tStone);
    OreDictManager.INSTANCE.setAutomaticItemData(tStone, new OreDictItemData(rMaterial, U * 9));
    return rMaterial;
}
Also used : OreDictMaterial(gregapi.oredict.OreDictMaterial) OreDictItemData(gregapi.oredict.OreDictItemData)

Example 12 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class MT method woodnormal.

/**
 * Making the Table a little bit more overviewable. DO NOT USE THESE FUNCTIONS YOURSELF!!! Use "OreDictMaterial.createMaterial(YOUR-ID-AS-SPECIFIED-IN-THE-ID-RANGES, OREDICT-NAME, LOCALISED-NAME)"
 */
static OreDictMaterial woodnormal(int aID, String aNameOreDict, String aLocal, long aR, long aG, long aB, double aSpeed, long aDurability, Object... aRandomData) {
    OreDictMaterial rMaterial = create(aID, aNameOreDict, SET_WOOD, aR, aG, aB, 255, aRandomData, G_WOOD, ANY.Wood, ANY.WoodPlastic, ANY.WoodNormal, ANY.WoodDefault, ANY.WoodUntreated, WOOD, MORTAR, TICKS_PER_SMELT / 2, FLAMMABLE, APPROXIMATE).setLocal(aLocal).uumMcfg(0, C, 6 * U, H2O, 15 * U).aspects(TC.ARBOR, 1).setBurning(Ash, U9).setSmelting(Ash, U4).qual(1, aSpeed, aDurability, 0).heat(400, 500);
    String tPlank = "plank" + rMaterial.mNameInternal, tStick = "stick" + rMaterial.mNameInternal;
    OreDictManager.INSTANCE.addAutoBlackListing(tPlank);
    OreDictManager.INSTANCE.addReRegistration(tStick, OD.stickWood);
    OreDictManager.INSTANCE.addReRegistration(tPlank, OD.plankWood);
    OreDictManager.INSTANCE.setAutomaticItemData(tPlank, new OreDictItemData(rMaterial, U));
    OreDictManager.INSTANCE.addReRegistrationWithReversal("plate" + rMaterial.mNameInternal, tPlank);
    return rMaterial;
}
Also used : OreDictMaterial(gregapi.oredict.OreDictMaterial) OreDictItemData(gregapi.oredict.OreDictItemData)

Example 13 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class RecipeMapScannerMolecular method findRecipe.

@Override
public Recipe findRecipe(IHasWorldAndCoords aTileEntity, Recipe aRecipe, boolean aNotUnificated, long aSize, ItemStack aSpecialSlot, FluidStack[] aFluids, ItemStack... aInputs) {
    Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aSize, aSpecialSlot, aFluids, aInputs);
    if (rRecipe != null || aInputs == null || aInputs.length < 2 || aInputs[0] == null || aInputs[1] == null || GAPI_POST.mFinishedServerStarted <= 0)
        return rRecipe;
    ItemStack tUSB = null, tScanned = null;
    for (ItemStack aInput : aInputs) if (ST.valid(aInput)) {
        if (ST.invalid(tUSB) && OM.is_(OD_USB_STICKS[3], aInput))
            tUSB = aInput;
        else
            tScanned = aInput;
        if (ST.valid(tUSB) && ST.valid(tScanned)) {
            // just to make eclipse shut the fuck up
            assert tScanned != null;
            OreDictItemData aData = OM.anydata_(tScanned);
            if (aData.mPrefix != null && aData.mMaterial != null && aData.mMaterial.mMaterial.mID > 0 && aData.mPrefix.contains(TD.Prefix.SCANNABLE)) {
                rRecipe = new Recipe(F, F, F, ST.array(ST.amount(1, tScanned), ST.amount(1, tUSB)), ST.array(ST.amount(1, tUSB)), null, null, null, null, (aData.mMaterial.mMaterial.mProtons + aData.mMaterial.mMaterial.mNeutrons) * 512, 512, 0);
                if (!rRecipe.mOutputs[0].hasTagCompound())
                    rRecipe.mOutputs[0].setTagCompound(UT.NBT.make());
                rRecipe.mOutputs[0].getTagCompound().setTag(NBT_USB_DATA, UT.NBT.makeShort(NBT_REPLICATOR_DATA, aData.mMaterial.mMaterial.mID));
                rRecipe.mOutputs[0].getTagCompound().setByte(NBT_USB_TIER, (byte) 3);
                return rRecipe;
            }
            return rRecipe;
        }
    }
    return rRecipe;
}
Also used : Recipe(gregapi.recipes.Recipe) OreDictItemData(gregapi.oredict.OreDictItemData) ItemStack(net.minecraft.item.ItemStack)

Example 14 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class RecipeMapShredder method getRecipeFor.

@Override
public Recipe getRecipeFor(ItemStack aInput) {
    OreDictItemData aData = OM.anydata(aInput);
    if (aData == null || (aData.mPrefix != null && (!aData.mPrefix.contains(TD.Prefix.RECYCLABLE) || aData.mPrefix.containsAny(TD.Prefix.DUST_BASED, TD.Prefix.ORE, TD.Prefix.ORE_PROCESSING_BASED, TD.Prefix.IS_CONTAINER))) || (aData.mMaterial != null && aData.mMaterial.mMaterial.contains(TD.Atomic.ANTIMATTER)) || FL.getFluid(aInput, T) != null)
        return null;
    List<OreDictMaterialStack> tList = new ArrayListNoNulls<>();
    for (OreDictMaterialStack tMaterial : aData.getAllMaterialStacks()) if (tMaterial.mMaterial.mTargetPulver.mAmount > 0)
        OM.stack(UT.Code.units(tMaterial.mAmount, U, tMaterial.mMaterial.mTargetPulver.mAmount, F), tMaterial.mMaterial.mTargetPulver.mMaterial).addToList(tList);
    if (tList.isEmpty())
        return null;
    ItemStack[] tOutputs = new ItemStack[Math.min(tList.size(), mOutputItemsCount)];
    int i = 0, tDuration = 0;
    for (OreDictMaterialStack tMaterial : tList) {
        tDuration += UT.Code.units(tMaterial.mAmount, U, 256 * Math.max(1, tMaterial.mMaterial.mToolQuality + 1), T);
        if (i < tOutputs.length) {
            ItemStack tStack = OM.dust(tMaterial);
            if (tStack != null)
                tOutputs[i++] = tStack;
        }
    }
    if (!UT.Code.exists(0, tOutputs))
        return null;
    return new Recipe(F, F, F, ST.array(ST.amount(1, aInput)), tOutputs, null, null, ZL_FS, ZL_FS, Math.max(1, tDuration), 16, 0);
}
Also used : Recipe(gregapi.recipes.Recipe) OreDictItemData(gregapi.oredict.OreDictItemData) OreDictMaterialStack(gregapi.oredict.OreDictMaterialStack) ItemStack(net.minecraft.item.ItemStack) ArrayListNoNulls(gregapi.code.ArrayListNoNulls)

Example 15 with OreDictItemData

use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.

the class MultiTileEntityMassStorage method updatePartialContent.

public boolean updatePartialContent() {
    int tMaxStorage = getMaxContent();
    ItemStack tContent = slot(1);
    if (mPartialUnits > 0 && slotHas(1) && tContent.stackSize < tMaxStorage) {
        OreDictItemData mData = OM.anydata_(tContent);
        if (mData != null && mData.hasValidPrefixData()) {
            long tTargetAmount = getUnitAmount(mData.mPrefix);
            if (mPartialUnits >= tTargetAmount) {
                ItemStack tStack = ST.amount(mPartialUnits / tTargetAmount, tContent);
                if (tStack.stackSize > 0) {
                    mPartialUnits -= tTargetAmount * tStack.stackSize;
                    if (tStack.stackSize + tContent.stackSize > tMaxStorage)
                        mPartialUnits += tTargetAmount * (tStack.stackSize + tContent.stackSize - tMaxStorage);
                    tContent.stackSize = Math.min(tMaxStorage, tContent.stackSize + tStack.stackSize);
                    updateInventory();
                }
            }
        }
    }
    return T;
}
Also used : OreDictItemData(gregapi.oredict.OreDictItemData) ItemStack(net.minecraft.item.ItemStack)

Aggregations

OreDictItemData (gregapi.oredict.OreDictItemData)64 ItemStack (net.minecraft.item.ItemStack)41 OreDictMaterial (gregapi.oredict.OreDictMaterial)20 FluidStack (net.minecraftforge.fluids.FluidStack)16 ArrayListNoNulls (gregapi.code.ArrayListNoNulls)12 OreDictMaterialStack (gregapi.oredict.OreDictMaterialStack)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 Recipe (gregapi.recipes.Recipe)9 Block (net.minecraft.block.Block)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)5 List (java.util.List)5 OreDictPrefix (gregapi.oredict.OreDictPrefix)4 IOreDictListenerEvent (gregapi.oredict.event.IOreDictListenerEvent)4 OreDictListenerEvent_Names (gregapi.oredict.event.OreDictListenerEvent_Names)4 HashSetNoNulls (gregapi.code.HashSetNoNulls)3 IItemContainer (gregapi.code.IItemContainer)3 ItemStackContainer (gregapi.code.ItemStackContainer)3 PacketDeathPoint (gregapi.network.packets.PacketDeathPoint)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 Item (net.minecraft.item.Item)3