TypeRegistry.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #include "TypeRegistry.h"
  2. #include <Datei.h>
  3. #include "Animal.h"
  4. #include "BasicBlocks.h"
  5. #include "BasicItems.h"
  6. #include "BasicTool.h"
  7. #include "BlockFilter.h"
  8. #include "BlockInstanceGeneratorRule.h"
  9. #include "BlockTypeGeneratorRule.h"
  10. #include "Chest.h"
  11. #include "Dimension.h"
  12. #include "DimensionGenerator.h"
  13. #include "FluidBlock.h"
  14. #include "FluidContainer.h"
  15. #include "GeneratorRule.h"
  16. #include "Grass.h"
  17. #include "GrowingPlant.h"
  18. #include "JsonExpression.h"
  19. #include "LightSources.h"
  20. #include "ModelInfo.h"
  21. #include "PlaceableProof.h"
  22. #include "Quest.h"
  23. #include "Recipie.h"
  24. #include "TreeSeblingBlock.h"
  25. #include "TreeTemplate.h"
  26. TypeRegistry::TypeRegistry()
  27. : ReferenceCounter()
  28. {
  29. // register quest datastructures
  30. registerType(new QuestRequirementStorageType());
  31. registerType(new QuestStorageType());
  32. registerType(new QuestPartyType());
  33. registerType(new QuestType());
  34. registerType(new QuestCollectionType());
  35. registerSubType(new QuestRequirementOpenDialogType());
  36. registerType(new ItemJsonType());
  37. registerType(new ItemStackInfoType());
  38. registerSubType(new QuestRewardGiveItemsType());
  39. // block types
  40. registerType(new ModelInfoFactory());
  41. registerSubType(new BasicBlockTypeFactory());
  42. registerSubType(new AdditionalItemSpawningBlockTypeFactory());
  43. registerSubType(new BasicLightSourceBlockTypeFactory());
  44. registerSubType(new ChestBlockTypeFactory());
  45. registerSubType(new FluidBlockTypeFactory());
  46. registerSubType(new GrassBlockTypeFactory());
  47. registerSubType(new GrowingPlantBlockTypeFactory());
  48. registerSubType(new TreeSeblingBlockTypeFactory());
  49. // block filter
  50. registerSubType(new BlockFilterAndFactory());
  51. registerSubType(new BlockFilterOrFactory());
  52. registerSubType(new BlockFilterNotFactory());
  53. registerSubType(new BlockFilterBlockTypeFactory());
  54. registerSubType(new BlockFilterTypeGroupFactory());
  55. registerSubType(new BlockFilterMaxHardnessFactory());
  56. registerSubType(new BlockFilterMinHardnessFactory());
  57. registerSubType(new BlockFilterMaxHeatFactory());
  58. // placeable proof
  59. registerSubType(new PlaceableProofAndFactory());
  60. registerSubType(new PlaceableProofOrFactory());
  61. registerSubType(new PlaceableProofNotFactory());
  62. registerSubType(new PlaceableProofBlockFilterFactory());
  63. // item types
  64. registerSubType(new BasicBlockItemTypeFactory());
  65. registerSubType(new BasicItemTypeFactory());
  66. registerSubType(new BasicToolItemTypeFactory());
  67. registerSubType(new FluidContainerItemTypeFactory());
  68. // item skills
  69. registerSubType(new XPBasedLevelUpRuleFactory());
  70. registerType(new DamagingItemSkillConfigFactory());
  71. registerSubType(new DamagingItemSkillFactory());
  72. registerType(new BlockReplaceItemSkillConfigFactory());
  73. registerSubType(new BlockReplaceItemSkillFactory());
  74. registerType(new FluidContainerItemSkillConfigFactory());
  75. registerSubType(new FluidContainerItemSkillFactory());
  76. // reipies
  77. registerType(new RecipieInputFactory());
  78. registerType(new RecipieOutputFactory());
  79. registerSubType(new ShapedRecipieFactory());
  80. registerSubType(new UnshapedRecipieFactory());
  81. // item modifiers
  82. registerSubType(new ConsumeItemModifierFactory());
  83. registerSubType(new DoNothingModifierFactory());
  84. registerSubType(new AttributeItemModifierFactory());
  85. registerSubType(new CombinedItemModifierFactory());
  86. // item filters
  87. registerSubType(new CombinedItemFilterFactory());
  88. registerSubType(new AnyItemFilterFactory());
  89. registerSubType(new TypeItemFilterFactory());
  90. registerSubType(new GroupItemFilterFactory());
  91. // json Expressions
  92. registerSubType(new JVariableFloatExpressionFactory());
  93. registerSubType(new JVariableBoolExpressionFactory());
  94. registerSubType(new JConstantFloatExpressionFactory());
  95. registerSubType(new JConstantBoolExpressionFactory());
  96. registerSubType(new JNoiseFloatExpressionFactory());
  97. registerSubType(new JOperatorFloatExpressionFactory());
  98. registerSubType(new JBoolOperatorBoolExpressionFactory());
  99. registerSubType(new JFloatOperatorBoolExpressionFactory());
  100. registerSubType(new JBlockTypeBoolExpressionFactory());
  101. // world generator
  102. registerType(new WorldHeightLayerFactory());
  103. registerSubType(new BlockTypeGeneratorRuleFactory());
  104. registerSubType(new BlockInstanceGeneratorRuleFactory());
  105. registerSubType(new BiomedCavedDimensionGeneratorFactory());
  106. registerType(new BiomGeneratorFactory());
  107. registerType(new StructureTemplateCollectionFactory());
  108. registerSubType(new TreeTemplateFactory());
  109. registerType(new EntityGeneratorFactory());
  110. // entities
  111. registerSubType(new AnimalEntityTypeFactory());
  112. }
  113. void TypeRegistry::writeSyntaxInfo(Framework::Text folderPath) const
  114. {
  115. for (Framework::Text* typeId : parsableTypeNames)
  116. {
  117. TypeFatoryRef* factory
  118. = parsableTypes.z(typeId->getText(), typeId->getLength());
  119. Framework::JSON::Validator::JSONValidator* validator
  120. = factory->getValidator();
  121. Framework::Datei syntaxFile(
  122. new Framework::Text(folderPath + "/" + *typeId + ".xml"));
  123. syntaxFile.erstellen();
  124. Framework::Text syntaxContent = validator->zConstraints()->toString();
  125. syntaxFile.open(Framework::Datei::Style::schreiben);
  126. syntaxFile.schreibe(syntaxContent, syntaxContent.getLength());
  127. syntaxFile.close();
  128. validator->release();
  129. }
  130. }