use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.
the class MaterialMetaItem method registerOreDict.
public void registerOreDict() {
for (short metaItem : generatedItems) {
OrePrefix prefix = this.orePrefixes[metaItem / 1000];
Material material = Material.MATERIAL_REGISTRY.getObjectById(metaItem % 1000);
OreDictUnifier.registerOre(new ItemStack(this, 1, metaItem), prefix, material);
}
}
use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.
the class MaterialMetaItem method addInformation.
// TODO DELETE ON RELEASE
@Override
public void addInformation(ItemStack itemStack, @Nullable World worldIn, List<String> lines, ITooltipFlag tooltipFlag) {
if (itemStack.getMetadata() >= 32000)
return;
OrePrefix prefix = this.orePrefixes[itemStack.getMetadata() / 1000];
Material material = Material.MATERIAL_REGISTRY.getObjectById(itemStack.getMetadata() % 1000);
if (prefix != null) {
lines.add("IconType: " + prefix.materialIconType);
}
if (material != null) {
lines.add("IconSet: " + material.materialIconSet);
}
}
use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.
the class ProcessingGem method registerOre.
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
if (entry.material instanceof GemMaterial) {
GemMaterial material = (GemMaterial) entry.material;
ItemStack stack = simpleStack.asItemStack();
long materialAmount = entry.orePrefix.materialAmount;
ItemStack crushedStack = OreDictUnifier.getDust(material, materialAmount);
if (material.hasFlag(SolidMaterial.MatFlags.MORTAR_GRINDABLE)) {
ModHandler.addShapelessRecipe("gem_t_dust_" + material, crushedStack, "m", stack);
}
if (!material.hasFlag(DustMaterial.MatFlags.NO_SMASHING)) {
OrePrefix prevPrefix = GTUtility.getItem(ORDER, ORDER.indexOf(entry.orePrefix) - 1, null);
if (prevPrefix != null) {
ItemStack prevStack = OreDictUnifier.get(prevPrefix, material, 2);
ModHandler.addShapelessRecipe("gem_t_gem_" + material, prevStack, "h", stack);
RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(prevStack).duration(20).EUt(16).buildAndRegister();
}
}
if (!material.hasFlag(DustMaterial.MatFlags.NO_WORKING)) {
if (material.hasFlag(SolidMaterial.MatFlags.GENERATE_LONG_ROD) && materialAmount >= M * 2) {
RecipeMap.LATHE_RECIPES.recipeBuilder().inputs(stack).outputs(OreDictUnifier.get(OrePrefix.stickLong, material, (int) (materialAmount / (M * 2))), OreDictUnifier.getDust(material, materialAmount % (M * 2))).duration((int) material.getMass()).EUt(16).buildAndRegister();
} else if (materialAmount >= M) {
RecipeMap.LATHE_RECIPES.recipeBuilder().inputs(stack).outputs(OreDictUnifier.get(OrePrefix.stick, material, (int) (materialAmount / M)), OreDictUnifier.getDust(material, materialAmount % M)).duration((int) material.getMass()).EUt(16).buildAndRegister();
}
}
}
}
use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.
the class ModHandler method addSmeltingAndAlloySmeltingRecipe.
/**
* Adds to Furnace AND Alloysmelter AND Induction Smelter
*/
public static void addSmeltingAndAlloySmeltingRecipe(ItemStack input, ItemStack output, boolean hidden) {
boolean skip = false;
if (input.isEmpty()) {
GTLog.logger.error("Input cannot be an empty ItemStack", new IllegalArgumentException());
skip = true;
}
if (output.isEmpty()) {
GTLog.logger.error("Output cannot be an empty ItemStack", new IllegalArgumentException());
skip = true;
}
if (skip)
return;
if (input.getCount() == 1) {
addSmeltingRecipe(input, output);
}
RecipeBuilder.NotConsumableInputRecipeBuilder recipeBuilder = RecipeMap.ALLOY_SMELTER_RECIPES.recipeBuilder().inputs(input).outputs(output).duration(130).EUt(3);
OrePrefix prefix = OreDictUnifier.getPrefix(output);
if (prefix != null) {
switch(prefix) {
case ingot:
recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_INGOT);
break;
case block:
recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_BLOCK);
break;
case nugget:
recipeBuilder.notConsumable(MetaItems.SHAPE_MOLD_NUGGET);
break;
}
if (hidden) {
recipeBuilder.hidden();
}
recipeBuilder.buildAndRegister();
}
// if (GregTechMod.gregtechproxy.mTEMachineRecipes) {
// ThermalExpansion.addInductionSmelterRecipe(input, null, output, null, output.stackSize * 1600, 0);
// }
}
use of gregtech.api.unification.ore.OrePrefix in project GregTech by GregTechCE.
the class MetaItem1 method onEntityItemUpdate.
@Override
public boolean onEntityItemUpdate(EntityItem itemEntity) {
int damage = itemEntity.getItem().getMetadata();
if (damage < this.metaItemOffset && damage >= 0 && !itemEntity.getEntityWorld().isRemote) {
Material material = Material.MATERIAL_REGISTRY.getObjectById(damage % 1000);
if (material != null) {
int posX = MathHelper.floor(itemEntity.posX);
int posY = MathHelper.floor(itemEntity.posY);
int posZ = MathHelper.floor(itemEntity.posZ);
OrePrefix prefix = this.orePrefixes[(damage / 1000)];
if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure || prefix == OrePrefix.crushed || prefix == OrePrefix.dust) {
IBlockState blockState = itemEntity.getEntityWorld().getBlockState(new BlockPos(posX, posY, posZ));
if (blockState.getBlock() == Blocks.CAULDRON) {
int waterLevel = blockState.getValue(BlockCauldron.LEVEL);
if (waterLevel > 0) {
boolean waterConsumed = false;
if (prefix == OrePrefix.crushed) {
itemEntity.setItem(OreDictUnifier.get(OrePrefix.crushedPurified, material, itemEntity.getItem().getCount()));
waterConsumed = true;
} else if (prefix == OrePrefix.dustImpure || prefix == OrePrefix.dustPure) {
itemEntity.setItem(OreDictUnifier.get(OrePrefix.dust, material, itemEntity.getItem().getCount()));
waterConsumed = true;
}
if (waterConsumed) {
itemEntity.getEntityWorld().setBlockState(new BlockPos(posX, posY, posZ), blockState.withProperty(BlockCauldron.LEVEL, waterLevel - 1));
}
return true;
}
}
}
}
}
return false;
}
Aggregations