This commit is contained in:
Cloudburst
2021-03-25 19:32:06 +01:00
parent b5c7abb0d1
commit 515a763adc
4 changed files with 317 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
package cloudburst.rejects.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import minegame159.meteorclient.commands.Command;
import minegame159.meteorclient.utils.player.ChatUtils;
import minegame159.meteorclient.utils.player.InvUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Hand;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
//Credit to the original author (https://github.com/Gaider10/BookDupe) (i think) for some of this code.
public class BookDupeCommand extends Command {
private final SimpleCommandExceptionType BOOK_NOT_FOUND_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("No writeable book found in inventory."));
private final ItemStack DUPE_BOOK = new ItemStack(Items.WRITABLE_BOOK, 1);
public BookDupeCommand() {
super("dupe", "Dupes using a held, writable book.");
StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < 21845; i++){
stringBuilder.append((char) 2048);
}
String str1 = stringBuilder.toString();
ListTag listTag = new ListTag();
listTag.addTag(0, StringTag.of(str1));
for(int i = 1; i < 40; i++){
listTag.addTag(i, StringTag.of("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
}
DUPE_BOOK.putSubTag("title", StringTag.of("a"));
DUPE_BOOK.putSubTag("pages", listTag);
}
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
if (InvUtils.getHand(Items.WRITABLE_BOOK) != Hand.MAIN_HAND) ChatUtils.prefixError("BOOK DUPE", "No book found, you must be holding a writable book!");
else mc.player.networkHandler.sendPacket(new BookUpdateC2SPacket(DUPE_BOOK, true, mc.player.inventory.selectedSlot));
return SINGLE_SUCCESS;
});
}
}

View File

@@ -199,7 +199,7 @@ public class Notebot extends Command {
currentNote++;
return;
}
mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_HARP, 2f, note);
mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_HARP, 2f, (float) Math.pow(2.0D, (note - 12) / 12.0D));
currentNote++;
}