Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Villager RNG Manipulation #642

Open
wants to merge 98 commits into
base: fabric
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
3e36064
temp changes
RealRTTV May 29, 2024
1cca6b4
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV May 29, 2024
5552602
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV May 30, 2024
b935782
finally i can hold on to a villager's rng state
RealRTTV May 31, 2024
fe4133a
ok, now that it's been held on to, i can try to predict it, but for s…
RealRTTV May 31, 2024
800fd92
ok now i can crack it, gotta figure out how to
RealRTTV Jun 1, 2024
5fcbf15
ok, now it works
RealRTTV Jun 2, 2024
b5fe87c
whoopsie
RealRTTV Jun 2, 2024
fa0fde5
need to check the ping checking
RealRTTV Jun 2, 2024
406d55a
ping checking might work, idk
RealRTTV Jun 11, 2024
f416f2b
Merge remote-tracking branch 'refs/remotes/upstream/fabric' into vill…
RealRTTV Jun 17, 2024
70aaf2a
yo, check out this broken code
RealRTTV Jun 19, 2024
f047024
Fixes to villager cracking
Earthcomputer Jun 19, 2024
c419414
IT WORKS!! btw i still have villager adjustment shenanigans
RealRTTV Jun 19, 2024
48bf868
Fix two pitch cracking and add three pitch cracking
Gaider10 Jun 19, 2024
2734f64
Add simulation for unhappy no and water splashing sounds
Gaider10 Jun 20, 2024
bff08d1
Merge pull request #1 from Gaider10/villager_rng_cracking
RealRTTV Jun 20, 2024
47e53f2
Add simulation for more actions and add trade cracking for levels abo…
Gaider10 Jun 20, 2024
4910518
Handle ambient sound inside trading gui correctly
Gaider10 Jun 20, 2024
e92307e
Merge pull request #2 from Gaider10/villager_rng_cracking
RealRTTV Jun 20, 2024
5e8f1f2
ok changed some stuff lol i think this might be good
RealRTTV Jun 20, 2024
4642e34
removed latticg code
RealRTTV Jun 20, 2024
0bc4167
removed unused diff
RealRTTV Jun 20, 2024
4e65243
added help dialog for failed clock, no clock set, cracking during the…
RealRTTV Jun 21, 2024
a6f6ed5
shit
RealRTTV Jun 21, 2024
deeb1e6
Use the ambient sound that detected the desync for recracking
Gaider10 Jun 21, 2024
e4732b9
Fix nighttime check
Gaider10 Jun 21, 2024
badfe97
Merge pull request #3 from Gaider10/villager_rng_cracking
RealRTTV Jun 21, 2024
5c304e4
- added custom out of sync messages
RealRTTV Jun 22, 2024
38b8d69
- added nicer display to goals using ItemParser
RealRTTV Jun 23, 2024
3813d7b
added toString
RealRTTV Jun 23, 2024
7c2fe74
??
RealRTTV Jun 29, 2024
9519911
changes in response to review
RealRTTV Jul 1, 2024
42e3a20
added three-item-goal and two-item-enchanted-goal
RealRTTV Jul 2, 2024
6ecb586
whoop
RealRTTV Jul 3, 2024
d6894f8
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Jul 9, 2024
c453a39
updated and some minor, minor stuff
RealRTTV Jul 9, 2024
6293252
Update clientcommands.aw
RealRTTV Jul 12, 2024
b4a94ef
removed wildcard import
RealRTTV Jul 13, 2024
75bd52e
Update DebugRandom.java
RealRTTV Jul 13, 2024
c170054
Update DebugRandom.java
RealRTTV Jul 13, 2024
c3e4090
Update DebugRandom.java
RealRTTV Jul 13, 2024
7ac0113
Update ItemAndEnchantmentsPredicateArgument.java
RealRTTV Jul 13, 2024
210dbf4
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Aug 9, 2024
d2fb531
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Sep 28, 2024
02ee3c7
fixed some todo items
RealRTTV Sep 28, 2024
295840b
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Oct 5, 2024
a2757cc
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Nov 21, 2024
ee61233
added error calculation and updated to 1.21.3
RealRTTV Nov 21, 2024
ed97934
made it auto-readjust
RealRTTV Nov 21, 2024
fa04bfd
i can negate this and make it easier to understand
RealRTTV Nov 21, 2024
43a46df
fixed string literal translations
RealRTTV Nov 21, 2024
15803a5
stuff idk
RealRTTV Nov 22, 2024
dd5c552
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Nov 22, 2024
623fee1
whoops
RealRTTV Nov 22, 2024
1b5a836
Merge branch 'fabric' into fork/RealRTTV/villager_rng_cracking
Earthcomputer Nov 26, 2024
2f6eff6
whoopsie
RealRTTV Nov 26, 2024
6d250ba
Merge remote-tracking branch 'origin/villager_rng_cracking' into vill…
RealRTTV Nov 26, 2024
e534d05
whoopsie
RealRTTV Nov 26, 2024
0ea73a9
beruh
RealRTTV Nov 26, 2024
69e04fd
dw i moved it for ya
RealRTTV Nov 26, 2024
12b4039
bruh
RealRTTV Nov 26, 2024
e50cc27
Cleanup and fixes, extract stuff out of fishing cracker to use for vi…
Earthcomputer Nov 27, 2024
5548e61
Changed failure message for villager cracking
RealRTTV Nov 27, 2024
9054d8d
Move stuff around to be in more appropriate places
Earthcomputer Nov 27, 2024
40cec5b
Fix compile
Earthcomputer Nov 27, 2024
8daca5b
Improvements to cvillager command
Earthcomputer Nov 27, 2024
31837d4
Add fishingManipulation config
Earthcomputer Nov 27, 2024
0119a52
added faux task for villager cracking
RealRTTV Nov 28, 2024
b3345f0
fine then earth
RealRTTV Nov 28, 2024
94e2b5d
safer choice
RealRTTV Nov 28, 2024
abcb7bd
oh thats handy
RealRTTV Nov 28, 2024
76f01e3
Merge branch 'Earthcomputer:fabric' into villager_rng_cracking
RealRTTV Nov 28, 2024
8277f6f
removed usages of the term brute force where it wasn't applicable
RealRTTV Nov 28, 2024
a62b7d0
fixed null pointer exception
RealRTTV Nov 28, 2024
d6e2841
wiser choice in case `setTargetVillager(null)` is called
RealRTTV Nov 28, 2024
4f3aa4f
Merge branch 'refs/heads/fabric' into fork/RealRTTV/villager_rng_crac…
Earthcomputer Nov 29, 2024
f9a4530
Add villager random hierarchy regression test
Earthcomputer Nov 29, 2024
51a47ac
changed some names
RealRTTV Nov 29, 2024
a855766
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Nov 30, 2024
06c31b9
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Nov 30, 2024
612b84b
added error messages for breaking villager manipulation
RealRTTV Nov 30, 2024
00a3921
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Nov 30, 2024
11fcc1f
fixed failure of tests
RealRTTV Dec 1, 2024
e9fd0b7
added checks to spawn area
RealRTTV Dec 1, 2024
69ea5f2
moved code to a fn
RealRTTV Dec 1, 2024
7e02d21
oh yeah no that should be there
RealRTTV Dec 1, 2024
d1d8ce3
removed useless fn
RealRTTV Dec 1, 2024
d5bbb5a
me when wildcard imports
RealRTTV Dec 1, 2024
fdb5e7b
it works, hooray
RealRTTV Dec 1, 2024
6923b87
and that removes the stupid " from" at the end
RealRTTV Dec 1, 2024
29a4a0a
made changes from review
RealRTTV Dec 2, 2024
cd6cfc9
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Dec 3, 2024
29a0e5b
push
RealRTTV Dec 3, 2024
f75ae00
mister taxi driver, i don't want your weird math!
RealRTTV Dec 3, 2024
d1054fa
Include commit hash in clientcommands build and use it in github link…
Earthcomputer Dec 3, 2024
8231449
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV Dec 4, 2024
cc85f30
forgor
RealRTTV Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import net.earthcomputer.clientcommands.buildscript.CheckLanguageFilesTask
import net.earthcomputer.clientcommands.buildscript.GenerateBuildInfoTask

