1.1.8
All checks were successful
SorceryCraft/pipeline/head This commit looks good

Tweak Casting Table UI
This commit is contained in:
TheBrokenRail 2020-03-10 20:47:27 -04:00
parent 3a173b25d1
commit 6d8376b8a9
3 changed files with 13 additions and 16 deletions

View File

@ -1,5 +1,8 @@
### Changelog ### Changelog
**1.1.8**
* Tweak Casting Table UI
**1.1.7** **1.1.7**
* Improve JavaDoc * Improve JavaDoc
* Update Mappings * Update Mappings

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
loader_version = 0.7.8+build.187 loader_version = 0.7.8+build.187
# Mod Properties # Mod Properties
mod_version = 1.1.7 mod_version = 1.1.8
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = sorcerycraft archives_base_name = sorcerycraft

View File

@ -67,7 +67,6 @@ public class CastingTableScreen extends ScreenWithHandler<CastingTableScreenHand
if (button.visible) { if (button.visible) {
Spell spell = handler.getRecipes()[button.getIndex() + indexStartOffset]; Spell spell = handler.getRecipes()[button.getIndex() + indexStartOffset];
button.setMessage(SpellTag.getTranslatedSpell(spell.getID(), spell.getLevel(), true).getString()); button.setMessage(SpellTag.getTranslatedSpell(spell.getID(), spell.getLevel(), true).getString());
button.setFocused((button.getIndex() + indexStartOffset) == selectedIndex);
} }
} }
} }
@ -78,17 +77,11 @@ public class CastingTableScreen extends ScreenWithHandler<CastingTableScreenHand
client.getTextureManager().bindTexture(TEXTURE); client.getTextureManager().bindTexture(TEXTURE);
int i = (width - backgroundWidth) / 2; int i = (width - backgroundWidth) / 2;
int j = (height - backgroundHeight) / 2; int j = (height - backgroundHeight) / 2;
int k = spells.length + 1 - 7; int k = spells.length - 7;
if (k > 1) { if (k > 1) {
int l = 139 - (27 + (k - 1) * 139 / k); int modifier = (int) (((float) indexStartOffset / k) * (1 + 139 - 27));
int m = 1 + l / k + 139 / k; blit(i + 94, j + 18 + modifier, getZOffset(), 0.0F, 199.0F, 6, 27, 256, 512);
int o = Math.min(113, indexStartOffset * m);
if (this.indexStartOffset == k - 1) {
o = 113;
}
blit(i + 94, j + 18 + o, getZOffset(), 0.0F, 199.0F, 6, 27, 256, 512);
} else { } else {
blit(i + 94, j + 18, getZOffset(), 6.0F, 199.0F, 6, 27, 256, 512); blit(i + 94, j + 18, getZOffset(), 6.0F, 199.0F, 6, 27, 256, 512);
} }
@ -104,10 +97,10 @@ public class CastingTableScreen extends ScreenWithHandler<CastingTableScreenHand
if (!canScroll(spells.length) || (x >= indexStartOffset && x < 7 + indexStartOffset)) { if (!canScroll(spells.length) || (x >= indexStartOffset && x < 7 + indexStartOffset)) {
ItemStack itemStack = spells[x].getItemCost(); ItemStack itemStack = spells[x].getItemCost();
itemRenderer.zOffset = 100.0F; itemRenderer.zOffset = 100.0F;
int n = k + 2; int y = k + 2;
itemRenderer.renderGuiItem(itemStack, i + 5 + 68, n); itemRenderer.renderGuiItem(itemStack, i + 5 + 68, y);
itemRenderer.renderGuiItemOverlay(textRenderer, itemStack, i + 5 + 68, n); itemRenderer.renderGuiItemOverlay(textRenderer, itemStack, i + 5 + 68, y);
itemRenderer.zOffset = 0.0F; itemRenderer.zOffset = 0.0F;
k += 20; k += 20;
} }
@ -211,8 +204,9 @@ public class CastingTableScreen extends ScreenWithHandler<CastingTableScreenHand
} }
@Override @Override
public void setFocused(boolean state) { public void render(int mouseX, int mouseY, float delta) {
super.setFocused(state); active = (index + CastingTableScreen.this.indexStartOffset) != CastingTableScreen.this.selectedIndex;
super.render(mouseX, mouseY, delta);
} }
public int getIndex() { public int getIndex() {