improved creative give
This commit is contained in:
@@ -17,6 +17,7 @@ import java.lang.invoke.MethodHandles;
|
||||
import cloudburst.rejects.commands.*;
|
||||
import cloudburst.rejects.gui.hud.*;
|
||||
import cloudburst.rejects.modules.*;
|
||||
import cloudburst.rejects.utils.GiveUtils;
|
||||
import cloudburst.rejects.utils.Utils;
|
||||
|
||||
public class MeteorRejectsAddon extends MeteorAddon {
|
||||
@@ -28,7 +29,9 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
||||
LOG.info("Initializing Meteor Rejects Addon");
|
||||
|
||||
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
|
||||
|
||||
Utils.init();
|
||||
GiveUtils.init();
|
||||
|
||||
Modules modules = Modules.get();
|
||||
modules.add(new AntiBot());
|
||||
|
||||
@@ -3,21 +3,17 @@ package cloudburst.rejects.commands;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
|
||||
|
||||
import cloudburst.rejects.arguments.EnumStringArgumentType;
|
||||
import cloudburst.rejects.utils.GiveUtils;
|
||||
import minegame159.meteorclient.systems.commands.Command;
|
||||
import minegame159.meteorclient.utils.player.SlotUtils;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static cloudburst.rejects.utils.GiveUtils.createPreset;
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
import java.util.*;
|
||||
@@ -27,18 +23,11 @@ public class GiveCommand extends Command {
|
||||
public GiveCommand() {
|
||||
super("give", "Gives items in creative", "item", "kit");
|
||||
}
|
||||
|
||||
private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(new LiteralText("You must be in creative mode to use this."));
|
||||
private final static SimpleCommandExceptionType NO_SPACE = new SimpleCommandExceptionType(new LiteralText("No space in hotbar"));
|
||||
private final Collection<String> PRESETS = Arrays.asList("forceop", "negs", "stacked", "spawners", "bookban",
|
||||
"test", "eggs");
|
||||
private final Collection<String> CONTAINERS = Arrays.asList("chest", "shulker", "trapped_chest", "barrel",
|
||||
"dispenser", "egg");
|
||||
private final Collection<String> PRESETS = GiveUtils.PRESETS.keySet();
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(literal("egg").executes(ctx -> {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
ItemStack inHand = mc.player.getMainHandStack();
|
||||
ItemStack item = new ItemStack(Items.STRIDER_SPAWN_EGG);
|
||||
NbtCompound ct = new NbtCompound();
|
||||
@@ -67,12 +56,11 @@ public class GiveCommand extends Command {
|
||||
t.put("EntityTag", ct);
|
||||
item.setTag(t);
|
||||
item.setCustomName(inHand.getName());
|
||||
addItem(item);
|
||||
GiveUtils.giveItem(item);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
|
||||
builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
String message = ctx.getArgument("message", String.class);
|
||||
message = message.replace("&", "\247");
|
||||
ItemStack stack = new ItemStack(Items.ARMOR_STAND);
|
||||
@@ -89,67 +77,24 @@ public class GiveCommand extends Command {
|
||||
tag.putString("CustomName", Text.Serializer.toJson(new LiteralText(message)));
|
||||
tag.put("Pos", NbtList);
|
||||
stack.putSubTag("EntityTag", tag);
|
||||
addItem(stack);
|
||||
GiveUtils.giveItem(stack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
|
||||
builder.then(literal("firework").executes(ctx -> {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
ItemStack firework = new ItemStack(Items.FIREWORK_ROCKET);
|
||||
NbtCompound baseCompound = new NbtCompound();
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
NbtList explosionList = new NbtList();
|
||||
|
||||
for(int i = 0; i < 5000; i++)
|
||||
{
|
||||
NbtCompound explosionCompound = new NbtCompound();
|
||||
|
||||
Random rand = new Random();
|
||||
explosionCompound.putByte("Type", (byte)rand.nextInt(5));
|
||||
|
||||
int colors[] = {1973019,11743532,3887386,5320730,2437522,8073150,2651799,11250603,4408131,14188952,4312372,14602026,6719955,12801229,15435844,15790320};
|
||||
|
||||
explosionCompound.putIntArray("Colors", colors);
|
||||
explosionList.add(explosionCompound);
|
||||
}
|
||||
|
||||
|
||||
tagCompound.putInt("Flight", 0);
|
||||
tagCompound.put("Explosions", explosionList);
|
||||
baseCompound.put("Fireworks", tagCompound);
|
||||
firework.setTag(baseCompound);
|
||||
addItem(firework);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
|
||||
builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
String playerName = ctx.getArgument("owner",String.class);
|
||||
ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("SkullOwner", playerName);
|
||||
itemStack.setTag(tag);
|
||||
addItem(itemStack);
|
||||
GiveUtils.giveItem(itemStack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
|
||||
builder.then(literal("preset").then(argument("name", new EnumStringArgumentType(PRESETS))
|
||||
.then(argument("container", new EnumStringArgumentType(CONTAINERS)).executes(context -> {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
String name = context.getArgument("name", String.class);
|
||||
String container = context.getArgument("container", String.class);
|
||||
addItem(createPreset(name, container));
|
||||
return SINGLE_SUCCESS;
|
||||
}))));
|
||||
}
|
||||
|
||||
private void addItem(ItemStack item) throws CommandSyntaxException {
|
||||
for(int i = 0; i < 36; i++) {
|
||||
ItemStack stack = mc.player.getInventory().getStack(SlotUtils.indexToId(i));
|
||||
if (!stack.isEmpty()) continue;
|
||||
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(SlotUtils.indexToId(i), item));
|
||||
return;
|
||||
}
|
||||
throw NO_SPACE.create();
|
||||
builder.then(literal("preset").then(argument("name", new EnumStringArgumentType(PRESETS)).executes(context -> {
|
||||
String name = context.getArgument("name", String.class);
|
||||
GiveUtils.giveItem(GiveUtils.getPreset(name));
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@ import java.util.List;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
|
||||
/*
|
||||
Ported from Cornos
|
||||
https://github.com/cornos/Cornos/blob/master/src/main/java/me/zeroX150/cornos/features/command/impl/Scan.java
|
||||
*/
|
||||
public class ServerCommand extends Command {
|
||||
|
||||
private final static SimpleCommandExceptionType ADDRESS_ERROR = new SimpleCommandExceptionType(new LiteralText("Couldn't obtain server address"));
|
||||
|
||||
@@ -4,9 +4,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
import cloudburst.rejects.utils.GiveUtils;
|
||||
import minegame159.meteorclient.gui.GuiTheme;
|
||||
import minegame159.meteorclient.gui.WindowScreen;
|
||||
import minegame159.meteorclient.gui.widgets.containers.WTable;
|
||||
@@ -18,7 +18,6 @@ import minegame159.meteorclient.settings.Settings;
|
||||
import minegame159.meteorclient.utils.network.HttpUtils;
|
||||
import minegame159.meteorclient.utils.network.MeteorExecutor;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
import minegame159.meteorclient.utils.player.SlotUtils;
|
||||
|
||||
import static minegame159.meteorclient.utils.Utils.mc;
|
||||
|
||||
@@ -31,6 +30,7 @@ import java.lang.reflect.Type;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
public class HeadScreen extends WindowScreen {
|
||||
|
||||
@@ -95,7 +95,11 @@ public class HeadScreen extends WindowScreen {
|
||||
t.add(theme.label(head.getName().asString()));
|
||||
WButton give = t.add(theme.button("Give")).widget();
|
||||
give.action = () -> {
|
||||
addItem(head);
|
||||
try {
|
||||
GiveUtils.giveItem(head);
|
||||
} catch (CommandSyntaxException e) {
|
||||
ChatUtils.error("Heads", e.getMessage());
|
||||
}
|
||||
};
|
||||
WButton equip = t.add(theme.button("Equip")).widget();
|
||||
equip.tooltip = "Equip client-side.";
|
||||
@@ -127,17 +131,4 @@ public class HeadScreen extends WindowScreen {
|
||||
return head;
|
||||
}
|
||||
|
||||
private void addItem(ItemStack item) {
|
||||
if (!mc.player.getAbilities().creativeMode) {
|
||||
ChatUtils.error("Heads", "You must be in creative mode to use this.");
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < 36; i++) {
|
||||
ItemStack stack = mc.player.getInventory().getStack(SlotUtils.indexToId(i));
|
||||
if (stack == null || !stack.isEmpty() || stack.getItem() != Items.AIR) continue;
|
||||
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(SlotUtils.indexToId(i), item));
|
||||
return;
|
||||
}
|
||||
ChatUtils.error("Heads", "No space in hotbar.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/*
|
||||
Ported from: https://github.com/BleachDrinker420/BleachHack/pull/211
|
||||
*/
|
||||
public class InteractionScreen extends Screen {
|
||||
|
||||
private final Entity entity;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Gravity extends Module {
|
||||
}
|
||||
else if (moon.get()) {
|
||||
Vec3d velocity = mc.player.getVelocity();
|
||||
((IVec3d) velocity).set(velocity.x, velocity.y + 0.0568000030517578, velocity.z); // Yes, this was precisely calculated.
|
||||
((IVec3d) velocity).set(velocity.x, velocity.y + 0.0568000030517578, velocity.z); // Yes, this was precisely calculated by the cornos dev (https://github.com/cornos/Cornos/blob/master/src/main/java/me/zeroX150/cornos/features/module/impl/movement/MoonGravity.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ import net.minecraft.world.chunk.WorldChunk;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/*
|
||||
Ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/module/mods/NewChunks.java
|
||||
*/
|
||||
public class NewChunks extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user