Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"

provided "org.mozilla:rhino:${project.rhino_version}"
modCompileOnly("com.terraformersmc:modmenu:${project.modmenu_version}")
provided 'net.minidev:json-smart:2.6.0'

modApi("com.terraformersmc:modmenu:${project.modmenu_version}")
}

processResources {
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ org.gradle.configuration-cache=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.9
loader_version=0.17.3
loom_version=1.12-SNAPSHOT
minecraft_version=1.21.11
loader_version=0.18.2
loom_version=1.14-SNAPSHOT

# Mod Properties
mod_version=9.1.0
mod_version=9.1.1
maven_group=hudder
archives_base_name=hudder

# Dependencies
fabric_api_version=0.133.14+1.21.9
rhino_version=1.8.0
modmenu_version=16.0.0-rc.1
fabric_api_version=0.139.5+1.21.11
rhino_version=1.8.1
modmenu_version=17.0.0-alpha.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-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
import java.net.URI;
import java.util.List;

import org.jetbrains.annotations.Nullable;

import dev.ngspace.ngsmcconfig.api.NGSMCConfigCategory;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.StringWidget;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.util.Util;

public abstract class AbstractNGSMCConfigScreen extends Screen {

Expand Down Expand Up @@ -82,10 +79,9 @@ protected void init() {
}
addRenderableWidget(globalResetButton);

errorWidget = new StringWidget(error!=null?error:Component.literal(""), font);
errorWidget = new StringWidget(error!=null?error.plainCopy().withColor(0xFF0000):Component.literal(""), font);
errorWidget.setPosition(65, 0);
errorWidget.setSize(300, 20);
errorWidget.setColor(0xFF0000);
// errorWidget.alignLeft();
addRenderableWidget(errorWidget);

Expand Down Expand Up @@ -161,9 +157,9 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTi
container.render(graphics, mouseX, mouseY, partialTick);
super.render(graphics, mouseX, mouseY, partialTick);
}
@Override
public boolean handleComponentClicked(@Nullable Style style) {
if (style == null) return false;
return super.handleComponentClicked(style);
}
// @Override
// public boolean handleComponentClicked(@Nullable Style style) {
// if (style == null) return false;
// return super.handleComponentClicked(style);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;

public class DropdownElement extends AbstractWidget {

Expand All @@ -20,7 +20,7 @@ public DropdownElement(int i, int j, int k, int l, Component component) {
@Override
protected void renderWidget(GuiGraphics guiGraphics, int i, int j, float f) {
guiGraphics.fill(getX(), getY(), getRight(), getBottom(), 0xFFFFFFFF);
ResourceLocation resourceLocation = ResourceLocation.withDefaultNamespace("widget/text_field");
Identifier resourceLocation = Identifier.withDefaultNamespace("widget/text_field");
guiGraphics.blitSprite(RenderPipelines.GUI_TEXTURED, resourceLocation, this.getX(), this.getY(), this.getWidth(), this.getHeight());
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/github/ngspace/hudder/Hudder.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.Optional;
import java.util.Scanner;

import io.github.ngspace.hudder.data_management.EffectData;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
Expand All @@ -19,6 +18,7 @@
import io.github.ngspace.hudder.compilers.utils.Compilers;
import io.github.ngspace.hudder.compilers.utils.functionandconsumerapi.FunctionAndConsumerAPI;
import io.github.ngspace.hudder.data_management.Advanced;
import io.github.ngspace.hudder.data_management.EffectData;
import io.github.ngspace.hudder.data_management.ResourcePackVariables;
import io.github.ngspace.hudder.data_management.api.DataVariableRegistry;
import io.github.ngspace.hudder.main.HudCompilationManager;
Expand All @@ -39,7 +39,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.toasts.SystemToast;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.LoggedPrintStream;
/**
* <h1>If you expect any comments or JavaDocs explaining the bug-filled shithole I call "my code"
Expand Down Expand Up @@ -81,7 +81,7 @@ public class Hudder implements ClientModInitializer {
"hudder.configkeybind",
InputConstants.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
GLFW.GLFW_KEY_R, // The keycode of the key
KeyMapping.Category.register(ResourceLocation.parse("hudder.keybinds")) // The translation key of the keybinding's category.
KeyMapping.Category.register(Identifier.parse("hudder.keybinds")) // The translation key of the keybinding's category.
));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import io.github.ngspace.hudder.uielements.TextureElement;
import io.github.ngspace.hudder.uielements.TextureVerticesElement;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.animal.equine.AbstractHorse;
import net.minecraft.world.item.ItemStack;

public class HudderBuiltInMethods {private HudderBuiltInMethods() {}
Expand All @@ -32,7 +32,7 @@ public static void registerMethods(FunctionAndConsumerAPI api) {

//Textures

api.registerConsumer((e,a,s)->e.addUIElement(new BuiltInTextureElement(ResourceLocation.withDefaultNamespace(
api.registerConsumer((e,a,s)->e.addUIElement(new BuiltInTextureElement(Identifier.withDefaultNamespace(
s[0].asString().trim()), s[1].asInt(), s[2].asInt(), s[3].asInt(),s[4].asInt())), "drawTexture", "texture");

api.registerConsumer((e,a,s)-> e.addUIElement(new TextureElement(s[0].asString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.github.ngspace.hudder.utils.HudFileUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.ItemStack;

public abstract class AScriptingLanguageCompiler extends AVarTextCompiler {
Expand Down Expand Up @@ -105,7 +105,7 @@ public void loadFunctions(IScriptingLanguageEngine engine) {
//Item

engine.bindConsumer(s->elms.add(new ItemElement(s[1].asInt(), s[2].asInt(),new ItemStack(BuiltInRegistries.ITEM.getValue(
ResourceLocation.tryParse(s[0].asString()))),s[3].asFloat(), false)),"drawItem", "item");
Identifier.tryParse(s[0].asString()))),s[3].asFloat(), false)),"drawItem", "item");

//Slot

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.world.entity.animal.equine.AbstractChestedHorse;
import net.minecraft.world.entity.animal.equine.AbstractHorse;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.levelgen.WorldgenRandom;

Expand All @@ -38,8 +38,8 @@ public static Boolean getBoolean(String key) {
}
case "hudhidden": yield ins.options.hideGui;
case "showdebug": yield ins.getDebugOverlay().showDebugScreen();
case "f3enabled": yield ins.debugEntries.isF3Visible();
case "camera_detached": yield c.getEntity() != p;
case "f3enabled": yield ins.debugEntries.isOverlayVisible();
case "camera_detached": yield c.entity() != p;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.ItemEnchantments;

Expand All @@ -24,14 +24,14 @@ public static Object getObject(String key, DataComponentMap comp) {

/* Text Objects */
case "custom_name", "item_name": {
Component t = (Component) comp.get(BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(ResourceLocation.withDefaultNamespace(key)));
Component t = (Component) comp.get(BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(Identifier.withDefaultNamespace(key)));

yield t!=null ? t.getString() : null;
}

/* Primitives */
case "repair_cost", "damage", "max_damage", "max_stack_size", "enchantment_glint_override":
yield comp.get(BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(ResourceLocation.withDefaultNamespace(key)));
yield comp.get(BuiltInRegistries.DATA_COMPONENT_TYPE.getValue(Identifier.withDefaultNamespace(key)));

// case "mining_speed": yield comp.get(DataComponentTypes.TOOL).defaultMiningSpeed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.util.Mth;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.animal.horse.AbstractHorse;
import net.minecraft.world.entity.animal.equine.AbstractHorse;
import net.minecraft.world.level.LightLayer;

public class NumberData {private NumberData() {}
Expand All @@ -36,7 +36,7 @@ public static Object getNumber(String key) {
case "avgfps","avg_fps": yield (double) Advanced.getAverageFPS();
case "minfps","min_fps": yield (double) Advanced.getMinimumFPS();
case "maxfps","max_fps": yield (double) Advanced.getMaximumFPS();
case "ping": yield (double) ins.getConnection().getPlayerInfo(p.getName().getString()).getLatency();
case "ping": yield (double) ins.getConnection().getPlayerInfo(p.getUUID()).getLatency();
case "tps": yield (double) getTPS(ins);

case "gpu_d", "dgpu": yield Math.min(ins.getGpuUtilization(), 100.0);
Expand Down Expand Up @@ -108,13 +108,15 @@ public static Object getNumber(String key) {

case "playerspeed": {
var ent = p.getVehicle() == null ? p : p.getVehicle();
if (ent==null) yield 0;

double speed = (Math.sqrt(Math.pow(ent.getX() - ent.xOld, 2) +
Math.pow(ent.getY() - ent.yOld , 2) + Math.pow(ent.getZ() - ent.zOld , 2)) * 20);
yield speed;
}
case "horizontal_playerspeed": {
var ent = p.getVehicle() == null ? p : p.getVehicle();
if (ent==null) yield 0;

double speed = (Math.sqrt(Math.pow(ent.getX() - ent.xOld, 2) + Math.pow(ent.getZ() - ent.zOld , 2)) * 20);
yield speed;
Expand All @@ -136,12 +138,12 @@ public static Object getNumber(String key) {


/* Camera position */
case "cam_dxpos": yield c.getPosition().x;
case "cam_dypos": yield c.getPosition().y;
case "cam_dzpos": yield c.getPosition().z;
case "cam_xpos": yield (double) c.getBlockPosition().getX();
case "cam_ypos": yield (double) c.getBlockPosition().getY();
case "cam_zpos": yield (double) c.getBlockPosition().getZ();
case "cam_dxpos": yield c.position().x;
case "cam_dypos": yield c.position().y;
case "cam_dzpos": yield c.position().z;
case "cam_xpos": yield (double) c.blockPosition().getX();
case "cam_ypos": yield (double) c.blockPosition().getY();
case "cam_zpos": yield (double) c.blockPosition().getZ();



Expand All @@ -155,11 +157,11 @@ public static Object getNumber(String key) {


/* Camera chunk information */
case "cam_subchunkx": yield (double) (c.getBlockPosition().getX() & 0xF);
case "cam_subchunky": yield (double) (c.getBlockPosition().getY() & 0xF);
case "cam_subchunkz": yield (double) (c.getBlockPosition().getZ() & 0xF);
case "cam_chunkx": yield (double) (c.getBlockPosition().getX() >> 4);
case "cam_chunkz": yield (double) (c.getBlockPosition().getZ() >> 4);
case "cam_subchunkx": yield (double) (c.blockPosition().getX() & 0xF);
case "cam_subchunky": yield (double) (c.blockPosition().getY() & 0xF);
case "cam_subchunkz": yield (double) (c.blockPosition().getZ() & 0xF);
case "cam_chunkx": yield (double) (c.blockPosition().getX() >> 4);
case "cam_chunkz": yield (double) (c.blockPosition().getZ() >> 4);



Expand All @@ -186,22 +188,22 @@ public static Object getNumber(String key) {

/* Camera roation */
// Pitch
case "cam_dpitch": yield (double) c.getXRot();
case "cam_pitch": yield (double) (int) c.getXRot();
case "cam_dpitch": yield (double) c.xRot();
case "cam_pitch": yield (double) (int) c.xRot();
// Yaw
case "cam_dyaw": {
float yaw = c.getYRot();
float yaw = c.yRot();
if (yaw<0) yield (double) (360d+(yaw % 360d));
yield yaw % 360d;
}
case "cam_yaw": {
int yaw = (int) c.getYRot();
int yaw = (int) c.yRot();
if (yaw<0) yield (double) (360+(yaw % 360));
yield yaw % 360d;
}
// F3 yaw
case "cam_f3_dyaw": yield (double) Mth.wrapDegrees(c.getYRot());
case "cam_f3_yaw": yield (double) (int) Mth.wrapDegrees(c.getYRot());
case "cam_f3_dyaw": yield (double) Mth.wrapDegrees(c.yRot());
case "cam_f3_yaw": yield (double) (int) Mth.wrapDegrees(c.yRot());



Expand All @@ -220,9 +222,9 @@ public static Object getNumber(String key) {
case "blocklight", "block_light": yield (double) ins.level.getBrightness(LightLayer.BLOCK,p.blockPosition());
case "skylight", "sky_light": yield (double) ins.level.getBrightness(LightLayer.SKY,p.blockPosition());
/* At camera */
case "cam_light": yield (double) ins.level.getMaxLocalRawBrightness(c.getBlockPosition());
case "cam_blocklight", "cam_block_light": yield (double) ins.level.getBrightness(LightLayer.BLOCK,c.getBlockPosition());
case "cam_skylight", "cam_sky_light": yield (double) ins.level.getBrightness(LightLayer.SKY,c.getBlockPosition());
case "cam_light": yield (double) ins.level.getMaxLocalRawBrightness(c.blockPosition());
case "cam_blocklight", "cam_block_light": yield (double) ins.level.getBrightness(LightLayer.BLOCK,c.blockPosition());
case "cam_skylight", "cam_sky_light": yield (double) ins.level.getBrightness(LightLayer.SKY,c.blockPosition());



Expand Down
Loading
Loading