@@ -0,0 +1,1702 @@
+package info.u_team.u_team_core.intern.loot;%0A%0Aimport com.google.gson.*;%0A%0Aimport info.u_team.u_team_core.UCoreMain;%0Aimport info.u_team.u_team_core.tileentity.UTileEntity;%0Aimport net.minecraft.item.ItemStack;%0Aimport net.minecraft.nbt.CompoundNBT;%0Aimport net.minecraft.tileentity.TileEntity;%0Aimport net.minecraft.util.ResourceLocation;%0Aimport net.minecraft.world.storage.loot.*;%0Aimport net.minecraft.world.storage.loot.conditions.ILootCondition;%0A%0Apublic class SetTileEntityNBTLootFunction extends LootFunction %7B%0A%09%0A%09private SetTileEntityNBTLootFunction(ILootCondition%5B%5D conditions) %7B%0A%09%09super(conditions);%0A%09%7D%0A%09%0A%09public ItemStack doApply(ItemStack stack, LootContext context) %7B%0A%09%09if (context.has(LootParameters.BLOCK_ENTITY)) %7B%0A%09%09%09final CompoundNBT compound = new CompoundNBT();%0A%09%09%09final TileEntity tileEntity = context.get(LootParameters.BLOCK_ENTITY);%0A%09%09%09if (tileEntity instanceof UTileEntity) %7B%0A%09%09%09%09((UTileEntity) tileEntity).writeNBT(compound);%0A%09%09%09%7D else %7B%0A%09%09%09%09tileEntity.write(compound);%0A%09%09%09%7D%0A%09%09%09if (!compound.isEmpty()) %7B%0A%09%09%09%09stack.setTagInfo(%22BlockEntityTag%22, compound);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return stack;%0A%09%7D%0A%09%0A%09public static LootFunction.Builder%3C?%3E builder() %7B%0A%09%09return builder((conditions) -%3E new SetTileEntityNBTLootFunction(conditions));%0A%09%7D%0A%09%0A%09public static class Serializer extends LootFunction.Serializer%3CSetTileEntityNBTLootFunction%3E %7B%0A%09%09%0A%09%09public Serializer() %7B%0A%09%09%09super(new ResourceLocation(UCoreMain.MODID, %22set_tileentity_nbt%22), SetTileEntityNBTLootFunction.class);%0A%09%09%7D%0A%09%09%0A%09%09@Override%0A%09%09public SetTileEntityNBTLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, ILootCondition%5B%5D conditions) %7B%0A%09%09%09return new SetTileEntityNBTLootFunction(conditions);%0A%09%09%7D%0A%09%7D%0A%7D

Add set tile entity nbt loot function