Skip to content

Commit

Permalink
Working scrolling + no legacy actions
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Mar 4, 2023
1 parent 4c30458 commit b40a886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private DevInventoryGroup useCodeBlock() {
if(codeblock.identifier.equals(this.id)) items.add(codeblock.item.getItem());
}
for(Action action: ActionDump.getActionDump().actions) {
if(action.getCodeBlock().identifier.equals(this.id)) items.add(action.icon.getItem());
if(action.getCodeBlock().identifier.equals(this.id) && !action.icon.name.equals("")) items.add(action.icon.getItem());
}
} catch (Exception ignored) {}
return items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private void populate() {
if(text.equals("")) text = null;
List<ItemStack> search = group.searchItems(text);
if( search == null ) return;
scrollHeight = Math.max(0,search.size() - 45);
scrollHeight = Math.max(0,(int) Math.ceil((double) (search.size() - 45) / 9) * 9);
for (int i = 0; i < 45; i++) {
int value = i + (int) scrollPosition * 9;
if(value < search.size()) this.handler.slots.get(i).setStack(search.get(value));
Expand Down Expand Up @@ -275,9 +275,9 @@ protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int
if (itemGroup != INVENTORY) {
RenderSystem.setShaderTexture(0, TEXTURE);
int scrollbarX = this.x + 175;
int scrollbarY = this.y + 18;
int k = scrollbarY + 114;
this.drawTexture(matrices, scrollbarX, (int)(scrollbarY + ((k - scrollbarY - 17) * ((this.scrollPosition * 9) / (scrollHeight + 9)))), 232, 0, 12, 15);
int scrollbarY = this.y + 18 ;
if(scrollHeight == 0) this.drawTexture(matrices, scrollbarX, scrollbarY, 244, 0, 12, 15);
else this.drawTexture(matrices, scrollbarX, scrollbarY + (95 * (int) (this.scrollPosition * 9) / (scrollHeight)), 232, 0, 12, 15);
}
else {
if(this.client != null && this.client.player != null) InventoryScreen.drawEntity(this.x + 88, this.y + 45, 20, (float)(this.x + 88 - mouseX), (float)(this.y + 45 - 30 - mouseY), this.client.player);
Expand Down

0 comments on commit b40a886

Please sign in to comment.