use of mekanism.api.providers.IItemProvider in project Mekanism by mekanism.
the class OreProcessingRecipeProvider method addDynamicOreProcessingIngotRecipes.
private void addDynamicOreProcessingIngotRecipes(Consumer<IFinishedRecipe> consumer, String basePath, PrimaryResource resource) {
net.minecraft.util.IItemProvider ingot = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.INGOT, resource);
ITag<Item> ingotTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.INGOT, resource);
net.minecraft.util.IItemProvider nugget = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.NUGGET, resource);
ITag<Item> nuggetTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.NUGGET, resource);
net.minecraft.util.IItemProvider block = MekanismBlocks.PROCESSED_RESOURCE_BLOCKS.get(resource);
ITag<Item> blockTag = MekanismTags.Items.PROCESSED_RESOURCE_BLOCKS.get(resource);
net.minecraft.util.IItemProvider ore = MekanismBlocks.ORES.get(OreType.get(resource));
float dustExperience = 0.3F;
if (resource == PrimaryResource.IRON) {
ingot = Items.IRON_INGOT;
ingotTag = Tags.Items.INGOTS_IRON;
nugget = Items.IRON_NUGGET;
nuggetTag = Tags.Items.NUGGETS_IRON;
block = Blocks.IRON_BLOCK;
blockTag = Tags.Items.STORAGE_BLOCKS_IRON;
ore = Blocks.IRON_ORE;
dustExperience = 0.35F;
} else if (resource == PrimaryResource.GOLD) {
ingot = Items.GOLD_INGOT;
ingotTag = Tags.Items.INGOTS_GOLD;
nugget = Items.GOLD_NUGGET;
nuggetTag = Tags.Items.NUGGETS_GOLD;
block = Blocks.GOLD_BLOCK;
blockTag = Tags.Items.STORAGE_BLOCKS_GOLD;
ore = Blocks.GOLD_ORE;
dustExperience = 0.5F;
}
IItemProvider dust = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.DUST, resource);
IItemProvider dirtyDust = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.DIRTY_DUST, resource);
IItemProvider clump = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.CLUMP, resource);
IItemProvider crystal = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.CRYSTAL, resource);
IItemProvider shard = MekanismItems.PROCESSED_RESOURCES.get(ResourceType.SHARD, resource);
ITag<Item> dustTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.DUST, resource);
ITag<Item> dirtyDustTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.DIRTY_DUST, resource);
ITag<Item> clumpTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.CLUMP, resource);
ITag<Item> shardTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.SHARD, resource);
ITag<Item> crystalTag = MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.CRYSTAL, resource);
SlurryRegistryObject<?, ?> slurry = MekanismSlurries.PROCESSED_RESOURCES.get(resource);
// Clump
// from ore
ItemStackChemicalToItemStackRecipeBuilder.purifying(ItemStackIngredient.from(resource.getOreTag()), GasStackIngredient.from(MekanismGases.OXYGEN, 1), clump.getItemStack(3)).build(consumer, Mekanism.rl(basePath + "clump/from_ore"));
// from shard
ItemStackChemicalToItemStackRecipeBuilder.purifying(ItemStackIngredient.from(shardTag), GasStackIngredient.from(MekanismGases.OXYGEN, 1), clump.getItemStack()).build(consumer, Mekanism.rl(basePath + "clump/from_shard"));
// Crystal
// from slurry
ChemicalCrystallizerRecipeBuilder.crystallizing(SlurryStackIngredient.from(slurry.getCleanSlurry(), 200), crystal.getItemStack()).build(consumer, Mekanism.rl(basePath + "crystal/from_slurry"));
// Dirty Dust
// from clump
ItemStackToItemStackRecipeBuilder.crushing(ItemStackIngredient.from(clumpTag), dirtyDust.getItemStack()).build(consumer, Mekanism.rl(basePath + "dirty_dust/from_clump"));
// Dust
// from dirty dust
ItemStackToItemStackRecipeBuilder.enriching(ItemStackIngredient.from(dirtyDustTag), dust.getItemStack()).build(consumer, Mekanism.rl(basePath + "dust/from_dirty_dust"));
// from ingot
ItemStackToItemStackRecipeBuilder.crushing(ItemStackIngredient.from(ingotTag), dust.getItemStack()).build(consumer, Mekanism.rl(basePath + "dust/from_ingot"));
// from ore
ItemStackToItemStackRecipeBuilder.enriching(ItemStackIngredient.from(resource.getOreTag()), dust.getItemStack(2)).build(consumer, Mekanism.rl(basePath + "dust/from_ore"));
// Ingot
// from dust
RecipeProviderUtil.addSmeltingBlastingRecipes(consumer, Ingredient.of(dustTag), ingot, dustExperience, 200, Mekanism.rl(basePath + "ingot/from_dust_blasting"), Mekanism.rl(basePath + "ingot/from_dust_smelting"));
if (!resource.isVanilla()) {
// from block
ExtendedShapelessRecipeBuilder.shapelessRecipe(ingot, 9).addIngredient(blockTag).build(consumer, Mekanism.rl(basePath + "ingot/from_block"));
// to block
ExtendedShapedRecipeBuilder.shapedRecipe(block).pattern(MekanismRecipeProvider.STORAGE_PATTERN).key(Pattern.CONSTANT, ingotTag).build(consumer, Mekanism.rl(basePath + "storage_blocks/from_ingots"));
// from nuggets
ExtendedShapedRecipeBuilder.shapedRecipe(ingot).pattern(MekanismRecipeProvider.STORAGE_PATTERN).key(Pattern.CONSTANT, nuggetTag).build(consumer, Mekanism.rl(basePath + "ingot/from_nuggets"));
// to nuggets
ExtendedShapelessRecipeBuilder.shapelessRecipe(nugget, 9).addIngredient(ingotTag).build(consumer, Mekanism.rl(basePath + "nugget/from_ingot"));
// from ore
RecipeProviderUtil.addSmeltingBlastingRecipes(consumer, Ingredient.of(resource.getOreTag()), ingot, dustExperience * 2, 200, Mekanism.rl(basePath + "ingot/from_ore_blasting"), Mekanism.rl(basePath + "ingot/from_ore_smelting"));
}
// Ore
// from dust
CombinerRecipeBuilder.combining(ItemStackIngredient.from(dustTag, 8), ItemStackIngredient.from(Tags.Items.COBBLESTONE), new ItemStack(ore)).build(consumer, Mekanism.rl(basePath + "ore/from_dust"));
// Shard
// from crystal
ItemStackChemicalToItemStackRecipeBuilder.injecting(ItemStackIngredient.from(crystalTag), GasStackIngredient.from(MekanismGases.HYDROGEN_CHLORIDE, 1), shard.getItemStack()).build(consumer, Mekanism.rl(basePath + "shard/from_crystal"));
// from ore
ItemStackChemicalToItemStackRecipeBuilder.injecting(ItemStackIngredient.from(resource.getOreTag()), GasStackIngredient.from(MekanismGases.HYDROGEN_CHLORIDE, 1), shard.getItemStack(4)).build(consumer, Mekanism.rl(basePath + "shard/from_ore"));
// Slurry
// clean
FluidSlurryToSlurryRecipeBuilder.washing(FluidStackIngredient.from(FluidTags.WATER, 5), SlurryStackIngredient.from(slurry.getDirtySlurry(), 1), slurry.getCleanSlurry().getStack(1)).build(consumer, Mekanism.rl(basePath + "slurry/clean"));
// dirty
ChemicalDissolutionRecipeBuilder.dissolution(ItemStackIngredient.from(resource.getOreTag()), GasStackIngredient.from(MekanismGases.SULFURIC_ACID, 1), slurry.getDirtySlurry().getStack(1_000)).build(consumer, Mekanism.rl(basePath + "slurry/dirty"));
}
use of mekanism.api.providers.IItemProvider in project Mekanism by mekanism.
the class ToolsItemModelProvider method registerModels.
@Override
protected void registerModels() {
// Shields
addShieldModel(ToolsItems.BRONZE_SHIELD, Mekanism.rl("block/block_bronze"));
addShieldModel(ToolsItems.LAPIS_LAZULI_SHIELD, mcLoc("block/lapis_block"));
addShieldModel(ToolsItems.OSMIUM_SHIELD, Mekanism.rl("block/block_osmium"));
addShieldModel(ToolsItems.REFINED_GLOWSTONE_SHIELD, Mekanism.rl("block/block_refined_glowstone"));
addShieldModel(ToolsItems.REFINED_OBSIDIAN_SHIELD, Mekanism.rl("block/block_refined_obsidian"));
addShieldModel(ToolsItems.STEEL_SHIELD, Mekanism.rl("block/block_steel"));
// Armor items are generated textures, all other tools module items are handheld
for (IItemProvider itemProvider : ToolsItems.ITEMS.getAllItems()) {
Item item = itemProvider.getItem();
if (item instanceof ItemMekanismShield) {
// Skip shields, we manually handle them above
continue;
}
ResourceLocation texture;
if (isVanilla(itemProvider)) {
texture = itemTexture(itemProvider);
} else {
String name = itemProvider.getName();
int index = name.lastIndexOf('_');
texture = modLoc("item/" + name.substring(0, index) + '/' + name.substring(index + 1));
}
if (item instanceof ArmorItem) {
generated(itemProvider, texture);
} else {
handheld(itemProvider, texture);
}
}
}
use of mekanism.api.providers.IItemProvider in project Mekanism by mekanism.
the class ModuleHelper method mapSupportedModules.
private void mapSupportedModules(String imcMethod, IItemProvider moduleContainer, Map<ModuleData<?>, ImmutableSet.Builder<Item>> supportedContainersBuilderMap) {
ImmutableSet.Builder<ModuleData<?>> supportedModulesBuilder = ImmutableSet.builder();
InterModComms.getMessages(Mekanism.MODID, imcMethod::equals).forEach(message -> {
Object body = message.getMessageSupplier().get();
if (body instanceof IModuleDataProvider) {
IModuleDataProvider<?> moduleDataProvider = (IModuleDataProvider<?>) body;
supportedModulesBuilder.add(moduleDataProvider.getModuleData());
logDebugReceivedIMC(imcMethod, message.getSenderModId(), moduleDataProvider);
} else if (body instanceof IModuleDataProvider[]) {
for (IModuleDataProvider<?> moduleDataProvider : ((IModuleDataProvider<?>[]) body)) {
supportedModulesBuilder.add(moduleDataProvider.getModuleData());
logDebugReceivedIMC(imcMethod, message.getSenderModId(), moduleDataProvider);
}
} else {
Mekanism.logger.warn("Received IMC message for '{}' from mod '{}' with an invalid body.", imcMethod, message.getSenderModId());
}
});
Set<ModuleData<?>> supported = supportedModulesBuilder.build();
if (!supported.isEmpty()) {
Item item = moduleContainer.getItem();
supportedModules.put(item, supported);
for (ModuleData<?> data : supported) {
supportedContainersBuilderMap.computeIfAbsent(data, d -> ImmutableSet.builder()).add(item);
}
}
}
Aggregations