revert 045623a67b
revert Split client & common sources + POC FPS counter
This commit is contained in:
14
build.gradle
14
build.gradle
@ -18,18 +18,6 @@ repositories {
|
|||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
|
||||||
splitEnvironmentSourceSets()
|
|
||||||
|
|
||||||
mods {
|
|
||||||
"survivalfabric" {
|
|
||||||
sourceSet sourceSets.main
|
|
||||||
sourceSet sourceSets.client
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fabricApi {
|
fabricApi {
|
||||||
configureDataGeneration {
|
configureDataGeneration {
|
||||||
client = true
|
client = true
|
||||||
@ -38,7 +26,7 @@ fabricApi {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
// To change the versions see the gradle.properties file
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "net.minecraft:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
package wtf.hak.survivalfabric;
|
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.option.KeyBinding;
|
|
||||||
import net.minecraft.client.util.InputUtil;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class SurvivalFabricClient implements ClientModInitializer {
|
|
||||||
|
|
||||||
public static boolean SHOULD_SHOW_FPS = false;
|
|
||||||
|
|
||||||
KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
|
||||||
"key.survivalfabric.fps", // The translation key of the keybinding's name
|
|
||||||
InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse.
|
|
||||||
GLFW.GLFW_KEY_PERIOD, // The keycode of the key
|
|
||||||
"category.survivalfabric.utils" // The translation key of the keybinding's category.
|
|
||||||
));
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
|
||||||
while (keyBinding.wasPressed()) {
|
|
||||||
MinecraftClient mc = MinecraftClient.getInstance();
|
|
||||||
SHOULD_SHOW_FPS = !SHOULD_SHOW_FPS;
|
|
||||||
if(SHOULD_SHOW_FPS) {
|
|
||||||
mc.player.sendMessage(Text.literal("FPS Counter is now on").withColor(Color.GREEN.getRGB()), true);
|
|
||||||
} else
|
|
||||||
mc.player.sendMessage(Text.literal("FPS Counter is now off").withColor(Color.RED.getRGB()), true);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package wtf.hak.survivalfabric;
|
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
|
||||||
|
|
||||||
public class SurvivalFabricDataGenerator implements DataGeneratorEntrypoint {
|
|
||||||
@Override
|
|
||||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package wtf.hak.survivalfabric.mixin.client;
|
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
|
||||||
import wtf.hak.survivalfabric.SurvivalFabricClient;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
@Mixin(InGameHud.class)
|
|
||||||
public class InGameHudMixin {
|
|
||||||
|
|
||||||
private final int TEXT_COLOR = Color.GRAY.getRGB();
|
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("RETURN"))
|
|
||||||
private void renderFPS(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
|
|
||||||
if(SurvivalFabricClient.SHOULD_SHOW_FPS) {
|
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
context.drawTextWithShadow(client.textRenderer, client.getCurrentFps() + " FPS", 5, 5, TEXT_COLOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"package": "wtf.hak.survivalfabric.mixin.client",
|
|
||||||
"compatibilityLevel": "JAVA_21",
|
|
||||||
"client": [
|
|
||||||
"InGameHudMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,8 @@
|
|||||||
package wtf.hak.survivalfabric.mixin;
|
package wtf.hak.survivalfabric.mixin;
|
||||||
|
|
||||||
import com.mojang.authlib.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
import net.minecraft.network.message.MessageType;
|
import net.minecraft.network.message.MessageType;
|
||||||
import net.minecraft.network.message.SignedMessage;
|
import net.minecraft.network.message.SignedMessage;
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.PlayerManager;
|
import net.minecraft.server.PlayerManager;
|
||||||
import net.minecraft.server.network.ConnectedClientData;
|
import net.minecraft.server.network.ConnectedClientData;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
@ -26,7 +24,7 @@ public abstract class PlayerManagerMixin {
|
|||||||
|
|
||||||
@Inject(method = {"onPlayerConnect"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V")})
|
@Inject(method = {"onPlayerConnect"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V")})
|
||||||
public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
|
public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity player, ConnectedClientData clientData, CallbackInfo ci) {
|
||||||
if(ConfigManager.getConfig().joinMessageEnabled && !player.getServer().isSingleplayer()) {
|
if(ConfigManager.getConfig().joinMessageEnabled) {
|
||||||
Text text = Text.literal(String.format(ConfigManager.getConfig().joinMessage, player.getName().getString()));
|
Text text = Text.literal(String.format(ConfigManager.getConfig().joinMessage, player.getName().getString()));
|
||||||
player.sendMessage(text, false);
|
player.sendMessage(text, false);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"category.survivalfabric.utils": "ChirpClient",
|
|
||||||
"key.survivalfabric.fps": "Toggle FPS"
|
|
||||||
}
|
|
@ -18,27 +18,20 @@
|
|||||||
"main": [
|
"main": [
|
||||||
"wtf.hak.survivalfabric.SurvivalFabric"
|
"wtf.hak.survivalfabric.SurvivalFabric"
|
||||||
],
|
],
|
||||||
"client": [
|
|
||||||
"wtf.hak.survivalfabric.SurvivalFabricClient"
|
|
||||||
],
|
|
||||||
"fabric-datagen": [
|
"fabric-datagen": [
|
||||||
"wtf.hak.survivalfabric.SurvivalFabricDataGenerator"
|
"wtf.hak.survivalfabric.SurvivalFabricDataGenerator"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"survivalfabric.mixins.json",
|
"survivalfabric.mixins.json"
|
||||||
{
|
|
||||||
"config": "survivalfabric.client.mixins.json",
|
|
||||||
"environment": "client"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.16.10",
|
"fabricloader": ">=0.16.10",
|
||||||
"minecraft": "~1.21.5",
|
"minecraft": "~1.21.4",
|
||||||
"java": ">=21",
|
"java": ">=21",
|
||||||
"fabric-api": "*"
|
"fabric-api": "*"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"another-mod": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user