Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.20.3 and 1.20.4 #45

Merged
merged 7 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.23
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1

# Mod Properties
mod_version=2.1.0
mod_version=2.1.1
maven_group=de.greenman999
archives_base_name=librarian-trade-finder

# Dependencies
fabric_version=0.90.0+1.20.2
fabric_version=0.91.2+1.20.4
2 changes: 1 addition & 1 deletion src/main/java/de/greenman999/screens/ControlUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void init() {
.id(1)
.build());

enchantmentsListWidget = new EnchantmentsListWidget(this.client, this.width / 2 - 10, this.height, 25, this.height - 5, 20);
enchantmentsListWidget = new EnchantmentsListWidget(this.client, this.width / 2 - 10, this.height - 30, 25, 20);
this.addDrawableChild(enchantmentsListWidget);

this.addDrawableChild(GrayButtonWidget.builder(getButtonText("tradefinderui.options.tp-to-villager", LibrarianTradeFinder.getConfig().tpToVillager), (buttonWidget) -> {
Expand Down
27 changes: 17 additions & 10 deletions src/main/java/de/greenman999/screens/EnchantmentsListWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
public class EnchantmentsListWidget extends EntryListWidget<EnchantmentEntry> {

public GrayButtonWidget resetButton;
public int top;

public EnchantmentsListWidget(MinecraftClient client, int width, int height, int top, int itemHeight) {
super(client, width, height, top, itemHeight);
this.top = top;

public EnchantmentsListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);
setRenderBackground(false);

for(Enchantment enchantment : LibrarianTradeFinder.getConfig().enchantments.keySet()) {
Expand All @@ -40,15 +43,14 @@ public EnchantmentsListWidget(MinecraftClient client, int width, int height, int
.tooltip(Tooltip.of(Text.translatable("tradefinderui.reset.tooltip")))
.build();

this.right = this.width + 7;
}

@Override
protected void drawSelectionHighlight(DrawContext context, int y, int entryWidth, int entryHeight, int borderColor, int fillColor) {
}

@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
this.setSelected(null);
MatrixStack matrices = context.getMatrices();
matrices.push();
Expand All @@ -62,7 +64,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
RenderSystem.disableDepthTest();
matrices.pop();

super.render(context, mouseX, mouseY, delta);
super.renderWidget(context, mouseX, mouseY, delta);

for(EnchantmentEntry enchantmentEntry : this.children()) {
if(enchantmentEntry.maxPriceField.isActive()) {
Expand Down Expand Up @@ -95,8 +97,9 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
}
}


@Override
public void appendNarrations(NarrationMessageBuilder builder) {
protected void appendClickableNarrations(NarrationMessageBuilder builder) {

}

Expand All @@ -105,25 +108,29 @@ public int getRowWidth() {
return this.width - 12;
}

@Override
public int getRight() {
return this.width + 7;
}

@Override
protected int getScrollbarPositionX() {
return this.width - 1;
}

@Override
public int getRowTop(int index) {
return this.top - (int)this.getScrollAmount() + index * this.itemHeight + this.headerHeight;
return this.getY() - (int)this.getScrollAmount() + index * this.itemHeight + this.headerHeight;
}

@Override
public int getRowLeft() {
return this.left + this.width / 2 - this.getRowWidth() / 2 - 1;
return this.getX() + this.width / 2 - this.getRowWidth() / 2 - 1;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
resetButton.mouseClicked(mouseX, mouseY, button);
System.out.println();
return super.mouseClicked(mouseX, mouseY, button);
}

Expand Down Expand Up @@ -161,7 +168,7 @@ public boolean charTyped(char chr, int modifiers) {
@Override
protected EnchantmentEntry getEntryAtPosition(double x, double y) {
int i = this.getRowWidth() / 2;
int j = this.left + this.width / 2;
int j = this.getX() + this.width / 2;
int k = j - i;
int l = j + i;
int m = MathHelper.floor(y - (double)this.top) - this.headerHeight + (int)this.getScrollAmount();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/greenman999/screens/GrayButtonWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected GrayButtonWidget(int x, int y, int width, int height, Text message, Pr
}

@Override
public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
this.setFocused(false);
MatrixStack matrices = context.getMatrices();
matrices.push();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"accessWidener" : "librarian-trade-finder.accesswidener",
"depends": {
"fabricloader": ">=0.14.13",
"minecraft": ">=1.20.2",
"minecraft": ">=1.20.3",
"java": ">=17",
"fabric-api": "*"
}
Expand Down