コード例 #1
0
 /// <summary>
 /// Intializes a new <see cref="BaseVisibleAdvancement"/>
 /// </summary>
 /// <param name="packNamespace">The namespace the advancement is in</param>
 /// <param name="fileName">The name of the advancement file</param>
 /// <param name="writeSetting">The setting for writing the file</param>
 /// <param name="requirements">The requirements for getting the advancement</param>
 /// <param name="reward">The rewards to get for getting the advancement</param>
 /// <param name="announceInChat">True if when the advancement is unlocked it will be announced in chat. False if not</param>
 /// <param name="description">The description on the advancement</param>
 /// <param name="frame">The frame around the <see cref="Icon"/></param>
 /// <param name="hidden">True if the advancement can't be seen unless it has been unlocked</param>
 /// <param name="icon">The icon on the advancement</param>
 /// <param name="name">The shown advancement name</param>
 /// <param name="showToast">True if when the advancement is unlocked it will display a toast in the top right corner. False if not</param>
 protected BaseVisibleAdvancement(BasePackNamespace packNamespace, string?fileName, Requirement[] requirements, Reward?reward, BaseJsonText name, BaseJsonText description, Item icon, ID.AdvancementFrame frame = ID.AdvancementFrame.task, bool announceInChat = false, bool showToast = true, bool hidden = false, WriteSetting writeSetting = WriteSetting.LockedAuto) : base(packNamespace, fileName, requirements, reward, writeSetting)
 {
     Name           = name;
     Description    = description;
     Icon           = icon;
     Frame          = frame;
     AnnounceInChat = announceInChat;
     ShowToast      = showToast;
     Hidden         = hidden;
 }
コード例 #2
0
        public void TestDispose()
        {
            BaseDatapack      pack  = new DatapackTestClass("a path", "name");
            BasePackNamespace space = pack.Namespace <NamespaceTestClass>("namespace");

            Assert.IsFalse(pack.Disposed, "Pack wasn't disposed and shouldn't be disposed");
            Assert.IsFalse(space.Disposed, "namespace in pack wasn't disposed and shouldn't be disposed");

            pack.Dispose();
            Assert.IsTrue(((DatapackTestClass)pack).RandomValue, "AfterDispose didn't run");
            Assert.IsTrue(pack.Disposed, "Pack was disposed and should be disposed");
            Assert.IsTrue(space.Disposed, "namespace in pack was disposed and should be disposed since the pack is disposed");
            Assert.ThrowsException <InvalidOperationException>(() => pack.Namespace <NamespaceTestClass>("namespace"), "Shouldn't be able to get/create namespaces after pack has been disposed");
        }
コード例 #3
0
        public void TestNamespace()
        {
            //setup
            using BaseDatapack pack = new DatapackTestClass("a path", "name");
            //test
            BasePackNamespace space1 = pack.Namespace <NamespaceTestClass>("namespace");
            BasePackNamespace space2 = pack.Namespace <NamespaceTestClass>("namespace");
            BasePackNamespace space3 = pack.Namespace <NamespaceTestClass>("potato");

            Assert.IsTrue(space1.IsSetup, "namespace was not setup");
            Assert.AreEqual("namespace", space1.Name, "Namespace did not get correct name");
            Assert.AreEqual(space1, space2, "namespace failed to find and return existing namespace");
            Assert.AreEqual("potato", space3.Name, "Namespace failed to add extra namespace");
            Assert.AreNotEqual(space1, space3, "Namespace failed to output correct namespace");

            Assert.ThrowsException <ArgumentException>(() => new NamespaceTestClass(pack, "namespace"), "Cannot have 2 namespaces with the same name");
        }
コード例 #4
0
 /// <summary>
 /// Intializes a new <see cref="BaseFile"/> with the given values
 /// </summary>
 /// <param name="packNamespace">The namespace this file is for</param>
 /// <param name="fileName">The name of the file</param>
 /// <param name="writeSetting">The setting for the file</param>
 /// <param name="fileType">The type of file</param>
 protected BaseFile(BasePackNamespace packNamespace, string?fileName, WriteSetting writeSetting, string fileType) : base(packNamespace, fileName, writeSetting, fileType)
 {
 }
コード例 #5
0
ファイル: GroupTests.cs プロジェクト: Vilder50/SharpCraft
 public TestGroupClass(BasePackNamespace packNamespace, string fileName, List <GroupItemClass> items, bool appendGroup, WriteSetting writeSetting) : base(packNamespace, fileName, items, appendGroup, writeSetting, "test")
 {
     FinishedConstructing();
 }
コード例 #6
0
 public BaseFileTestClass2(BasePackNamespace packNamespace, string fileName, WriteSetting setting) : base(packNamespace, fileName, setting, "test2")
 {
     FinishedConstructing();
 }
コード例 #7
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockStructure(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #8
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockGroup(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #9
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new <see cref="BaseMockFile"/>
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public BaseMockFile(BasePackNamespace packNamespace, string name)
 {
     FileId        = name;
     PackNamespace = packNamespace;
 }
コード例 #10
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockAdvancement(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #11
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockDimensionType(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #12
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockLootTable(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #13
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockPredicate(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #14
0
ファイル: MockFile.cs プロジェクト: Vilder50/SharpCraft
 /// <summary>
 /// Intializes a new mock file
 /// </summary>
 /// <param name="packNamespace">The namespace the file is in</param>
 /// <param name="name">The name of the file</param>
 public MockRecipe(BasePackNamespace packNamespace, string name) : base(packNamespace, name)
 {
 }
コード例 #15
0
 /// <summary>
 /// Intializes a new <see cref="BaseAdvancement"/>
 /// </summary>
 /// <param name="packNamespace">The namespace the advancement is in</param>
 /// <param name="fileName">The name of the advancement file</param>
 /// <param name="writeSetting">The setting for writing the file</param>
 /// <param name="requirements">The requirements for getting the advancement</param>
 /// <param name="reward">The rewards to get for getting the advancement</param>
 protected BaseAdvancement(BasePackNamespace packNamespace, string?fileName, Requirement[] requirements, Reward?reward, WriteSetting writeSetting) : base(packNamespace, fileName, writeSetting, "advancement")
 {
     Requirements = requirements;
     Reward       = reward;
 }