improve blueprint library text colors, add refreshing on GUI open (#2270)

This commit is contained in:
asiekierka 2014-12-13 13:52:25 +01:00
parent 9299ddccac
commit 177eb3d9f1
4 changed files with 21 additions and 8 deletions

View file

@ -181,7 +181,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
// legacy beta BuildCraft
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
+ "blueprints" + File.separator + "client\"",
// infered used download location
// inferred user download location
"\"" + getDownloadsDir() + "\""
}
).getStringList().clone();

View file

@ -58,13 +58,18 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory,
}
public void refresh() {
if (worldObj.isRemote) {
BuildCraftBuilders.clientDB.refresh();
setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId));
}
}
@Override
public void initialize() {
super.initialize();
if (worldObj.isRemote) {
setCurrentPage(BuildCraftBuilders.clientDB.getPage (pageId));
}
refresh();
}
public void setCurrentPage(ArrayList<BlueprintId> newPage) {

View file

@ -35,7 +35,7 @@ public class BlueprintDatabase {
private File outputDir;
private File[] inputDirs;
private Set<BlueprintId> blueprintIds = new TreeSet<BlueprintId>();
private Set<BlueprintId> blueprintIds;
private BlueprintId [] pages = new BlueprintId [0];
/**
@ -56,6 +56,11 @@ public class BlueprintDatabase {
inputDirs[i] = new File(inputPaths[i]);
}
refresh();
}
public void refresh() {
blueprintIds = new TreeSet<BlueprintId>();
loadIndex(inputDirs);
}
@ -187,7 +192,7 @@ public class BlueprintDatabase {
}
}
pages = blueprintIds.toArray(pages);
pages = blueprintIds.toArray(new BlueprintId[blueprintIds.size()]);
}
}

View file

@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import buildcraft.BuildCraftBuilders;
import buildcraft.BuildCraftCore;
import buildcraft.builders.TileBlueprintLibrary;
import buildcraft.builders.blueprints.BlueprintId;
import buildcraft.builders.blueprints.BlueprintId.Kind;
@ -52,6 +53,8 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
deleteButton = new GuiButton(2, guiLeft + 158, guiTop + 114, 25, 20, StringUtils.localize("gui.del"));
buttonList.add(deleteButton);
library.refresh();
checkDelete();
checkPages();
}
@ -74,14 +77,14 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
int i2 = 24;
if (bpt.kind == Kind.Blueprint) {
drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0xFFA0A0FF, 0xFFA0A0FF);
drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0xFFA0C0F0, 0xFFA0C0F0);
} else {
drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0x80ffffff, 0x80ffffff);
}
}
if (bpt.kind == Kind.Blueprint) {
fontRendererObj.drawString(name, 9, 25 + 9 * c, 0x1000FF);
fontRendererObj.drawString(name, 9, 25 + 9 * c, 0x305080);
} else {
fontRendererObj.drawString(name, 9, 25 + 9 * c, 0x000000);
}