Java源码示例:codechicken.nei.NEIClientUtils
示例1
@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;
}
}
}
}
}
示例2
@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;
}
示例3
@Override
public void onUpdate() {
if (!NEIClientUtils.shiftKey()) {
cycleticks++;
if (cycleticks % 20 == 0)
for (CachedRecipe crecipe : arecipes)
((CachedFireworkRecipe) crecipe).cycle();
}
}
示例4
@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;
}
示例5
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);
}
}
示例6
@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();
}
}
示例7
@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);
}
示例8
@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;
}
}
}
}
示例9
@Override
public void loadCraftingRecipes(ItemStack output){
for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
for(PositionedStack stack : recipe.output) {
for(ItemStack itemStack : stack.items) {
if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, output)) {
arecipes.add(recipe);
}
}
}
}
}
示例10
/**
* Simplified wrapper, implement this and fill the empty recipe array with recipes
*
* @param ingredient The ingredient the recipes must contain.
*/
@Override
public void loadUsageRecipes(ItemStack ingredient){
for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
for(PositionedStack stack : recipe.input) {
for(ItemStack itemStack : stack.items) {
if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, ingredient)) {
arecipes.add(recipe);
}
}
}
}
}
示例11
public void onUpdate() {
if (!NEIClientUtils.shiftKey())
cycleticks++;
}
示例12
public String getRecipeName() {
return NEIClientUtils.translate("recipe.fuel");
}
示例13
@Override
public String getRecipeName()
{
return NEIClientUtils.translate("recipe.profiler."+(crafting ? "crafting" : "usage"));
}
示例14
@Override
public String getRecipeName() {
return NEIClientUtils.translate("recipe.brewing");
}
示例15
public String getRecipeName() {
return NEIClientUtils.translate("recipe.shapeless");
}
示例16
@Override
public String getRecipeName() {
return NEIClientUtils.translate("recipe.firework");
}
示例17
@Override
public String getRecipeName() {
return NEIClientUtils.translate("recipe.furnace");
}
示例18
@Override
public String getRecipeName() {
return NEIClientUtils.translate("recipe.shaped");
}
示例19
public String dumpButtonText() {
return NEIClientUtils.lang.translate("options.tools.dump.dump");
}
示例20
public String modeButtonText() {
return NEIClientUtils.lang.translate("options.tools.dump.mode." + getMode());
}
示例21
private void returnScreen(IChatComponent msg) {
Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui());
NEIClientUtils.printChatMessage(msg);
}
示例22
private void updateNames() {
toggleButton.text = NEIClientUtils.translate("options." + name + "." + (show() ? "show" : "hide"));
}
示例23
@Override
public String getRecipeName () {
return NEIClientUtils.translate("recipe.gardenstuff.bloomeryFurnace", new Object[0]);
}