Files
src
README.md
Code
12 1,001
src/main/java/pl/visuals/VisualsMod.java
package pl.visuals;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
public class VisualsMod implements ClientModInitializer {
public static KeyBinding MENU_KEY, AIM_KEY;
@Override
public void onInitializeClient() {
Config.load();
// UWAGA 1.21.9+: kategoria klawiszy to KeyBinding.Category, nie String.
KeyBinding.Category cat = KeyBinding.Category.create(Identifier.of("visualsmod", "main"));
MENU_KEY = KeyBindingHelper.registerKeyBinding(
new KeyBinding("key.visualsmod.menu", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_RIGHT_SHIFT, cat));
AIM_KEY = KeyBindingHelper.registerKeyBinding(
new KeyBinding("key.visualsmod.aim", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_G, cat));
ClientTickEvents.END_CLIENT_TICK.register(mc -> {
while (MENU_KEY.wasPressed()) mc.setScreen(new ConfigScreen(mc.currentScreen));
Backtrack.tick(mc);
AutoAim.tick(mc);
DeathCross.tick(mc);
});
AttackEntityCallback.EVENT.register((player, world, hand, entity, hit) -> {
if (entity instanceof PlayerEntity p) DeathCross.markHit(p.getUuid());
return ActionResult.PASS;
});
ClientCommandRegistrationCallback.EVENT.register((dispatcher, access) -> Spotify.registerCommands(dispatcher));
Spotify.init();
WorldRenderEvents.AFTER_ENTITIES.register(Render::render);
}
}