1
0
Fork 0

increase hotbar size

This commit is contained in:
Sen 2025-08-18 13:27:26 +02:00
parent 69bb1e6ffb
commit 5641c5c834
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
7 changed files with 27 additions and 17 deletions

View file

@ -386,7 +386,7 @@ public class Client implements IThreadListener {
private final List<Message> hotbar = Lists.newArrayList();
private final File config = new File(System.getProperty("config.file", "client.cfg"));
private final Bind[] keyBindsHotbar = new Bind[] {
Bind.SELECT1, Bind.SELECT2, Bind.SELECT3, Bind.SELECT4, Bind.SELECT5, Bind.SELECT6, Bind.SELECT7, Bind.SELECT8, Bind.SELECT9
Bind.SELECT1, Bind.SELECT2, Bind.SELECT3, Bind.SELECT4, Bind.SELECT5, Bind.SELECT6, Bind.SELECT7, Bind.SELECT8, Bind.SELECT9, Bind.SELECT10, Bind.SELECT11, Bind.SELECT12
};
private final int[] tickTimes = new int[240];
private final long[] frames = new long[240];
@ -874,7 +874,7 @@ public class Client implements IThreadListener {
}
if(this.viewEntity == this.player) {
for (int l = 0; l < 9; ++l)
for (int l = 0; l < this.keyBindsHotbar.length && l < this.player.getHotbarSize(); ++l)
{
if (this.keyBindsHotbar[l].isPressed())
{
@ -1076,8 +1076,9 @@ public class Client implements IThreadListener {
int selected = this.player.getSelectedIndex();
int scale = this.scaleHotbar ? 2 : 1;
for(int n = 0; n < 9; n++) {
int x = this.fbX / 2 - 90 * scale + n * 20 * scale + 2 * scale;
int size = this.player.getHotbarSize();
for(int n = 0; n < size; n++) {
int x = this.fbX / 2 - size * 10 * scale + n * 20 * scale + 2 * scale;
int y = this.fbY - 20 * scale;
if(selected == n)
Drawing.drawRect(x - scale * 2, y - scale * 2, 20 * scale, 20 * scale, 0xffffffff);
@ -1231,11 +1232,12 @@ public class Client implements IThreadListener {
ItemRenderer.enableGUIStandardItemLighting();
GL11.glPushMatrix();
int scale = this.scaleHotbar ? 2 : 1;
GL11.glTranslatef((float)(this.fbX / 2 - 90 * scale + 2 * scale), (float)(this.fbY - 20 * scale), 0.0f);
int size = this.player.getHotbarSize();
GL11.glTranslatef((float)(this.fbX / 2 - size * 10 * scale + 2 * scale), (float)(this.fbY - 20 * scale), 0.0f);
if(this.scaleHotbar)
GL11.glScalef(2.0f, 2.0f, 2.0f);
for(int index = 0; index < 9; ++index) {
for(int index = 0; index < size; ++index) {
int xPos = index * 20;
ItemStack itemstack = this.player.getStackInSlot(index);
if(itemstack != null) {
@ -1272,11 +1274,12 @@ public class Client implements IThreadListener {
GlState.disableDepth();
if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) {
int scale = this.scaleHotbar ? 2 : 1;
for(int index = 0; index < 9; ++index) {
int size = this.player.getHotbarSize();
for(int index = 0; index < size; ++index) {
ItemStack itemstack = this.player.getStackInSlot(index);
if(itemstack != null) {
GuiContainer.renderItemOverlay(itemstack,
this.fbX / 2 - 90 * scale + 2 * scale + index * 20 * scale, this.fbY - 20 * scale, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale);
this.fbX / 2 - size * 10 * scale + 2 * scale + index * 20 * scale, this.fbY - 20 * scale, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale);
}
}
}
@ -1396,8 +1399,8 @@ public class Client implements IThreadListener {
else if(this.player != null) {
this.player.setSelectedIndex(this.player.getSelectedIndex() - dir);
if(this.player.getSelectedIndex() < 0)
this.player.setSelectedIndex(9 - 1);
else if(this.player.getSelectedIndex() >= 9)
this.player.setSelectedIndex(this.player.getHotbarSize() - 1);
else if(this.player.getSelectedIndex() >= this.player.getHotbarSize())
this.player.setSelectedIndex(0);
this.controller.resetUseCooldown();
}
@ -1618,7 +1621,7 @@ public class Client implements IThreadListener {
return;
int idx = this.player.getInventorySlotContainItem(item);
if(idx >= 0 && idx < 9) {
if(idx >= 0 && idx < this.player.getHotbarSize()) {
this.player.setSelectedIndex(idx);
this.controller.resetUseCooldown();
}