Skip to content

Commit c993d4f

Browse files
committed
v3.2
1 parent a9fd8da commit c993d4f

11 files changed

Lines changed: 483 additions & 34 deletions

File tree

cambios.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
# v3.1
1+
# v3.2
22

33
## novedades
44

5-
- aviso para actualizar
6-
75
### adiciones
86

97
#### módulos nuevos:
108

11-
- resaltado de entidades: wallhack para entidades, modo de caja y de brillo
12-
- hitboxes: cambia el color de las hitboxes de f3+b
9+
- dupe de bundle: robado de .gg/dupes, usando un bundle y un libro de bookbot, dupea 63 del ítem deseado
10+
- j. k. rowling: rellena libros con caca de manera automática
1311

1412
### arreglos / mejoras
1513

16-
- más opciones para amortiguar caídas con tobillos fuertes
17-
- selección de minado ahora solo renderizará el contorno si su ajuste está activado
18-
- prioridad de selección de minado, cuantos más clics tenga un bloque, mayor será su prioridad. también la opción de deseleccionar un bloque.
19-
- opción para minar bloques en orden forzosamente en selección de minado (no funciona del todo)
20-
- evitar romper la caña si está a punto de romperse en auto pesca
14+
- ahora el aviso de actualizaciones ya funciona bien
2115

2216
## problemas reconocidos
2317

src/main/java/me/retucio/sputnik/Sputnik.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.retucio.sputnik;
22

3+
import com.ibm.icu.text.CaseMap;
34
import me.retucio.sputnik.cape.CapeManager;
45
import me.retucio.sputnik.command.CommandManager;
56
import me.retucio.sputnik.command.commands.BindCommand;
@@ -9,6 +10,7 @@
910
import me.retucio.sputnik.event.EventBus;
1011
import me.retucio.sputnik.event.SubscribeEvent;
1112
import me.retucio.sputnik.event.events.ShutdownEvent;
13+
import me.retucio.sputnik.event.events.interact.OpenScreenEvent;
1214
import me.retucio.sputnik.event.events.sputnik.LoadCapeManagerEvent;
1315
import me.retucio.sputnik.event.events.sputnik.LoadClickGUIEvent;
1416
import me.retucio.sputnik.event.events.sputnik.LoadCommandManagerEvent;
@@ -42,6 +44,7 @@
4244
import net.minecraft.client.MinecraftClient;
4345
import net.minecraft.client.gui.screen.ChatScreen;
4446
import net.minecraft.client.gui.screen.Screen;
47+
import net.minecraft.client.gui.screen.TitleScreen;
4548
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
4649
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
4750
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
@@ -133,11 +136,6 @@ public void onTick() {
133136
settingsApplied = true;
134137
}
135138

136-
if (VersionChecker.shouldShowScreen && !(mc.currentScreen instanceof UpdateScreen)) {
137-
VersionChecker.shouldShowScreen = false;
138-
CompletableFuture.delayedExecutor(5, TimeUnit.SECONDS).execute(() -> mc.execute(() -> mc.setScreen(new UpdateScreen())));
139-
}
140-
141139
ModuleManager.INSTANCE.getEnabledModules().forEach(Module::onTick);
142140
mc.getWindow().setTitle(ClientSettingsFrame.guiSettings.windowTitle.getValue());
143141
}
@@ -244,6 +242,16 @@ private boolean isOnTypingScreen() {
244242
|| mc.currentScreen instanceof AbstractCommandBlockScreen;
245243
}
246244

