mirror of
https://github.com/Shiewk/ViewServerResources.git
synced 2026-04-28 03:44:17 +02:00
1.21.5 support
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.8.9'
|
id 'fabric-loom' version '1.10.1'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,13 +2,13 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21.3
|
minecraft_version=1.21.5
|
||||||
yarn_mappings=1.21.3+build.2
|
yarn_mappings=1.21.5+build.1
|
||||||
loader_version=0.16.8
|
loader_version=0.16.12
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.1
|
mod_version=1.0.2
|
||||||
maven_group=de.shiewk
|
maven_group=de.shiewk
|
||||||
archives_base_name=ViewServerResources
|
archives_base_name=ViewServerResources
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.106.1+1.21.3
|
fabric_version=0.119.5+1.21.5
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public class ManageListScreen<T> extends Screen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
addDrawableChild(new ManageListWidget<T>(textRenderer, 0, 0, width-8, height, title, list));
|
addDrawableChild(new ManageListWidget<>(textRenderer, 0, 0, width, height, title, list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ public class ManageListWidget<T> extends ScrollableWidget {
|
|||||||
yp += 4;
|
yp += 4;
|
||||||
final TextWidget tw = new TextWidget(Text.literal(t.toString()), renderer);
|
final TextWidget tw = new TextWidget(Text.literal(t.toString()), renderer);
|
||||||
tw.setHeight(20);
|
tw.setHeight(20);
|
||||||
tw.setPosition((width - 28) / 2 - (tw.getWidth() / 2), yp);
|
tw.setPosition((width - 34) / 2 - (tw.getWidth() / 2), yp);
|
||||||
elements.add(tw);
|
elements.add(tw);
|
||||||
elements.add(new ButtonWidget.Builder(Text.literal("x"), btn -> {
|
elements.add(new ButtonWidget.Builder(Text.literal("x"), btn -> {
|
||||||
btn.active = false;
|
btn.active = false;
|
||||||
list.remove(t);
|
list.remove(t);
|
||||||
refreshElements(renderer);
|
refreshElements(renderer);
|
||||||
}).width(20).position(width - 24, yp).build());
|
}).width(20).position(width - 30, yp).build());
|
||||||
yp += 20;
|
yp += 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getContentsHeight() {
|
protected int getContentsHeightWithPadding() {
|
||||||
return list.size() * 24;
|
return list.size() * 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,15 @@ public class ManageListWidget<T> extends ScrollableWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderContents(DrawContext context, int mouseX, int mouseY, float delta) {
|
protected void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
mouseY += (int) getScrollY();
|
mouseY += (int) getScrollY();
|
||||||
|
context.getMatrices().push();
|
||||||
|
context.getMatrices().translate(0, -getScrollY(), 0);
|
||||||
for (ClickableWidget element : elements) {
|
for (ClickableWidget element : elements) {
|
||||||
element.render(context, mouseX, mouseY, delta);
|
element.render(context, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
context.getMatrices().pop();
|
||||||
|
drawScrollbar(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,17 +69,13 @@ public class ManageListWidget<T> extends ScrollableWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
mouseY += getScrollY();
|
double mouseYScrolled = mouseY + getScrollY();
|
||||||
for (ClickableWidget element : elements) {
|
for (ClickableWidget element : elements) {
|
||||||
if (element.isMouseOver(mouseX, mouseY)){
|
if (element.isMouseOver(mouseX, mouseYScrolled)){
|
||||||
return element.mouseClicked(mouseX, mouseY, button);
|
return element.mouseClicked(mouseX, mouseYScrolled, button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
if (super.checkScrollbarDragged(mouseX, mouseY, button)) return true;
|
||||||
}
|
return super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawBox(DrawContext context, int x, int y, int width, int height) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user