mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 03:27:56 +01:00
Merge remote-tracking branch 'upstream/new-data-preperation-1.17' into new-data-1.17
This commit is contained in:
commit
d000684963
@ -201,7 +201,7 @@ configurations.all {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
dependsOn("downloadResources")
|
dependsOn("copyData")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@ -218,4 +218,4 @@ publishing {
|
|||||||
task copyData(type: Copy) {
|
task copyData(type: Copy) {
|
||||||
from("MinestomDataGenerator/Minestom-Data/$mcVersion/")
|
from("MinestomDataGenerator/Minestom-Data/$mcVersion/")
|
||||||
into(new File(project.projectDir, "/src/main/resources/minecraft_data/"))
|
into(new File(project.projectDir, "/src/main/resources/minecraft_data/"))
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,4 @@ run {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
dependsOn(project.rootProject.tasks.getByName("copyData"))
|
dependsOn(project.rootProject.tasks.getByName("copyData"))
|
||||||
}
|
}
|
||||||
|
@ -23,75 +23,75 @@ public class Generators {
|
|||||||
LOGGER.error("Usage: <MC version> <source folder> <target folder>");
|
LOGGER.error("Usage: <MC version> <source folder> <target folder>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String targetVersion = args[0];
|
String targetVersion = args[0].replace(".", "_");
|
||||||
File inputFolder = new File(args[1]);
|
File inputFolder = new File(args[1]);
|
||||||
File outputFolder = new File(args[2]);
|
File outputFolder = new File(args[2]);
|
||||||
// Generate blocks
|
// Generate blocks
|
||||||
new BlockGenerator(
|
new BlockGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_blocks.json"),
|
new File(inputFolder, targetVersion + "_blocks.json"),
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_block_properties.json"),
|
new File(inputFolder, targetVersion + "_block_properties.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate fluids
|
// Generate fluids
|
||||||
new FluidGenerator(
|
new FluidGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_fluids.json"),
|
new File(inputFolder, targetVersion + "_fluids.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate entities
|
// Generate entities
|
||||||
new EntityTypeGenerator(
|
new EntityTypeGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_entities.json"),
|
new File(inputFolder, targetVersion + "_entities.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate items
|
// Generate items
|
||||||
new MaterialGenerator(
|
new MaterialGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_items.json"),
|
new File(inputFolder, targetVersion + "_items.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate enchantments
|
// Generate enchantments
|
||||||
new EnchantmentGenerator(
|
new EnchantmentGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_enchantments.json"),
|
new File(inputFolder, targetVersion + "_enchantments.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// TODO: Generate attributes
|
// TODO: Generate attributes
|
||||||
// new AttributeGenerator(
|
// new AttributeGenerator(
|
||||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_attributes.json"),
|
// new File(inputFolder, targetVersion + "_attributes.json"),
|
||||||
// outputFolder
|
// outputFolder
|
||||||
// ).generate();
|
// ).generate();
|
||||||
// Generate potion effects
|
// Generate potion effects
|
||||||
new PotionEffectGenerator(
|
new PotionEffectGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_potion_effects.json"),
|
new File(inputFolder, targetVersion + "_potion_effects.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate potions
|
// Generate potions
|
||||||
new PotionTypeGenerator(
|
new PotionTypeGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_potions.json"),
|
new File(inputFolder, targetVersion + "_potions.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate particles
|
// Generate particles
|
||||||
new ParticleGenerator(
|
new ParticleGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_particles.json"),
|
new File(inputFolder, targetVersion + "_particles.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// Generate sounds
|
// Generate sounds
|
||||||
new SoundEventGenerator(
|
new SoundEventGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_sounds.json"),
|
new File(inputFolder, targetVersion + "_sounds.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
// TODO: Generate villager professions
|
// TODO: Generate villager professions
|
||||||
// new VillagerProfessionGenerator(
|
// new VillagerProfessionGenerator(
|
||||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_villager_professions.json"),
|
// new File(inputFolder, targetVersion + "_villager_professions.json"),
|
||||||
// outputFolder
|
// outputFolder
|
||||||
// ).generate();
|
// ).generate();
|
||||||
// TODO: Generate villager types
|
// TODO: Generate villager types
|
||||||
// new VillagerTypeGenerator(
|
// new VillagerTypeGenerator(
|
||||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_villager_types.json"),
|
// new File(inputFolder, targetVersion + "_villager_types.json"),
|
||||||
// outputFolder
|
// outputFolder
|
||||||
// ).generate();
|
// ).generate();
|
||||||
// Generate statistics
|
// Generate statistics
|
||||||
new StatisticGenerator(
|
new StatisticGenerator(
|
||||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_custom_statistics.json"),
|
new File(inputFolder, targetVersion + "_custom_statistics.json"),
|
||||||
outputFolder
|
outputFolder
|
||||||
).generate();
|
).generate();
|
||||||
LOGGER.info("Finished generating code");
|
LOGGER.info("Finished generating code");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,4 @@ public abstract class MinestomCodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.minestom.codegen.attribute;
|
package net.minestom.codegen.attribute;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.squareup.javapoet.*;
|
import com.squareup.javapoet.*;
|
||||||
import net.minestom.codegen.MinestomCodeGenerator;
|
import net.minestom.codegen.MinestomCodeGenerator;
|
||||||
@ -135,13 +137,13 @@ public final class AttributeGenerator extends MinestomCodeGenerator {
|
|||||||
// toString method
|
// toString method
|
||||||
attributeClass.addMethod(
|
attributeClass.addMethod(
|
||||||
MethodSpec.methodBuilder("toString")
|
MethodSpec.methodBuilder("toString")
|
||||||
.addAnnotation(NotNull.class)
|
.addAnnotation(NotNull.class)
|
||||||
.addAnnotation(Override.class)
|
.addAnnotation(Override.class)
|
||||||
.returns(String.class)
|
.returns(String.class)
|
||||||
// this resolves to [Namespace]
|
// this resolves to [Namespace]
|
||||||
.addStatement("return \"[\" + this.id + \"]\"")
|
.addStatement("return \"[\" + this.id + \"]\"")
|
||||||
.addModifiers(Modifier.PUBLIC)
|
.addModifiers(Modifier.PUBLIC)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
// Creating ClampedAttribute
|
// Creating ClampedAttribute
|
||||||
ClassName clampedAttributeClassName = ClassName.get("net.minestom.server.attribute", "ClampedAttribute");
|
ClassName clampedAttributeClassName = ClassName.get("net.minestom.server.attribute", "ClampedAttribute");
|
||||||
@ -251,4 +253,4 @@ public final class AttributeGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,4 +412,4 @@ public final class BlockGenerator extends MinestomCodeGenerator {
|
|||||||
// Write files to outputFolder
|
// Write files to outputFolder
|
||||||
writeFiles(filesToWrite, outputFolder);
|
writeFiles(filesToWrite, outputFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,4 +442,4 @@ public final class EntityTypeGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.minestom.codegen.entity;
|
package net.minestom.codegen.entity;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.squareup.javapoet.*;
|
import com.squareup.javapoet.*;
|
||||||
import net.minestom.codegen.MinestomCodeGenerator;
|
import net.minestom.codegen.MinestomCodeGenerator;
|
||||||
@ -216,4 +218,4 @@ public final class VillagerProfessionGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package net.minestom.codegen.entity;
|
package net.minestom.codegen.entity;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.squareup.javapoet.*;
|
import com.squareup.javapoet.*;
|
||||||
import net.minestom.codegen.MinestomCodeGenerator;
|
import net.minestom.codegen.MinestomCodeGenerator;
|
||||||
@ -168,4 +170,4 @@ public final class VillagerTypeGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ public final class FluidGenerator extends MinestomCodeGenerator {
|
|||||||
String fluidName = fluid.get("name").getAsString();
|
String fluidName = fluid.get("name").getAsString();
|
||||||
|
|
||||||
fluidClass.addEnumConstant(fluidName, TypeSpec.anonymousClassBuilder(
|
fluidClass.addEnumConstant(fluidName, TypeSpec.anonymousClassBuilder(
|
||||||
"$T.from($S)",
|
"$T.from($S)",
|
||||||
namespaceIDClassName,
|
namespaceIDClassName,
|
||||||
fluid.get("id").getAsString()
|
fluid.get("id").getAsString()
|
||||||
).build()
|
).build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -154,4 +154,4 @@ public final class FluidGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,4 +153,4 @@ public final class EnchantmentGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public final class MaterialGenerator extends MinestomCodeGenerator {
|
|||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
if (ap.get("slot") != null) {
|
if (ap.get("slot") != null) {
|
||||||
switch(ap.get("slot").getAsString()) {
|
switch (ap.get("slot").getAsString()) {
|
||||||
case "head": {
|
case "head": {
|
||||||
enumConst.addMethod(
|
enumConst.addMethod(
|
||||||
MethodSpec.methodBuilder("isHelmet")
|
MethodSpec.methodBuilder("isHelmet")
|
||||||
@ -348,4 +348,4 @@ public final class MaterialGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,4 +152,4 @@ public final class ParticleGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,4 +153,4 @@ public final class PotionEffectGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,4 +153,4 @@ public final class PotionTypeGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,4 +152,4 @@ public final class SoundEventGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,4 +153,4 @@ public final class StatisticGenerator extends MinestomCodeGenerator {
|
|||||||
outputFolder
|
outputFolder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,4 @@ public final class NameUtil {
|
|||||||
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
|
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user