Skip to content

Commit

Permalink
Update to 1.17
Browse files Browse the repository at this point in the history
This release Updates the mod to mc version 1.17.
This is the first time i created/edited a mod.
  • Loading branch information
LifeIsAParadox committed Aug 24, 2021
1 parent 76edb13 commit ad40e15
Show file tree
Hide file tree
Showing 20 changed files with 145 additions and 115 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
1.8, # Minimum supported by Minecraft
11, # Current Java LTS
15 # Latest version
16 # Minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]
Expand All @@ -34,8 +32,8 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
path: build/libs/
43 changes: 20 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.6-SNAPSHOT'
id 'fabric-loom' version '0.9-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand All @@ -19,29 +19,31 @@ repositories {
flatDir {
dirs 'libs'
}
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://maven.shedaniel.me/" }
maven {
url 'https://repo.maven.apache.org/maven2'
name 'Maven Central'
}

}

dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.8.7'
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Cloth API
include "me.shedaniel.cloth:config-2:${project.cloth_api_version}"
modApi("me.shedaniel.cloth:config-2:${project.cloth_api_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

// Auto Config
include "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
modApi("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
// Cloth config
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
exclude group: "net.fabricmc.fabric-api"
exclude module: "modmenu"
}
include "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}"

// Mod Menu
modImplementation "io.github.prospector:modmenu:${project.mod_menu_version}"
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
Expand All @@ -65,13 +67,8 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
}

