Skip to content

Commit

Permalink
Merge pull request #131 from rybot666/1.20.4
Browse files Browse the repository at this point in the history
Update to 1.20.4
  • Loading branch information
tr7zw authored Feb 2, 2024
2 parents f4d6f4b + 58c0afa commit fa65d48
Show file tree
Hide file tree
Showing 35 changed files with 307 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.fabricmc.api.ClientModInitializer;

public class ExordiumMod extends ExordiumModBase implements ClientModInitializer {

@Override
public void onInitializeClient() {
super.onInitialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> {
return ExordiumModBase.instance.createConfigScreen(parent);
};
}
}

}
69 changes: 33 additions & 36 deletions FG-Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
{
"schemaVersion": 1,
"id": "exordium",
"version": "${version}",

"name": "Exordium",
"description": "Render the ingame gui on its own FPS limiter",
"authors": [
"tr7zw"
],
"contact": {
"homepage": "https://github.com/tr7zw",
"sources": "https://github.com/tr7zw",
"issues": "https://github.com/tr7zw"
},

"license": "tr7zw Protective License",
"icon": "assets/exordium/icon.png",

"environment": "client",
"entrypoints": {
"client": [
"dev.tr7zw.exordium.ExordiumMod"
"schemaVersion": 1,
"id": "exordium",
"version": "${version}",
"name": "Exordium",
"description": "Render the ingame gui on its own FPS limiter",
"authors": [
"tr7zw"
],
"modmenu": [
"dev.tr7zw.exordium.ExordiumModMenu"
"contact": {
"homepage": "https://github.com/tr7zw",
"sources": "https://github.com/tr7zw",
"issues": "https://github.com/tr7zw"
},
"license": "tr7zw Protective License",
"icon": "assets/exordium/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"dev.tr7zw.exordium.ExordiumMod"
],
"modmenu": [
"dev.tr7zw.exordium.ExordiumModMenu"
],
"preLaunch": [
"dev.tr7zw.exordium.ExordiumPreLaunch"
]
},
"mixins": [
"exordium.mixins.json"
],
"preLaunch" : [
"dev.tr7zw.exordium.ExordiumPreLaunch"
]
},
"mixins": [
"exordium.mixins.json"
],
"accessWidener" : "exordium.accesswidener",
"depends": {
"fabric": "*",
"minecraft": ">=1.20.2"
}
"accessWidener": "exordium.accesswidener",
"depends": {
"fabric": "*",
"minecraft": ">=1.20.2"
}
}
6 changes: 3 additions & 3 deletions FG-Fabric/src/test/java/dev/tr7zw/tests/MixinTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testMixins() {
objenesis.newInstance(SignBlockEntity.class);
objenesis.newInstance(SignRenderer.class);
}

