Skip to content

Commit

Permalink
1.0.6 update
Browse files Browse the repository at this point in the history
removed owo lib
fixed some bugs
  • Loading branch information
MeexReay committed Oct 20, 2023
1 parent 1ad16e6 commit e593859
Show file tree
Hide file tree
Showing 19 changed files with 989 additions and 198 deletions.
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ repositories {
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

//add joml
modImplementation 'org.joml:joml:1.10.4'
include 'org.joml:joml:1.10.4'

// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
Expand All @@ -30,13 +37,13 @@ dependencies {

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"

modImplementation "io.wispforest:owo-lib:${project.owo_version}"
// only if you plan to use owo-config
annotationProcessor "io.wispforest:owo-lib:${project.owo_version}"
// modImplementation "io.wispforest:owo-lib:${project.owo_version}"
// // only if you plan to use owo-config
// annotationProcessor "io.wispforest:owo-lib:${project.owo_version}"

// include this if you don't want force your users to install owo
// sentinel will warn them and give the option to download it automatically
include "io.wispforest:owo-sentinel:${project.owo_version}"
// include "io.wispforest:owo-sentinel:${project.owo_version}"
}

base {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.1
loader_version=0.14.17
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.23

# Mod Properties
mod_version = 1.0.5
mod_version = 1.0.6
maven_group = themixray.repeating.mod
archives_base_name = repeating-mod

# Dependencies
fabric_version=0.76.1+1.19.3
fabric_version=0.83.0+1.20

owo_version=0.10.3+1.19.3
#owo_version=0.11.1+1.20
6 changes: 3 additions & 3 deletions src/main/java/themixray/repeating/mod/EasyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public void save() {
}

private String toText(Map<String,String> p) {
String t = "";
StringBuilder t = new StringBuilder();
for (Map.Entry<String,String> e:p.entrySet())
t += e.getKey() + "=" + e.getValue() + "\n";
return t;
t.append(e.getKey()).append("=").append(e.getValue()).append("\n");
return t.toString();
}
private Map<String,String> toMap(String j) {
Map<String,String> m = new HashMap<>();
Expand Down
81 changes: 75 additions & 6 deletions src/main/java/themixray/repeating/mod/RepeatingMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,49 @@
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.fabricmc.fabric.api.client.rendering.v1.DimensionRenderingRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.render.*;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.MovementType;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.MutableText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import themixray.repeating.mod.render.RenderHelper;
import themixray.repeating.mod.render.RenderSystem;
import themixray.repeating.mod.render.buffer.WorldBuffer;

import java.awt.*;
import java.util.*;
import java.util.List;

public class RepeatingMod implements ClientModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("repeating-mod");
public static final MinecraftClient client = MinecraftClient.getInstance();
public static final FabricLoader loader = FabricLoader.getInstance();
public static RepeatingMod me;

public Vec3d start_record_pos = null;
public Vec3d finish_record_pos = null;

public List<RecordEvent> record = new ArrayList<>();
public boolean is_recording = false;
public long last_record = -1;
Expand All @@ -46,13 +66,59 @@ public class RepeatingMod implements ClientModInitializer {

public long record_pos_delay = 20;

public static Random rand = new Random();

public EasyConfig conf;

@Override
public void onInitializeClient() {
LOGGER.info("Repeating mod initialized");
me = this;

RenderSystem.init();
WorldRenderEvents.LAST.register(context -> {
WorldBuffer buffer = RenderHelper.startTri(context);
if (start_record_pos != null) {
RenderHelper.drawRectFromTri(buffer,
(float) start_record_pos.getX() - 0.25F,
(float) start_record_pos.getY() + 0.01F,
(float) start_record_pos.getZ() - 0.25F,

(float) start_record_pos.getX() + 0.25F,
(float) start_record_pos.getY() + 0.01F,
(float) start_record_pos.getZ() - 0.25F,

(float) start_record_pos.getX() + 0.25F,
(float) start_record_pos.getY() + 0.01F,
(float) start_record_pos.getZ() + 0.25F,

(float) start_record_pos.getX() - 0.25F,
(float) start_record_pos.getY() + 0.01F,
(float) start_record_pos.getZ() + 0.25F,
new Color(70,230,70,128));
}
if (finish_record_pos != null) {
RenderHelper.drawRectFromTri(buffer,
(float) finish_record_pos.getX() - 0.25F,
(float) finish_record_pos.getY() + 0.01F,
(float) finish_record_pos.getZ() - 0.25F,

(float) finish_record_pos.getX() + 0.25F,
(float) finish_record_pos.getY() + 0.01F,
(float) finish_record_pos.getZ() - 0.25F,

(float) finish_record_pos.getX() + 0.25F,
(float) finish_record_pos.getY() + 0.01F,
(float) finish_record_pos.getZ() + 0.25F,

(float) finish_record_pos.getX() - 0.25F,
(float) finish_record_pos.getY() + 0.01F,
(float) finish_record_pos.getZ() + 0.25F,
new Color(230,70,70,128));
}
RenderHelper.endTri(buffer);
});

Map<String,String> def = new HashMap<>();
def.put("record_pos_delay", String.valueOf(record_pos_delay));

Expand Down Expand Up @@ -109,14 +175,15 @@ public RecordEvent getLastRecord(String t) {
return null;
}


public void startRecording() {
is_recording = true;
menu.update_btns();
record.clear();

record.add(new RecordMoveEvent(client.player.getPos(),
client.player.getHeadYaw(), client.player.getPitch()));
finish_record_pos = null;
Vec3d v = client.player.getPos();
record.add(new RecordMoveEvent(v,client.player.getHeadYaw(),client.player.getPitch()));
start_record_pos = v;

if (record_pos_delay > 0) {
move_tick = new TickTask(
Expand Down Expand Up @@ -226,6 +293,7 @@ public void recordCameraInput() {

public void stopRecording() {
is_recording = false;
finish_record_pos = client.player.getPos();
if (move_tick != null) {
move_tick.cancel();
move_tick = null;
Expand Down Expand Up @@ -285,10 +353,11 @@ public static double round(double value, int places) {
return (double) Math.round(value * factor) / factor;
}

public static void sendMessage(Text text) {
public static void sendMessage(MutableText text) {
client.player.sendMessage(Text.literal("[")
.append(Text.translatable("text.repeating-mod.name"))
.append("] ").append(text));
.append(Text.translatable("text.repeating-mod.name"))
.append("] ").formatted(Formatting.BOLD,Formatting.DARK_GRAY)
.append(text.formatted(Formatting.RESET).formatted(Formatting.GRAY)));
}

public static void sendDebug(String s) {
Expand Down
Loading

0 comments on commit e593859

Please sign in to comment.