forked from cabaletta/baritone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
547 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* This file is part of Baritone. | ||
* | ||
* Baritone is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Baritone is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package baritone.api.command.datatypes; | ||
|
||
import baritone.api.command.exception.CommandException; | ||
import baritone.api.command.helpers.TabCompleteHelper; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.ItemLike; | ||
|
||
import java.util.stream.Stream; | ||
|
||
public enum ItemById implements IDatatypeFor<Item> { | ||
INSTANCE; | ||
|
||
@Override | ||
public Item get(IDatatypeContext ctx) throws CommandException { | ||
Item item; | ||
if ((item = BuiltInRegistries.ITEM.get(new ResourceLocation(ctx.getConsumer().getString()))) == Items.AIR) { | ||
throw new IllegalArgumentException("No item found by that id"); | ||
} | ||
return item; | ||
} | ||
|
||
@Override | ||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException { | ||
return new TabCompleteHelper() | ||
.append(BuiltInRegistries.ITEM.keySet().stream().map(ResourceLocation::toString)) | ||
.filterPrefixNamespaced(ctx.getConsumer().getString()) | ||
.sortAlphabetically() | ||
.stream(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* This file is part of Baritone. | ||
* | ||
* Baritone is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Baritone is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package baritone.api.process; | ||
|
||
import baritone.api.BaritoneAPI; | ||
import net.minecraft.world.entity.player.Inventory; | ||
import net.minecraft.world.inventory.Slot; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.alchemy.Potion; | ||
import net.minecraft.world.item.crafting.*; | ||
import org.checkerframework.checker.units.qual.C; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This Process controls the Production of Items. | ||
*/ | ||
public interface ICraftingProcess extends IBaritoneProcess { | ||
|
||
/** | ||
* Executes the crafting of the requested recipes such that we obtain the requested amount of output. | ||
* It is possible to mix recipes with different out puts, but it may lead to strange results. | ||
* @param recipes List of recipes that should be used. | ||
* @param amount how many result items are wanted. | ||
*/ | ||
void craft(List<CraftingRecipe> recipes, int amount); | ||
|
||
/** | ||
* @param item that should be crafted. | ||
* @param allCraftingRecipes if all crafting recipes should be returned or only the one that can be crafted | ||
* @return List of recipes that result in the provided Item. | ||
*/ | ||
List<CraftingRecipe> getCraftingRecipes(Item item, boolean allCraftingRecipes); | ||
|
||
/** | ||
* @param recipes that should be crafted. | ||
* @param amount how much output is wanted. | ||
* @return Can we craft this the requested amount of output from the provided recipes? | ||
*/ | ||
boolean canCraft(List<CraftingRecipe> recipes, int amount); | ||
|
||
/** | ||
* @param recipe the recipe we want to craft. | ||
* @return Do we need a crafting table or can we craft it in our inventory? | ||
*/ | ||
boolean canCraftInInventory(CraftingRecipe recipe); | ||
/* | ||
void smithing(SmithingRecipe recipe); | ||
void stoneCutting(StonecutterRecipe recipe, int amount); | ||
boolean forge(Slot primaryItem, Slot secondaryItem); | ||
void grind(Slot item); | ||
void smelt(SmeltingRecipe recipe, int amount); | ||
List<SmeltingRecipe> getSmeltingRecipe(Item item, boolean allSmeltingRecipes); | ||
void brew(Potion potion, int amount); | ||
void trade();/**/ | ||
|
||
/* todo | ||
* crafting | ||
* smithing | ||
* forge (anvil) | ||
* grind | ||
* smelting | ||
* brewing | ||
* weaving | ||
* trading | ||
* enchanting | ||
* */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.