Compare commits
8 Commits
9325e24c5c
...
1.4.0
Author | SHA1 | Date | |
---|---|---|---|
ba6153fa41 | |||
798027a3af | |||
6b2d080746 | |||
87b6900ff3 | |||
c39249e3c1 | |||
281297bdca | |||
55e9b0fafd | |||
4b5b697883 |
35
README.md
35
README.md
@ -26,37 +26,30 @@ As a challenge I'm trying to make it as user-friendly as possible.
|
|||||||
- Version "control"
|
- Version "control"
|
||||||
- Shared Ender Chest
|
- Shared Ender Chest
|
||||||
- Shared EC Access control (via config)
|
- Shared EC Access control (via config)
|
||||||
|
- Open/close EC block while opening/closing SEC
|
||||||
|
- Play open & close sounds
|
||||||
- Vein miner
|
- Vein miner
|
||||||

|

|
||||||
|
- Chat Calculator
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
- /spectator | Essentially server-side free-cam, you get put in spectator and are able to fly around, once you use the command again you get put back to where you were.
|
- /spectator | Essentially server-side free-cam, you get put in spectator and are able to fly around, once you use the command again you get put back to where you were.
|
||||||
- /slimechunk (/sc) | See if you're currently in a slimechunk
|
- /slimechunk (/sc) | See if you're currently in a slimechunk
|
||||||
|
|
||||||
# Currently working on 1.3.2
|
|
||||||
|
|
||||||
## Server Side
|
|
||||||
- [x] Chat Calculator
|
|
||||||
|
|
||||||
|
|
||||||
## Client Side
|
## Client Side
|
||||||
|
|
||||||
### New Features
|
- Teleportation Angle Viewer for [this machine](https://www.youtube.com/watch?v=FnUE-ZaALLw)
|
||||||
- [x] Teleportation Angle Viewer for [this machine](https://www.youtube.com/watch?v=FnUE-ZaALLw)
|
- Toggleable pitch/yaw lock while teleporting
|
||||||

|

|
||||||
- [x] Removed game fog (lava, water, etc.)
|
- Remove game fog (lava, water, etc.)
|
||||||
- [x] All types individually toggleable
|
- All types individually toggleable
|
||||||
- [x] Mod Menu integration
|
- Mod Menu integration
|
||||||
- [x] Automatic config adaption (currently booleans only)
|
- Automatic config adaption (currently booleans only)
|
||||||
- [x] Removed darkness effect
|
- Remove darkness effect
|
||||||
- [x] Toggleable
|
- Toggleable
|
||||||
|
- Keybinding for /camera
|
||||||
|
|
||||||
### Changes
|
# To-do
|
||||||
- Shared Ender Chest
|
|
||||||
- [x] Open/close EC block while opening/closing SEC
|
|
||||||
- [x] Play open & close sounds
|
|
||||||
|
|
||||||
# Features to come
|
|
||||||
|
|
||||||
## General
|
## General
|
||||||
- Rework config system
|
- Rework config system
|
||||||
|
@ -9,7 +9,7 @@ yarn_mappings=1.21.5+build.1
|
|||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.3.2
|
mod_version=1.4.0
|
||||||
maven_group=wtf.hak.survivalfabric
|
maven_group=wtf.hak.survivalfabric
|
||||||
archives_base_name=survivalfabric
|
archives_base_name=survivalfabric
|
||||||
|
|
||||||
|
@ -4,13 +4,20 @@ import net.fabricmc.api.ClientModInitializer;
|
|||||||
import wtf.hak.survivalfabric.config.client.ClientConfigManager;
|
import wtf.hak.survivalfabric.config.client.ClientConfigManager;
|
||||||
import wtf.hak.survivalfabric.features.AngleViewer;
|
import wtf.hak.survivalfabric.features.AngleViewer;
|
||||||
import wtf.hak.survivalfabric.features.RemoveDarknessEffect;
|
import wtf.hak.survivalfabric.features.RemoveDarknessEffect;
|
||||||
|
import wtf.hak.survivalfabric.features.SFKeyBindings;
|
||||||
|
|
||||||
public class SurvivalFabricClient implements ClientModInitializer {
|
public class SurvivalFabricClient implements ClientModInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
|
||||||
|
// Config
|
||||||
ClientConfigManager.getConfig();
|
ClientConfigManager.getConfig();
|
||||||
|
|
||||||
|
// Features
|
||||||
AngleViewer.register();
|
AngleViewer.register();
|
||||||
RemoveDarknessEffect.register();
|
RemoveDarknessEffect.register();
|
||||||
|
SFKeyBindings.register();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,4 +10,5 @@ public class ClientConfig {
|
|||||||
public boolean renderWaterFog = false;
|
public boolean renderWaterFog = false;
|
||||||
public boolean renderSnowFog = false;
|
public boolean renderSnowFog = false;
|
||||||
public boolean removeDarknessEffect = true;
|
public boolean removeDarknessEffect = true;
|
||||||
|
public boolean lockTeleportHeadMovement = true;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package wtf.hak.survivalfabric.features;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
public class SFKeyBindings {
|
||||||
|
|
||||||
|
private static final KeyBinding CAMERA_BIND = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.survivalfabric.camera", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_PERIOD, "category.survivalfabric.survivalfabric"));
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
|
if(client.player != null) {
|
||||||
|
if (CAMERA_BIND.wasPressed()) {
|
||||||
|
client.player.networkHandler.sendChatCommand("camera");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -23,24 +23,25 @@ public abstract class BackgroundRendererMixin {
|
|||||||
|
|
||||||
@Inject(method = "applyFog", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "applyFog", at = @At("RETURN"), cancellable = true)
|
||||||
private static void applyFog(Camera camera, BackgroundRenderer.FogType fogType, Vector4f color, float viewDistance, boolean thickenFog, float tickProgress, CallbackInfoReturnable<Fog> cir) {
|
private static void applyFog(Camera camera, BackgroundRenderer.FogType fogType, Vector4f color, float viewDistance, boolean thickenFog, float tickProgress, CallbackInfoReturnable<Fog> cir) {
|
||||||
|
CameraSubmersionType submersion = camera.getSubmersionType();
|
||||||
boolean renderFog = true;
|
boolean renderFog = true;
|
||||||
CameraSubmersionType subType = camera.getSubmersionType();
|
|
||||||
if (subType == CameraSubmersionType.NONE) {
|
|
||||||
World world = camera.getFocusedEntity().getWorld();
|
|
||||||
if (world.getRegistryKey() == World.OVERWORLD && !getConfig().renderOverworldFog)
|
|
||||||
renderFog = false;
|
|
||||||
else if (world.getRegistryKey() == World.NETHER && !getConfig().renderNetherFog)
|
|
||||||
renderFog = false;
|
|
||||||
else if (world.getRegistryKey() == World.END && !getConfig().renderEndFog)
|
|
||||||
renderFog = false;
|
|
||||||
} else if (subType == CameraSubmersionType.WATER && !getConfig().renderWaterFog)
|
|
||||||
renderFog = false;
|
|
||||||
else if (subType == CameraSubmersionType.LAVA && !getConfig().renderLavaFog)
|
|
||||||
renderFog = false;
|
|
||||||
else if (subType == CameraSubmersionType.POWDER_SNOW && !getConfig().renderSnowFog)
|
|
||||||
renderFog = false;
|
|
||||||
|
|
||||||
if (!renderFog)
|
switch (submersion) {
|
||||||
|
case NONE -> {
|
||||||
|
World world = camera.getFocusedEntity().getWorld();
|
||||||
|
if ((world.getRegistryKey() == World.OVERWORLD && !getConfig().renderOverworldFog)
|
||||||
|
|| (world.getRegistryKey() == World.NETHER && !getConfig().renderNetherFog)
|
||||||
|
|| (world.getRegistryKey() == World.END && !getConfig().renderEndFog)) {
|
||||||
|
renderFog = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case WATER -> renderFog = getConfig().renderWaterFog;
|
||||||
|
case LAVA -> renderFog = getConfig().renderLavaFog;
|
||||||
|
case POWDER_SNOW -> renderFog = getConfig().renderSnowFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!renderFog) {
|
||||||
cir.setReturnValue(EMPTY_FOG);
|
cir.setReturnValue(EMPTY_FOG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import wtf.hak.survivalfabric.config.client.ClientConfigManager;
|
||||||
import wtf.hak.survivalfabric.features.AngleViewer;
|
import wtf.hak.survivalfabric.features.AngleViewer;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
@ -14,7 +15,7 @@ public abstract class EntityMixin {
|
|||||||
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
|
||||||
private void preventYawChange(float yaw, CallbackInfo ci) {
|
private void preventYawChange(float yaw, CallbackInfo ci) {
|
||||||
if ((Object) this instanceof ClientPlayerEntity player) {
|
if ((Object) this instanceof ClientPlayerEntity player) {
|
||||||
if (player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT) {
|
if (player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT && ClientConfigManager.getConfig().lockTeleportHeadMovement) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,7 +24,7 @@ public abstract class EntityMixin {
|
|||||||
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
|
||||||
private void preventPitchChange(float pitch, CallbackInfo ci) {
|
private void preventPitchChange(float pitch, CallbackInfo ci) {
|
||||||
if ((Object) this instanceof ClientPlayerEntity player) {
|
if ((Object) this instanceof ClientPlayerEntity player) {
|
||||||
if (player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT) {
|
if (player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT && ClientConfigManager.getConfig().lockTeleportHeadMovement) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ public class ModMenuIntegration implements ModMenuApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
System.out.println("Does ModMenuIntegration even load?");
|
return ConfigScreen::new;
|
||||||
return parent -> new ConfigScreen(parent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,35 +49,39 @@ public abstract class PlayerManagerMixin {
|
|||||||
|
|
||||||
@Inject(method = {"broadcast(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/network/message/MessageType$Parameters;)V"}, at = {@At("HEAD")}, cancellable = true)
|
@Inject(method = {"broadcast(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/network/message/MessageType$Parameters;)V"}, at = {@At("HEAD")}, cancellable = true)
|
||||||
private void onBroadcast(SignedMessage message, ServerPlayerEntity sender, MessageType.Parameters parameters, CallbackInfo ci) {
|
private void onBroadcast(SignedMessage message, ServerPlayerEntity sender, MessageType.Parameters parameters, CallbackInfo ci) {
|
||||||
if (sender != null && ConfigManager.getConfig().chatMessageEnabled) {
|
if (sender != null) {
|
||||||
String rawMessage = message.getContent().getString().trim();
|
String rawMessage = message.getContent().getString().trim();
|
||||||
if (sender != null && ConfigManager.getConfig().chatCalcEnabled && rawMessage.endsWith("=")) {
|
boolean isCalcEnabled = ConfigManager.getConfig().chatCalcEnabled;
|
||||||
String expression = rawMessage.substring(0, rawMessage.length() - 1).trim();
|
boolean isMsgEnabled = ConfigManager.getConfig().chatMessageEnabled;
|
||||||
|
|
||||||
|
String processedMessage = rawMessage;
|
||||||
|
|
||||||
|
if (isCalcEnabled) {
|
||||||
|
String expression = rawMessage.endsWith("=") ? rawMessage.substring(0, rawMessage.length() - 1).trim() : rawMessage;
|
||||||
try {
|
try {
|
||||||
String result = String.valueOf(evaluateExpression(expression));
|
String result = String.valueOf(evaluateExpression(expression));
|
||||||
if (rawMessage.contains(" ")) rawMessage += " ";
|
StringBuilder sb = new StringBuilder(rawMessage).append("§6");
|
||||||
rawMessage += (result.endsWith(".0")) ? result.substring(0, result.length() - 2) : result;
|
|
||||||
} catch (Exception e) {
|
if (rawMessage.contains(" ")) sb.append(" ");
|
||||||
}
|
if (!rawMessage.endsWith("=")) sb.append("=");
|
||||||
|
if (rawMessage.contains(" ")) sb.append(" ");
|
||||||
|
|
||||||
|
sb.append(result.endsWith(".0") ? result.substring(0, result.length() - 2) : result);
|
||||||
|
processedMessage = sb.toString();
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
Text text = Text.literal(String.format(ConfigManager.getConfig().chatMessage, sender.getName().getString(), rawMessage));
|
|
||||||
sender.getServer().getPlayerManager().broadcast(text, false);
|
if (isMsgEnabled) {
|
||||||
|
String formatted = String.format(ConfigManager.getConfig().chatMessage, sender.getName().getString(), processedMessage);
|
||||||
|
sender.getServer().getPlayerManager().broadcast(Text.literal(formatted), false);
|
||||||
|
} else if (isCalcEnabled) {
|
||||||
|
String formatted = "<" + sender.getName().getString() + "> " + processedMessage;
|
||||||
|
sender.getServer().getPlayerManager().broadcast(Text.literal(formatted), false);
|
||||||
|
}
|
||||||
|
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
} else if (sender != null && ConfigManager.getConfig().chatCalcEnabled) {
|
|
||||||
String rawMessage = message.getContent().getString().trim();
|
|
||||||
if (rawMessage.endsWith("=")) {
|
|
||||||
String expression = rawMessage.substring(0, rawMessage.length() - 1).trim();
|
|
||||||
try {
|
|
||||||
String result = String.valueOf(evaluateExpression(expression));
|
|
||||||
if (rawMessage.contains(" ")) rawMessage += " ";
|
|
||||||
rawMessage += (result.endsWith(".0")) ? result.substring(0, result.length() - 2) : result;
|
|
||||||
Text formattedMessage = Text.literal("<" + sender.getName().getString() + "> " + rawMessage);
|
|
||||||
sender.getServer().getPlayerManager().broadcast(formattedMessage, false);
|
|
||||||
ci.cancel();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double evaluateExpression(String expression) {
|
private double evaluateExpression(String expression) {
|
||||||
|
@ -15,5 +15,7 @@
|
|||||||
"key.survivalfabric.angle12": "204.81 / -54.23",
|
"key.survivalfabric.angle12": "204.81 / -54.23",
|
||||||
"key.survivalfabric.angle13": "245.14 / -54.23",
|
"key.survivalfabric.angle13": "245.14 / -54.23",
|
||||||
"key.survivalfabric.angle14": "204.98 / -41.68",
|
"key.survivalfabric.angle14": "204.98 / -41.68",
|
||||||
"key.survivalfabric.angle15": "244.97 / -41.71"
|
"key.survivalfabric.angle15": "244.97 / -41.71",
|
||||||
|
"category.survivalfabric.survivalfabric": "Survival Fabric",
|
||||||
|
"key.survivalfabric.camera": "/camera"
|
||||||
}
|
}
|
Reference in New Issue
Block a user