1.21.3 support

This commit is contained in:
kawaiizenbo 2024-11-09 18:47:28 -07:00
parent 854ce7201c
commit 8f9a6005f5
13 changed files with 31 additions and 28 deletions

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.6-SNAPSHOT' id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

View file

@ -4,14 +4,14 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.21.1 minecraft_version=1.21.3
yarn_mappings=1.21.1+build.3 yarn_mappings=1.21.3+build.2
loader_version=0.16.3 loader_version=0.16.9
# Mod Properties # Mod Properties
mod_version = 0.3.0 mod_version = 0.3.1
maven_group = me.kawaiizenbo maven_group = me.kawaiizenbo
archives_base_name = moonlight archives_base_name = moonlight
# Dependencies # Dependencies
fabric_version=0.103.0+1.21.1 fabric_version=0.107.3+1.21.3

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -27,7 +27,7 @@ public class Moonlight implements ModInitializer
public static final Moonlight INSTANCE = new Moonlight(); public static final Moonlight INSTANCE = new Moonlight();
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight"); public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows"; public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
public static final String versionTag = ColorUtils.magenta + "v0.3.0"; public static final String versionTag = ColorUtils.magenta + "v0.3.1";
public static Config CONFIG = new Config(); public static Config CONFIG = new Config();
@Override @Override

View file

@ -14,6 +14,6 @@ public class NoFall extends Module
@Override @Override
public void tick() public void tick()
{ {
if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, false));
} }
} }

View file

@ -23,22 +23,22 @@ public class Reach extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
oldBe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).getBaseValue(); oldBe = mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).getBaseValue();
oldEe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).getBaseValue(); oldEe = mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value); mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value);
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value); mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(oldBe); mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(oldBe);
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(oldEe); mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(oldEe);
} }
} }

View file

@ -20,20 +20,20 @@ public class Speed extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
old = mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).getBaseValue(); old = mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(speed.value/10d); mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(speed.value/10d);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(old); mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(old);
} }
} }

View file

@ -20,19 +20,19 @@ public class Step extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
old = mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).getBaseValue(); old = mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(stepHeight.value); mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(stepHeight.value);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(old); mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(old);
} }
} }

View file

@ -7,6 +7,7 @@ import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class CategoryPane public class CategoryPane
@ -44,7 +45,7 @@ public class CategoryPane
} }
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color); drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color);
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawGuiTexture(icon, x+2, y+2, 12, 12); drawContext.drawGuiTexture(RenderLayer::getGuiTextured, icon, x+2, y+2, 12, 12);
drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false); drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false);
if (!collapsed) if (!collapsed)
{ {

View file

@ -4,6 +4,7 @@ import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class HUDModuleButton public class HUDModuleButton
@ -24,7 +25,7 @@ public class HUDModuleButton
this.y = y; this.y = y;
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false); drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
if (!module.settings.isEmpty()) drawContext.drawGuiTexture(Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12); if (!module.settings.isEmpty()) drawContext.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12);
} }
public boolean hovered(int mouseX, int mouseY) public boolean hovered(int mouseX, int mouseY)

View file

@ -6,6 +6,7 @@ import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class HUDModuleList public class HUDModuleList
@ -39,7 +40,7 @@ public class HUDModuleList
} }
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, 0xFF55FFFF); drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, 0xFF55FFFF);
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawGuiTexture(Identifier.of("moonlight", "hud"), x+2, y+2, 12, 12); drawContext.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("moonlight", "hud"), x+2, y+2, 12, 12);
drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, 0xFFFFFFFF, false); drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, 0xFFFFFFFF, false);
if (!collapsed) if (!collapsed)
{ {

View file

@ -28,7 +28,7 @@ public class ArmorDisplay extends HUDModule
{ {
ItemStack piece = mc.player.getInventory().getStack(i); ItemStack piece = mc.player.getInventory().getStack(i);
drawContext.drawItem(piece, x, y+yOffset); drawContext.drawItem(piece, x, y+yOffset);
drawContext.drawItemInSlot(textRenderer, piece, x, y+yOffset); drawContext.drawStackOverlay(textRenderer, piece, x, y+yOffset);
yOffset += 16; yOffset += 16;
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "moonlight", "id": "moonlight",
"version": "v0.3.0", "version": "v0.3.1",
"name": "Moonlight Meadows", "name": "Moonlight Meadows",
"description": "Utility mod with a focus on stability.", "description": "Utility mod with a focus on stability.",
"authors": [ "authors": [
@ -29,9 +29,9 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.16.3", "fabricloader": ">=0.16.9",
"fabric-api": "*", "fabric-api": "*",
"minecraft": "~1.21.1", "minecraft": "~1.21.3",
"java": ">=21" "java": ">=21"
} }
} }