.give command bossbar and dud tnt

This commit is contained in:
C10udburst
2022-03-18 22:38:54 +01:00
parent 9f3385a576
commit b32d679f48
2 changed files with 19 additions and 4 deletions

View File

@@ -61,8 +61,7 @@ public class GiveCommand extends Command {
})); }));
builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> { builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
String message = ctx.getArgument("message", String.class); String message = ctx.getArgument("message", String.class).replace("&", "\247");
message = message.replace("&", "\247");
ItemStack stack = new ItemStack(Items.ARMOR_STAND); ItemStack stack = new ItemStack(Items.ARMOR_STAND);
NbtCompound tag = new NbtCompound(); NbtCompound tag = new NbtCompound();
NbtList NbtList = new NbtList(); NbtList NbtList = new NbtList();
@@ -81,6 +80,21 @@ public class GiveCommand extends Command {
return SINGLE_SUCCESS; return SINGLE_SUCCESS;
}))); })));
builder.then(literal("bossbar").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
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.Serializer.toJson(new LiteralText(message)));
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);
GiveUtils.giveItem(stack);
return SINGLE_SUCCESS;
})));
builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> { builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> {
String playerName = ctx.getArgument("owner",String.class); String playerName = ctx.getArgument("owner",String.class);
ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD); ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD);

View File

@@ -40,7 +40,7 @@ public class GiveUtils {
new Identifier("tnt_minecart"), new Identifier("tnt_minecart"),
new Identifier("lightning_bolt")); new Identifier("lightning_bolt"));
// Ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/command/commands/CmdGive.java // Some ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/command/commands/CmdGive.java
private static final List<Triple<String, Item, String>> STRING_PRESETS = Arrays.asList( private static final List<Triple<String, Item, String>> STRING_PRESETS = Arrays.asList(
Triple.of("lag_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:32767,MaxSpawnDelay:0,SpawnRange:32767,Delay:0,MinSpawnDelay:0}}"), Triple.of("lag_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:32767,MaxSpawnDelay:0,SpawnRange:32767,Delay:0,MinSpawnDelay:0}}"),
Triple.of("tnt_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,SpawnData:{Fuse:1,id:\"minecraft:tnt\"},MaxSpawnDelay:0,SpawnRange:10,Delay:0,MinSpawnDelay:0}}"), Triple.of("tnt_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,SpawnData:{Fuse:1,id:\"minecraft:tnt\"},MaxSpawnDelay:0,SpawnRange:10,Delay:0,MinSpawnDelay:0}}"),
@@ -51,7 +51,8 @@ public class GiveUtils {
Triple.of("eg_curse_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{EntityTag:{SoundEvent:\"entity.elder_guardian.curse\",pickup:1b,id:\"minecraft:arrow\"}}"), Triple.of("eg_curse_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{EntityTag:{SoundEvent:\"entity.elder_guardian.curse\",pickup:1b,id:\"minecraft:arrow\"}}"),
Triple.of("big_slime", Items.SLIME_SPAWN_EGG, "{EntityTag:{Size:50,id:\"minecraft:slime\"}}"), Triple.of("big_slime", Items.SLIME_SPAWN_EGG, "{EntityTag:{Size:50,id:\"minecraft:slime\"}}"),
Triple.of("particle_area_expand", Items.SKELETON_SPAWN_EGG, "{EntityTag:{Particle:\"angry_villager\",Radius:1.0f,RadiusOnUse:1.0f,Duration:10000,id:\"minecraft:area_effect_cloud\",RadiusPerTick:10.0f}}"), Triple.of("particle_area_expand", Items.SKELETON_SPAWN_EGG, "{EntityTag:{Particle:\"angry_villager\",Radius:1.0f,RadiusOnUse:1.0f,Duration:10000,id:\"minecraft:area_effect_cloud\",RadiusPerTick:10.0f}}"),
Triple.of("armor_stand_spawner_minecart", Items.BAT_SPAWN_EGG, "{EntityTag:{SpawnData:{id:\"minecraft:armor_stand\"},id:\"minecraft:spawner_minecart\"}}") Triple.of("armor_stand_spawner_minecart", Items.BAT_SPAWN_EGG, "{EntityTag:{SpawnData:{id:\"minecraft:armor_stand\"},id:\"minecraft:spawner_minecart\"}}"),
Triple.of("dud_tnt", Items.DROWNED_SPAWN_EGG, "{EntityTag:{Fuse:30000,Invulnerable:1b,id:\"minecraft:tnt\"}}")
); );
private static final Random random = new Random(); private static final Random random = new Random();