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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div style="text-align: center;"><h1 >BetterF3</h1>
<br />

[![Version](https://img.shields.io/badge/dynamic/json?color=ed37aa&label=Version&query=%24%5B%27promos%27%5D%5B%271.21.3-latest%27%5D&url=https%3A%2F%2Fapi.modrinth.com%2Fupdates%2Fbetterf3%2Fforge%5Fupdates.json?cacheSeconds=2592000)](https://modrinth.com/mod/betterf3)
[![Minecraft Versions](https://img.shields.io/badge/Minecraft-1.16.2--1.21.3+-9450cc)](http://files.minecraftforge.net/)
[![License: MIT](https://img.shields.io/badge/License-MIT-2230f2.svg)](https://github.com/TreyRuffy/BetterF3/blob/architectury/1.21.3/LICENSE.txt)
[![Version](https://img.shields.io/badge/dynamic/json?color=ed37aa&label=Version&query=%24%5B%27promos%27%5D%5B%271.21.11-latest%27%5D&url=https%3A%2F%2Fapi.modrinth.com%2Fupdates%2Fbetterf3%2Fforge%5Fupdates.json?cacheSeconds=2592000)](https://modrinth.com/mod/betterf3)
[![Minecraft Versions](https://img.shields.io/badge/Minecraft-1.16.2--1.21.11+-9450cc)](http://files.minecraftforge.net/)
[![License: MIT](https://img.shields.io/badge/License-MIT-2230f2.svg)](https://github.com/TreyRuffy/BetterF3/blob/architectury/1.21.11/LICENSE.txt)
<br/>
[![Twitter: TreyRuffy](https://img.shields.io/twitter/follow/TreyRuffy.svg?style=social)](https://twitter.com/TreyRuffy)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public synchronized void renderAnimation(final GuiGraphics context, final Callba
xPos = (int) (xPos * GeneralOptions.animationSpeed);

if (xPos >= 300) {
this.minecraft.debugEntries.setOverlayVisible(false);
closingAnimation = false;
this.minecraft.debugEntries.isOverlayVisible = false;
this.minecraft.debugEntries.rebuildCurrentList();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package me.cominixo.betterf3.mixin;

import me.cominixo.betterf3.config.GeneralOptions;
import net.minecraft.client.gui.components.debug.DebugScreenEntryList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static me.cominixo.betterf3.utils.Utils.START_X_POS;
import static me.cominixo.betterf3.utils.Utils.closingAnimation;
import static me.cominixo.betterf3.utils.Utils.xPos;

/**
* Mixin for DebugScreenEntryList.
*/
@Mixin(DebugScreenEntryList.class)
public abstract class DebugScreenEntryListMixin {

@Shadow
public boolean isOverlayVisible;

/**
* Rebuilds the current list.
*/
@Shadow
public abstract void rebuildCurrentList();

@Inject(method = "setOverlayVisible", at = @At("HEAD"), cancellable = true)
private synchronized void onSetOverlayVisible(final boolean visible, final CallbackInfo ci) {
if (GeneralOptions.disableMod) {
return;
}
if (GeneralOptions.enableAnimations) {
if (this.isOverlayVisible && !visible && !closingAnimation) {
closingAnimation = true;
} else if (!this.isOverlayVisible && visible) {
closingAnimation = false;
xPos = START_X_POS;
this.isOverlayVisible = true;
this.rebuildCurrentList();
}
} else {
this.isOverlayVisible = visible;
this.rebuildCurrentList();
}
ci.cancel();
}
}
37 changes: 0 additions & 37 deletions common/src/main/java/me/cominixo/betterf3/mixin/KeyboardMixin.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
package me.cominixo.betterf3.mixin;

import me.cominixo.betterf3.config.GeneralOptions;
import me.cominixo.betterf3.config.gui.ModConfigScreen;
import net.minecraft.client.KeyboardHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import static me.cominixo.betterf3.utils.Utils.START_X_POS;
import static me.cominixo.betterf3.utils.Utils.closingAnimation;
import static me.cominixo.betterf3.utils.Utils.xPos;

/**
* Modifies the debug keys (f3 / f3 + m).
*/
Expand Down Expand Up @@ -55,34 +48,4 @@ public void processF3(final KeyEvent keyEvent, final CallbackInfoReturnable<Bool
}
}

@Inject(method = "keyPress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/debug/DebugScreenEntryList;toggleDebugOverlay()V", opcode = Opcodes.PUTFIELD, ordinal = 0), cancellable = true)
private synchronized void animationAndAlwaysEnableProfiler(final long l, final int i, final KeyEvent keyEvent, final CallbackInfo ci) {
if (GeneralOptions.disableMod) {
return;
}
if (GeneralOptions.enableAnimations) {
if (this.minecraft.debugEntries.isOverlayVisible()) {
closingAnimation = true;
ci.cancel();
} else {
closingAnimation = false;
xPos = START_X_POS;
this.minecraft.debugEntries.setOverlayVisible(true);
}
} else {
this.minecraft.debugEntries.toggleDebugOverlay();
}
if (GeneralOptions.alwaysEnableProfiler) {
this.minecraft.getDebugOverlay().renderProfilerChart = this.minecraft.getDebugOverlay().showDebugScreen();
}
if (GeneralOptions.alwaysEnableTPS) {
this.minecraft.getDebugOverlay().renderFpsCharts = this.minecraft.getDebugOverlay().showDebugScreen();
}
if (GeneralOptions.alwaysEnablePing && this.minecraft.getDebugOverlay().showDebugScreen() && !this.minecraft.getDebugOverlay().renderFpsCharts &&
!this.minecraft.getDebugOverlay().showNetworkCharts()) {
this.minecraft.getDebugOverlay().toggleNetworkCharts();
}
ci.cancel();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.cominixo.betterf3.modules;

import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import me.cominixo.betterf3.utils.DebugLine;
import me.cominixo.betterf3.utils.Utils;
Expand All @@ -16,13 +17,16 @@
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.attribute.EnvironmentAttributes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.MoonPhase;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.WorldgenRandom;
import net.minecraft.world.level.lighting.LevelLightEngine;
Expand Down Expand Up @@ -147,17 +151,21 @@ public void update(final Minecraft client) {
if (blockY > -1) {
highestBlockServer.append(" ").append(typeString).append(": ").append(blockY);
}
}
}

if (serverWorld instanceof ServerLevel serverLevel && serverLevel.isInsideBuildHeight(blockPos.getY())) {
final float moonSize = serverLevel.getMoonBrightness(blockPos);
final long inhabitedTime;
// Local Difficulty
if (serverWorld.isInsideBuildHeight(blockPos.getY())) {
final float moonSize;
final long inhabitedTime;

inhabitedTime = serverChunk.getInhabitedTime();
final MoonPhase moonPhase = serverWorld.environmentAttributes().getDimensionValue(EnvironmentAttributes.MOON_PHASE);
moonSize = DimensionType.MOON_BRIGHTNESS_PER_PHASE[moonPhase.index()];

final DifficultyInstance localDifficulty = new DifficultyInstance(serverWorld.getDifficulty(), serverWorld.getDayTime(), inhabitedTime, moonSize);
localDifficultyString = String.format("%.2f " + I18n.get("text.betterf3.line.clamped") + ": %.2f", localDifficulty.getEffectiveDifficulty(), localDifficulty.getSpecialMultiplier());
}
}
inhabitedTime = Objects.requireNonNullElse(serverChunk, clientChunk).getInhabitedTime();

final DifficultyInstance localDifficulty = new DifficultyInstance(serverWorld.getDifficulty(), serverWorld.getDayTime(), inhabitedTime, moonSize);
localDifficultyString = String.format("%.2f " + I18n.get("text.betterf3.line.clamped") + ": %.2f", localDifficulty.getEffectiveDifficulty(), localDifficulty.getSpecialMultiplier());
}

if (integratedServer != null) {
Expand Down
3 changes: 2 additions & 1 deletion common/src/main/resources/betterf3.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ accessible field net/minecraft/client/renderer/LevelRenderer viewArea Lnet/minec
accessible field net/minecraft/client/gui/components/debug/DebugEntryHeightmap HEIGHTMAP_NAMES Ljava/util/Map;
accessible field net/minecraft/client/gui/components/DebugScreenOverlay renderFpsCharts Z
accessible field net/minecraft/client/gui/components/DebugScreenOverlay renderProfilerChart Z
accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Ljava/lang/String;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier;
accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Ljava/lang/String;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier;
accessible field net/minecraft/client/gui/components/debug/DebugScreenEntryList isOverlayVisible Z
1 change: 1 addition & 0 deletions common/src/main/resources/betterf3.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"minVersion": "0.8",
"client": [
"DebugMixin",
"DebugScreenEntryListMixin",
"KeyboardMixin",
"autof3.DebugOptionMixin",
"bossbar.BossbarMixin",
Expand Down
2 changes: 1 addition & 1 deletion docs/changelogs/17.0.0.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! last_version=16.0.3
!
### Added
- 1.21.11 support
- 1.21.11 support
6 changes: 5 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
}

// Tells Gradle to use fabric resource loader in order to use language files
include(modImplementation(fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)))
modImplementation(fabricApi.module("fabric-resource-loader-v1", project.fabric_api_version))

// Tells Gradle to use night config
implementation 'com.electronwill.night-config:json:3.6.6'
Expand Down Expand Up @@ -115,6 +115,10 @@ unifiedPublishing {
curseforge.set "cloth-config"
modrinth.set "cloth-config"
}
depends {
curseforge.set "fabric-api"
modrinth.set "fabric-api"
}
optional {
curseforge.set "modmenu"
modrinth.set "modmenu"
Expand Down
7 changes: 4 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
]
},
"depends": {
"fabricloader": ">=0.17.0",
"minecraft": ">=1.21.9"
"fabricloader": ">=0.18.0",
"minecraft": ">=1.21.11",
"fabric": "*"
},
"recommends": {
"modmenu": ">=15.0.0"
"modmenu": ">=17.0.0"
},
"accessWidener" : "betterf3.accesswidener",
"mixins": ["betterf3.mixins.json", "betterf3.fabric.mixins.json"]
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ side = "CLIENT"
[[dependencies.betterf3]]
modId = "minecraft"
mandatory = true
versionRange = "[1.21.4,)"
versionRange = "[1.21.11,)"
ordering = "NONE"
side = "BOTH"

Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ config = "betterf3.mixins.json"
[[dependencies.betterf3]]
modId = "minecraft"
mandatory = true
versionRange = "[1.21.9,)"
versionRange = "[1.21.11,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.betterf3]]
modId = "cloth_config"
versionRange = "[20.0.0,)"
versionRange = "[21.11.0,)"
mandatory = true
Loading