本文整理汇总了Java中codechicken.nei.NEIClientUtils类的典型用法代码示例。如果您正苦于以下问题:Java NEIClientUtils类的具体用法?Java NEIClientUtils怎么用?Java NEIClientUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NEIClientUtils类属于codechicken.nei包,在下文中一共展示了NEIClientUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadCraftingRecipes
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(ItemStack result) {
result.stackSize = 1;
if (dummy.isCookResultAcceptable(result)) {
Map map = FurnaceRecipes.smelting().getSmeltingList();
Iterator it = map.keySet().iterator();
while (it.hasNext()) {
ItemStack itemStack = (ItemStack) it.next();
if (NEIClientUtils.areStacksSameTypeCrafting(FurnaceRecipes.smelting().getSmeltingResult(itemStack),
result)) {
arecipes.add(new CachedOvenRecipe(itemStack, result));
}
}
}
}
示例2: openRecipeGui
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
public static boolean openRecipeGui(String inputId, Object... ingredients) {
Minecraft mc = NEIClientUtils.mc();
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
ArrayList<IUsageHandler> handlers = new ArrayList<IUsageHandler>();
for (IUsageHandler usagehandler : usagehandlers) {
profiler.start(usagehandler.getRecipeName());
IUsageHandler handler = usagehandler.getUsageHandler(inputId, ingredients);
if (handler.numRecipes() > 0)
handlers.add(handler);
}
profiler.end();
if (handlers.isEmpty())
return false;
mc.displayGuiScreen(new GuiUsageRecipe(prevscreen, handlers));
return true;
}
示例3: openRecipeGui
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
public static boolean openRecipeGui(String outputId, Object... results) {
Minecraft mc = NEIClientUtils.mc();
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
ArrayList<ICraftingHandler> handlers = new ArrayList<ICraftingHandler>();
for (ICraftingHandler craftinghandler : craftinghandlers) {
profiler.start(craftinghandler.getRecipeName());
ICraftingHandler handler = craftinghandler.getRecipeHandler(outputId, results);
if (handler.numRecipes() > 0)
handlers.add(handler);
}
profiler.end();
if (handlers.isEmpty())
return false;
mc.displayGuiScreen(new GuiCraftingRecipe(prevscreen, handlers));
return true;
}
示例4: dumpFile
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
public void dumpFile() {
try {
File file = new File(CommonUtils.getMinecraftDir(), "dumps/" + getFileName(name.replaceFirst(".+\\.", "")));
if (!file.getParentFile().exists())
file.getParentFile().mkdirs();
if (!file.exists())
file.createNewFile();
dumpTo(file);
NEIClientUtils.printChatMessage(dumpMessage(file));
} catch (Exception e) {
System.err.println("Error dumping " + renderName() + " mode: " + getMode());
e.printStackTrace();
}
}
示例5: getIngredient
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
public PositionedStack getIngredient()
{
int cycle = cycleticks / 48;
if(ingred.item.getItemDamage() == -1)
{
PositionedStack stack = ingred.copy();
int maxDamage = 0;
do
{
maxDamage++;
stack.item.setItemDamage(maxDamage);
}
while(NEIClientUtils.isValidItem(stack.item));
stack.item.setItemDamage(cycle % maxDamage);
return stack;
}
return ingred;
}
示例6: loadUsageRecipes
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void loadUsageRecipes(ItemStack ingredient){
for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
boolean[] addedRecipe = new boolean[program.getRecipeList().size()];
for(int j = 0; j < program.getRecipeList().size(); j++) {
if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getInput(), ingredient)) {
arecipes.add(getShape(i, j));
addedRecipe[j] = true;
}
}
if(ingredient.getItem() == Itemss.assemblyProgram && ingredient.getItemDamage() == i) {
for(int j = 0; j < program.getRecipeList().size(); j++)
if(!addedRecipe[j]) arecipes.add(getShape(i, j));
} else {
for(ItemStack machine : getMachinesFromEnum(program.getRequiredMachines())) {
if(NEIClientUtils.areStacksSameTypeCrafting(machine, ingredient)) {
for(int j = 0; j < program.getRecipeList().size(); j++)
if(!addedRecipe[j]) arecipes.add(getShape(i, j));
break;
}
}
}
}
}
示例7: lastKeyTyped
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode)
{
ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
if(stackover == null)
return false;
if(keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey()))
return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
return false;
}
示例8: onUpdate
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void onUpdate() {
if (!NEIClientUtils.shiftKey()) {
cycleticks++;
if (cycleticks % 20 == 0)
for (CachedRecipe crecipe : arecipes)
((CachedFireworkRecipe) crecipe).cycle();
}
}
示例9: handleTooltip
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
currenttip = super.handleTooltip(gui, currenttip, recipe);
Point mousepos = GuiDraw.getMousePosition();
Point relMouse = new Point(mousepos.x - gui.guiLeft, mousepos.y - gui.guiTop);
Point recipepos = gui.getRecipePosition(recipe);
if (currenttip.isEmpty() && GuiContainerManager.getStackMouseOver(gui) == null &&
new Rectangle(recipepos.x, recipepos.y, 166, 55).contains(relMouse))
currenttip.add(NEIClientUtils.translate(
"recipe.firework.tooltip" + ((CachedFireworkRecipe) arecipes.get(recipe)).recipeType));
return currenttip;
}
示例10: mouseClicked
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void mouseClicked(int mousex, int mousey, int button) {
if (modeCount() > 1 && modeButtonSize().contains(mousex, mousey)) {
NEIClientUtils.playClickSound();
getTag().setIntValue((getMode() + 1) % modeCount());
} else if (dumpButtonSize().contains(mousex, mousey)) {
NEIClientUtils.playClickSound();
dumpFile();
}
}
示例11: dumpFile
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
public void dumpFile() {
try {
File file = new File(CommonUtils.getMinecraftDir(), "dumps/" + getFileName(name.replaceFirst(".+\\.", "")));
if (!file.getParentFile().exists())
file.getParentFile().mkdirs();
if (!file.exists())
file.createNewFile();
dumpTo(file);
NEIClientUtils.printChatMessage(dumpMessage(file));
} catch (Exception e) {
NEIClientConfig.logger.error("Error dumping " + renderName() + " mode: " + getMode(), e);
}
}
示例12: mouseClicked
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void mouseClicked(int mousex, int mousey, int button) {
if(getMode() == 3 && resButtonSize().contains(mousex, mousey)) {
NEIClientUtils.playClickSound();
getTag(name+".res").setIntValue((renderTag(name+".res").getIntValue(0) + 1) % resolutions.length);
}
else
super.mouseClicked(mousex, mousey, button);
}
示例13: loadCraftingRecipes
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IAlloyFurnaceRecipe recipe : AlloyFurnaceRegistry.getInstance().getAllRecipes())
if (recipe instanceof AlloyFurnaceRegistry.StandardAlloyFurnaceRecipe) {
if (NEIClientUtils.areStacksSameTypeCrafting(recipe.getCraftingResult(null), result)) {
arecipes.add(new AlloyRecipe((AlloyFurnaceRegistry.StandardAlloyFurnaceRecipe) recipe));
}
}
}
示例14: loadUsageRecipes
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IAlloyFurnaceRecipe recipe : AlloyFurnaceRegistry.getInstance().getAllRecipes()) {
if (recipe instanceof AlloyFurnaceRegistry.StandardAlloyFurnaceRecipe) {
AlloyFurnaceRegistry.StandardAlloyFurnaceRecipe standardAlloyRecipe = (AlloyFurnaceRegistry.StandardAlloyFurnaceRecipe) recipe;
for (ItemStack input : standardAlloyRecipe.getRequiredItems()) {
if (NEIClientUtils.areStacksSameTypeCrafting(input, ingredient)) {
arecipes.add(new AlloyRecipe(standardAlloyRecipe));
break;
}
}
}
}
}
示例15: loadCraftingRecipes
import codechicken.nei.NEIClientUtils; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(ItemStack result){
for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
for(int j = 0; j < program.getRecipeList().size(); j++) {
if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getOutput(), result)) {
arecipes.add(getShape(i, j));
break;
}
}
}
}