plugins {
id 'fabric-loom' version '1.9-SNAPSHOT'
Expand Down Expand Up @@ -94,6 +95,10 @@ jar {
from("LICENSE")
}

tasks.register('generateBuildInfo', GenerateBuildInfoTask) {
outputFile = new File(temporaryDir, "build_info.json")
}

processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft_version_dependency
Expand All @@ -108,6 +113,8 @@ processResources {
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}

from generateBuildInfo
}

java {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package net.earthcomputer.clientcommands.buildscript

import com.google.gson.Gson
import com.google.gson.JsonObject
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecOperations
import java.io.ByteArrayOutputStream
import javax.inject.Inject

abstract class GenerateBuildInfoTask : DefaultTask() {
@get:OutputFile
abstract val outputFile: RegularFileProperty

@get:Inject
protected abstract val execOperations: ExecOperations

init {
outputs.upToDateWhen { false }
}

@TaskAction
fun run() {
val gitCommitHashBytes = ByteArrayOutputStream()
execOperations.exec {
commandLine("git", "rev-parse", "HEAD")
standardOutput = gitCommitHashBytes
}.rethrowFailure()
val commitHash = gitCommitHashBytes.toByteArray().decodeToString().trim()

val json = JsonObject()
json.addProperty("commit_hash", commitHash)

outputFile.asFile.get().writer().use {
Gson().toJson(json, it)
}
}
}
Binary file added docs/villager_rng_setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 133 additions & 0 deletions regressionTests/villagerRandomHierarchy.regressiontest

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ public static void main(String[] args) throws IOException {
}

Path destDir = Path.of(args[0]);
genLattiCG(destDir);
genPlayerLattiCG(destDir);
}

