Skip to content

Commit

Permalink
Added config option for disabling tool mode indicator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kittychanley committed Dec 23, 2015
1 parent c09c0d4 commit b65b8a8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/API/com/bioxx/tfc/api/TFCOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class TFCOptions
public static String quiverHUDPosition = "bottomleft";
public static boolean enableSolidDetailed = true;
public static int maxRemovedSolidDetailed = 12;
public static boolean enableToolModeIndicator = true;

// Time
public static int yearLength = 96;
Expand Down
1 change: 1 addition & 0 deletions src/Common/com/bioxx/tfc/Core/Config/TFC_ConfigFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ public static void reloadGeneral()
quiverHUDPosition = generalConfig.getString("quiverHUDPosition", GENERAL, quiverHUDPosition, "Valid position strings are: bottomleft, left, topleft, bottomright, right, topright", new String[]{"bottomleft", "left", "topleft", "bottomright", "right", "topright"}, "config.gui.TFCConfig.general.quiverHUDPosition");
enableSolidDetailed = generalConfig.getBoolean("enableSolidDetailed", GENERAL, enableSolidDetailed, "Should sides of detailed blocks be considered solid?", "config.gui.TFCConfig.general.enableSolidDetailed");
maxRemovedSolidDetailed = generalConfig.getInt("maxRemovedSolidDetailed", GENERAL, maxRemovedSolidDetailed, 0, 64, "Maximum count of removed sub-blocks on one side for the detailed block side to still be solid.", "config.gui.TFCConfig.general.maxRemovedSolidDetailed");
enableToolModeIndicator = generalConfig.getBoolean("enableToolModeIndicator", GENERAL, enableToolModeIndicator, "Set to false to hide the tool mode indicator that is displayed next to the hotbar for tools such as chisels and hoes.", "config.gui.TFCConfig.general.enableToolModeIndicator");

generalConfig.setCategoryLanguageKey(TIME, "config.gui.TFCConfig.time");

Expand Down
51 changes: 28 additions & 23 deletions src/Common/com/bioxx/tfc/Handlers/Client/RenderOverlayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -78,6 +79,8 @@ public void render(RenderGameOverlayEvent.Pre event)
ScaledResolution sr = event.resolution;
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
InventoryPlayer playerInventory = player.inventory;
PlayerInfo playerInfo = PlayerManagerTFC.getInstance().getClientPlayer();

int healthRowHeight = sr.getScaledHeight() - 40;
int armorRowHeight = healthRowHeight - 10;
Expand All @@ -87,31 +90,34 @@ public void render(RenderGameOverlayEvent.Pre event)
TFC_Core.bindTexture(tfcicons);

//Render Tool Mode
if (player.inventory.getCurrentItem() != null &&
player.inventory.getCurrentItem().getItem() instanceof ItemCustomHoe)
if (TFCOptions.enableToolModeIndicator && playerInventory.getCurrentItem() != null)
{
int mode = PlayerManagerTFC.getInstance().getClientPlayer().hoeMode;
this.drawTexturedModalRect(mid + 95, sr.getScaledHeight() - 21, 0+(20*mode), 38, 20, 20);
}
else if (player.inventory.getCurrentItem() != null &&
player.inventory.getCurrentItem().getItem() instanceof ItemChisel)
{
boolean hasHammer = false;
Item currentItem = playerInventory.getCurrentItem().getItem();

for (int i = 0; i < 9; i++)
if (currentItem instanceof ItemCustomHoe)
{
if (player.inventory.mainInventory[i] != null && player.inventory.mainInventory[i].getItem() instanceof ItemHammer)
{
hasHammer = true;
break;
}
int mode = playerInfo.hoeMode;
this.drawTexturedModalRect(mid + 95, sr.getScaledHeight() - 21, 0 + (20 * mode), 38, 20, 20);
}
if (hasHammer)
else if (currentItem instanceof ItemChisel)
{
int mode = PlayerManagerTFC.getInstance().getClientPlayer().chiselMode;
TFC_Core.bindTexture(ChiselManager.getInstance().getResourceLocation(mode));
this.drawTexturedModalRect(mid + 95, sr.getScaledHeight() - 21, ChiselManager.getInstance().getTextureU(mode), ChiselManager.getInstance().getTextureV(mode), 20, 20);
TFC_Core.bindTexture(tfcicons);
boolean hasHammer = false;

for (int i = 0; i < 9; i++)
{
if (playerInventory.mainInventory[i] != null && playerInventory.mainInventory[i].getItem() instanceof ItemHammer)
{
hasHammer = true;
break;
}
}
if (hasHammer)
{
int mode = playerInfo.chiselMode;
TFC_Core.bindTexture(ChiselManager.getInstance().getResourceLocation(mode));
this.drawTexturedModalRect(mid + 95, sr.getScaledHeight() - 21, ChiselManager.getInstance().getTextureU(mode), ChiselManager.getInstance().getTextureV(mode), 20, 20);
TFC_Core.bindTexture(tfcicons);
}
}
}

Expand Down Expand Up @@ -180,7 +186,6 @@ else if ("left".equalsIgnoreCase(pos))
TFC_Core.bindTexture(tfcicons);
}

PlayerInfo playerclient = PlayerManagerTFC.getInstance().getClientPlayer();
if(mc.playerController.gameIsSurvivalOrAdventure())
{
//Draw Health
Expand All @@ -201,9 +206,9 @@ else if ("left".equalsIgnoreCase(pos))

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(mid+1, healthRowHeight, 0, 20, 90, 5);
if(playerclient != null && playerclient.guishowFoodRestoreAmount)
if (playerInfo.guishowFoodRestoreAmount)
{
float percentFood2 = Math.min(percentFood + playerclient.guiFoodRestoreAmount / foodstats.getMaxStomach(player), 1);
float percentFood2 = Math.min(percentFood + playerInfo.guiFoodRestoreAmount / foodstats.getMaxStomach(player), 1);
GL11.glColor4f(0.0F, 0.6F, 0.0F, 0.3F);
this.drawTexturedModalRect(mid+1, healthRowHeight, 0, 25, (int) (90*(percentFood2)), 5);
}
Expand Down

0 comments on commit b65b8a8

Please sign in to comment.