Skip to content

Commit

Permalink
changed some names
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRTTV committed Nov 29, 2024
1 parent f9a4530 commit 51a47ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/net/earthcomputer/clientcommands/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ public static void setVillagerManipulation(boolean villagerManipulation) {
}
}

@Config(setter = @Config.Setter("setMaxVillagerSimulationTicks"), temporary = true)
public static int maxVillagerSimulationTicks = 12000;
public static void setMaxVillagerSimulationTicks(int maxVillagerSimulationTicks) {
Configs.maxVillagerSimulationTicks = Mth.clamp(maxVillagerSimulationTicks, 0, 1_000_000);
@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 @@ -269,9 +269,9 @@ private static int start(boolean levelUp) throws CommandSyntaxException {

VillagerTrades.ItemListing[] listings = VillagerTrades.TRADES.get(profession).getOrDefault(crackedLevel, new VillagerTrades.ItemListing[0]);
int adjustmentTicks = levelUp ? -40 : 0;
VillagerRngSimulator.OfferWaitingResult result = VillagerCracker.simulator.bruteForceOffers(listings, levelUp ? 240 : 10, Configs.maxVillagerSimulationTicks, offer -> VillagerCracker.goals.stream().anyMatch(goal -> goal.matches(offer)));
VillagerRngSimulator.BruteForceResult result = VillagerCracker.simulator.bruteForceOffers(listings, levelUp ? 240 : 10, Configs.maxVillagerManipulationWaitTicks, offer -> VillagerCracker.goals.stream().anyMatch(goal -> goal.matches(offer)));
if (result == null) {
ClientCommandHelper.addOverlayMessage(Component.translatable("commands.cvillager.bruteForce.failed", Configs.maxVillagerSimulationTicks).withStyle(ChatFormatting.RED), 100);
ClientCommandHelper.addOverlayMessage(Component.translatable("commands.cvillager.bruteForce.failed", Configs.maxVillagerManipulationWaitTicks).withStyle(ChatFormatting.RED), 100);
return Command.SINGLE_SUCCESS;
}
VillagerRngSimulator.SurroundingOffers surroundingOffers = VillagerCracker.simulator.generateSurroundingOffers(listings, result.ticksPassed(), 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public void onXpOrbSpawned(int value) {
}

@Nullable
public VillagerRngSimulator.OfferWaitingResult bruteForceOffers(VillagerTrades.ItemListing[] listings, int minTicks, int maxTicks, Predicate<VillagerCracker.Offer> predicate) {
public VillagerRngSimulator.BruteForceResult bruteForceOffers(VillagerTrades.ItemListing[] listings, int minTicks, int maxTicks, Predicate<VillagerCracker.Offer> predicate) {
Villager targetVillager = VillagerCracker.getVillager();
if (targetVillager != null && getCrackedState().isCracked()) {
VillagerRngSimulator branchedSimulator = this.copy();
Expand All @@ -399,7 +399,7 @@ public VillagerRngSimulator.OfferWaitingResult bruteForceOffers(VillagerTrades.I
VillagerCracker.Offer offer = offerSimulator.anyOffersMatch(listings, targetVillager, predicate);
if (offer != null) {
// we do the calls before this ticks processing so that since with 0ms ping, the server reads it next tick
return new OfferWaitingResult(ticksPassed, offer);
return new BruteForceResult(ticksPassed, offer);
}
branchedSimulator.simulateTick();
}
Expand Down Expand Up @@ -519,7 +519,7 @@ public MutableComponent getMessage(boolean addColor) {
}
}

public record OfferWaitingResult(int ticksPassed, VillagerCracker.Offer offer) {
public record BruteForceResult(int ticksPassed, VillagerCracker.Offer offer) {
}

public record SurroundingOffers(List<VillagerCracker.Offer[]> before, VillagerCracker.Offer[] middle, List<VillagerCracker.Offer[]> after) {
Expand Down

0 comments on commit 51a47ac

Please sign in to comment.