.give improvements

This commit is contained in:
Cloudburst
2021-05-15 20:00:19 +02:00
parent e965fcd683
commit 18a2b46166
2 changed files with 49 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import minegame159.meteorclient.utils.player.ChatUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.StringNbtReader;
import java.util.Random;
@@ -28,6 +29,9 @@ public class GiveUtils {
case "dispenser":
item = new ItemStack(Items.DISPENSER);
break;
case "egg":
item = new ItemStack(Items.CHEST);
break;
default:
item = new ItemStack(Items.PINK_SHULKER_BOX);
break;
@@ -267,6 +271,15 @@ public class GiveUtils {
default:
break;
}
if (container.equals("egg")) {
CompoundTag ct = new CompoundTag();
ct.put("EntityTag", StringNbtReader.parse("{Time:1,id:\"minecraft:falling_block\",BlockState:{Name:\"minecraft:chest\"}}"));
((CompoundTag) ct.get("EntityTag")).put("TileEntityData", item.getTag().get("BlockEntityTag"));
ct.put("display", item.getTag().get("display"));
item = new ItemStack(Items.STRIDER_SPAWN_EGG);
item.setTag(ct);
}
} catch (CommandSyntaxException e) {
ChatUtils.error("An NBT parsing error occured");
}