java {
Expand Down Expand Up @@ -108,4 +105,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
29 changes: 13 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties (https://modmuss50.me/fabric.html)
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.5
loader_version=0.11.3
# Fabric Properties (https://fabricmc.net/versions.html)
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.39
loader_version=0.11.6

fabric_api_version=0.29.3+1.16
fabric_version=0.31.0+1.16
# APIs
#Fabric api
fabric_version=0.38.0+1.17

# Dependencies
## Cloth Api (https://www.curseforge.com/minecraft/mc-mods/cloth-config/files)
cloth_api_version=4.8.3
## Auto Config (https://bintray.com/shedaniel/autoconfig1u/autoconfig1u/_latestVersion)
auto_config_version=3.3.1
## Mod Menu (https://maven.fabricmc.net/io/github/prospector/modmenu/)
mod_menu_version=1.14.13+build.21
clothconfig_version=5.0.38
## Mod Menu (https://www.curseforge.com/minecraft/mc-mods/modmenu/files)
mod_menu_version=2.0.4

# Mod Properties
mod_version = 1.0.5
mod_version = 1.0.6
maven_group = me.xmrvizzy
archives_base_name = skyblocker

org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_281
archives_base_name = skyblocker
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand Down Expand Up @@ -182,4 +182,4 @@ APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.xmrvizzy.skyblocker.config;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package me.xmrvizzy.skyblocker.config.modmenu;

import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.shedaniel.autoconfig.AutoConfig;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public void sendChatMessage(String message, CallbackInfo ci) {

@Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true)
public void dropSelectedItem(boolean dropEntireStack, CallbackInfoReturnable<Boolean> cir) {
if (Utils.isSkyblock) HotbarSlotLock.handleDropSelectedItem(this.inventory.selectedSlot, cir);
if (Utils.isSkyblock) HotbarSlotLock.handleDropSelectedItem(this.getInventory().selectedSlot, cir);
}
}
29 changes: 17 additions & 12 deletions src/main/java/me/xmrvizzy/skyblocker/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.xmrvizzy.skyblocker.mixin;

import com.mojang.blaze3d.systems.RenderSystem;
import me.xmrvizzy.skyblocker.SkyblockerMod;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
import me.xmrvizzy.skyblocker.skyblock.Attribute;
Expand Down Expand Up @@ -29,7 +30,7 @@
@Mixin(InGameHud.class)
public abstract class InGameHudMixin extends DrawableHelper {
private static final Identifier SLOT_LOCK = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/slot_lock.png");
private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/bars.png");
private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE,"textures/gui/bars.png");

private MatrixStack hotbarMatrices;
private int hotbarSlotIndex;
Expand All @@ -41,8 +42,8 @@ public abstract class InGameHudMixin extends DrawableHelper {
private int scaledHeight;
@Shadow
private int scaledWidth;

@Shadow public abstract TextRenderer getFontRenderer();
@Shadow
public abstract TextRenderer getTextRenderer();

@ModifyVariable(method = "setOverlayMessage(Lnet/minecraft/text/Text;Z)V", at = @At("HEAD"))
private Text setOverlayMessage(Text message) {
Expand All @@ -61,10 +62,10 @@ public void renderHotbar(float f, MatrixStack matrices, CallbackInfo ci) {
}

@Inject(method = "renderHotbarItem", at = @At("HEAD"))
public void renderHotbarItem(int i, int j, float f, PlayerEntity player, ItemStack item, CallbackInfo ci) {
public void renderHotbarItem(int i, int j, float f, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
if (Utils.isSkyblock) {
if (HotbarSlotLock.isLocked(hotbarSlotIndex)) {
this.client.getTextureManager().bindTexture(SLOT_LOCK);
RenderSystem.setShaderTexture(0,SLOT_LOCK);
this.drawTexture(hotbarMatrices, i, j, 0, 0,16, 16);
}
hotbarSlotIndex++;
Expand Down Expand Up @@ -108,7 +109,8 @@ private void renderBars(MatrixStack matrices) {
int xp = (int) (this.client.player.experienceProgress * 33.0F);

// Icons
this.client.getTextureManager().bindTexture(BARS);
// this.client.getTextureManager().bindTexture(BARS);
RenderSystem.setShaderTexture(0,InGameHudMixin.BARS);
this.drawTexture(matrices, left, top, 0, 0, 9, 9);
this.drawTexture(matrices, left + 47, top, 9, 0, 7, 9);
this.drawTexture(matrices, left + 92, top, 16, 0, 9, 9);
Expand All @@ -131,17 +133,20 @@ private void renderBars(MatrixStack matrices) {
renderText(matrices, Attribute.MANA.get(), left + 56, top, 5636095);
renderText(matrices, Attribute.DEFENCE.get(), left + 103, top, 12106180);
renderText(matrices, this.client.player.experienceLevel, left + 150, top, 8453920);

}

private void renderText(MatrixStack matrices, int value, int left, int top, int color) {
String text = Integer.toString(value);
int x = left + (33 - this.getFontRenderer().getWidth(text)) / 2;
int x = left + (33 - this.getTextRenderer().getWidth(text)) / 2;
int y = top - 3;

this.getFontRenderer().draw(matrices, text, (float) (x + 1), (float) y, 0);
this.getFontRenderer().draw(matrices, text, (float) (x - 1), (float) y, 0);
this.getFontRenderer().draw(matrices, text, (float) x, (float) (y + 1), 0);
this.getFontRenderer().draw(matrices, text, (float) x, (float) (y - 1), 0);
this.getFontRenderer().draw(matrices, text, (float) x, (float) y, color);
this.getTextRenderer().draw(matrices, text, (float) (x + 1), (float) y, 0);
this.getTextRenderer().draw(matrices, text, (float) (x - 1), (float) y, 0);
this.getTextRenderer().draw(matrices, text, (float) x, (float) (y + 1), 0);
this.getTextRenderer().draw(matrices, text, (float) x, (float) (y - 1), 0);
this.getTextRenderer().draw(matrices, text, (float) x, (float) y, color);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.Nullable;
Expand All @@ -32,7 +32,7 @@ public void renderItemBar(TextRenderer renderer, ItemStack stack, int x, int y,

if (Utils.isSkyblock && SkyblockerConfig.get().locations.dwarvenMines.enableDrillFuel) {
if (!stack.isEmpty()) {
CompoundTag tag = stack.getTag();
NbtCompound tag = stack.getNbt();
if (tag != null && tag.contains("ExtraAttributes")) {
if (tag.getCompound("ExtraAttributes").contains("drill_fuel")) {
float current = 3000.0F;
Expand All @@ -50,7 +50,7 @@ public void renderItemBar(TextRenderer renderer, ItemStack stack, int x, int y,

RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
RenderSystem.disableAlphaTest();
// RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
Expand All @@ -60,7 +60,7 @@ public void renderItemBar(TextRenderer renderer, ItemStack stack, int x, int y,
this.renderGuiQuad(buffer, x + 2, y + 13, 13, 2, 0,0,0,255);
this.renderGuiQuad(buffer, x + 2, y + 13, width, 1, rgb >> 16 & 255, rgb >> 8 & 255, rgb & 255, 255);
RenderSystem.enableBlend();
RenderSystem.enableAlphaTest();
// RenderSystem.enableAlphaTest();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.xmrvizzy.skyblocker.skyblock;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.shedaniel.autoconfig.AutoConfig;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.option.KeyBinding;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

Expand Down Expand Up @@ -32,8 +32,8 @@ public static void handleDropSelectedItem(int slot, CallbackInfoReturnable<Boole
public static void handleInputEvents(ClientPlayerEntity player) {
while (hotbarSlotLock.wasPressed()) {
List<Integer> lockedSlots = SkyblockerConfig.get().general.lockedSlots;
int selected = player.inventory.selectedSlot;
if (!isLocked(player.inventory.selectedSlot)) lockedSlots.add(selected);
int selected = player.getInventory().selectedSlot;
if (!isLocked(player.getInventory().selectedSlot)) lockedSlots.add(selected);
else lockedSlots.remove(Integer.valueOf(selected));
AutoConfig.getConfigHolder(SkyblockerConfig.class).save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import net.minecraft.client.render.debug.DebugRenderer.Renderer;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.BlazeEntity;
import net.minecraft.text.LiteralText;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
package me.xmrvizzy.skyblocker.skyblock.dungeon;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.MapRenderer;
import net.minecraft.client.render.MapRenderer;
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.map.MapState;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;

public class DungeonMap {

public static void render(MatrixStack matrices) {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player == null && client.world == null) return;
ItemStack item = client.player.inventory.main.get(8);
CompoundTag tag = item.getTag();
ItemStack item = client.player.getInventory().main.get(8);
NbtCompound tag = item.getNbt();

if (tag != null && tag.contains("map")) {
VertexConsumerProvider.Immediate vertices = client.getBufferBuilders().getEffectVertexConsumers();
MapRenderer map = client.gameRenderer.getMapRenderer();
MapState state = FilledMapItem.getMapState(item, client.world);
MapState state = FilledMapItem.getOrCreateMapState(item, client.world);

if (state == null) return;
matrices.push();
matrices.translate(2, 2, 0);
matrices.scale(1, 1, 0);
map.draw(matrices, vertices, state, false, 15728880);
map.draw(matrices, vertices, 15728880,state, false,15728880);
vertices.draw();
matrices.pop();
}
Expand Down
Loading

0 comments on commit ad40e15

Please sign in to comment.