use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.
the class MT method wood.
/**
* 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 wood(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_WOOD, ANY.Wood, ANY.WoodPlastic, WOOD, MORTAR);
String tPlank = "plank" + rMaterial.mNameInternal;
OreDictManager.INSTANCE.addAutoBlackListing(tPlank);
OreDictManager.INSTANCE.addReRegistration(tPlank, OD.plankAnyWood);
if ("Wood".equalsIgnoreCase(rMaterial.mNameInternal))
return rMaterial;
OreDictManager.INSTANCE.setAutomaticItemData(tPlank, new OreDictItemData(rMaterial, U));
OreDictManager.INSTANCE.addReRegistrationWithReversal("plate" + rMaterial.mNameInternal, tPlank);
return rMaterial;
}
use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.
the class MultiTileEntityPlaceable method readFromNBT2.
@Override
public void readFromNBT2(NBTTagCompound aNBT) {
mStack = ST.load(aNBT, NBT_VALUE);
if (ST.valid(mStack)) {
mSize = UT.Code.bindStack(ST.size(mStack));
OreDictItemData tData = OM.anydata(mStack);
if (tData != null && tData.hasValidMaterialData() && tData.mMaterial.mMaterial.mID > 0)
mMaterial = tData.mMaterial.mMaterial;
}
super.readFromNBT2(aNBT);
}
use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.
the class GT_API_Proxy method getBurnTime.
@Override
public int getBurnTime(ItemStack aFuel) {
if (ST.invalid(aFuel) || FL.getFluid(aFuel, T) != null)
return 0;
Block aBlock = ST.block(aFuel);
// Needed so Railcrafts Tunnel Bore works properly and doesn't try to burn its Rails while laying them.
if (aBlock instanceof BlockRailBase)
return 0;
if (aBlock instanceof BlockHugeMushroom)
return (3 * TICKS_PER_SMELT) / 2;
if (aBlock == BlocksGT.BalesGrass)
return (9 * TICKS_PER_SMELT) / ((ST.meta_(aFuel) & 3) == 1 ? 2 : 4);
if (aBlock instanceof BlockBaseBale)
return (9 * TICKS_PER_SMELT) / 4;
if (aBlock instanceof BlockBasePlanks)
return (3 * TICKS_PER_SMELT) / 2;
if (aBlock instanceof BlockBaseSapling)
return TICKS_PER_SMELT / 2;
if (aBlock instanceof BlockBaseBeam || aBlock instanceof BlockBaseLog)
return TICKS_PER_SMELT * 6;
long rFuelValue = 0;
if (aFuel.getItem() instanceof MultiItemRandom) {
Short tFuelValue = ((MultiItemRandom) aFuel.getItem()).mBurnValues.get(ST.meta_(aFuel));
if (tFuelValue != null)
rFuelValue = Math.max(rFuelValue, tFuelValue);
} else {
if (OD.logWood.is_(aFuel))
return TICKS_PER_SMELT * 6;
if (OD.itemResin.is_(aFuel))
return TICKS_PER_SMELT / 2;
}
NBTTagCompound tNBT = aFuel.getTagCompound();
if (tNBT != null) {
rFuelValue = Math.max(rFuelValue, tNBT.getLong(NBT_FUEL_VALUE));
}
OreDictItemData tData = OM.anydata_(aFuel);
if (tData != null) {
long tBurnTime = 0;
if (tData.mPrefix == OP.oreRaw) {
tBurnTime = tData.mMaterial.mMaterial.mFurnaceBurnTime;
} else if (tData.mPrefix == OP.blockRaw) {
tBurnTime = tData.mMaterial.mMaterial.mFurnaceBurnTime * 10;
} else if (tData.mPrefix == null || tData.mPrefix.contains(TD.Prefix.BURNABLE)) {
for (OreDictMaterialStack tMaterial : tData.getAllMaterialStacks()) tBurnTime += (tData.mPrefix == OP.oreRaw ? tMaterial.mMaterial.mFurnaceBurnTime : tData.mPrefix == OP.blockRaw ? tMaterial.mMaterial.mFurnaceBurnTime * 10 : UT.Code.units(tMaterial.mMaterial.mFurnaceBurnTime, U, tMaterial.mAmount, F));
if (tData.mPrefix == OP.stick && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
return (int) UT.Code.bind(0, 32000, Math.max(TICKS_PER_SMELT / 2, tBurnTime));
if (tData.mPrefix == OP.stickLong && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
return (int) UT.Code.bind(0, 32000, Math.max(TICKS_PER_SMELT, tBurnTime));
if (tData.mPrefix == OP.blockPlate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 27) / 2, tBurnTime));
if (tData.mPrefix == OP.crateGtPlate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 51) / 2, tBurnTime));
if (tData.mPrefix == OP.crateGt64Plate && ANY.Wood.mToThis.contains(tData.mMaterial.mMaterial))
return (int) UT.Code.bind(0, 32000, Math.max((TICKS_PER_SMELT * 195) / 2, tBurnTime));
}
rFuelValue = Math.max(rFuelValue, tBurnTime);
}
// return at most 160 Smelts, without any fraction smelts.
return (int) UT.Code.bind(0, 32000, rFuelValue);
}
use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.
the class NEI_RecipeMap method loadCraftingRecipes.
@Override
public void loadCraftingRecipes(ItemStack aResult) {
if (!CODE_CLIENT)
return;
if (ST.invalid(aResult))
return;
try {
OreDictItemData tPrefixMaterial = OM.association_(aResult);
ArrayList<ItemStack> tResults = new ArrayListNoNulls<>();
tResults.add(aResult);
tResults.add(OM.get_(aResult));
ArrayList<ItemStack> tRedirects = ItemsGT.sNEIRedirects.get(new ItemStackContainer(aResult));
if (tRedirects != null)
tResults.addAll(tRedirects);
tRedirects = ItemsGT.sNEIRedirects.get(new ItemStackContainer(aResult, W));
if (tRedirects != null)
tResults.addAll(tRedirects);
if (tPrefixMaterial != null && !tPrefixMaterial.mBlackListed) {
if (tPrefixMaterial.mMaterial.mMaterial.mID > 0 && BlocksGT.ore != null && BlocksGT.oreBroken != null && tPrefixMaterial.mPrefix.containsAny(TD.Prefix.ORE, TD.Prefix.ORE_PROCESSING_BASED)) {
tResults.add(ST.make((Block) BlocksGT.ore, 1, tPrefixMaterial.mMaterial.mMaterial.mID));
tResults.add(ST.make((Block) BlocksGT.oreBroken, 1, tPrefixMaterial.mMaterial.mMaterial.mID));
}
for (OreDictPrefix tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
tResults.add(tPrefix.mat(tPrefixMaterial.mMaterial.mMaterial, 1));
}
}
if (!ItemsGT.NEI_DONT_SHOW_FLUIDS.contains(aResult, T)) {
FluidStack tFluid = FL.getFluid(aResult, T);
if (tFluid != null) {
tResults.add(FL.display(tFluid, F, F));
for (FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid))
tResults.add(ST.copy(tData.filledContainer));
}
}
}
ArrayList<Recipe> tRecipes = new ArrayListNoNulls<>();
for (Recipe tRecipe : mRecipeMap.getNEIRecipes(tResults.toArray(ZL_IS))) if (!tRecipes.contains(tRecipe))
tRecipes.add(tRecipe);
for (Recipe tRecipe : tRecipes) arecipes.add(new CachedDefaultRecipe(tRecipe));
sortRecipes();
} catch (Throwable e) {
e.printStackTrace(ERR);
}
}
use of gregapi.oredict.OreDictItemData in project gregtech6 by GregTech6.
the class NEI_RecipeMap method loadUsageRecipes.
@Override
public void loadUsageRecipes(ItemStack aInput) {
if (!CODE_CLIENT)
return;
if (ST.invalid(aInput))
return;
try {
OreDictItemData tPrefixMaterial = OM.association_(aInput);
ArrayList<ItemStack> tInputs = new ArrayListNoNulls<>();
tInputs.add(aInput);
tInputs.add(OreDictManager.INSTANCE.getStack_(F, aInput));
ArrayList<ItemStack> tRedirects = ItemsGT.sNEIRedirects.get(new ItemStackContainer(aInput));
if (tRedirects != null)
tInputs.addAll(tRedirects);
tRedirects = ItemsGT.sNEIRedirects.get(new ItemStackContainer(aInput, W));
if (tRedirects != null)
tInputs.addAll(tRedirects);
if (tPrefixMaterial != null) {
for (OreDictPrefix tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
tInputs.add(tPrefix.mat(tPrefixMaterial.mMaterial.mMaterial, 1));
}
}
if (!ItemsGT.NEI_DONT_SHOW_FLUIDS.contains(aInput, T)) {
FluidStack tFluid = FL.getFluid(aInput, T);
if (tFluid != null) {
tInputs.add(FL.display(tFluid, F, F));
for (FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid))
tInputs.add(ST.copy(tData.filledContainer));
}
}
}
ArrayList<Recipe> tRecipes = new ArrayListNoNulls<>();
for (Recipe tRecipe : mRecipeMap.getNEIUsages(tInputs.toArray(ZL_IS))) if (!tRecipes.contains(tRecipe))
tRecipes.add(tRecipe);
for (Recipe tRecipe : tRecipes) arecipes.add(new CachedDefaultRecipe(tRecipe));
sortRecipes();
} catch (Throwable e) {
e.printStackTrace(ERR);
}
}
Aggregations