Skip to content

Commit

Permalink
Update to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Jun 27, 2023
1 parent 30db772 commit 71ba1b9
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish'
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ org.gradle.jvmargs = -Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version = 1.19.4
yarn_mappings = 1.19.4+build.1
loader_version = 0.14.17
minecraft_version = 1.20.1
yarn_mappings = 1.20.1+build.8
loader_version = 0.14.21

# Mod Properties
mod_version = 1.9.0-alpha
mod_version = 1.8.3
maven_group = com.kevinthegreat.skyblockmod
archives_base_name = skyblock-mod

# Dependencies
fabric_version = 0.75.3+1.19.4
modmenu_version = 6.1.0-rc.1
fabric_version = 0.84.0+1.20.1
modmenu_version = 7.1.0
jgit_version = 6.4.0.202211300538-r
renderer_version = master-SNAPSHOT
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
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.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.FilledMapItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.map.MapState;

//from skyfabric
public class DungeonMap {
public void render(MatrixStack matrixStack, float tickDelta) {
public void render(DrawContext context, float tickDelta) {
SkyblockModOptions options = SkyblockMod.skyblockMod.options;
if (options.dungeonMap.getValue() && SkyblockMod.skyblockMod.info.catacombs) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
Expand All @@ -28,12 +28,12 @@ public void render(MatrixStack matrixStack, float tickDelta) {
return;
}
VertexConsumerProvider.Immediate vertices = minecraftClient.getBufferBuilders().getEffectVertexConsumers();
matrixStack.push();
matrixStack.translate(options.dungeonMapX.getValue(), options.dungeonMapY.getValue(), 0);
matrixStack.scale(options.dungeonMapScale.getValue().floatValue(), options.dungeonMapScale.getValue().floatValue(), 0);
minecraftClient.gameRenderer.getMapRenderer().draw(matrixStack, vertices, FilledMapItem.getMapId(itemStack), mapState, false, 15728880);
context.getMatrices().push();
context.getMatrices().translate(options.dungeonMapX.getValue(), options.dungeonMapY.getValue(), 0);
context.getMatrices().scale(options.dungeonMapScale.getValue().floatValue(), options.dungeonMapScale.getValue().floatValue(), 0);
minecraftClient.gameRenderer.getMapRenderer().draw(context.getMatrices(), vertices, FilledMapItem.getMapId(itemStack), mapState, false, 15728880);
vertices.draw();
matrixStack.pop();
context.getMatrices().pop();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import com.kevinthegreat.skyblockmod.SkyblockMod;
import com.kevinthegreat.skyblockmod.misc.Experiments;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -21,39 +20,39 @@ public abstract class HandledScreenMixin {
private final Experiments skyblockmod_experiments = SkyblockMod.skyblockMod.experiments;

@Inject(method = "drawSlot", at = @At(value = "TAIL"))
private void skyblockmod_fillSlot(MatrixStack matrices, Slot slot, CallbackInfo ci) {
private void skyblockmod_fillSlot(DrawContext context, Slot slot, CallbackInfo ci) {
if (skyblockmod_experiments.type != Experiments.Type.NONE && skyblockmod_experiments.state == Experiments.State.SHOW && slot.inventory instanceof SimpleInventory) {
switch (skyblockmod_experiments.type) {
case CHRONOMATRON -> {
Item item = skyblockmod_experiments.chronomatronSlots.get(skyblockmod_experiments.chronomatronCurrentOrdinal);
if (slot.getStack().isOf(item) || Experiments.terracottaToGlass.get(slot.getStack().getItem()) == item) {
matrices.push();
matrices.translate(0, 0, 300);
DrawableHelper.fill(matrices, slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
matrices.pop();
context.getMatrices().push();
context.getMatrices().translate(0, 0, 300);
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
context.getMatrices().pop();
}
}
case SUPERPAIRS -> {
ItemStack itemStack = skyblockmod_experiments.superpairsSlots.get(slot.getIndex());
if (itemStack != null && !ItemStack.areEqual(itemStack, slot.getStack())) {
matrices.push();
matrices.translate(0, 0, 300);
context.getMatrices().push();
context.getMatrices().translate(0, 0, 300);
if (ItemStack.areEqual(skyblockmod_experiments.superpairsCurrentSlot, itemStack) && slot.getStack().getName().getString().equals("Click a second button!")) {
DrawableHelper.fill(matrices, slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
} else if (skyblockmod_experiments.superpairsDuplicatedSlots.contains(slot.getIndex())) {
DrawableHelper.fill(matrices, slot.x, slot.y, slot.x + 16, slot.y + 16, -1056964864);
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, -1056964864);
} else {
DrawableHelper.fill(matrices, slot.x, slot.y, slot.x + 16, slot.y + 16, 1090453504);
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, 1090453504);
}
matrices.pop();
context.getMatrices().pop();
}
}
case ULTRASEQUENCER -> {
if (slot.getIndex() == skyblockmod_experiments.ultrasequencerNextSlot) {
matrices.push();
matrices.translate(0, 0, 300);
DrawableHelper.fill(matrices, slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
matrices.pop();
context.getMatrices().push();
context.getMatrices().translate(0, 0, 300);
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, -1073676544);
context.getMatrices().pop();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
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.client.util.math.MatrixStack;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;

Expand Down Expand Up @@ -46,38 +46,38 @@ protected void addGridWidget() {
}

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

protected void renderBackGroundAndTitle(MatrixStack matrices) {
renderBackground(matrices);
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
protected void renderBackGroundAndTitle(DrawContext context) {
renderBackground(context);
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 15, 0xFFFFFF);
}

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

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

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

protected ButtonWidget addButton(Text message, ButtonWidget.PressAction onPress){
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) {
return ButtonWidget.builder(message, button -> client.setScreen(screenFunction.apply(this))).build();
}

protected <T> ClickableWidget createButton(SimpleOption<T> option){
protected <T> ClickableWidget createButton(SimpleOption<T> option) {
return option.createWidget(gameOptions, 0, 0, ButtonWidget.DEFAULT_WIDTH);
}
}
4 changes: 1 addition & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
"depends": {
"fabricloader": ">=0.14.11",
"fabric": "*",
"minecraft": [
"~1.19.4"
],
"minecraft": ">=1.20",
"java": ">=17"
}
}

0 comments on commit 71ba1b9

Please sign in to comment.