-
-
Couldn't load subscription status.
- Fork 129
Villager RNG Manipulation #642
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
Open
RealRTTV
wants to merge
99
commits into
Earthcomputer:fabric
Choose a base branch
from
RealRTTV:villager_rng_cracking
base: fabric
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 33 commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
3e36064
temp changes
RealRTTV 1cca6b4
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 5552602
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV b935782
finally i can hold on to a villager's rng state
RealRTTV fe4133a
ok, now that it's been held on to, i can try to predict it, but for s…
RealRTTV 800fd92
ok now i can crack it, gotta figure out how to
RealRTTV 5fcbf15
ok, now it works
RealRTTV b5fe87c
whoopsie
RealRTTV fa0fde5
need to check the ping checking
RealRTTV 406d55a
ping checking might work, idk
RealRTTV f416f2b
Merge remote-tracking branch 'refs/remotes/upstream/fabric' into vill…
RealRTTV 70aaf2a
yo, check out this broken code
RealRTTV f047024
Fixes to villager cracking
Earthcomputer c419414
IT WORKS!! btw i still have villager adjustment shenanigans
RealRTTV 48bf868
Fix two pitch cracking and add three pitch cracking
Gaider10 2734f64
Add simulation for unhappy no and water splashing sounds
Gaider10 bff08d1
Merge pull request #1 from Gaider10/villager_rng_cracking
RealRTTV 47e53f2
Add simulation for more actions and add trade cracking for levels abo…
Gaider10 4910518
Handle ambient sound inside trading gui correctly
Gaider10 e92307e
Merge pull request #2 from Gaider10/villager_rng_cracking
RealRTTV 5e8f1f2
ok changed some stuff lol i think this might be good
RealRTTV 4642e34
removed latticg code
RealRTTV 0bc4167
removed unused diff
RealRTTV 4e65243
added help dialog for failed clock, no clock set, cracking during the…
RealRTTV a6f6ed5
shit
RealRTTV deeb1e6
Use the ambient sound that detected the desync for recracking
Gaider10 e4732b9
Fix nighttime check
Gaider10 badfe97
Merge pull request #3 from Gaider10/villager_rng_cracking
RealRTTV 5c304e4
- added custom out of sync messages
RealRTTV 38b8d69
- added nicer display to goals using ItemParser
RealRTTV 3813d7b
added toString
RealRTTV 7c2fe74
??
RealRTTV 9519911
changes in response to review
RealRTTV 42e3a20
added three-item-goal and two-item-enchanted-goal
RealRTTV 6ecb586
whoop
RealRTTV d6894f8
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV c453a39
updated and some minor, minor stuff
RealRTTV 6293252
Update clientcommands.aw
RealRTTV b4a94ef
removed wildcard import
RealRTTV 75bd52e
Update DebugRandom.java
RealRTTV c170054
Update DebugRandom.java
RealRTTV c3e4090
Update DebugRandom.java
RealRTTV 7ac0113
Update ItemAndEnchantmentsPredicateArgument.java
RealRTTV 210dbf4
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV d2fb531
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 02ee3c7
fixed some todo items
RealRTTV 295840b
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV a2757cc
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV ee61233
added error calculation and updated to 1.21.3
RealRTTV ed97934
made it auto-readjust
RealRTTV fa04bfd
i can negate this and make it easier to understand
RealRTTV 43a46df
fixed string literal translations
RealRTTV 15803a5
stuff idk
RealRTTV dd5c552
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 623fee1
whoops
RealRTTV 1b5a836
Merge branch 'fabric' into fork/RealRTTV/villager_rng_cracking
Earthcomputer 2f6eff6
whoopsie
RealRTTV 6d250ba
Merge remote-tracking branch 'origin/villager_rng_cracking' into vill…
RealRTTV e534d05
whoopsie
RealRTTV 0ea73a9
beruh
RealRTTV 69e04fd
dw i moved it for ya
RealRTTV 12b4039
bruh
RealRTTV e50cc27
Cleanup and fixes, extract stuff out of fishing cracker to use for vi…
Earthcomputer 5548e61
Changed failure message for villager cracking
RealRTTV 9054d8d
Move stuff around to be in more appropriate places
Earthcomputer 40cec5b
Fix compile
Earthcomputer 8daca5b
Improvements to cvillager command
Earthcomputer 31837d4
Add fishingManipulation config
Earthcomputer 0119a52
added faux task for villager cracking
RealRTTV b3345f0
fine then earth
RealRTTV 94e2b5d
safer choice
RealRTTV abcb7bd
oh thats handy
RealRTTV 76f01e3
Merge branch 'Earthcomputer:fabric' into villager_rng_cracking
RealRTTV 8277f6f
removed usages of the term brute force where it wasn't applicable
RealRTTV a62b7d0
fixed null pointer exception
RealRTTV d6e2841
wiser choice in case `setTargetVillager(null)` is called
RealRTTV 4f3aa4f
Merge branch 'refs/heads/fabric' into fork/RealRTTV/villager_rng_crac…
Earthcomputer f9a4530
Add villager random hierarchy regression test
Earthcomputer 51a47ac
changed some names
RealRTTV a855766
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 06c31b9
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 612b84b
added error messages for breaking villager manipulation
RealRTTV 00a3921
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 11fcc1f
fixed failure of tests
RealRTTV e9fd0b7
added checks to spawn area
RealRTTV 69ea5f2
moved code to a fn
RealRTTV 7e02d21
oh yeah no that should be there
RealRTTV d1d8ce3
removed useless fn
RealRTTV d5bbb5a
me when wildcard imports
RealRTTV fdb5e7b
it works, hooray
RealRTTV 6923b87
and that removes the stupid " from" at the end
RealRTTV 29a4a0a
made changes from review
RealRTTV cd6cfc9
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV 29a0e5b
push
RealRTTV f75ae00
mister taxi driver, i don't want your weird math!
RealRTTV d1054fa
Include commit hash in clientcommands build and use it in github link…
Earthcomputer 8231449
Merge remote-tracking branch 'upstream/fabric' into villager_rng_crac…
RealRTTV cc85f30
forgor
RealRTTV bcdc53c
added checks for villager rng waiting state so it doesn't break
RealRTTV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
331 changes: 331 additions & 0 deletions
331
src/main/java/net/earthcomputer/clientcommands/command/VillagerCommand.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
src/main/java/net/earthcomputer/clientcommands/features/VillagerCracker.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| package net.earthcomputer.clientcommands.features; | ||
|
|
||
| import net.earthcomputer.clientcommands.command.ClientCommandHelper; | ||
| import net.earthcomputer.clientcommands.command.VillagerCommand; | ||
| import net.earthcomputer.clientcommands.interfaces.IVillager; | ||
| import net.minecraft.client.Minecraft; | ||
| import net.minecraft.client.multiplayer.ClientLevel; | ||
| import net.minecraft.core.GlobalPos; | ||
| import net.minecraft.network.chat.Component; | ||
| import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket; | ||
| import net.minecraft.network.protocol.game.ClientboundSoundPacket; | ||
| import net.minecraft.world.entity.Entity; | ||
| import net.minecraft.world.entity.npc.Villager; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| import java.lang.ref.WeakReference; | ||
| import java.util.UUID; | ||
|
|
||
| public class VillagerCracker { | ||
| // This value was computed by brute forcing all seeds | ||
| public static final float MAX_ERROR = 5 * 0x1.0p-24f; | ||
|
|
||
| @Nullable | ||
| private static UUID villagerUuid = null; | ||
| @Nullable | ||
| private static WeakReference<Villager> cachedVillager = null; | ||
| @Nullable | ||
| private static GlobalPos clockPos = null; | ||
| @Nullable | ||
| public static VillagerCommand.Offer targetOffer = null; | ||
| @Nullable | ||
| private static Long lastServerTick = null; | ||
| private static boolean receivedClockRateWarning = false; | ||
|
|
||
| @Nullable | ||
| public static Villager getVillager() { | ||
| if (villagerUuid == null) { | ||
| cachedVillager = null; | ||
| return null; | ||
| } | ||
| if (cachedVillager != null) { | ||
| Villager villager = cachedVillager.get(); | ||
| if (villager != null && !villager.isRemoved()) { | ||
| return villager; | ||
| } | ||
| } | ||
| if (Minecraft.getInstance().level != null) { | ||
| for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) { | ||
| if (entity.getUUID() == villagerUuid && entity instanceof Villager villager) { | ||
| cachedVillager = new WeakReference<>(villager); | ||
| return villager; | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Nullable | ||
| public static GlobalPos getClockPos() { | ||
| return clockPos; | ||
| } | ||
|
|
||
| public static void setTargetVillager(@Nullable Villager villager) { | ||
| Villager oldVillager = getVillager(); | ||
| if (oldVillager != null) { | ||
| ((IVillager) oldVillager).clientcommands_getVillagerRngSimulator().reset(); | ||
| } | ||
|
|
||
| if (clockPos == null) { | ||
| ClientCommandHelper.sendHelp(Component.translatable("commands.cvillager.help.noClock")); | ||
| } | ||
|
|
||
| ClientLevel level = Minecraft.getInstance().level; | ||
|
|
||
| if (level.getDayTime() % 24000 < 12000) { | ||
| ClientCommandHelper.sendHelp(Component.translatable("commands.cvillager.help.day")); | ||
RealRTTV marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| VillagerCracker.cachedVillager = new WeakReference<>(villager); | ||
| VillagerCracker.villagerUuid = villager == null ? null : villager.getUUID(); | ||
| } | ||
|
|
||
| public static void setClockPos(@Nullable GlobalPos pos) { | ||
| VillagerCracker.clockPos = pos; | ||
| } | ||
|
|
||
| public static void onSoundEventPlayed(ClientboundSoundPacket packet) { | ||
| Villager targetVillager = getVillager(); | ||
| if (targetVillager == null || getClockPos() == null) { | ||
| return; | ||
| } | ||
|
|
||
| switch (packet.getSound().value().getLocation().toString()) { | ||
| case "minecraft:entity.villager.ambient", "minecraft:entity.villager.trade" -> ((IVillager) targetVillager).clientcommands_onAmbientSoundPlayed(packet.getPitch()); | ||
| case "minecraft:entity.villager.no" -> ((IVillager) targetVillager).clientcommands_onNoSoundPlayed(packet.getPitch()); | ||
| case "minecraft:entity.villager.yes" -> ((IVillager) targetVillager).clientcommands_onYesSoundPlayed(packet.getPitch()); | ||
| case "minecraft:entity.generic.splash" -> ((IVillager) targetVillager).clientcommands_onSplashSoundPlayed(packet.getPitch()); | ||
| } | ||
| } | ||
|
|
||
| public static void onXpOrbSpawned(ClientboundAddExperienceOrbPacket packet) { | ||
| Villager targetVillager = getVillager(); | ||
| if (targetVillager == null) { | ||
| return; | ||
| } | ||
|
|
||
| ((IVillager) targetVillager).clientcommands_onXpOrbSpawned(packet.getValue()); | ||
| } | ||
|
|
||
| public static void onServerTick() { | ||
| long now = System.currentTimeMillis(); | ||
|
|
||
| Villager targetVillager = getVillager(); | ||
| if (targetVillager == null) { | ||
| lastServerTick = now; | ||
| return; | ||
| } | ||
|
|
||
| if (lastServerTick != null && now - lastServerTick > 80L && !receivedClockRateWarning) { | ||
| ClientCommandHelper.sendHelp(Component.translatable("commands.cvillager.help.tooSlow")); | ||
| receivedClockRateWarning = true; | ||
| } | ||
|
|
||
| ((IVillager) targetVillager).clientcommands_onServerTick(); | ||
|
|
||
| lastServerTick = now; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.