Skip to content

Commit

Permalink
Added configurable HUD offset
Browse files Browse the repository at this point in the history
  • Loading branch information
kamildanak committed Mar 1, 2017
1 parent 959f4bd commit c6b0762
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/java/info/jbcs/minecraft/vending/Vending.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
Expand Down Expand Up @@ -56,6 +57,7 @@ public class Vending {

public static GuiHandler guiVending;
public static GuiHandler guiWrench;
public static int offsetY;

public static CreativeTabs tabVending;
public static boolean close_on_partial_sold_out;
Expand Down Expand Up @@ -120,6 +122,10 @@ public ItemStack getTabIconItem() {
transfer_to_inventory = config.get("general", "transfer_to_inventory", false,
"Transfer sold items directly to player's inventory.").getBoolean(false);

int defaultOffset = (Loader.isModLoaded("waila"))?40:15;
offsetY = config.get("general", "offsetY", defaultOffset,
"Set Y offset of HUD").getInt(defaultOffset);

config.save();
blockVendingMachine.setCreativeTab(tabVending);
blockAdvancedVendingMachine.setCreativeTab(tabVending);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.kamildanak.minecraft.enderpay.api.EnderPayApi;
import info.jbcs.minecraft.vending.General;
import info.jbcs.minecraft.vending.Utils;
import info.jbcs.minecraft.vending.Vending;
import info.jbcs.minecraft.vending.gui.lib.elements.GuiElement;
import info.jbcs.minecraft.vending.gui.lib.elements.GuiItemsList;
import info.jbcs.minecraft.vending.gui.lib.elements.GuiLabel;
Expand Down Expand Up @@ -100,7 +101,7 @@ public void onRenderInfo(RenderGameOverlayEvent.Post event) {
boughtAndSold.setHorizontal(mc.player.isSneaking());

TileEntityVendingMachine tileEntity = (TileEntityVendingMachine) te;
root.y = 15;
root.y = Vending.offsetY;
labelSeller.setCaption(tileEntity.getOwnerName());
labelSeller.center = true;

Expand Down

0 comments on commit c6b0762

Please sign in to comment.