Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Jun 24, 2024
1 parent 692eea3 commit e8a79f7
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 166 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Skyblock Mod 1.10.4 for 1.21

Support for 1.21


## Skyblock Mod 1.10.3 for 1.20.6

Fix waypoints crashing when entering some invalid numbers as coordinates.
Expand Down
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}
Expand Down Expand Up @@ -112,15 +112,13 @@ publishMods {
projectId = "658094"
projectSlug = "skyblockmod" // Required for discord webhook
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add("1.20.5")
minecraftVersions.add("1.20.6")
minecraftVersions.add("1.21")
requires("fabric-api")
}
modrinth {
projectId = "GTIrlvJk"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add("1.20.5")
minecraftVersions.add("1.20.6")
minecraftVersions.add("1.21")
}
github {
repository = "kevinthegreat1/SkyblockMod-Fabric"
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ org.gradle.jvmargs = -Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version = 1.20.6
yarn_mappings = 1.20.6+build.1
minecraft_version = 1.21
yarn_mappings = 1.21+build.1
loader_version = 0.15.11

# Mod Properties
mod_version = 1.10.3
mod_version = 1.10.4
maven_group = com.kevinthegreat.skyblockmod
archives_base_name = skyblock-mod

# Dependencies
fabric_version = 0.98.0+1.20.6
modmenu_version = 10.0.0-beta.1
skyblocker_version = 1.20.3-beta.2+1.20.6
jgit_version = 6.8.0.202311291450-r
fabric_version = 0.100.1+1.21
modmenu_version = 11.0.0-beta.1
skyblocker_version = v1.21.0+1.21
jgit_version = 6.9.0.202403050737-r
## Apache Commons Math (https://mvnrepository.com/artifact/org.apache.commons/commons-math3)
commons_math_version = 3.6.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.gson.JsonParser;
import com.kevinthegreat.skyblockmod.SkyblockMod;
import com.kevinthegreat.skyblockmod.util.ChatListener;
import com.kevinthegreat.skyblockmod.util.ColorUtils;
import com.kevinthegreat.skyblockmod.util.RenderHelper;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -97,7 +98,7 @@ public void render(WorldRenderContext context) {
return;
}
for (BlockPos fairySoul : fairySouls.get(SkyblockMod.skyblockMod.info.locationRaw)) {
float[] colorComponents = isFairySoulNotFound(fairySoul) ? DyeColor.GREEN.getColorComponents() : DyeColor.RED.getColorComponents();
float[] colorComponents = isFairySoulNotFound(fairySoul) ? ColorUtils.getFloatComponents(DyeColor.GREEN) : ColorUtils.getFloatComponents(DyeColor.RED);
RenderHelper.renderFilledWithBeaconBeam(context, fairySoul, colorComponents, 0.5F, true);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kevinthegreat.skyblockmod.misc;

import com.kevinthegreat.skyblockmod.SkyblockMod;
import com.kevinthegreat.skyblockmod.util.ColorUtils;
import com.kevinthegreat.skyblockmod.util.ItemUtils;
import com.kevinthegreat.skyblockmod.util.RenderHelper;
import com.kevinthegreat.skyblockmod.waypoint.Waypoint;
Expand Down Expand Up @@ -43,7 +44,7 @@

public class MythologicalRitual {
private static final Pattern GRIFFIN_BURROW_DUG = Pattern.compile("(?<message>You dug out a Griffin Burrow!|You finished the Griffin burrow chain!) \\((?<index>\\d)/4\\)");
private static final float[] ORANGE_COLOR_COMPONENTS = DyeColor.ORANGE.getColorComponents();
private static final float[] ORANGE_COLOR_COMPONENTS = ColorUtils.getFloatComponents(DyeColor.ORANGE);
private long lastEchoTime;
private final Map<BlockPos, GriffinBurrow> griffinBurrows = new HashMap<>();
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public interface BeaconBlockEntityRendererInvoker {
@SuppressWarnings("unused")
@Invoker("renderBeam")
static void renderBeam(MatrixStack matrices, VertexConsumerProvider vertexConsumers, float tickDelta, long worldTime, int yOffset, int maxY, float[] color) {
static void renderBeam(MatrixStack matrices, VertexConsumerProvider vertexConsumers, float tickDelta, long worldTime, int yOffset, int maxY, int color) {
throw new IllegalStateException("Mixin invoker failed to apply.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,31 @@
import com.kevinthegreat.skyblockmod.SkyblockMod;
import com.kevinthegreat.skyblockmod.option.SkyblockModOptions;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.GridWidget;
import net.minecraft.client.gui.widget.SimplePositioningWidget;
import net.minecraft.client.option.SimpleOption;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;

import java.util.function.Function;

public abstract class AbstractSkyblockModOptionsScreen extends GameOptionsScreen {
protected final SkyblockModOptions options;
protected GridWidget gridWidget;
protected GridWidget.Adder adder;

protected AbstractSkyblockModOptionsScreen(Screen parent, Text title) {
super(parent, MinecraftClient.getInstance().options, title);
options = SkyblockMod.skyblockMod.options;
}

@Override
protected void init() {
super.init();
initGridWidget();
}

private void initGridWidget() {
gridWidget = new GridWidget();
gridWidget.getMainPositioner().marginX(5).marginBottom(4).alignHorizontalCenter();
adder = gridWidget.createAdder(2);
}

protected void addGridWidget() {
adder.add(ButtonWidget.builder(ScreenTexts.DONE, button -> client.setScreen(parent)).width(200).build(), 2, adder.copyPositioner().marginTop(6));
gridWidget.refreshPositions();
SimplePositioningWidget.setPos(gridWidget, 0, height / 6 - 12, width, height, 0.5f, 0);
gridWidget.forEachChild(this::addDrawableChild);
}

@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
renderBackGroundAndTitle(context, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);
}

protected void renderBackGroundAndTitle(DrawContext context, int mouseX, int mouseY, float delta) {
renderBackground(context, mouseX, mouseY, delta);
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 15, 0xFFFFFF);
}

@Override
public void removed() {
options.save();
}

protected ButtonWidget addScreenButton(Text message, Function<Screen, Screen> screenFunction) {
return adder.add(createButton(message, screenFunction));
}

protected <T> ClickableWidget addOptionButton(SimpleOption<T> option) {
return adder.add(createButton(option));
}

protected ButtonWidget addButton(Text message, ButtonWidget.PressAction onPress) {
return adder.add(ButtonWidget.builder(message, onPress).build());
}

protected ButtonWidget createButton(Text message, Function<Screen, Screen> screenFunction) {
protected ButtonWidget createScreenButton(Text message, Function<Screen, Screen> screenFunction) {
return ButtonWidget.builder(message, button -> client.setScreen(screenFunction.apply(this))).build();
}

protected <T> ClickableWidget createButton(SimpleOption<T> option) {
return option.createWidget(gameOptions, 0, 0, ButtonWidget.DEFAULT_WIDTH);
protected ButtonWidget createButton(Text message, ButtonWidget.PressAction onPress) {
return ButtonWidget.builder(message, onPress).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@ public DungeonsOptionsScreen(Screen parent) {
}

@Override
protected void init() {
super.init();
addOptionButton(options.dungeonMap);
addOptionButton(options.dungeonMapScale);
addOptionButton(options.dungeonMapX);
addOptionButton(options.dungeonMapY);
addOptionButton(options.dungeonScore270);
addOptionButton(options.dungeonScore270Text);
addOptionButton(options.dungeonScore300);
addOptionButton(options.dungeonScore300Text);
addOptionButton(options.lividColor);
addOptionButton(options.lividColorText);
addOptionButton(options.reparty);
addGridWidget();
protected void addOptions() {
body.addAll(options.dungeonMap, options.dungeonMapScale, options.dungeonMapX, options.dungeonMapY, options.dungeonScore270, options.dungeonScore270Text, options.dungeonScore300, options.dungeonScore300Text, options.lividColor, options.lividColorText, options.reparty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,8 @@ public FeaturesOptionsScreen(Screen parent) {
}

@Override
protected void init() {
super.init();
addOptionButton(options.experimentChronomatron);
addOptionButton(options.experimentSuperpairs);
addOptionButton(options.experimentUltrasequencer);
addOptionButton(options.fairySouls);
addOptionButton(options.fishing);
addOptionButton(options.mythologicalRitual);
addOptionButton(options.quiver);
addOptionButton(options.shortcuts);
addOptionButton(options.waypoints);
addOptionButton(options.waypointType);
addScreenButton(Text.translatable("skyblocker.waypoints.config"), WaypointsScreen::new);
addGridWidget();
protected void addOptions() {
body.addAll(options.experimentChronomatron, options.experimentSuperpairs, options.experimentUltrasequencer, options.fairySouls, options.fishing, options.mythologicalRitual, options.quiver, options.shortcuts, options.waypoints, options.waypointType);
body.addWidgetEntry(createScreenButton(Text.translatable("skyblocker.waypoints.config"), WaypointsScreen::new), null);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.kevinthegreat.skyblockmod.screen;

import com.kevinthegreat.skyblockmod.util.EmptyButtonWidget;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.EmptyWidget;
import net.minecraft.text.Text;

public class SkyblockModOptionsScreen extends AbstractSkyblockModOptionsScreen {
Expand All @@ -17,13 +17,9 @@ public SkyblockModOptionsScreen(Screen parent) {
}

@Override
protected void init() {
super.init();
addScreenButton(DUNGEONS, DungeonsOptionsScreen::new);
addScreenButton(OTHER_FEATURES, FeaturesOptionsScreen::new);
adder.add(EmptyWidget.ofHeight(20), 2);
addButton(Text.translatable("skyblockmod:options.reload"), button -> options.load());
addButton(Text.translatable("skyblockmod:options.save"), button -> options.save());
addGridWidget();
protected void addOptions() {
body.addWidgetEntry(createScreenButton(DUNGEONS, DungeonsOptionsScreen::new), createScreenButton(OTHER_FEATURES, FeaturesOptionsScreen::new));
body.addWidgetEntry(EmptyButtonWidget.ofHeight(20), null);
body.addWidgetEntry(createButton(Text.translatable("skyblockmod:options.reload"), button -> options.load()), createButton(Text.translatable("skyblockmod:options.save"), button -> options.save()));
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/kevinthegreat/skyblockmod/util/ColorUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.kevinthegreat.skyblockmod.util;

import net.minecraft.util.DyeColor;

public class ColorUtils {
/**
* Takes an RGB color as an integer and returns an array of the color's components as floats, in RGB format.
*
* @param color The color to get the components of.
* @return An array of the color's components as floats.
*/
public static float[] getFloatComponents(int color) {
return new float[] {
((color >> 16) & 0xFF) / 255f,
((color >> 8) & 0xFF) / 255f,
(color & 0xFF) / 255f
};
}

/**
* @param dye The dye from which the entity color will be used for the components.
*/
public static float[] getFloatComponents(DyeColor dye) {
return getFloatComponents(dye.getEntityColor());
}
}
Loading

0 comments on commit e8a79f7

Please sign in to comment.