Skip to content

Commit

Permalink
Add a minimal textures option that only uses colored parts and no cus…
Browse files Browse the repository at this point in the history
…tom textures for less graphic memory usage. Let's see if this helps.
  • Loading branch information
bonii-xx committed Sep 26, 2014
1 parent 2f80edd commit 1eb4c50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/main/java/tconstruct/library/tools/DynamicToolPart.java
Expand Up @@ -15,6 +15,7 @@
import tconstruct.library.util.IToolPart;
import tconstruct.library.util.TextureHelper;
import tconstruct.tools.TinkerTools;
import tconstruct.util.config.PHConstruct;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -115,12 +116,13 @@ public void registerIcons (IIconRegister iconRegister)
this.icons = new IIcon[max+1];

// register icon for each material that has one
for(Map.Entry<Integer, tconstruct.library.tools.ToolMaterial> entry : TConstructRegistry.toolMaterials.entrySet())
{
String tex = modTexPrefix + ":" + folder + entry.getValue().materialName.toLowerCase() + texture;
if(TextureHelper.itemTextureExists(tex))
this.icons[entry.getKey()] = iconRegister.registerIcon(tex);
}
if(!PHConstruct.minimalTextures)
for(Map.Entry<Integer, tconstruct.library.tools.ToolMaterial> entry : TConstructRegistry.toolMaterials.entrySet())
{
String tex = modTexPrefix + ":" + folder + entry.getValue().materialName.toLowerCase() + texture;
if(TextureHelper.itemTextureExists(tex))
this.icons[entry.getKey()] = iconRegister.registerIcon(tex);
}

// default texture
this.defaultIcon = iconRegister.registerIcon(modTexPrefix + ":" + folder + texture);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/tconstruct/library/tools/ToolCore.java
Expand Up @@ -21,6 +21,7 @@
import tconstruct.library.util.TextureHelper;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.entity.FancyEntityItem;
import tconstruct.util.config.PHConstruct;

/**
* NBTTags Main tag - InfiTool
Expand Down Expand Up @@ -214,16 +215,17 @@ public void registerIcons (IIconRegister iconRegister)

private void addIcons(HashMap<Integer, String> textures, HashMap<Integer, IIcon> icons, IIconRegister iconRegister, String standard)
{
// compatibility mode: no specific textures
if(PHConstruct.minimalTextures)
textures.clear();

icons.clear();
for(Map.Entry<Integer, String> entry : textures.entrySet())
{
if(TextureHelper.itemTextureExists(entry.getValue()))
icons.put(entry.getKey(), iconRegister.registerIcon(entry.getValue()));
}

// get the mod id stuff.


if(standard != null && !standard.isEmpty()) {
standard = getDefaultTexturePath() + "/" + standard;
icons.put(-1, iconRegister.registerIcon(standard));
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/tconstruct/util/config/PHConstruct.java
Expand Up @@ -184,6 +184,7 @@ public static void initProps (File location)
throwableSmeltery = config.get("Experimental", "Items can be thrown into smelteries", true).getBoolean(true);
newSmeltery = config.get("Experimental", "Use new adaptive Smeltery code", false, "Warning: Very buggy").getBoolean(false);
meltableHorses = config.get("Experimental", "Allow horses to be melted down for glue", true).getBoolean(true);
minimalTextures = config.get("Experimental", "Minimal Textures", false).getBoolean(false);

/* Save the configuration file only if it has changed */
if (config.hasChanged())
Expand Down Expand Up @@ -351,5 +352,6 @@ public static void initProps (File location)
public static boolean throwableSmeltery;
public static boolean newSmeltery;
public static boolean meltableHorses;
public static boolean minimalTextures;

}

0 comments on commit 1eb4c50

Please sign in to comment.