Skip to content

Commit

Permalink
update to 1.21
Browse files Browse the repository at this point in the history
way2muchnoise committed Jul 7, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
robstoll Robert Stoll
1 parent f75a6cd commit ddefc34
Showing 9 changed files with 39 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ private void load(ResourceLocation location, ServerLevel serverLevel) {
return true;

String name = FilenameUtils.removeExtension(relative).replaceAll("\\\\", "/");
ResourceLocation key = new ResourceLocation(location.getNamespace(), name);
ResourceLocation key = ResourceLocation.fromNamespaceAndPath(location.getNamespace(), name);

if (!registry.containsKey(key)) {
BufferedReader reader = null;
Original file line number Diff line number Diff line change
@@ -156,24 +156,24 @@ public void drawConnection(GuiGraphics guiGraphics, BetterAdvancementWidget pare
int borderLineColor = 0xFF000000;

if (this.betterDisplayInfo.drawDirectLines()) {
double x1 = scrollX + this.x + ADVANCEMENT_SIZE / 2 + 3;
double y1 = scrollY + this.y + ADVANCEMENT_SIZE / 2;
double x2 = scrollX + parent.x + ADVANCEMENT_SIZE / 2 + 3;
double y2 = scrollY + parent.y + ADVANCEMENT_SIZE / 2;
double width;
float x1 = scrollX + this.x + ADVANCEMENT_SIZE / 2 + 3;
float y1 = scrollY + this.y + ADVANCEMENT_SIZE / 2;
float x2 = scrollX + parent.x + ADVANCEMENT_SIZE / 2 + 3;
float y2 = scrollY + parent.y + ADVANCEMENT_SIZE / 2;

float width;
boolean perpendicular = x1 == x2 || y1 == y2;

if (!perpendicular) {
switch (this.screenScale) {
case 1 -> width = drawInside ? 1.5 : 0.5;
case 2 -> width = drawInside ? 2.25 : 0.75;
case 3 -> width = drawInside ? 2 : 0.6666666666666667;
case 4 -> width = drawInside ? 2.125 : 0.625;
case 1 -> width = drawInside ? 1.5F : 0.5F;
case 2 -> width = drawInside ? 2.25F : 0.75F;
case 3 -> width = drawInside ? 2F : 0.6666666666666667F;
case 4 -> width = drawInside ? 2.125F : 0.625F;
default -> width = drawInside ? 3 : 1;
}
if (drawInside) {
RenderUtil.drawRect(x1 - .75, y1 - .75, x2 - .75, y2 - .75, width, borderLineColor);
RenderUtil.drawRect(x1 - .75F, y1 - .75F, x2 - .75F, y2 - .75F, width, borderLineColor);
}
else {
RenderUtil.drawRect(x1, y1, x2, y2, width, innerLineColor);
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

public final class Resources {
private static ResourceLocation resourceLocation(String location) {
return new ResourceLocation(Constants.ID, location);
return ResourceLocation.fromNamespaceAndPath(Constants.ID, location);
}

public static final class Gui {
Original file line number Diff line number Diff line change
@@ -26,29 +26,25 @@ public static void setColor(int color) {
RenderSystem.setShaderColor(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 1.0F);
}

public static void drawRect(double x, double y, double x2, double y2, double width, int color) {
public static void drawRect(float x, float y, float x2, float y2, float width, int color) {
if (y > y2) {
double tempY = y;
double tempX = x;
float tempY = y;
float tempX = x;
y = y2;
x = x2;
y2 = tempY;
x2 = tempX;
}
Tesselator tesselator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferbuilder = tesselator.getBuilder();
RenderSystem.enableBlend();
// RenderSystem.disableTexture();
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderUtil.setColor(color);
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
BufferBuilder bufferbuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
boolean xHigh = x < x2;
bufferbuilder.vertex(x, xHigh ? y + width : y, 0.0D).endVertex();
bufferbuilder.vertex(x2, xHigh ? y2 + width : y2, 0.0D).endVertex();
bufferbuilder.vertex(x2 + width, xHigh ? y2 : y2 + width, 0.0D).endVertex();
bufferbuilder.vertex(x + width, xHigh ? y : y + width, 0.0D).endVertex();
tesselator.end();
// RenderSystem.enableTexture();
bufferbuilder.addVertex(x, xHigh ? y + width : y, 0.0F);
bufferbuilder.addVertex(x2, xHigh ? y2 + width : y2, 0.0F);
bufferbuilder.addVertex(x2 + width, xHigh ? y2 : y2 + width, 0.0F);
bufferbuilder.addVertex(x + width, xHigh ? y : y + width, 0.0F);
RenderSystem.disableBlend();
}
}
2 changes: 1 addition & 1 deletion Common/src/main/resources/betteradvancements.accesswidener
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
accessWidener v1 named
accessible class net/minecraft/client/gui/screens/advancements/AdvancementTabType
accessible class net/minecraft/client/gui/screens/advancements/AdvancementTabType
6 changes: 3 additions & 3 deletions Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@
"betteradvancements.mixins.json"
],
"depends": {
"fabricloader": ">=0.13",
"fabricloader": ">=0.15",
"fabric-api": "*",
"minecraft": "1.20.x",
"java": ">=17"
"minecraft": "1.21.x",
"java": ">=21"
},
"suggests": {
},
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public boolean findAdvancements(ResourceLocation location, ServerLevel serverLev
Path root = null;
if (source == null) {
if (serverLevel != null) {
root = serverLevel.getServer().getServerDirectory().toPath().resolve("advancements/" + location.getNamespace());
root = serverLevel.getServer().getServerDirectory().resolve("advancements/" + location.getNamespace());
}
}
else if (source.isFile()) {
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public boolean findAdvancements(ResourceLocation location, ServerLevel serverLev
Path root = null;
if (source == null) {
if (serverLevel != null) {
root = serverLevel.getServer().getServerDirectory().toPath().resolve("advancements/" + location.getNamespace());
root = serverLevel.getServer().getServerDirectory().resolve("advancements/" + location.getNamespace());
}
}
else if (source.isFile()) {
24 changes: 12 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -15,31 +15,31 @@ githubUrl=way2muchnoise/BetterAdvancements
platforms=fabric,forge,neoforge

# Minecraft
minecraftVersion=1.20.6
minecraftVersionRange=[1.20, 1.21)
minecraftVersion=1.21
minecraftVersionRange=[1.21, 1.22)

# Forge
forgeVersion=50.1.0
loaderVersionRange=[50,)
forgeVersionRange=[50.0.0,)
forgeVersion=51.0.16
loaderVersionRange=[51,)
forgeVersionRange=[51.0.0,)

# Fabric
fabricVersion=0.100.2+1.20.6
fabricVersion=0.100.3+1.21
fabricLoaderVersion=0.15.11

# NeoForge
neoforgeVersion=20.6.119
neoforgeVersion=21.0.21-beta
neoforgeLoaderVersionRange=[2,)
neoforgeVersionRange=[20.6.0,)
neoforgeVersionRange=[21.0.0,)

# Fabric Config screen
clothVersion=14.0.126
modMenuVersion=10.0.0-beta.1
clothVersion=15.0.127
modMenuVersion=11.0.1

# Mappings
mappingsChannel=parchment
mappingsParchmentMinecraftVersion=1.20.6
mappingsParchmentVersion=2024.06.16
mappingsParchmentMinecraftVersion=1.21
mappingsParchmentVersion=2024.06.23

# Publishing
curseProjectId=272515

0 comments on commit ddefc34

Please sign in to comment.