245+
// notificar al usuario de que hay una actualización disponible, si la hay
246+
@SubscribeEvent
247+
public void onSetScreen(OpenScreenEvent event) {
248+
if (VersionChecker.shouldShowScreen && event.getScreen() instanceof TitleScreen) {
249+
event.cancel();
250+
VersionChecker.shouldShowScreen = false;
251+
mc.execute(() -> mc.currentScreen = new UpdateScreen());
252+
}
253+
}
254+
247255
@SubscribeEvent
248256
public void onStop(ShutdownEvent event) {
249257
ConfigManager.save();

src/main/java/me/retucio/sputnik/mixin/mixins/misc/MinecraftClientMixin.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
import me.retucio.sputnik.event.events.interact.UseItemEvent;
1010
import me.retucio.sputnik.module.ModuleManager;
1111
import me.retucio.sputnik.module.modules.player.FastUse;
12+
import me.retucio.sputnik.ui.screen.UpdateScreen;
13+
import me.retucio.sputnik.util.VersionChecker;
1214
import net.minecraft.client.MinecraftClient;
1315
import net.minecraft.client.gui.screen.Screen;
1416
import net.minecraft.client.world.ClientWorld;
1517
import net.minecraft.item.ItemStack;
1618
import net.minecraft.util.Hand;
19+
import org.jspecify.annotations.Nullable;
1720
import org.spongepowered.asm.mixin.*;
1821
import org.spongepowered.asm.mixin.injection.*;
1922
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -32,6 +35,10 @@ public abstract class MinecraftClientMixin {
3235

3336
// eventos
3437

38+
@Shadow
39+
@Nullable
40+
public Screen currentScreen;
41+
3542
@Inject(method = "tick", at = @At("HEAD"))
3643
private void onTickPre(CallbackInfo ci) {
3744
Sputnik.INSTANCE.onTick();
@@ -67,7 +74,6 @@ private void onUseItem(CallbackInfo ci, @Local Hand hand) {
6774
if (event.isCancelled()) ci.cancel();
6875
}
6976

70-
7177
// telemetría
7278

7379
@Inject(method = "isTelemetryEnabledByApi", at = @At("RETURN"), cancellable = true)

src/main/java/me/retucio/sputnik/module/ModuleManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ private void addClient() {
8484
private void addMisc() {
8585
add(new AntiInvis());
8686
add(new AnvilFont());
87+
add(new BookBot());
8788
add(new BossbarStack());
89+
add(new BundleDupe());
8890
add(new ChatPlus());
8991
add(new CreativeInventoryHotbarKeybinds());
9092
add(new FakePlayer());
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
package me.retucio.sputnik.module.modules.misc;
2+
3+
import me.retucio.sputnik.event.SubscribeEvent;
4+
import me.retucio.sputnik.event.events.network.DisconnectEvent;
5+
import me.retucio.sputnik.module.Category;
6+
import me.retucio.sputnik.module.Module;
7+
import me.retucio.sputnik.module.setting.SettingGroup;
8+
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
9+
import me.retucio.sputnik.module.setting.settings.NumberSetting;
10+
import me.retucio.sputnik.module.setting.settings.StringSetting;
11+
import me.retucio.sputnik.util.ChatUtil;
12+
import me.retucio.sputnik.util.InventoryUtil;
13+
import net.minecraft.client.font.TextHandler;
14+
import net.minecraft.component.DataComponentTypes;
15+
import net.minecraft.component.type.WritableBookContentComponent;
16+
import net.minecraft.component.type.WrittenBookContentComponent;
17+
import net.minecraft.item.ItemStack;
18+
import net.minecraft.item.Items;
19+
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
20+
import net.minecraft.text.*;
21+
22+
import java.util.ArrayList;
23+
import java.util.List;
24+
import java.util.Optional;
25+
import java.util.PrimitiveIterator;
26+
import java.util.Random;
27+
import java.util.function.Predicate;
28+
29+
30+
public class BookBot extends Module {
31+
32+
private final SettingGroup sgBook = addSg(new SettingGroup("libro", true));
33+
34+
private final NumberSetting delay = sgGeneral.add(new NumberSetting(
35+
"delay",
36+
"delay entre la escritura de libros",
37+
20,
38+
1,
39+
200,
40+
1
41+
));
42+
43+
private final BooleanSetting toggleOnDisconnect = sgGeneral.add(new BooleanSetting(
44+
"desactivar al desconectarse",
45+
".",
46+
true
47+
));
48+
49+
private final StringSetting name = sgBook.add(new StringSetting(
50+
"nombre",
51+
"nombre a usar para los libros",
52+
"mortadela y filetón",
53+
100
54+
));
55+
56+
private final BooleanSetting count = sgBook.add(new BooleanSetting(
57+
"contar",
58+
"contar los libros y añadir el número al final del nombre",
59+
true
60+
));
61+
62+
private final NumberSetting pages = sgBook.add(new NumberSetting(
63+
"páginas",
64+
"número de páginas a llenar con mierda",
65+
50,
66+
1,
67+
100,
68+
1
69+
));
70+
71+
private final BooleanSetting sign = sgBook.add(new BooleanSetting(
72+
"firmar",
73+
"firmar el libro",
74+
true
75+
));
76+
77+
private final BooleanSetting onlyAscii = sgBook.add(new BooleanSetting(
78+
"solo ascii",
79+
"usar solamente caracteres ascii",
80+
false
81+
));
82+
83+
private int delayTimer, bookCount;
84+
private Random random;
85+
86+
public BookBot() {
87+
super("j. k. rowling", "rellena libros con caca", Category.MISC);
88+
}
89+
90+
@Override
91+
public void onEnable() {
92+
random = new Random();
93+
delayTimer = delay.getIntValue();
94+
bookCount = 0;
95+
super.onEnable();
96+
}
97+
98+
@Override
99+
public void onTick() {
100+
if (mc.player == null) return;
101+
102+
Predicate<ItemStack> bookPredicate = stack -> {
103+
WritableBookContentComponent component = stack.get(DataComponentTypes.WRITABLE_BOOK_CONTENT);
104+
return stack.getItem() == Items.WRITABLE_BOOK && (component == null || component.pages().isEmpty());
105+
};
106+
107+
ItemStack book = InventoryUtil.find(bookPredicate);
108+
if (book == null) {
109+
ChatUtil.warn("no se encontró ningún libro");
110+
toggle();
111+
return;
112+
}
113+
114+
if (mc.player.getMainHandStack() != book) {
115+
InventoryUtil.swapWithHotbar(
116+
mc.player.getInventory().getSlotWithStack(book),
117+
mc.player.getInventory().getSelectedSlot()
118+
);
119+
}
120+
121+
if (delayTimer > 0) {
122+
delayTimer--;
123+
return;
124+
}
125+
126+
delayTimer = delay.getIntValue();
127+
128+
int origin = onlyAscii.getValue() ? 0x21 : 0x0800;
129+
int bound = onlyAscii.getValue() ? 0x7E : 0x10FFFF;
130+
131+
writeBook(random.ints(origin, bound)
132+
.filter(i -> !Character.isWhitespace(i)
133+
&& i != '\r' && i != '\n')
134+
.iterator()
135+
);
136+
}
137+
138+
@SubscribeEvent
139+
private void onDisconnect(DisconnectEvent event) {
140+
if (toggleOnDisconnect.getValue()) {
141+
toggle();
142+
}
143+
}
144+
145+
private void writeBook(PrimitiveIterator.OfInt chars) {
146+
ArrayList<String> pages = new ArrayList<>();
147+
ArrayList<RawFilteredPair<Text>> filteredPages = new ArrayList<>();
148+
int maxPages = this.pages.getIntValue();
149+
150+
TextHandler.WidthRetriever widthRetriever = mc.textRenderer.getTextHandler().widthRetriever;
151+
int pageIndex = 0;
152+
int lineIndex = 0;
153+
final StringBuilder page = new StringBuilder();
154+
float lineWidth = 0;
155+
156+
while (chars.hasNext() && pageIndex < maxPages) {
157+
int c = chars.nextInt();
158+
159+
if (c == '\r' || c == '\n') {
160+
page.append('\n');
161+
lineWidth = 0;
162+
lineIndex++;
163+
} else {
164+
float charWidth = widthRetriever.getWidth(c, Style.EMPTY);
165+
166+
if (lineWidth + charWidth > 114f) {
167+
page.append('\n');
168+
lineWidth = charWidth;
169+
lineIndex++;
170+
if (lineIndex != 14) page.appendCodePoint(c);
171+
} else if (lineWidth == 0f && c == ' ') {
172+
continue;
173+
} else {
174+
lineWidth += charWidth;
175+
page.appendCodePoint(c);
176+
}
177+
}
178+
179+
if (lineIndex == 14) {
180+
filteredPages.add(RawFilteredPair.of(Text.of(page.toString())));
181+
pages.add(page.toString());
182+
page.setLength(0);
183+
pageIndex++;
184+
lineIndex = 0;
185+
lineWidth = 0;
186+
}
187+
}
188+
189+
if (!page.isEmpty() && pageIndex < maxPages) {
190+
filteredPages.add(RawFilteredPair.of(Text.of(page.toString())));
191+
pages.add(page.toString());
192+
}
193+
194+
if (bookCount > 0) {
195+
ChatUtil.info("creado libro n. " + bookCount);
196+
}
197+
198+
createBook(pages, filteredPages);
199+
}
200+
201+
private void processLinesToPages(List<StringVisitable> lines, ArrayList<String> pages, ArrayList<RawFilteredPair<Text>> filteredPages, int maxPages) {
202+
int pageIndex = 0;
203+
int lineIndex = 0;
204+
StringBuilder currentPage = new StringBuilder();
205+
206+
for (StringVisitable line : lines) {
207+
String lineText = line.getString();
208+
209+
if (!currentPage.isEmpty()) {
210+
currentPage.append('\n');
211+
}
212+
213+
currentPage.append(lineText);
214+
lineIndex++;
215+
216+
if (lineIndex == 14) {
217+
filteredPages.add(RawFilteredPair.of(Text.of(currentPage.toString())));
218+
pages.add(currentPage.toString());
219+
currentPage.setLength(0);
220+
pageIndex++;
221+
lineIndex = 0;
222+
223+
if (pageIndex == maxPages) break;
224+
}
225+
}
226+
227+
if (!currentPage.isEmpty() && pageIndex < maxPages) {
228+
filteredPages.add(RawFilteredPair.of(Text.of(currentPage.toString())));
229+
pages.add(currentPage.toString());
230+
}
231+
}
232+
233+
private void createBook(ArrayList<String> pages, ArrayList<RawFilteredPair<Text>> filteredPages) {
234+
String title = name.getValue();
235+
if (count.getValue() && bookCount != 0) title += " #" + bookCount;
236+
237+
mc.player.getMainHandStack().set(DataComponentTypes.WRITTEN_BOOK_CONTENT, new WrittenBookContentComponent(
238+
RawFilteredPair.of(title),
239+
mc.player.getGameProfile().name(),
240+
0,
241+
filteredPages,
242+
true
243+
));
244+
245+
mc.player.networkHandler.sendPacket(new BookUpdateC2SPacket(
246+
mc.player.getInventory().getSelectedSlot(),
247+
pages,
248+
sign.getValue()
249+
? Optional.of(title)
250+
: Optional.empty()
251+
));
252+
253+
bookCount++;
254+
}
255+
}

0 commit comments

Comments
 (0)