Merge branch 'master' into 1.21.4
All checks were successful
build / build (push) Successful in 1m9s

This commit is contained in:
2025-04-06 12:25:41 +02:00
6 changed files with 41 additions and 19 deletions

View File

@ -29,7 +29,6 @@ As a challenge I'm trying to make it as user-friendly as possible. (It ain't the
- Vein miner
![VeinMiner](https://i.imgur.com/zOXWMNa.gif)
### 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.
- /slimechunk (/sc) | See if you're currently in a slimechunk
@ -40,9 +39,11 @@ As a challenge I'm trying to make it as user-friendly as possible. (It ain't the
- [x] Chat Calculator
## Client Side
- [x] Teleportation Angle Viewer
- [x] Teleportation Angle Viewer for [this machine](https://www.youtube.com/watch?v=FnUE-ZaALLw)
![Teleportation Keybindings](https://i.imgur.com/gjO1H3d.png)
- [x] Removed game fog (lava, water, etc.)
- [ ] Made it toggleable
- [ ] Mod Menu integration
# Features to come

View File

@ -1,12 +1,12 @@
package wtf.hak.survivalfabric;
import net.fabricmc.api.ClientModInitializer;
import wtf.hak.survivalfabric.teleportation.AngleViewHandler;
import wtf.hak.survivalfabric.features.AngleViewer;
public class SurvivalFabricClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
AngleViewHandler.registerKeybindings();
AngleViewer.register();
}
}

View File

@ -1,4 +1,4 @@
package wtf.hak.survivalfabric.teleportation;
package wtf.hak.survivalfabric.features;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
@ -11,12 +11,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class AngleViewHandler {
public class AngleViewer {
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
public static boolean PREVENT_HEAD_MOVEMENT = false;
public static void registerKeybindings() {
public static void register() {
for(Angle angle : Angle.values()) {
KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.survivalfabric." + angle.name().toLowerCase(),

View File

@ -0,0 +1,20 @@
package wtf.hak.survivalfabric.mixin.client;
import net.minecraft.client.render.BackgroundRenderer;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Fog;
import net.minecraft.client.render.FogShape;
import org.joml.Vector4f;
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.CallbackInfoReturnable;
@Mixin(value = BackgroundRenderer.class, priority = 910)
public abstract class BackgroundRendererMixin {
@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) {
cir.setReturnValue(new Fog(-8.0f, 1_000_000.0F, FogShape.CYLINDER, 0,0,0,0));
}
}

View File

@ -6,7 +6,7 @@ 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 wtf.hak.survivalfabric.teleportation.AngleViewHandler;
import wtf.hak.survivalfabric.features.AngleViewer;
@Mixin(Entity.class)
public abstract class EntityMixin {
@ -14,7 +14,7 @@ public abstract class EntityMixin {
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
private void preventYawChange(float yaw, CallbackInfo ci) {
if((Object) this instanceof ClientPlayerEntity player) {
if(player.isMainPlayer() && AngleViewHandler.PREVENT_HEAD_MOVEMENT) {
if(player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT) {
ci.cancel();
}
}
@ -23,7 +23,7 @@ public abstract class EntityMixin {
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
private void preventPitchChange(float pitch, CallbackInfo ci) {
if((Object) this instanceof ClientPlayerEntity player) {
if(player.isMainPlayer() && AngleViewHandler.PREVENT_HEAD_MOVEMENT) {
if(player.isMainPlayer() && AngleViewer.PREVENT_HEAD_MOVEMENT) {
ci.cancel();
}
}

View File

@ -1,11 +1,12 @@
{
"required": true,
"package": "wtf.hak.survivalfabric.mixin.client",
"compatibilityLevel": "JAVA_21",
"client": [
"EntityMixin"
],
"injectors": {
"defaultRequire": 1
"required": true,
"package": "wtf.hak.survivalfabric.mixin.client",
"compatibilityLevel": "JAVA_21",
"client": [
"BackgroundRendererMixin",
"EntityMixin"
],
"injectors": {
"defaultRequire": 1
}
}