@Test
public void langTests() throws Throwable {
Language lang = TestUtil.loadDefault("/assets/exordium/lang/en_us.json");
Expand All @@ -64,9 +64,9 @@ public void langTests() throws Throwable {
CustomConfigScreen screen = (CustomConfigScreen) ExordiumModBase.instance.createConfigScreen(null);
List<OptionInstance<?>> options = TestUtil.bootStrapCustomConfigScreen(screen);
assertNotEquals(screen.getTitle().getString(), lang.getOrDefault(screen.getTitle().getString()));
for(OptionInstance<?> option : options) {
for (OptionInstance<?> option : options) {
Set<String> keys = TestUtil.getKeys(option, true);
for(String key : keys) {
for (String key : keys) {
System.out.println(key + " " + lang.getOrDefault(key));
assertNotEquals(key, lang.getOrDefault(key));
}
Expand Down
14 changes: 7 additions & 7 deletions FG-Fabric/src/test/java/dev/tr7zw/tests/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ public String getOrDefault(String paramString1, String paramString2) {
}
};
}

public static Set<String> getKeys(OptionInstance<?> optionsInstance, boolean tooltips) {
Set<String> keys = new HashSet<>();
keys.add(optionsInstance.toString());
if(tooltips) {
if (tooltips) {
keys.add(optionsInstance.toString() + ".tooltip");
}
return keys;
}

public static List<OptionInstance<?>> bootStrapCustomConfigScreen(CustomConfigScreen screen) throws Exception {
Field optionsField = CustomConfigScreen.class.getDeclaredField("list");
optionsField.setAccessible(true);
Expand All @@ -117,13 +117,13 @@ public static List<OptionInstance<?>> bootStrapCustomConfigScreen(CustomConfigSc
init.invoke(screen);
return list.options;
}

private static class CustomOptionsList extends OptionsList {

public List<OptionInstance<?>> options = new ArrayList<>();

public CustomOptionsList() {
super(null, 0, 0, 0, 0, 0);
super(null, 0, 0, 0, 0);
}

@Override
Expand All @@ -136,7 +136,7 @@ public int addBig(OptionInstance<?> optionInstance) {
public void addSmall(OptionInstance<?> optionInstance, OptionInstance<?> optionInstance2) {
options.add(optionInstance);
}

}

}
7 changes: 4 additions & 3 deletions FG-Forge/src/main/java/dev/tr7zw/exordium/ExordiumMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public void initModloader() {
() -> new IExtensionPoint.DisplayTest(
() -> ModLoadingContext.get().getActiveContainer().getModInfo().getVersion().toString(),
(remote, isServer) -> true));
ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class, () -> new ConfigScreenFactory((mc, screen) -> {
return createConfigScreen(screen);
}));
ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class,
() -> new ConfigScreenFactory((mc, screen) -> {
return createConfigScreen(screen);
}));
MinecraftForge.EVENT_BUS.addListener(this::preOverlayRender);
MinecraftForge.EVENT_BUS.addListener(this::postOverlayRender);
MinecraftForge.EVENT_BUS.addListener(this::postRenderGuiEvent);
Expand Down
2 changes: 1 addition & 1 deletion FG-Forge/src/main/resources/exordium.init.mixins.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"minVersion": "0.8",
"plugin": "cdev.tr7zw.exordium.MixinExtrasConfigPlugin"
}
}
19 changes: 10 additions & 9 deletions Shared/src/main/java/dev/tr7zw/exordium/BufferManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public void initialize() {
vanillaBuffers.put(new ResourceLocation("scoreboard"),
gui -> ((ScoreBoardOverlayAccess) gui).getScoreBoardOverlayBuffer());
vanillaBuffers.put(new ResourceLocation("hotbar"), gui -> ((HotbarOverlayAccess) gui).getHotbarOverlayBuffer());
registerCustomHandler(new ResourceLocation("vignette"), data -> {
registerCustomHandler(new ResourceLocation("vignette"), data -> {
VignetteOverlayAccess vignette = (VignetteOverlayAccess) minecraft.gui;
if (ExordiumModBase.instance.config.vignetteSettings.enabled) {
if(!vignette.getVignetteOverlayBuffer().render()) {
vignette.renderCustomVignette(data.gui());
if (!vignette.getVignetteOverlayBuffer().render()) {
vignette.renderCustomVignette(data.gui());
}
data.cancel().set(true);
}
Expand Down Expand Up @@ -90,23 +90,24 @@ public BufferedComponent getBufferedComponent(ResourceLocation resourceLocation,
}
return null;
}

public Consumer<HandlerData> getCustomHandler(ResourceLocation resourceLocation) {
return customHandlers.get(resourceLocation);
}

public Runnable getCustomEndHandler(ResourceLocation resourceLocation) {
return customEndHandlers.get(resourceLocation);
}

public void registerCustomHandler(ResourceLocation resourceLocation, Consumer<HandlerData> handler) {
customHandlers.put(resourceLocation, handler);
}

public void registerCustomEndHandler(ResourceLocation resourceLocation, Runnable handler) {
customEndHandlers.put(resourceLocation, handler);
}

public record HandlerData(GuiGraphics gui, AtomicBoolean cancel) {}

public record HandlerData(GuiGraphics gui, AtomicBoolean cancel) {
}

}
8 changes: 4 additions & 4 deletions Shared/src/main/java/dev/tr7zw/exordium/ExordiumModBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public void onInitialize() {
}
}
bufferManager.initialize();
initModloader();
}
initModloader();
}

public void writeConfig() {
if (settingsFile.exists())
settingsFile.delete();
Expand Down Expand Up @@ -115,7 +115,7 @@ public void setTemporaryScreenOverwrite(RenderTarget temporaryScreenOverwrite) {
public CustomShaderManager getCustomShaderManager() {
return customShaderManager;
}

public BufferManager getBufferManager() {
return bufferManager;
}
Expand Down
5 changes: 3 additions & 2 deletions Shared/src/main/java/dev/tr7zw/exordium/PreLoadedMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import dev.tr7zw.exordium.config.Config;

/**
* Dirty workaround cause Forge calls ui render methods of mixins before the mod is loaded?!?
* Dirty workaround cause Forge calls ui render methods of mixins before the mod
* is loaded?!?
*
* @author tr7zw
*
Expand All @@ -13,7 +14,7 @@ public class PreLoadedMod extends ExordiumModBase {
public PreLoadedMod() {
this.config = new Config();
}

@Override
public void initModloader() {

Expand Down
6 changes: 3 additions & 3 deletions Shared/src/main/java/dev/tr7zw/exordium/access/GuiAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
public interface GuiAccess {

public ChatComponent getChatComponent();

public PlayerTabOverlay getPlayerTabOverlay();

public int getTickCount();

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,47 @@
public interface VanillaBufferAccess {

public interface DebugOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getDebugOverlayBuffer();

}

public interface ChatOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getChatOverlayBuffer();

}

public interface CrosshairOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getCrosshairOverlayBuffer();
}

public interface ExperienceBarOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getExperienceBarOverlayBuffer();
}

public interface PlayerListOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getPlayerListOverlayBuffer();
}

public interface ScoreBoardOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getScoreBoardOverlayBuffer();
}

public interface VignetteOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getVignetteOverlayBuffer();

public void renderCustomVignette(GuiGraphics guiGraphics);
}

public interface HotbarOverlayAccess extends VanillaBufferAccess {

public BufferedComponent getHotbarOverlayBuffer();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public void initialize() {
options.add(getOnOffOption("text.exordium.enableSignBuffering", () -> config.enableSignBuffering,
(b) -> config.enableSignBuffering = b));

options.add(
getOnOffOption("text.exordium.enableNametagScreenBuffering", () -> config.enableNametagScreenBuffering,
(b) -> config.enableNametagScreenBuffering = b));
options.add(getOnOffOption("text.exordium.enableNametagScreenBuffering",
() -> config.enableNametagScreenBuffering, (b) -> config.enableNametagScreenBuffering = b));
options.add(getIntOption("text.exordium.targetFPSNameTags", 30, 80, () -> config.targetFPSNameTags,
(v) -> config.targetFPSNameTags = v));
options.add(getIntOption("text.exordium.pollRate", 20, 240, () -> config.pollRate, (v) -> config.pollRate = v));
Expand Down
Loading

0 comments on commit fa65d48

Please sign in to comment.