diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4e3015a6..09f479ce 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,9 @@ -**Version:-** 0.X.X+foo +**Version:-** Release/Snapshot 0.X.X+foo ### Changes * State * Your -* Changes +* Changes * Here ### Bug Fixes @@ -14,4 +14,3 @@ * Minor * Changes * Here - diff --git a/README.md b/README.md index d816b030..53ca872c 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,20 @@ An unofficial plugin for [MCreator](https://mcreator.net/), a highly advanced Mi This project is not official. Not affiliated with the respective owners and maintainers of Fabric, Minecraft, or MCreator. Do not expect any official support from their respective communities. ## Features -- Advancement (Mostly complete, procedure triggered advancements don't work) - -- Armor (Mostly complete, custom 3D models need to be hardcoded) **To don't get an error, you have to select a sound.** - (Not all sounds are included because mappings are not finished. Any help is welcome.) - -- Block (Mostly complete) - -- Food (Mostly complete) - -- Fuel (Complete) - -- Function (Complete) - -- Item (Mostly Complete) - -- Loot table (Complete) - -- Recipe (Complete) - -- Tag (Complete) - -- Tool (Pickaxe, Axe, Shovel, Hoe and Sword) +* Advancement (Mostly complete) +* Armor (Mostly complete) **To don't get an error, you have to select a sound.** (Not all sounds are included because mappings are not finished. Any help is welcome.) +* Block (Mostly complete) +* Food (Mostly complete) +* Fuel (Complete) +* Function (Complete) +* Item (Mostly Complete) +* Loot table (Complete) +* Recipe (Complete) +* Tag (Complete) +* Tool (Pickaxe, Axe, Shovel, Hoe and Sword) +* Biome (Not complete) +* Ore generation (Nether and Overworld, Netherrack and Stone Respectively) +* Itemgroups (Complete) ## Downloads/Install Instructions diff --git a/src/fabric-1.15.2/biome.definition.yaml b/src/fabric-1.15.2/biome.definition.yaml new file mode 100644 index 00000000..f0a2bf66 --- /dev/null +++ b/src/fabric-1.15.2/biome.definition.yaml @@ -0,0 +1,3 @@ +templates: + - template: biome.java.ftl + name: "@SRCROOT/@BASEPACKAGEPATH/world/biome/@NAME.java" diff --git a/src/fabric-1.15.2/generator.yaml b/src/fabric-1.15.2/generator.yaml index 3e498890..1bcab8a9 100644 --- a/src/fabric-1.15.2/generator.yaml +++ b/src/fabric-1.15.2/generator.yaml @@ -1,6 +1,6 @@ name: Minecraft Fabric for 1.15.2 (@buildfileversion) -basefeatures: [model_json,model_obj,sounds] -partial_support: [block,item,food,armor] +basefeatures: [model_json,model_obj] +partial_support: [block,item,food,armor,biome,tab,sounds,fuel] status: dev buildfileversion: 0.8.7+build.201 @@ -27,6 +27,9 @@ base_templates: - template: modbase/mod.java.ftl name: "@SRCROOT/@BASEPACKAGEPATH/@JavaModName.java" canLock: true +- template: modbase/biomeRegistry.java.ftl + name: "@SRCROOT/@BASEPACKAGEPATH/registry/@JavaModNameBiomes.java" + canLock: true - template: modbase/fabric.mod.json.ftl writer: json name: "@RESROOT/fabric.mod.json" diff --git a/src/fabric-1.15.2/templates/biome.java.ftl b/src/fabric-1.15.2/templates/biome.java.ftl new file mode 100644 index 00000000..c360b6b4 --- /dev/null +++ b/src/fabric-1.15.2/templates/biome.java.ftl @@ -0,0 +1,118 @@ +<#-- @formatter:off --> +package ${package}.world.biome; + +import net.fabricmc.fabric.api.biomes.v1.OverworldClimate; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +public class ${name} extends Biome{ + + public static final int WEIGHT = ${data.biomeWeight}; + + public ${name}(){ + super(new Biome.Settings().configureSurfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_CONFIG) + .precipitation(Biome.Precipitation.<#if (data.rainingPossibility > 0)><#if (data.temperature > 0.15)>RAIN<#else>SNOW<#else>NONE) + .category(Biome.Category.PLAINS) + .depth(${data.baseHeight}f) + .scale(${data.heightVariation}f) + .temperature(${data.temperature}f) + .precipitation(Precipitation.<#if (data.rainingPossibility > 0)><#if (data.temperature > 0.15)>RAIN<#else>SNOW<#else>NONE) + .downfall(${data.rainingPossibility}f) + <#if data.customColors> + .waterColor(${data.waterColor.getRGB()}).waterFogColor(${data.waterColor.getRGB()}) + <#else> + .waterColor(4159204).waterFogColor(329011) + + <#if data.parent?? && data.parent.getUnmappedValue() != "No parent"> + .parent("${data.parent}") + <#else> + .parent((String)null)); + + + this.addStructureFeature(Feature.MINESHAFT.configure(new MineshaftFeatureConfig(0.004D, MineshaftFeature.Type.NORMAL))); + this.addStructureFeature(Feature.STRONGHOLD.configure(FeatureConfig.DEFAULT)); + DefaultBiomeFeatures.addLandCarvers(this); + DefaultBiomeFeatures.addDefaultStructures(this); + DefaultBiomeFeatures.addDungeons(this); + DefaultBiomeFeatures.addDefaultOres(this); + DefaultBiomeFeatures.addDefaultDisks(this); + DefaultBiomeFeatures.addDefaultVegetation(this); + DefaultBiomeFeatures.addSprings(this); + DefaultBiomeFeatures.addFrozenTopLayer(this); + <#if (data.flowersPerChunk > 0)> + DefaultBiomeFeatures.addDefaultFlowers(this); + + <#if (data.grassPerChunk > 0)> + DefaultBiomeFeatures.addDefaultGrass(this); + + <#if (data.flowersPerChunk > 0)> + DefaultBiomeFeatures.addForestFlowers(this); + + <#if data.generateLakes> + DefaultBiomeFeatures.addDefaultLakes(this); + + <#if (data.mushroomsPerChunk > 0)> + DefaultBiomeFeatures.addDefaultMushrooms(this); + + <#if (data.treesPerChunk > 0)> + <#if data.vanillaTreeType == "Big trees"> + DefaultBiomeFeatures.addTallBirchTrees(this); + DefaultBiomeFeatures.addForestTrees(this); + <#elseif data.vanillaTreeType == "Savanna trees"> + DefaultBiomeFeatures.addSavannaTrees(this); + <#elseif data.vanillaTreeType == "Mega pine trees"> + DefaultBiomeFeatures.addGiantTreeTaigaTrees(this); + <#elseif data.vanillaTreeType == "Mega spruce trees"> + DefaultBiomeFeatures.addGiantSpruceTaigaTrees(this); + <#elseif data.vanillaTreeType == "Birch trees"> + DefaultBiomeFeatures.addBirchTrees(this); + <#else> + DefaultBiomeFeatures.addBirchTrees(this); + DefaultBiomeFeatures.addForestTrees(this); + + + <#if (data.bigMushroomsChunk > 0)> + DefaultBiomeFeatures.addMushroomFieldsFeatures(this); + + <#if (data.reedsPerChunk > 0)> + DefaultBiomeFeatures.addBamboo(this); + + <#if (data.cactiPerChunk > 0)> + DefaultBiomeFeatures.addDesertFeatures(this); + + + this.addSpawn(EntityCategory.CREATURE, new Biome.SpawnEntry(EntityType.SHEEP, 12, 4, 4)); + this.addSpawn(EntityCategory.CREATURE, new Biome.SpawnEntry(EntityType.PIG, 10, 4, 4)); + this.addSpawn(EntityCategory.CREATURE, new Biome.SpawnEntry(EntityType.CHICKEN, 10, 4, 4)); + this.addSpawn(EntityCategory.CREATURE, new Biome.SpawnEntry(EntityType.COW, 8, 4, 4)); + this.addSpawn(EntityCategory.AMBIENT, new Biome.SpawnEntry(EntityType.BAT, 10, 8, 8)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.SPIDER, 100, 4, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.ZOMBIE, 95, 4, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.ZOMBIE_VILLAGER, 5, 1, 1)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.SKELETON, 100, 4, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.CREEPER, 100, 4, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.SLIME, 100, 4, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.ENDERMAN, 10, 1, 4)); + this.addSpawn(EntityCategory.MONSTER, new Biome.SpawnEntry(EntityType.WITCH, 5, 1, 1)); + } + <#if data.customColors> + @Environment(EnvType.CLIENT) + @Override + public int getSkyColor() { + return ${data.airColor.getRGB()}; + } + + @Environment(EnvType.CLIENT) + @Override + public int getGrassColorAt(double x, double z) { + return ${data.grassColor.getRGB()}; + } + + @Environment(EnvType.CLIENT) + @Override + public int getFoliageColor() { + return ${data.grassColor.getRGB()}; + } + +} +<#-- @formatter:on --> diff --git a/src/fabric-1.15.2/templates/block.java.ftl b/src/fabric-1.15.2/templates/block.java.ftl index 0cf471db..2f1e5266 100644 --- a/src/fabric-1.15.2/templates/block.java.ftl +++ b/src/fabric-1.15.2/templates/block.java.ftl @@ -211,6 +211,83 @@ public class ${name} extends <#if data.hasGravity>FallingBlock<#else>Block } + public void genBlock(Biome biome){ + <#list data.spawnWorldTypes as worldType> + <#if worldType=="Surface"> + try{ + <#if (data.spawnWorldTypes?size > 0)> + if(biome.getCategory() != Biome.Category.THEEND + <#if data.restrictionBiomes?has_content> + <#list data.restrictionBiomes as restrictionBiome> + && biome != Registry.BIOME.get(new Identifier("${restrictionBiome}")) + + + ){ + biome.addFeature( + GenerationStep + .Feature + .UNDERGROUND_ORES,Feature + .ORE + .configure( + new OreFeatureConfig(OreFeatureConfig + .Target + .NATURAL_STONE, + ${JavaModName} + .${name} + .getDefaultState(), + ${data.frequencyOnChunk} + )).createDecoratedFeature(Decorator + .COUNT_RANGE. + configure(new RangeDecoratorConfig( + ${data.frequencyPerChunks}, + ${data.minGenerateHeight}, + ${data.minGenerateHeight}, + ${data.maxGenerateHeight} + )))); + } + }catch(Throwable ignored){} + + + <#if worldType == "Nether"> + try{ + <#if (data.spawnWorldTypes?size > 0)> + if(biome.getCategory() != Biome.Category.THEEND + <#if data.restrictionBiomes?has_content> + <#list data.restrictionBiomes as restrictionBiome> + && biome != Registry.BIOME.get(new Identifier("${restrictionBiome}")) + + + ){ + biome.addFeature( + GenerationStep + .Feature + .UNDERGROUND_ORES,Feature + .ORE + .configure( + new OreFeatureConfig(OreFeatureConfig + .Target + .NETHERRACK, + ${JavaModName} + .${name} + .getDefaultState(), + ${data.frequencyOnChunk} + )).createDecoratedFeature(Decorator + .COUNT_RANGE. + configure(new RangeDecoratorConfig( + ${data.frequencyPerChunks}, + ${data.minGenerateHeight}, + ${data.minGenerateHeight}, + ${data.maxGenerateHeight} + )))); + } + }catch(Throwable ignored){} + + + + } + + } + <#-- @formatter:on --> diff --git a/src/fabric-1.15.2/templates/modbase/biomeRegistry.java.ftl b/src/fabric-1.15.2/templates/modbase/biomeRegistry.java.ftl new file mode 100644 index 00000000..e8cb0ed6 --- /dev/null +++ b/src/fabric-1.15.2/templates/modbase/biomeRegistry.java.ftl @@ -0,0 +1,36 @@ +<#-- @formatter:off --> +/* + * MCreator note: + * + * If you lock base mod element files, you can edit this file and the proxy files + * and they won't get overwritten. If you change your mod package or modid, you + * need to apply these changes to this file MANUALLY. + * + * + * + * If you do not lock base mod element files in Workspace settings, this file + * will be REGENERATED on each build. + * + */ +package ${package}.registry; + +public class ${JavaModName}Biomes { + + <#list w.getElementsOfType("BIOME") as biome> + public static Biome ${biome?upper_case}; + + + public static void registerBiomes() + { + <#list w.getElementsOfType("BIOME") as biome> + ${biome?upper_case} = register(new ${biome}(), "${modid}"); + FabricBiomes.addSpawnBiome(${JavaModName}Biomes.${biome?upper_case}); + + } + + private static Biome register(Biome biome, String id) { + return Registry.register(Registry.BIOME, id, biome); + } + +} +<#-- @formatter:on --> diff --git a/src/fabric-1.15.2/templates/modbase/mod.java.ftl b/src/fabric-1.15.2/templates/modbase/mod.java.ftl index fa526e10..7876b50f 100644 --- a/src/fabric-1.15.2/templates/modbase/mod.java.ftl +++ b/src/fabric-1.15.2/templates/modbase/mod.java.ftl @@ -7,9 +7,6 @@ * need to apply these changes to this file MANUALLY. * * - * Keep the ${JavaModName}Elements object in this class and all calls to this object - * INTACT in order to preserve functionality of mod elements generated by MCreator. - * * If you do not lock base mod element files in Workspace settings, this file * will be REGENERATED on each build. * @@ -18,6 +15,8 @@ package ${package}; import ${package}.item; +import net.fabricmc.fabric.api.biomes.v1.OverworldBiomes; +import net.fabricmc.fabric.api.biomes.v1.OverworldClimate; public class ${JavaModName} implements ModInitializer { @@ -43,7 +42,7 @@ public class ${JavaModName} implements ModInitializer { <#list w.getElementsOfType("BLOCK") as block> - public static final Block ${block} = new ${block}(); + public static final ${block} ${block} = new ${block}(); @Override @@ -64,6 +63,12 @@ public class ${JavaModName} implements ModInitializer { Registry.register(Registry.ITEM,new Identifier("${modid}","${armor.getRegistryName()}_boots"), ${armor}_BOOTS); +${JavaModName}Biomes.registerBiomes(); + +<#list w.getElementsOfType("BIOME") as biome> + OverworldBiomes.addContinentalBiome(${JavaModName}Biomes.${biome?upper_case},OverworldClimate.TEMPERATE,${biome}.WEIGHT); + + <#list w.getElementsOfType("FOOD") as food> Registry.register(Registry.ITEM, new Identifier("${modid}", "${food.getRegistryName()}"), ${food}); @@ -75,11 +80,13 @@ public class ${JavaModName} implements ModInitializer { <#list w.getElementsOfType("BLOCK") as block> <#assign ge = block.getGeneratableElement()> Registry.register(Registry.BLOCK, new Identifier("${modid}", "${block.getRegistryName()}"), ${block}); + Registry.BIOME.forEach(this.${block}::genBlock); + RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> { this.${block}.genBlock(biome); }); Registry.register(Registry.ITEM, new Identifier("${modid}", "${block.getRegistryName()}"), new BlockItem(${block}, new Item.Settings().group(${ge.creativeTab}))); <#list w.getElementsOfType("FUEL") as fuel> - ${fuel}Fuel.initialize(); + ${fuel}Fuel.initialize(); } } diff --git a/src/fabric-1.15.2/utils/mcitems.ftl b/src/fabric-1.15.2/utils/mcitems.ftl index f7eef213..acccea1d 100644 --- a/src/fabric-1.15.2/utils/mcitems.ftl +++ b/src/fabric-1.15.2/utils/mcitems.ftl @@ -3,10 +3,10 @@ <#return mappedBlock> <#elseif mappedBlock.toString().startsWith("CUSTOM:")> <#if !mappedBlock.toString().contains(".")> - <#return (generator.getElementPlainName(mappedBlock)) - + (generator.getRecipeElementType(mappedBlock.toString()) == "BLOCK")?then("Block", "Item") + ".block.getDefaultState()"> + <#return JavaModName + "." + (generator.getElementPlainName(mappedBlock)) + + (generator.getRecipeElementType(mappedBlock.toString()) == "BLOCK")?then("Block", "Item") + ".getDefaultState()"> <#else> - <#return (generator.getElementPlainName(mappedBlock)) + <#return JavaModName + "." + (generator.getElementPlainName(mappedBlock)) + (generator.getRecipeElementType(mappedBlock.toString()) == "BLOCK")?then("Block", "Item") + "." + generator.getElementExtension(mappedBlock) + ".getDefaultState()"> <#else> diff --git a/src/plugin.json b/src/plugin.json index 06ca9708..04a47b36 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -3,7 +3,7 @@ "minversion": 202000322116, "info": { "name": "Minecraft Fabric 1.15.2 Generator", - "version": "0.6.0+pre1", + "version": "0.6.0+pre2", "description": "A Fabric Generator", "author": "Goldorion with the help of CrispyChips and BoogieMonster1O1" }