1.20.6 Update (#347)
* initial no tests * Initial 1.20.6 update + tests/fixes * Initial 1.20.6 update + tests/fixes * 1.20.6 fixes * more 1.20.6 updates * initial port 1.20.6
This commit is contained in:
@@ -6,6 +6,8 @@ import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import meteordevelopment.meteorclient.commands.Command;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.NbtComponent;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
@@ -35,35 +37,41 @@ public class GiveCommand extends Command {
|
||||
ItemStack inHand = mc.player.getMainHandStack();
|
||||
ItemStack item = new ItemStack(Items.STRIDER_SPAWN_EGG);
|
||||
NbtCompound ct = new NbtCompound();
|
||||
|
||||
NbtCompound itemNbt = inHand
|
||||
.getOrDefault(DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT)
|
||||
.copyNbt();
|
||||
|
||||
if (inHand.getItem() instanceof BlockItem) {
|
||||
ct.putInt("Time", 1);
|
||||
ct.putString("id", "minecraft:falling_block");
|
||||
ct.put("BlockState", new NbtCompound());
|
||||
ct.getCompound("BlockState").putString("Name", Registries.ITEM.getId(inHand.getItem()).toString());
|
||||
if (inHand.hasNbt() && inHand.getNbt().contains("BlockEntityTag")) {
|
||||
ct.put("TileEntityData", inHand.getNbt().getCompound("BlockEntityTag"));
|
||||
itemNbt.putInt("Time", 1);
|
||||
itemNbt.putString("id", "minecraft:falling_block");
|
||||
itemNbt.put("BlockState", new NbtCompound());
|
||||
itemNbt.getCompound("BlockState").putString("Name", Registries.ITEM.getId(inHand.getItem()).toString());
|
||||
if (inHand.getComponents().contains(DataComponentTypes.BLOCK_ENTITY_DATA)) {
|
||||
itemNbt.put("TileEntityData", inHand.get(DataComponentTypes.BLOCK_ENTITY_DATA).copyNbt());
|
||||
}
|
||||
NbtCompound t = new NbtCompound();
|
||||
t.put("EntityTag", ct);
|
||||
item.setNbt(t);
|
||||
item.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(itemNbt));
|
||||
} else {
|
||||
ct.putString("id", "minecraft:item");
|
||||
NbtCompound it = new NbtCompound();
|
||||
it.putString("id", Registries.ITEM.getId(inHand.getItem()).toString());
|
||||
it.putInt("Count", inHand.getCount());
|
||||
if (inHand.hasNbt()) {
|
||||
it.put("tag", inHand.getNbt());
|
||||
if (!inHand.getComponents().isEmpty()) {
|
||||
it.put("tag", inHand.getOrDefault(DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT).copyNbt());
|
||||
}
|
||||
ct.put("Item", it);
|
||||
}
|
||||
NbtCompound t = new NbtCompound();
|
||||
t.put("EntityTag", ct);
|
||||
item.setNbt(t);
|
||||
item.setCustomName(inHand.getName());
|
||||
item.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(t));
|
||||
item.set(DataComponentTypes.CUSTOM_NAME, inHand.getName());
|
||||
GiveUtils.giveItem(item);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
|
||||
//TODO: allow for custom cords to place oob
|
||||
builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
|
||||
String message = ctx.getArgument("message", String.class).replace("&", "\247");
|
||||
ItemStack stack = new ItemStack(Items.ARMOR_STAND);
|
||||
@@ -77,9 +85,9 @@ public class GiveCommand extends Command {
|
||||
tag.putBoolean("Interpret", true);
|
||||
tag.putBoolean("NoGravity", true);
|
||||
tag.putBoolean("CustomNameVisible", true);
|
||||
tag.putString("CustomName", Text.Serialization.toJsonString(Text.literal(message)));
|
||||
tag.putString("CustomName", Text.literal(message).toString());
|
||||
tag.put("Pos", NbtList);
|
||||
stack.setSubNbt("EntityTag", tag);
|
||||
stack.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(tag));
|
||||
GiveUtils.giveItem(stack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
@@ -88,13 +96,13 @@ public class GiveCommand extends Command {
|
||||
String message = ctx.getArgument("message", String.class).replace("&", "\247");
|
||||
ItemStack stack = new ItemStack(Items.BAT_SPAWN_EGG);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("CustomName", Text.Serialization.toJsonString(Text.literal(message)));
|
||||
tag.putString("CustomName", Text.literal(message).toString());
|
||||
tag.putBoolean("NoAI", true);
|
||||
tag.putBoolean("Silent", true);
|
||||
tag.putBoolean("PersistenceRequired", true);
|
||||
tag.putBoolean("Invisible", true);
|
||||
tag.put("id", NbtString.of("minecraft:wither"));
|
||||
stack.setSubNbt("EntityTag", tag);
|
||||
stack.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(tag));
|
||||
GiveUtils.giveItem(stack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
@@ -104,7 +112,7 @@ public class GiveCommand extends Command {
|
||||
ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("SkullOwner", playerName);
|
||||
itemStack.setNbt(tag);
|
||||
itemStack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(tag));
|
||||
GiveUtils.giveItem(itemStack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ReconnectCommand extends Command {
|
||||
if (info != null) {
|
||||
mc.world.disconnect();
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc,
|
||||
ServerAddress.parse(info.address), info, false);
|
||||
ServerAddress.parse(info.address), info, false, null);
|
||||
}
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user