private static void genLattiCG(Path destDir) throws IOException {
private static void genPlayerLattiCG(Path destDir) throws IOException {
ProgramBuilder program = Program.builder(LCG.JAVA);
program.skip(-CCrackRng.NUM_THROWS * 4);
for (int i = 0; i < CCrackRng.NUM_THROWS; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public static void registerCommands(CommandDispatcher<FabricClientCommandSource>
UsageTreeCommand.register(dispatcher);
UuidCommand.register(dispatcher);
VarCommand.register(dispatcher);
VillagerCommand.register(dispatcher, context);
WeatherCommand.register(dispatcher);
WhisperEncryptedCommand.register(dispatcher);
WikiCommand.register(dispatcher);
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/net/earthcomputer/clientcommands/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.earthcomputer.clientcommands.features.FishingCracker;
import net.earthcomputer.clientcommands.features.PlayerRandCracker;
import net.earthcomputer.clientcommands.features.ServerBrandManager;
import net.earthcomputer.clientcommands.features.VillagerCracker;
import net.earthcomputer.clientcommands.util.MultiVersionCompat;
import net.minecraft.util.Mth;
import net.minecraft.util.StringRepresentable;
Expand Down Expand Up @@ -171,4 +172,20 @@ public enum PacketDumpMethod {
public static void setMinimumReplyDelaySeconds(float minimumReplyDelaySeconds) {
Configs.minimumReplyDelaySeconds = Math.clamp(minimumReplyDelaySeconds, 0.0f, ReplyCommand.MAXIMUM_REPLY_DELAY_SECONDS);
}

@Config(onChange = "onChangeVillagerManipulation", temporary = true)
public static boolean villagerManipulation = false;
public static void onChangeVillagerManipulation(boolean oldVillagerManipulation, boolean villagerManipulation) {
if (villagerManipulation) {
ServerBrandManager.rngWarning();
} else {
VillagerCracker.reset();
}
}

@Config(setter = @Config.Setter("setMaxVillagerManipulationWaitTicks"), temporary = true)
public static int maxVillagerManipulationWaitTicks = 12000;
public static void setMaxVillagerManipulationWaitTicks(int maxVillagerManipulationWaitTicks) {
Configs.maxVillagerManipulationWaitTicks = Mth.clamp(maxVillagerManipulationWaitTicks, 0, 1_000_000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;

import java.util.HashMap;
Expand Down Expand Up @@ -101,4 +102,18 @@ public static String registerCode(Runnable code) {
runnables.put(randomString, code);
return randomString;
}

public static void updateOverlayProgressBar(int current, int total, int width, int time) {
MutableComponent builder = Component.empty();
int color = Mth.hsvToRgb(current / (total * 3.0f), 1.0f, 1.0f);
builder.append(Component.literal("[").withColor(0xAAAAAA));
builder.append(Component.literal("~" + Math.round(100.0 * current / total) + "%").withColor(color));
builder.append(Component.literal("] ").withColor(0xAAAAAA));
int filledWidth = (int) Math.round((double) width * current / total);
int unfilledWidth = width - filledWidth;
builder.append(Component.literal("|".repeat(filledWidth)).withColor(color));
builder.append(Component.literal("|".repeat(unfilledWidth)).withColor(0xAAAAAA));

addOverlayMessage(builder, time);
}
}
Loading
Loading