mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
the
This commit is contained in:
parent
52825d9d9e
commit
e11087bee6
@ -44,6 +44,7 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
int size;
|
int size;
|
||||||
int selection;
|
int selection;
|
||||||
private GuiTextField search;
|
private GuiTextField search;
|
||||||
|
private InventoryPlayer playerInventory;
|
||||||
|
|
||||||
public GUIAnvil(InventoryPlayer player, int tier) {
|
public GUIAnvil(InventoryPlayer player, int tier) {
|
||||||
super(new ContainerAnvil(player, tier));
|
super(new ContainerAnvil(player, tier));
|
||||||
@ -51,7 +52,8 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 222;
|
this.ySize = 222;
|
||||||
|
|
||||||
|
this.playerInventory = player;
|
||||||
for(AnvilConstructionRecipe recipe : AnvilRecipes.getConstruction()) {
|
for(AnvilConstructionRecipe recipe : AnvilRecipes.getConstruction()) {
|
||||||
if(recipe.isTierValid(this.tier))
|
if(recipe.isTierValid(this.tier))
|
||||||
this.originList.add(recipe);
|
this.originList.add(recipe);
|
||||||
@ -243,7 +245,7 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
if(this.selection >= 0) {
|
if(this.selection >= 0) {
|
||||||
|
|
||||||
AnvilConstructionRecipe recipe = recipes.get(this.selection);
|
AnvilConstructionRecipe recipe = recipes.get(this.selection);
|
||||||
List<String> list = recipeToList(recipe);
|
List<String> list = recipeToList(recipe,playerInventory);
|
||||||
int longest = 0;
|
int longest = 0;
|
||||||
|
|
||||||
for(String s : list) {
|
for(String s : list) {
|
||||||
@ -274,7 +276,7 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
* @param recipe
|
* @param recipe
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<String> recipeToList(AnvilConstructionRecipe recipe) {
|
public List<String> recipeToList(AnvilConstructionRecipe recipe,InventoryPlayer inventory) {
|
||||||
|
|
||||||
List<String> list = new ArrayList();
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
@ -283,16 +285,44 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
for(AStack stack : recipe.input) {
|
for(AStack stack : recipe.input) {
|
||||||
if(stack instanceof ComparableStack) {
|
if(stack instanceof ComparableStack) {
|
||||||
ItemStack input = ((ComparableStack) stack).toStack();
|
ItemStack input = ((ComparableStack) stack).toStack();
|
||||||
list.add(">" + input.stackSize + "x " + input.getDisplayName());
|
boolean hasItem = false;
|
||||||
|
for (int i = 0; i < inventory.mainInventory.length; i++) {
|
||||||
|
ItemStack stackItem = inventory.mainInventory[i];
|
||||||
|
if(stackItem == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stackItem.getItem() == input.getItem() && stackItem.stackSize >= stack.stacksize) {
|
||||||
|
hasItem = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(hasItem) {
|
||||||
|
list.add(">" + input.stackSize + "x " + input.getDisplayName());
|
||||||
|
}else {
|
||||||
|
list.add(EnumChatFormatting.RED + ">" + input.stackSize + "x " + input.getDisplayName());
|
||||||
|
}
|
||||||
} else if(stack instanceof OreDictStack) {
|
} else if(stack instanceof OreDictStack) {
|
||||||
OreDictStack input = (OreDictStack) stack;
|
OreDictStack input = (OreDictStack) stack;
|
||||||
ArrayList<ItemStack> ores = OreDictionary.getOres(input.name);
|
ArrayList<ItemStack> ores = OreDictionary.getOres(input.name);
|
||||||
|
|
||||||
if(ores.size() > 0) {
|
if(ores.size() > 0) {
|
||||||
ItemStack inStack = ores.get((int) (Math.abs(System.currentTimeMillis() / 1000) % ores.size()));
|
ItemStack inStack = ores.get((int) (Math.abs(System.currentTimeMillis() / 1000) % ores.size()));
|
||||||
list.add(">" + input.stacksize + "x " + inStack.getDisplayName());
|
boolean hasItem = false;
|
||||||
|
for (int i = 0; i < inventory.mainInventory.length; i++) {
|
||||||
|
ItemStack stackItem = inventory.mainInventory[i];
|
||||||
|
if(stackItem == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stackItem.getItem() == inStack.getItem() && stackItem.stackSize >= stack.stacksize) {
|
||||||
|
hasItem = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasItem) {
|
||||||
|
list.add(">" + input.stacksize + "x " + inStack.getDisplayName());
|
||||||
|
} else {
|
||||||
|
list.add(EnumChatFormatting.RED + ">" + input.stacksize + "x " + inStack.getDisplayName());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
list.add("I AM ERROR");
|
list.add("I AM ERROR");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,6 +186,7 @@ public class GUIScreenTemplateFolder extends GuiScreen {
|
|||||||
this.search.setDisabledTextColour(0xffffff);
|
this.search.setDisabledTextColour(0xffffff);
|
||||||
this.search.setEnableBackgroundDrawing(false);
|
this.search.setEnableBackgroundDrawing(false);
|
||||||
this.search.setMaxStringLength(100);
|
this.search.setMaxStringLength(100);
|
||||||
|
this.search.setFocused(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user