TypeRegistry.cpp 5.3 KB

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