mirror of https://github.com/Minestom/Minestom.git
Use minestom-data to generate our enums.
This commit is contained in:
parent
c105fcc339
commit
105f2fdc7e
|
@ -32,7 +32,7 @@ hs_err_pid*
|
|||
|
||||
### Gradle template
|
||||
.gradle
|
||||
/build/
|
||||
**/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
@ -45,6 +45,7 @@ gradle-app.setting
|
|||
|
||||
# IDEA files
|
||||
.idea/
|
||||
**/out/
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
@ -56,5 +57,7 @@ gradle-app.setting
|
|||
/.mixin.out/
|
||||
|
||||
# When compiling we get a docs folder
|
||||
/docs
|
||||
.mixin.out/
|
||||
**/docs
|
||||
|
||||
# The data for generation and the resources is included in this folder
|
||||
src/main/resources
|
107
build.gradle
107
build.gradle
|
@ -5,6 +5,8 @@ plugins {
|
|||
id 'maven-publish'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
|
||||
id 'checkstyle'
|
||||
// Used to download our data
|
||||
id 'de.undercouch.download' version '4.1.1'
|
||||
}
|
||||
|
||||
group 'net.minestom.server'
|
||||
|
@ -72,14 +74,6 @@ sourceSets {
|
|||
srcDir 'src/autogenerated/java'
|
||||
}
|
||||
}
|
||||
generators {
|
||||
java {
|
||||
srcDir 'src/generators/java'
|
||||
}
|
||||
|
||||
compileClasspath += sourceSets.main.runtimeClasspath
|
||||
runtimeClasspath += sourceSets.main.runtimeClasspath
|
||||
}
|
||||
lwjgl {
|
||||
java {
|
||||
srcDir 'src/lwjgl/java'
|
||||
|
@ -98,12 +92,6 @@ java {
|
|||
withSourcesJar()
|
||||
}
|
||||
|
||||
registerFeature("generators") {
|
||||
usingSourceSet(sourceSets.generators)
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
@ -207,9 +195,6 @@ dependencies {
|
|||
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
|
||||
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengles::$lwjglNatives"
|
||||
lwjglRuntimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
|
||||
|
||||
|
||||
generatorsImplementation("com.squareup:javapoet:1.13.0")
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
|
@ -217,6 +202,10 @@ configurations.all {
|
|||
exclude group: "org.checkerframework", module: "checker-qual"
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn("downloadResources")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
|
@ -224,3 +213,87 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
def mcVersionUnderscored = mcVersion.replace('.', '_')
|
||||
def dataDest = new File(project.projectDir, "/src/main/resources/minecraft_data/")
|
||||
def dataDestTags = new File(project.projectDir, "/src/main/resources/minecraft_data/tags")
|
||||
def dataDestLootTable = new File(project.projectDir, "/src/main/resources/minecraft_data/loot_tables")
|
||||
|
||||
// UPDATE: Update the data to the required version
|
||||
task downloadResources(type: Download) {
|
||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_"
|
||||
src([
|
||||
// attributes.json
|
||||
"${mainURL}attributes.json",
|
||||
// biomes.json
|
||||
"${mainURL}biomes.json",
|
||||
// block_entities
|
||||
"${mainURL}block_entities.json",
|
||||
// block_properties
|
||||
"${mainURL}block_properties.json",
|
||||
// blocks.json
|
||||
"${mainURL}blocks.json",
|
||||
// custom_statistics.json
|
||||
"${mainURL}custom_statistics.json",
|
||||
// dimension_types.json
|
||||
"${mainURL}dimension_types.json",
|
||||
// enchantments.json
|
||||
"${mainURL}enchantments.json",
|
||||
// entities.json
|
||||
"${mainURL}entities.json",
|
||||
// fluids.json
|
||||
"${mainURL}fluids.json",
|
||||
// items.json
|
||||
"${mainURL}items.json",
|
||||
// map_colors.json
|
||||
"${mainURL}map_colors.json",
|
||||
// particles.json
|
||||
"${mainURL}particles.json",
|
||||
// potion_effects.json
|
||||
"${mainURL}potion_effects.json",
|
||||
// potions.json
|
||||
"${mainURL}potions.json",
|
||||
// sounds.json
|
||||
"${mainURL}sounds.json",
|
||||
// villager_professions.json
|
||||
"${mainURL}villager_professions.json",
|
||||
// villager_types.json
|
||||
"${mainURL}villager_types.json"
|
||||
])
|
||||
dest dataDest
|
||||
overwrite true
|
||||
dependsOn("downloadLootTables")
|
||||
dependsOn("downloadTags")
|
||||
}
|
||||
|
||||
task downloadTags(type: Download) {
|
||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_tags/${mcVersionUnderscored}_"
|
||||
src([
|
||||
// block_tags.json
|
||||
"${mainURL}block_tags.json",
|
||||
// entity_type_tags.json
|
||||
"${mainURL}entity_type_tags.json",
|
||||
// fluid_tags.json
|
||||
"${mainURL}fluid_tags.json",
|
||||
// item_tags.json
|
||||
"${mainURL}item_tags.json",
|
||||
])
|
||||
dest dataDestTags
|
||||
overwrite true
|
||||
}
|
||||
|
||||
task downloadLootTables(type: Download) {
|
||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_loot_tables/${mcVersionUnderscored}_"
|
||||
src([
|
||||
// block_loot_tables.json.json
|
||||
"${mainURL}block_loot_tables.json",
|
||||
// chest_loot_tables.json
|
||||
"${mainURL}chest_loot_tables.json",
|
||||
// entity_loot_tables.json
|
||||
"${mainURL}entity_loot_tables.json",
|
||||
// gameplay_loot_tables.json
|
||||
"${mainURL}gameplay_loot_tables.json",
|
||||
])
|
||||
dest dataDestLootTable
|
||||
overwrite true
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
// Used to download our data
|
||||
}
|
||||
|
||||
group 'net.minestom.server'
|
||||
version '1.0'
|
||||
|
||||
sourceCompatibility = 1.11
|
||||
|
||||
application {
|
||||
mainClass.set("net.minestom.codegen.Generators")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'org.jetbrains:annotations:20.1.0'
|
||||
implementation 'com.squareup:javapoet:1.13.0'
|
||||
// Logging
|
||||
implementation 'org.apache.logging.log4j:log4j-core:2.14.0'
|
||||
// SLF4J is the base logger for most libraries, therefore we can hook it into log4j2.
|
||||
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.0'
|
||||
// Kotlin stuff
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.kotlinVersion}"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:${project.kotlinVersion}"
|
||||
}
|
||||
|
||||
|
||||
run {
|
||||
// Update version
|
||||
setArgs(
|
||||
[
|
||||
// Point to gradle.properties "mcVersion"
|
||||
project.rootProject.properties["mcVersion"],
|
||||
// Points to src/main/resources/minecraft_data
|
||||
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}main${File.separatorChar}resources${File.separatorChar}minecraft_data",
|
||||
// Points to src/autogenerated/java
|
||||
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}autogenerated${File.separatorChar}java"
|
||||
]
|
||||
)
|
||||
dependsOn(project.rootProject.tasks.getByName("downloadResources"))
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package net.minestom.codegen;
|
||||
|
||||
import net.minestom.codegen.blocks.BlockGenerator;
|
||||
import net.minestom.codegen.entity.EntityTypeGenerator;
|
||||
import net.minestom.codegen.fluid.FluidGenerator;
|
||||
import net.minestom.codegen.item.EnchantmentGenerator;
|
||||
import net.minestom.codegen.item.MaterialGenerator;
|
||||
import net.minestom.codegen.particle.ParticleGenerator;
|
||||
import net.minestom.codegen.potion.PotionEffectGenerator;
|
||||
import net.minestom.codegen.potion.PotionTypeGenerator;
|
||||
import net.minestom.codegen.sound.SoundEventGenerator;
|
||||
import net.minestom.codegen.statistics.StatisticGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Generators {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Generators.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 3) {
|
||||
LOGGER.error("Usage: <MC version> <source folder> <target folder>");
|
||||
return;
|
||||
}
|
||||
String targetVersion = args[0];
|
||||
File inputFolder = new File(args[1]);
|
||||
File outputFolder = new File(args[2]);
|
||||
// Generate blocks
|
||||
new BlockGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_blocks.json"),
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_block_properties.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate fluids
|
||||
new FluidGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_fluids.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate entities
|
||||
new EntityTypeGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_entities.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate items
|
||||
new MaterialGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_items.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate enchantments
|
||||
new EnchantmentGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_enchantments.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// TODO: Generate attributes
|
||||
// new AttributeGenerator(
|
||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_attributes.json"),
|
||||
// outputFolder
|
||||
// ).generate();
|
||||
// Generate potion effects
|
||||
new PotionEffectGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_potion_effects.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate potions
|
||||
new PotionTypeGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_potions.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate particles
|
||||
new ParticleGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_particles.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// Generate sounds
|
||||
new SoundEventGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_sounds.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
// TODO: Generate villager professions
|
||||
// new VillagerProfessionGenerator(
|
||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_villager_professions.json"),
|
||||
// outputFolder
|
||||
// ).generate();
|
||||
// TODO: Generate villager types
|
||||
// new VillagerTypeGenerator(
|
||||
// new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_villager_types.json"),
|
||||
// outputFolder
|
||||
// ).generate();
|
||||
// Generate statistics
|
||||
new StatisticGenerator(
|
||||
new File(inputFolder, targetVersion.replaceAll("\\.", "_") + "_custom_statistics.json"),
|
||||
outputFolder
|
||||
).generate();
|
||||
LOGGER.info("Finished generating code");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.minestom.codegen;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MinestomCodeGenerator.class);
|
||||
protected static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
|
||||
|
||||
public abstract void generate();
|
||||
|
||||
protected void writeFiles(@NotNull List<JavaFile> fileList, File outputFolder) {
|
||||
for (JavaFile javaFile : fileList) {
|
||||
try {
|
||||
javaFile.writeTo(outputFolder);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("An error occured while writing source code to the file system.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
package net.minestom.codegen.attribute;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class AttributeGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AttributeGenerator.class);
|
||||
private final File attributesFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public AttributeGenerator(@NotNull File attributesFile, @NotNull File outputFolder) {
|
||||
this.attributesFile = attributesFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!attributesFile.exists()) {
|
||||
LOGGER.error("Failed to find attributes.json.");
|
||||
LOGGER.error("Stopped code generation for attributes.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registryClassName = ClassName.get("net.minestom.server.registry", "Registry");
|
||||
|
||||
JsonArray attributes;
|
||||
try {
|
||||
attributes = GSON.fromJson(new JsonReader(new FileReader(attributesFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find attributes.json.");
|
||||
LOGGER.error("Stopped code generation for attributes.");
|
||||
return;
|
||||
}
|
||||
List<JavaFile> filesToWrite = new ArrayList<>();
|
||||
|
||||
ClassName attributeClassName = ClassName.get("net.minestom.server.attribute", "Attribute");
|
||||
|
||||
// Attribute
|
||||
TypeSpec.Builder attributeClass = TypeSpec.classBuilder(attributeClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
attributeClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
attributeClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "defaultValue")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
attributeClass.addField(
|
||||
FieldSpec.builder(TypeName.BOOLEAN, "clientSyncable")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.BOOLEAN, "clientSyncable").build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "defaultValue").build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("this.clientSyncable = clientSyncable")
|
||||
.addStatement("this.defaultValue = defaultValue")
|
||||
.addModifiers(Modifier.PROTECTED)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getDefaultValue
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getDefaultValue")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.defaultValue")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isClientSyncable
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("isClientSyncable")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return this.clientSyncable")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isShared
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("isShared")
|
||||
.addAnnotation(Deprecated.class)
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return this.clientSyncable")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// values method
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("values")
|
||||
.addAnnotation(NotNull.class)
|
||||
.returns(ParameterizedTypeName.get(ClassName.get(List.class), attributeClassName))
|
||||
.addStatement("return $T.ATTRIBUTE_REGISTRY.values()", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
attributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// Creating ClampedAttribute
|
||||
ClassName clampedAttributeClassName = ClassName.get("net.minestom.server.attribute", "ClampedAttribute");
|
||||
|
||||
TypeSpec.Builder clampedAttributeClass = TypeSpec.classBuilder(clampedAttributeClassName)
|
||||
.superclass(attributeClassName)
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
clampedAttributeClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "minValue")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
clampedAttributeClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "maxValue")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
clampedAttributeClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.BOOLEAN, "clientSyncable").build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "defaultValue").build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "minValue").build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "maxValue").build())
|
||||
.addStatement("super(id, clientSyncable, defaultValue)")
|
||||
.addStatement("this.minValue = minValue")
|
||||
.addStatement("this.maxValue = maxValue")
|
||||
.addModifiers(Modifier.PROTECTED)
|
||||
.build()
|
||||
);
|
||||
// getMinValue
|
||||
clampedAttributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getMinValue")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.minValue")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getMaxValue
|
||||
clampedAttributeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getMaxValue")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.maxValue")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
CodeBlock.Builder staticBlock = CodeBlock.builder();
|
||||
// Use data
|
||||
for (JsonElement a : attributes) {
|
||||
JsonObject attribute = a.getAsJsonObject();
|
||||
String attributeName = attribute.get("name").getAsString();
|
||||
|
||||
JsonObject range = attribute.getAsJsonObject("range");
|
||||
if (range == null) {
|
||||
// Normal attribute
|
||||
attributeClass.addField(
|
||||
FieldSpec.builder(
|
||||
attributeClassName,
|
||||
attributeName
|
||||
).initializer(
|
||||
"new $T($T.from($S), $L, $L)",
|
||||
attributeClassName,
|
||||
namespaceIDClassName,
|
||||
attribute.get("id").getAsString(),
|
||||
attribute.get("clientSync").getAsBoolean(),
|
||||
attribute.get("defaultValue").getAsDouble()
|
||||
).addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).build()
|
||||
);
|
||||
} else {
|
||||
// ClampedAttribute
|
||||
attributeClass.addField(
|
||||
FieldSpec.builder(
|
||||
attributeClassName,
|
||||
attributeName
|
||||
).initializer(
|
||||
"new $T($T.from($S), $L, $L, $L, $L)",
|
||||
clampedAttributeClassName,
|
||||
namespaceIDClassName,
|
||||
attribute.get("id").getAsString(),
|
||||
attribute.get("clientSync").getAsBoolean(),
|
||||
attribute.get("defaultValue").getAsDouble(),
|
||||
range.get("minValue").getAsDouble(),
|
||||
range.get("maxValue").getAsDouble()
|
||||
).addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).build()
|
||||
);
|
||||
}
|
||||
// Add to static init.
|
||||
staticBlock.addStatement("$T.ATTRIBUTE_REGISTRY.register($N)", registryClassName, attributeName);
|
||||
}
|
||||
attributeClass.addStaticBlock(staticBlock.build());
|
||||
|
||||
filesToWrite.add(
|
||||
JavaFile.builder("net.minestom.server.attribute", attributeClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
);
|
||||
filesToWrite.add(
|
||||
JavaFile.builder("net.minestom.server.attribute", clampedAttributeClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
filesToWrite,
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,391 @@
|
|||
package net.minestom.codegen.blocks;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import net.minestom.codegen.util.NameUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class BlockGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BlockGenerator.class);
|
||||
private final File blocksFile;
|
||||
private final File blockPropertyFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public BlockGenerator(@NotNull File blocksFile, @NotNull File blockPropertyFile, @NotNull File outputFolder) {
|
||||
this.blocksFile = blocksFile;
|
||||
this.blockPropertyFile = blockPropertyFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!blocksFile.exists()) {
|
||||
LOGGER.error("Failed to find blocks.json.");
|
||||
LOGGER.error("Stopped code generation for blocks.");
|
||||
return;
|
||||
}
|
||||
if (!blockPropertyFile.exists()) {
|
||||
LOGGER.error("Failed to find block_properties.json.");
|
||||
LOGGER.error("Stopped code generation for block properties.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray blocks;
|
||||
try {
|
||||
blocks = GSON.fromJson(new JsonReader(new FileReader(blocksFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find blocks.json.");
|
||||
LOGGER.error("Stopped code generation for blocks.");
|
||||
return;
|
||||
}
|
||||
ClassName blockClassName = ClassName.get("net.minestom.server.instance.block", "Block");
|
||||
ClassName blockAltClassName = ClassName.get("net.minestom.server.instance.block", "BlockAlternative");
|
||||
List<JavaFile> filesToWrite = new ArrayList<>();
|
||||
|
||||
// Block
|
||||
TypeSpec.Builder blockClass = TypeSpec.enumBuilder(blockClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.SHORT, "defaultID")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "hardness")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "resistance")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.BOOLEAN, "isAir")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.BOOLEAN, "isSolid")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(TypeName.BOOLEAN, "blockEntity")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
blockClass.addField(
|
||||
FieldSpec.builder(ParameterizedTypeName.get(ClassName.get("java.util", "List"), blockAltClassName), "alternatives")
|
||||
.initializer("new $T<>()", ClassName.get("java.util", "ArrayList"))
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
);
|
||||
// Block constructor
|
||||
blockClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(TypeName.SHORT, "defaultID")
|
||||
.addParameter(TypeName.DOUBLE, "hardness")
|
||||
.addParameter(TypeName.DOUBLE, "resistance")
|
||||
.addParameter(TypeName.BOOLEAN, "isAir")
|
||||
.addParameter(TypeName.BOOLEAN, "isSolid")
|
||||
.addParameter(TypeName.BOOLEAN, "blockEntity")
|
||||
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("this.defaultID = defaultID")
|
||||
.addStatement("this.hardness = hardness")
|
||||
.addStatement("this.resistance = resistance")
|
||||
.addStatement("this.isAir = isAir")
|
||||
.addStatement("this.isSolid = isSolid")
|
||||
.addStatement("this.blockEntity = blockEntity")
|
||||
.addStatement("$T.blocks.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// addBlockState method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("addBlockAlternative")
|
||||
.addParameter(ParameterSpec.builder(blockAltClassName, "alternative").addAnnotation(NotNull.class).build())
|
||||
|
||||
.addStatement("this.alternatives.add(alternative)")
|
||||
.addStatement("BlockArray.blocks[alternative.getId()] = this")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getBlockId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return defaultID")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getName method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getName")
|
||||
.addAnnotation(NotNull.class)
|
||||
.returns(ClassName.get(String.class))
|
||||
.addStatement("return this.id.asString()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getHardness method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getHardness")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.hardness")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getResistance method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getResistance")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.resistance")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// breakInstantaneously method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("breaksInstantaneously")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return this.hardness == 0")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getBlockStates method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getAlternatives")
|
||||
.returns(ParameterizedTypeName.get(ClassName.get(List.class), blockAltClassName))
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.alternatives")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL) // Should this be final, for now I guess so.
|
||||
.build()
|
||||
);
|
||||
// isAir method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("isAir")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
// UPDATE: Make sure they didn't add new AIR types.
|
||||
.addStatement("return isAir")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isLiquid method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("isLiquid")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
// UPDATE: Make sure they didn't add new liquids.
|
||||
.addStatement("return this == WATER || this == LAVA")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isSolid method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("isSolid")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
// UPDATE: Make sure they didn't add new liquids.
|
||||
.addStatement("return isSolid")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// hasBlockEntity method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("hasBlockEntity")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return blockEntity")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getAlternative method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("getAlternative")
|
||||
.returns(blockAltClassName)
|
||||
.addParameter(TypeName.SHORT, "blockId")
|
||||
.addAnnotation(Nullable.class)
|
||||
.beginControlFlow("for ($T alt : alternatives) ", blockAltClassName)
|
||||
.beginControlFlow("if (alt.getId() == blockId)")
|
||||
.addStatement("return alt")
|
||||
.endControlFlow()
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// withProperties method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("withProperties")
|
||||
.returns(TypeName.SHORT)
|
||||
.addParameter(
|
||||
ParameterSpec.builder(ArrayTypeName.of(String.class), "properties").addAnnotation(NotNull.class).build()
|
||||
).varargs()
|
||||
.beginControlFlow("for ($T alt : alternatives)", blockAltClassName)
|
||||
.beginControlFlow("if ($T.equals(alt.getProperties(), properties))", Arrays.class)
|
||||
.addStatement("return alt.getId()")
|
||||
.endControlFlow()
|
||||
.endControlFlow()
|
||||
.addStatement("return this.defaultID")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromStateId method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromStateId")
|
||||
.returns(blockClassName)
|
||||
.addParameter(TypeName.SHORT, "blockStateId")
|
||||
.addStatement("return BlockArray.blocks[blockStateId]")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
blockClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// Staticblock in Block enum
|
||||
CodeBlock.Builder staticBlock = CodeBlock.builder();
|
||||
// Use data
|
||||
for (JsonElement b : blocks) {
|
||||
JsonObject block = b.getAsJsonObject();
|
||||
|
||||
String blockName = block.get("name").getAsString();
|
||||
JsonArray states = block.get("states").getAsJsonArray();
|
||||
// Enum constant in Block
|
||||
blockClass.addEnumConstant(blockName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S), (short) $L, $L, $L, $L, $L, $L",
|
||||
namespaceIDClassName,
|
||||
block.get("id").getAsString(),
|
||||
block.get("defaultBlockState").getAsShort(),
|
||||
states.get(0).getAsJsonObject().get("destroySpeed").getAsDouble(),
|
||||
block.get("explosionResistance").getAsDouble(),
|
||||
states.get(0).getAsJsonObject().get("isAir").getAsBoolean(),
|
||||
states.get(0).getAsJsonObject().get("isSolid").getAsBoolean(),
|
||||
block.get("blockEntity").getAsBoolean()
|
||||
).build()
|
||||
);
|
||||
ClassName blockStateSpecificClassName = ClassName.get(
|
||||
"net.minestom.server.instance.block.states",
|
||||
NameUtil.convertSnakeCaseToCamelCase(blockName.toLowerCase())
|
||||
);
|
||||
|
||||
// Common blockStateSpecificClass structure
|
||||
TypeSpec.Builder blockStateSpecificClass = TypeSpec.classBuilder(blockStateSpecificClassName)
|
||||
.addAnnotation(
|
||||
AnnotationSpec.builder(Deprecated.class)
|
||||
.addMember("since", "$S", "forever")
|
||||
.addMember("forRemoval", "$L", false).build()
|
||||
)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
// initStates method
|
||||
MethodSpec.Builder initStatesMethod = MethodSpec.methodBuilder("initStates")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||
|
||||
// init States methods in block specific classes
|
||||
for (JsonElement s : states) {
|
||||
JsonObject state = s.getAsJsonObject();
|
||||
|
||||
// block state properties
|
||||
JsonObject properties = state.get("properties").getAsJsonObject();
|
||||
if (properties.size() != 0) {
|
||||
StringBuilder propertiesStr = new StringBuilder();
|
||||
// has properties
|
||||
for (Map.Entry<String, JsonElement> entry : properties.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue().getAsString();
|
||||
propertiesStr.append('"').append(key).append('=').append(value).append("\",");
|
||||
}
|
||||
// Delete last comma
|
||||
propertiesStr.deleteCharAt(propertiesStr.length() - 1);
|
||||
|
||||
initStatesMethod.addStatement(
|
||||
"$T.$N.addBlockAlternative(new $T((short) $L, **REPLACE**))".replace("**REPLACE**", propertiesStr.toString()),
|
||||
blockClassName,
|
||||
blockName,
|
||||
blockAltClassName,
|
||||
state.get("id").getAsShort()
|
||||
);
|
||||
} else {
|
||||
// has no properties
|
||||
initStatesMethod.addStatement(
|
||||
"$T.$N.addBlockAlternative(new $T((short) $L))",
|
||||
blockClassName,
|
||||
blockName,
|
||||
blockAltClassName,
|
||||
state.get("id").getAsShort()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add initStates method
|
||||
blockStateSpecificClass.addMethod(initStatesMethod.build());
|
||||
|
||||
// Add initStates method refence to static block
|
||||
staticBlock.addStatement("$T.initStates()", blockStateSpecificClassName);
|
||||
|
||||
// Add BlockStates to list of files we need to write:
|
||||
filesToWrite.add(JavaFile.builder("net.minestom.server.instance.block.states", blockStateSpecificClass.build()).indent(" ").build());
|
||||
}
|
||||
blockClass.addStaticBlock(staticBlock.build());
|
||||
// Add ignore deprecations annotation
|
||||
blockClass.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "$S", "deprecation").build());
|
||||
|
||||
|
||||
// Add Block & BlockState to list of files we need to write:
|
||||
filesToWrite.add(
|
||||
JavaFile.builder("net.minestom.server.instance.block", blockClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(filesToWrite, outputFolder);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,438 @@
|
|||
package net.minestom.codegen.entity;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import net.minestom.codegen.util.NameUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public final class EntityTypeGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EntityTypeGenerator.class);
|
||||
private static final Map<String, String> metadata = new HashMap<>() {{
|
||||
// Class's name (without the Meta suffix) <--> Package
|
||||
// UPDATE: Handle new entity metadata
|
||||
// Ambient
|
||||
// put("AmbientCreature", "net.minestom.server.entity.metadata.ambient");
|
||||
put("Bat", "net.minestom.server.entity.metadata.ambient");
|
||||
// Animal
|
||||
// put("Animal", "net.minestom.server.entity.metadata.animal");
|
||||
put("AbstractHorse", "net.minestom.server.entity.metadata.animal");
|
||||
put("Bee", "net.minestom.server.entity.metadata.animal");
|
||||
put("ChestedHorse", "net.minestom.server.entity.metadata.animal");
|
||||
put("Chicken", "net.minestom.server.entity.metadata.animal");
|
||||
put("Cow", "net.minestom.server.entity.metadata.animal");
|
||||
put("Donkey", "net.minestom.server.entity.metadata.animal");
|
||||
put("Fox", "net.minestom.server.entity.metadata.animal");
|
||||
put("Hoglin", "net.minestom.server.entity.metadata.animal");
|
||||
put("Horse", "net.minestom.server.entity.metadata.animal");
|
||||
put("Llama", "net.minestom.server.entity.metadata.animal");
|
||||
put("Mooshroom", "net.minestom.server.entity.metadata.animal");
|
||||
put("Mule", "net.minestom.server.entity.metadata.animal");
|
||||
put("Ocelot", "net.minestom.server.entity.metadata.animal");
|
||||
put("Panda", "net.minestom.server.entity.metadata.animal");
|
||||
put("Pig", "net.minestom.server.entity.metadata.animal");
|
||||
put("PolarBear", "net.minestom.server.entity.metadata.animal");
|
||||
put("Rabbit", "net.minestom.server.entity.metadata.animal");
|
||||
put("Sheep", "net.minestom.server.entity.metadata.animal");
|
||||
put("SkeletonHorse", "net.minestom.server.entity.metadata.animal");
|
||||
put("Strider", "net.minestom.server.entity.metadata.animal");
|
||||
put("Turtle", "net.minestom.server.entity.metadata.animal");
|
||||
put("ZombieHorse", "net.minestom.server.entity.metadata.animal");
|
||||
// Animal - Tameable
|
||||
// put("TameableAnimal", "net.minestom.server.entity.metadata.animal.tameable");
|
||||
put("Cat", "net.minestom.server.entity.metadata.animal.tameable");
|
||||
put("Parrot", "net.minestom.server.entity.metadata.animal.tameable");
|
||||
put("Wolf", "net.minestom.server.entity.metadata.animal.tameable");
|
||||
// Arrow
|
||||
// put("AbstractArrow", "net.minestom.server.entity.metadata.arrow");
|
||||
put("Arrow", "net.minestom.server.entity.metadata.arrow");
|
||||
put("SpectralArrow", "net.minestom.server.entity.metadata.arrow");
|
||||
put("ThrownTrident", "net.minestom.server.entity.metadata.arrow");
|
||||
// Flying
|
||||
// put("Flying", "net.minestom.server.entity.metadata.flying");
|
||||
put("Ghast", "net.minestom.server.entity.metadata.flying");
|
||||
put("Phantom", "net.minestom.server.entity.metadata.flying");
|
||||
// Golem
|
||||
// put("AbstractGolem", "net.minestom.server.entity.metadata.golem");
|
||||
put("IronGolem", "net.minestom.server.entity.metadata.golem");
|
||||
put("Shulker", "net.minestom.server.entity.metadata.golem");
|
||||
put("SnowGolem", "net.minestom.server.entity.metadata.golem");
|
||||
// Item
|
||||
put("EyeOfEnder", "net.minestom.server.entity.metadata.item");
|
||||
put("Fireball", "net.minestom.server.entity.metadata.item");
|
||||
put("ItemContaining", "net.minestom.server.entity.metadata.item");
|
||||
put("ItemEntity", "net.minestom.server.entity.metadata.item");
|
||||
put("SmallFireball", "net.minestom.server.entity.metadata.item");
|
||||
put("Snowball", "net.minestom.server.entity.metadata.item");
|
||||
put("ThrownEgg", "net.minestom.server.entity.metadata.item");
|
||||
put("ThrownEnderPearl", "net.minestom.server.entity.metadata.item");
|
||||
put("ThrownExperienceBottle", "net.minestom.server.entity.metadata.item");
|
||||
put("ThrownPotion", "net.minestom.server.entity.metadata.item");
|
||||
// Minecart
|
||||
// put("AbstractMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
// put("AbstractMinecartContainer", "net.minestom.server.entity.metadata.minecart");
|
||||
put("ChestMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("CommandBlockMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("FurnaceMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("HopperMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("Minecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("SpawnerMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
put("TntMinecart", "net.minestom.server.entity.metadata.minecart");
|
||||
// Monster
|
||||
// put("Monster", "net.minestom.server.entity.metadata.monster");
|
||||
// put("BasePiglin", "net.minestom.server.entity.metadata.monster");
|
||||
put("Blaze", "net.minestom.server.entity.metadata.monster");
|
||||
put("CaveSpider", "net.minestom.server.entity.metadata.monster");
|
||||
put("Creeper", "net.minestom.server.entity.metadata.monster");
|
||||
put("ElderGuardian", "net.minestom.server.entity.metadata.monster");
|
||||
put("Enderman", "net.minestom.server.entity.metadata.monster");
|
||||
put("Endermite", "net.minestom.server.entity.metadata.monster");
|
||||
put("Giant", "net.minestom.server.entity.metadata.monster");
|
||||
put("Guardian", "net.minestom.server.entity.metadata.monster");
|
||||
put("PiglinBrute", "net.minestom.server.entity.metadata.monster");
|
||||
put("Piglin", "net.minestom.server.entity.metadata.monster");
|
||||
put("Silverfish", "net.minestom.server.entity.metadata.monster");
|
||||
put("Spider", "net.minestom.server.entity.metadata.monster");
|
||||
put("Vex", "net.minestom.server.entity.metadata.monster");
|
||||
put("Wither", "net.minestom.server.entity.metadata.monster");
|
||||
put("Zoglin", "net.minestom.server.entity.metadata.monster");
|
||||
// Monster - Raider
|
||||
// put("AbstractIllager", "net.minestom.server.entity.metadata.monster.raider")
|
||||
put("Evoker", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Illusioner", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Pillager", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Raider", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Ravager", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("SpellcasterIllager", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Vindicator", "net.minestom.server.entity.metadata.monster.raider");
|
||||
put("Witch", "net.minestom.server.entity.metadata.monster.raider");
|
||||
// Monster - Skeleton
|
||||
// put("AbstractSkeleton", "net.minestom.server.entity.metadata.monster.skeleton");
|
||||
put("Skeleton", "net.minestom.server.entity.metadata.monster.skeleton");
|
||||
put("Stray", "net.minestom.server.entity.metadata.monster.skeleton");
|
||||
put("WitherSkeleton", "net.minestom.server.entity.metadata.monster.skeleton");
|
||||
// Monster - Zombie
|
||||
put("Drowned", "net.minestom.server.entity.metadata.monster.zombie");
|
||||
put("Husk", "net.minestom.server.entity.metadata.monster.zombie");
|
||||
put("Zombie", "net.minestom.server.entity.metadata.monster.zombie");
|
||||
put("ZombieVillager", "net.minestom.server.entity.metadata.monster.zombie");
|
||||
put("ZombifiedPiglin", "net.minestom.server.entity.metadata.monster.zombie");
|
||||
// Other
|
||||
put("AreaEffectCloud", "net.minestom.server.entity.metadata.other");
|
||||
put("ArmorStand", "net.minestom.server.entity.metadata.other");
|
||||
put("Boat", "net.minestom.server.entity.metadata.other");
|
||||
put("DragonFireball", "net.minestom.server.entity.metadata.other");
|
||||
put("EndCrystal", "net.minestom.server.entity.metadata.other");
|
||||
put("EnderDragon", "net.minestom.server.entity.metadata.other");
|
||||
put("EvokerFangs", "net.minestom.server.entity.metadata.other");
|
||||
put("ExperienceOrb", "net.minestom.server.entity.metadata.other");
|
||||
put("FallingBlock", "net.minestom.server.entity.metadata.other");
|
||||
put("FireworkRocket", "net.minestom.server.entity.metadata.other");
|
||||
put("FishingHook", "net.minestom.server.entity.metadata.other");
|
||||
put("ItemFrame", "net.minestom.server.entity.metadata.other");
|
||||
put("LeashKnot", "net.minestom.server.entity.metadata.other");
|
||||
put("LightningBolt", "net.minestom.server.entity.metadata.other");
|
||||
put("LlamaSpit", "net.minestom.server.entity.metadata.other");
|
||||
put("MagmaCube", "net.minestom.server.entity.metadata.other");
|
||||
put("Painting", "net.minestom.server.entity.metadata.other");
|
||||
put("PrimedTnt", "net.minestom.server.entity.metadata.other");
|
||||
put("ShulkerBullet", "net.minestom.server.entity.metadata.other");
|
||||
put("Slime", "net.minestom.server.entity.metadata.other");
|
||||
put("TraderLlama", "net.minestom.server.entity.metadata.other");
|
||||
put("WitherSkull", "net.minestom.server.entity.metadata.other");
|
||||
// Villager
|
||||
// put("AbstractVillager", "net.minestom.server.entity.metadata.villager");
|
||||
put("Villager", "net.minestom.server.entity.metadata.villager");
|
||||
put("WanderingTrader", "net.minestom.server.entity.metadata.villager");
|
||||
// Water
|
||||
// put("WaterAnimalMeta", "net.minestom.server.entity.metadata.water")
|
||||
put("Squid", "net.minestom.server.entity.metadata.water");
|
||||
put("Dolphin", "net.minestom.server.entity.metadata.water");
|
||||
// Water - Fish
|
||||
// put("AbstractFish", "net.minestom.server.entity.metadata.water.fish");
|
||||
put("Cod", "net.minestom.server.entity.metadata.water.fish");
|
||||
put("Pufferfish", "net.minestom.server.entity.metadata.water.fish");
|
||||
put("Salmon", "net.minestom.server.entity.metadata.water.fish");
|
||||
put("TropicalFish", "net.minestom.server.entity.metadata.water.fish");
|
||||
// Player
|
||||
put("Player", "net.minestom.server.entity.metadata");
|
||||
|
||||
}};
|
||||
private final File entitiesFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public EntityTypeGenerator(@NotNull File entitiesFile, @NotNull File outputFolder) {
|
||||
this.entitiesFile = entitiesFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!entitiesFile.exists()) {
|
||||
LOGGER.error("Failed to find entities.json.");
|
||||
LOGGER.error("Stopped code generation for entities.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray entities;
|
||||
try {
|
||||
entities = GSON.fromJson(new JsonReader(new FileReader(entitiesFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find entities.json.");
|
||||
LOGGER.error("Stopped code generation for entities.");
|
||||
return;
|
||||
}
|
||||
ClassName entityClassName = ClassName.get("net.minestom.server.entity", "EntityType");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder entityClass = TypeSpec.enumBuilder(entityClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "width")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(TypeName.DOUBLE, "height")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(
|
||||
ParameterizedTypeName.get(
|
||||
ClassName.get(BiFunction.class),
|
||||
ClassName.get("net.minestom.server.entity", "Entity"),
|
||||
ClassName.get("net.minestom.server.entity", "Metadata"),
|
||||
ClassName.get("net.minestom.server.entity.metadata", "EntityMeta")
|
||||
),
|
||||
"metaConstructor"
|
||||
)
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
);
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(
|
||||
ClassName.get("net.minestom.server.entity", "EntitySpawnType"),
|
||||
"spawnType"
|
||||
)
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
);
|
||||
// static field
|
||||
entityClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(entityClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
entityClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "width").build())
|
||||
.addParameter(ParameterSpec.builder(TypeName.DOUBLE, "height").build())
|
||||
.addParameter(
|
||||
ParameterSpec.builder(
|
||||
ParameterizedTypeName.get(
|
||||
ClassName.get(BiFunction.class),
|
||||
ClassName.get("net.minestom.server.entity", "Entity"),
|
||||
ClassName.get("net.minestom.server.entity", "Metadata"),
|
||||
ClassName.get("net.minestom.server.entity.metadata", "EntityMeta")
|
||||
),
|
||||
"metaConstructor"
|
||||
)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
)
|
||||
.addParameter(
|
||||
ParameterSpec.builder(
|
||||
ClassName.get("net.minestom.server.entity", "EntitySpawnType"),
|
||||
"spawnType"
|
||||
)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
)
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("this.width = width")
|
||||
.addStatement("this.height = height")
|
||||
.addStatement("this.metaConstructor = metaConstructor")
|
||||
.addStatement("this.spawnType = spawnType")
|
||||
.addStatement("$T.entityTypes.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getWidth method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getWidth")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.width")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getHeight method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getHeight")
|
||||
.returns(TypeName.DOUBLE)
|
||||
.addStatement("return this.height")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getMetaConstructor method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getMetaConstructor")
|
||||
.returns(
|
||||
ParameterizedTypeName.get(
|
||||
ClassName.get(BiFunction.class),
|
||||
ClassName.get("net.minestom.server.entity", "Entity"),
|
||||
ClassName.get("net.minestom.server.entity", "Metadata"),
|
||||
ClassName.get("net.minestom.server.entity.metadata", "EntityMeta")
|
||||
)
|
||||
)
|
||||
.addStatement("return this.metaConstructor")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getSpawnType method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("getSpawnType")
|
||||
.returns(ClassName.get("net.minestom.server.entity", "EntitySpawnType"))
|
||||
.addStatement("return this.spawnType")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(entityClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
entityClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// Use data
|
||||
for (JsonElement e : entities) {
|
||||
JsonObject entity = e.getAsJsonObject();
|
||||
|
||||
String entityName = entity.get("name").getAsString();
|
||||
|
||||
// Get metaClass (this is a little complicated)
|
||||
String metaClassName = NameUtil.convertSnakeCaseToCamelCase(entityName.toLowerCase());
|
||||
switch (metaClassName) {
|
||||
// These are cases where the entity name doesn't fully match up to the meta name.
|
||||
// UPDATE: Handle new entity names that don't match up to their meta name.
|
||||
case "Item":
|
||||
metaClassName = "ItemEntity";
|
||||
break;
|
||||
case "Tnt":
|
||||
metaClassName = "PrimedTnt";
|
||||
break;
|
||||
case "FishingBobber":
|
||||
metaClassName = "FishingHook";
|
||||
break;
|
||||
case "Egg":
|
||||
case "EnderPearl":
|
||||
case "ExperienceBottle":
|
||||
case "Potion":
|
||||
case "Trident":
|
||||
metaClassName = "Thrown" + metaClassName;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
entityClass.addEnumConstant(
|
||||
entityName,
|
||||
TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S), $L, $L, $T::new, $T.$N",
|
||||
namespaceIDClassName,
|
||||
entity.get("id").getAsString(),
|
||||
entity.get("width").getAsDouble(),
|
||||
entity.get("height").getAsDouble(),
|
||||
ClassName.get(metadata.get(metaClassName), metaClassName + "Meta"),
|
||||
ClassName.get("net.minestom.server.entity", "EntitySpawnType"),
|
||||
entity.get("packetType").getAsString().toUpperCase()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.entity", entityClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
package net.minestom.codegen.entity;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class VillagerProfessionGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(VillagerProfessionGenerator.class);
|
||||
private final File villagerProfessionsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
|
||||
public VillagerProfessionGenerator(@NotNull File villagerProfessionsFile, @NotNull File outputFolder) {
|
||||
this.villagerProfessionsFile = villagerProfessionsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!villagerProfessionsFile.exists()) {
|
||||
LOGGER.error("Failed to find villager_professions.json.");
|
||||
LOGGER.error("Stopped code generation for villager professions.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName rawVillagerProfessionDataClassName = ClassName.get("net.minestom.server.raw_data", "RawVillagerProfessionData");
|
||||
ClassName registryClassName = ClassName.get("net.minestom.server.registry", "Registry");
|
||||
|
||||
JsonArray villagerProfessions;
|
||||
try {
|
||||
villagerProfessions = GSON.fromJson(new JsonReader(new FileReader(villagerProfessionsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find villager_professions.json.");
|
||||
LOGGER.error("Stopped code generation for villager professions.");
|
||||
return;
|
||||
}
|
||||
ClassName villagerProfessionClassName = ClassName.get("net.minestom.server.entity.metadata.villager", "VillagerProfession");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder villagerProfessionClass = TypeSpec.classBuilder(villagerProfessionClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
villagerProfessionClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
villagerProfessionClass.addField(
|
||||
FieldSpec.builder(rawVillagerProfessionDataClassName, "villagerProfessionData")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.VOLATILE)
|
||||
.addAnnotation(NotNull.class)
|
||||
.build()
|
||||
);
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(ParameterSpec.builder(rawVillagerProfessionDataClassName, "villagerProfessionData").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("this.villagerProfessionData = villagerProfessionData")
|
||||
.addModifiers(Modifier.PROTECTED)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getVillagerProfessionData method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("getVillagerProfessionData")
|
||||
.returns(rawVillagerProfessionDataClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.villagerProfessionData")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
|
||||
.build()
|
||||
);
|
||||
// setVillagerProfessionData method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("setVillagerProfessionData")
|
||||
.addParameter(ParameterSpec.builder(rawVillagerProfessionDataClassName, "villagerProfessionData").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.villagerProfessionData = villagerProfessionData")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
|
||||
.build()
|
||||
);
|
||||
// getNumericalId
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNumericalId")
|
||||
.returns(TypeName.INT)
|
||||
.addStatement("return $T.VILLAGER_PROFESSION_REGISTRY.getId(this)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(villagerProfessionClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.INT, "id")
|
||||
.addStatement("return $T.VILLAGER_PROFESSION_REGISTRY.get((short) id)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(villagerProfessionClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addParameter(ClassName.get("net.kyori.adventure.key", "Key"), "id")
|
||||
.addStatement("return $T.VILLAGER_PROFESSION_REGISTRY.get(id)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// values method
|
||||
villagerProfessionClass.addMethod(
|
||||
MethodSpec.methodBuilder("values")
|
||||
.addAnnotation(NotNull.class)
|
||||
.returns(ParameterizedTypeName.get(ClassName.get(List.class), villagerProfessionClassName))
|
||||
.addStatement("return $T.VILLAGER_PROFESSION_REGISTRY.values()", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
CodeBlock.Builder staticBlock = CodeBlock.builder();
|
||||
// Use data
|
||||
for (JsonElement vp : villagerProfessions) {
|
||||
JsonObject villagerProfession = vp.getAsJsonObject();
|
||||
|
||||
String villagerProfessionName = villagerProfession.get("name").getAsString();
|
||||
JsonElement workSound = villagerProfession.get("workSound");
|
||||
if (workSound == null) {
|
||||
villagerProfessionClass.addField(
|
||||
FieldSpec.builder(
|
||||
villagerProfessionClassName,
|
||||
villagerProfessionName
|
||||
).initializer(
|
||||
"new $T($T.from($S), new $T(() -> null))",
|
||||
villagerProfessionClassName,
|
||||
namespaceIDClassName,
|
||||
villagerProfession.get("id").getAsString(),
|
||||
|
||||
rawVillagerProfessionDataClassName
|
||||
).addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).build()
|
||||
);
|
||||
} else {
|
||||
villagerProfessionClass.addField(
|
||||
FieldSpec.builder(
|
||||
villagerProfessionClassName,
|
||||
villagerProfessionName
|
||||
).initializer(
|
||||
"new $T($T.from($S), new $T(() -> $T.SOUND_EVENT_REGISTRY.get($S)))",
|
||||
villagerProfessionClassName,
|
||||
namespaceIDClassName,
|
||||
villagerProfession.get("id").getAsString(),
|
||||
|
||||
rawVillagerProfessionDataClassName,
|
||||
registryClassName,
|
||||
workSound.getAsString()
|
||||
).addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Add to static init.
|
||||
staticBlock.addStatement("$T.VILLAGER_PROFESSION_REGISTRY.register($N)", registryClassName, villagerProfessionName);
|
||||
}
|
||||
|
||||
villagerProfessionClass.addStaticBlock(staticBlock.build());
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.entity.metadata.villager", villagerProfessionClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
package net.minestom.codegen.entity;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class VillagerTypeGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(VillagerTypeGenerator.class);
|
||||
private final File villagerTypesFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public VillagerTypeGenerator(@NotNull File villagerTypesFile, @NotNull File outputFolder) {
|
||||
this.villagerTypesFile = villagerTypesFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!villagerTypesFile.exists()) {
|
||||
LOGGER.error("Failed to find villager_types.json.");
|
||||
LOGGER.error("Stopped code generation for villager types.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registryClassName = ClassName.get("net.minestom.server.registry", "Registry");
|
||||
|
||||
JsonArray villagerTypes;
|
||||
try {
|
||||
villagerTypes = GSON.fromJson(new JsonReader(new FileReader(villagerTypesFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find villager_types.json.");
|
||||
LOGGER.error("Stopped code generation for villager types.");
|
||||
return;
|
||||
}
|
||||
ClassName villagerTypeClassName = ClassName.get("net.minestom.server.entity.metadata.villager", "VillagerType");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder villagerTypeClass = TypeSpec.classBuilder(villagerTypeClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
villagerTypeClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addModifiers(Modifier.PROTECTED)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNumericalId
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNumericalId")
|
||||
.returns(TypeName.INT)
|
||||
.addStatement("return $T.VILLAGER_TYPE_REGISTRY.getId(this)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(villagerTypeClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.INT, "id")
|
||||
.addStatement("return $T.VILLAGER_TYPE_REGISTRY.get((short) id)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(villagerTypeClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addParameter(ClassName.get("net.kyori.adventure.key", "Key"), "id")
|
||||
.addStatement("return $T.VILLAGER_TYPE_REGISTRY.get(id)", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// values method
|
||||
villagerTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("values")
|
||||
.addAnnotation(NotNull.class)
|
||||
.returns(ParameterizedTypeName.get(ClassName.get(List.class), villagerTypeClassName))
|
||||
.addStatement("return $T.VILLAGER_TYPE_REGISTRY.values()", registryClassName)
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
CodeBlock.Builder staticBlock = CodeBlock.builder();
|
||||
// Use data
|
||||
for (JsonElement vp : villagerTypes) {
|
||||
JsonObject villagerProfession = vp.getAsJsonObject();
|
||||
|
||||
String villagerProfessionName = villagerProfession.get("name").getAsString();
|
||||
|
||||
villagerTypeClass.addField(
|
||||
FieldSpec.builder(
|
||||
villagerTypeClassName,
|
||||
villagerProfessionName
|
||||
).initializer(
|
||||
"new $T($T.from($S))",
|
||||
villagerTypeClassName,
|
||||
namespaceIDClassName,
|
||||
villagerProfession.get("id").getAsString()
|
||||
).addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).build()
|
||||
);
|
||||
// Add to static init.
|
||||
staticBlock.addStatement("$T.VILLAGER_TYPE_REGISTRY.register($N)", registryClassName, villagerProfessionName);
|
||||
}
|
||||
|
||||
villagerTypeClass.addStaticBlock(staticBlock.build());
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.entity.metadata.villager", villagerTypeClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
package net.minestom.codegen.fluid;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class FluidGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FluidGenerator.class);
|
||||
private final File fluidsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public FluidGenerator(@NotNull File fluidsFile, @NotNull File outputFolder) {
|
||||
this.fluidsFile = fluidsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!fluidsFile.exists()) {
|
||||
LOGGER.error("Failed to find fluids.json.");
|
||||
LOGGER.error("Stopped code generation for fluids.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray fluids;
|
||||
try {
|
||||
fluids = GSON.fromJson(new JsonReader(new FileReader(fluidsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find fluids.json.");
|
||||
LOGGER.error("Stopped code generation for fluids.");
|
||||
return;
|
||||
}
|
||||
ClassName fluidClassName = ClassName.get("net.minestom.server.fluid", "Fluid");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder fluidClass = TypeSpec.enumBuilder(fluidClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
fluidClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
fluidClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(fluidClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.fluids.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// fromId Method
|
||||
fluidClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(fluidClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement f : fluids) {
|
||||
JsonObject fluid = f.getAsJsonObject();
|
||||
|
||||
String fluidName = fluid.get("name").getAsString();
|
||||
|
||||
fluidClass.addEnumConstant(fluidName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
fluid.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.fluid", fluidClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package net.minestom.codegen.item;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class EnchantmentGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EnchantmentGenerator.class);
|
||||
private final File enchantmentsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public EnchantmentGenerator(@NotNull File enchantmentsFile, @NotNull File outputFolder) {
|
||||
this.enchantmentsFile = enchantmentsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!enchantmentsFile.exists()) {
|
||||
LOGGER.error("Failed to find enchantments.json.");
|
||||
LOGGER.error("Stopped code generation for enchantments.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray enchantments;
|
||||
try {
|
||||
enchantments = GSON.fromJson(new JsonReader(new FileReader(enchantmentsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find enchantments.json.");
|
||||
LOGGER.error("Stopped code generation for enchantments.");
|
||||
return;
|
||||
}
|
||||
ClassName enchantmentClassName = ClassName.get("net.minestom.server.item", "Enchantment");
|
||||
|
||||
// Enchantment
|
||||
TypeSpec.Builder enchantmentClass = TypeSpec.enumBuilder(enchantmentClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
enchantmentClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
enchantmentClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(enchantmentClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.enchantments.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(enchantmentClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
enchantmentClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement e : enchantments) {
|
||||
JsonObject enchantment = e.getAsJsonObject();
|
||||
|
||||
String enchantmentName = enchantment.get("name").getAsString();
|
||||
enchantmentClass.addEnumConstant(enchantmentName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
enchantment.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.item", enchantmentClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,351 @@
|
|||
package net.minestom.codegen.item;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class MaterialGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MaterialGenerator.class);
|
||||
private final File itemsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public MaterialGenerator(@NotNull File itemsFile, @NotNull File outputFolder) {
|
||||
this.itemsFile = itemsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!itemsFile.exists()) {
|
||||
LOGGER.error("Failed to find items.json.");
|
||||
LOGGER.error("Stopped code generation for items.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
ClassName blockCN = ClassName.get("net.minestom.server.instance.block", "Block");
|
||||
ParameterizedTypeName blocksCNSupplier = ParameterizedTypeName.get(ClassName.get(Supplier.class), blockCN);
|
||||
|
||||
JsonArray items;
|
||||
try {
|
||||
items = GSON.fromJson(new JsonReader(new FileReader(itemsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find items.json.");
|
||||
LOGGER.error("Stopped code generation for items.");
|
||||
return;
|
||||
}
|
||||
ClassName itemClassName = ClassName.get("net.minestom.server.item", "Material");
|
||||
|
||||
// Item
|
||||
TypeSpec.Builder itemClass = TypeSpec.enumBuilder(itemClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
itemClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
itemClass.addField(
|
||||
FieldSpec.builder(TypeName.BYTE, "maxDefaultStackSize")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
itemClass.addField(
|
||||
FieldSpec.builder(blocksCNSupplier, "correspondingBlockSupplier")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).build()
|
||||
);
|
||||
// static field
|
||||
itemClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(itemClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
itemClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addParameter(TypeName.BYTE, "maxDefaultStackSize")
|
||||
.addParameter(ParameterSpec.builder(blocksCNSupplier, "correspondingBlockSupplier").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("this.maxDefaultStackSize = maxDefaultStackSize")
|
||||
.addStatement("this.correspondingBlockSupplier = correspondingBlockSupplier")
|
||||
.addStatement("$T.materials.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getName method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("getName")
|
||||
.addAnnotation(NotNull.class)
|
||||
.returns(ClassName.get(String.class))
|
||||
.addStatement("return this.id.asString()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getMaxDefaultStackSize
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("getMaxDefaultStackSize")
|
||||
.returns(TypeName.BYTE)
|
||||
.addStatement("return this.maxDefaultStackSize")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(itemClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// isFood method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isFood")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// hasState method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("hasState")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.beginControlFlow("if (this == BOW || this == TRIDENT || this == CROSSBOW || this == SHIELD)")
|
||||
.addStatement("return true")
|
||||
.nextControlFlow("else")
|
||||
.addStatement("return isFood()")
|
||||
.endControlFlow()
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isBlock method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isBlock")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement(
|
||||
"return this.correspondingBlockSupplier.get() != null && this.correspondingBlockSupplier.get() != $T.AIR",
|
||||
blockCN
|
||||
)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isArmor method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isArmor")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isHelmet method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isHelmet")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isChestplate method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isChestplate")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isLeggings method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isLeggings")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// isBoots method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("isBoots")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addStatement("return false")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getBlock method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("getBlock")
|
||||
.addAnnotation(Nullable.class)
|
||||
.returns(blockCN)
|
||||
.addStatement("return this.correspondingBlockSupplier.get()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
itemClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement i : items) {
|
||||
JsonObject item = i.getAsJsonObject();
|
||||
|
||||
String itemName = item.get("name").getAsString();
|
||||
TypeSpec.Builder enumConst;
|
||||
if (!(item.get("blockId").getAsString().equals("minecraft:air"))) {
|
||||
enumConst = TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S), (byte) $L, () -> $T.getBlock($S)",
|
||||
namespaceIDClassName,
|
||||
item.get("id").getAsString(),
|
||||
item.get("maxStackSize").getAsInt(),
|
||||
// Supplier
|
||||
registriesClassName,
|
||||
item.get("blockId").getAsString()
|
||||
);
|
||||
} else {
|
||||
enumConst = TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S), (byte) $L, () -> null",
|
||||
namespaceIDClassName,
|
||||
item.get("id").getAsString(),
|
||||
item.get("maxStackSize").getAsInt()
|
||||
);
|
||||
}
|
||||
if (item.get("edible").getAsBoolean()) {
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isFood")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if (item.get("armorProperties") != null) {
|
||||
JsonObject ap = item.get("armorProperties").getAsJsonObject();
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isArmor")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
if (ap.get("slot") != null) {
|
||||
switch(ap.get("slot").getAsString()) {
|
||||
case "head": {
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isHelmet")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "chest": {
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isChestplate")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "legs": {
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isLeggings")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "feet": {
|
||||
enumConst.addMethod(
|
||||
MethodSpec.methodBuilder("isBoots")
|
||||
.returns(TypeName.BOOLEAN)
|
||||
.addAnnotation(Override.class)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.addStatement("return true")
|
||||
.build()
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
itemClass.addEnumConstant(itemName, enumConst.build());
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.item", itemClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package net.minestom.codegen.particle;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class ParticleGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ParticleGenerator.class);
|
||||
private final File particlesFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public ParticleGenerator(@NotNull File particlesFile, @NotNull File outputFolder) {
|
||||
this.particlesFile = particlesFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!particlesFile.exists()) {
|
||||
LOGGER.error("Failed to find particles.json.");
|
||||
LOGGER.error("Stopped code generation for particles.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray particles;
|
||||
try {
|
||||
particles = GSON.fromJson(new JsonReader(new FileReader(particlesFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find particles.json.");
|
||||
LOGGER.error("Stopped code generation for particles.");
|
||||
return;
|
||||
}
|
||||
ClassName particleClassName = ClassName.get("net.minestom.server.particle", "Particle");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder particleClass = TypeSpec.enumBuilder(particleClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
particleClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
particleClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(particleClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
particleClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.particles.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
particleClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
particleClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
particleClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
particleClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(particleClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
particleClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement p : particles) {
|
||||
JsonObject particle = p.getAsJsonObject();
|
||||
|
||||
String particleName = particle.get("name").getAsString();
|
||||
|
||||
particleClass.addEnumConstant(particleName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
particle.get("id").getAsString()
|
||||
).build());
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.particle", particleClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package net.minestom.codegen.potion;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class PotionEffectGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PotionEffectGenerator.class);
|
||||
private final File potionEffectsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public PotionEffectGenerator(@NotNull File potionEffectsFile, @NotNull File outputFolder) {
|
||||
this.potionEffectsFile = potionEffectsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!potionEffectsFile.exists()) {
|
||||
LOGGER.error("Failed to find potionEffects.json.");
|
||||
LOGGER.error("Stopped code generation for potion effects.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray potionEffects;
|
||||
try {
|
||||
potionEffects = GSON.fromJson(new JsonReader(new FileReader(potionEffectsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find potionEffects.json.");
|
||||
LOGGER.error("Stopped code generation for potion effects.");
|
||||
return;
|
||||
}
|
||||
ClassName potionEffectClassName = ClassName.get("net.minestom.server.potion", "PotionEffect");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder potionEffectClass = TypeSpec.enumBuilder(potionEffectClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
potionEffectClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
potionEffectClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(potionEffectClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.potionEffects.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(potionEffectClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
potionEffectClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement pe : potionEffects) {
|
||||
JsonObject potionEffect = pe.getAsJsonObject();
|
||||
|
||||
String potionEffectName = potionEffect.get("name").getAsString();
|
||||
|
||||
potionEffectClass.addEnumConstant(potionEffectName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
potionEffect.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.potion", potionEffectClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package net.minestom.codegen.potion;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class PotionTypeGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PotionTypeGenerator.class);
|
||||
private final File potionsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public PotionTypeGenerator(@NotNull File potionsFile, @NotNull File outputFolder) {
|
||||
this.potionsFile = potionsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!potionsFile.exists()) {
|
||||
LOGGER.error("Failed to find potions.json.");
|
||||
LOGGER.error("Stopped code generation for potions.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray potions;
|
||||
try {
|
||||
potions = GSON.fromJson(new JsonReader(new FileReader(potionsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find potions.json.");
|
||||
LOGGER.error("Stopped code generation for potions.");
|
||||
return;
|
||||
}
|
||||
ClassName potionTypeClassName = ClassName.get("net.minestom.server.potion", "PotionType");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder potionTypeClass = TypeSpec.enumBuilder(potionTypeClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
potionTypeClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
potionTypeClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(potionTypeClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.potionTypes.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(potionTypeClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
potionTypeClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement p : potions) {
|
||||
JsonObject potion = p.getAsJsonObject();
|
||||
|
||||
String potionName = potion.get("name").getAsString();
|
||||
|
||||
potionTypeClass.addEnumConstant(potionName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
potion.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.potion", potionTypeClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package net.minestom.codegen.sound;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class SoundEventGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SoundEventGenerator.class);
|
||||
private final File soundsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public SoundEventGenerator(@NotNull File itemsFile, @NotNull File outputFolder) {
|
||||
this.soundsFile = itemsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!soundsFile.exists()) {
|
||||
LOGGER.error("Failed to find sounds.json.");
|
||||
LOGGER.error("Stopped code generation for sounds.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray sounds;
|
||||
try {
|
||||
sounds = GSON.fromJson(new JsonReader(new FileReader(soundsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find sounds.json.");
|
||||
LOGGER.error("Stopped code generation for sounds.");
|
||||
return;
|
||||
}
|
||||
ClassName soundClassName = ClassName.get("net.minestom.server.sound", "SoundEvent");
|
||||
// Sound
|
||||
TypeSpec.Builder soundClass = TypeSpec.enumBuilder(soundClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.sound", "Sound", "Type"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
soundClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
soundClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(soundClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
soundClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.soundEvents.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
soundClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
soundClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
soundClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
soundClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(soundClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
soundClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement s : sounds) {
|
||||
JsonObject sound = s.getAsJsonObject();
|
||||
|
||||
String soundName = sound.get("name").getAsString();
|
||||
soundClass.addEnumConstant(soundName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
sound.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.sound", soundClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package net.minestom.codegen.statistics;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.squareup.javapoet.*;
|
||||
import net.minestom.codegen.MinestomCodeGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Collections;
|
||||
|
||||
public final class StatisticGenerator extends MinestomCodeGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StatisticGenerator.class);
|
||||
private final File statisticsFile;
|
||||
private final File outputFolder;
|
||||
|
||||
public StatisticGenerator(@NotNull File statisticsFile, @NotNull File outputFolder) {
|
||||
this.statisticsFile = statisticsFile;
|
||||
this.outputFolder = outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
if (!statisticsFile.exists()) {
|
||||
LOGGER.error("Failed to find statistics.json.");
|
||||
LOGGER.error("Stopped code generation for statistics.");
|
||||
return;
|
||||
}
|
||||
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
|
||||
LOGGER.error("Output folder for code generation does not exist and could not be created.");
|
||||
return;
|
||||
}
|
||||
// Important classes we use alot
|
||||
ClassName namespaceIDClassName = ClassName.get("net.minestom.server.utils", "NamespaceID");
|
||||
ClassName registriesClassName = ClassName.get("net.minestom.server.registry", "Registries");
|
||||
|
||||
JsonArray statistics;
|
||||
try {
|
||||
statistics = GSON.fromJson(new JsonReader(new FileReader(statisticsFile)), JsonArray.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to find statistics.json.");
|
||||
LOGGER.error("Stopped code generation for statistics.");
|
||||
return;
|
||||
}
|
||||
ClassName statisticClassName = ClassName.get("net.minestom.server.statistic", "StatisticType");
|
||||
|
||||
// Particle
|
||||
TypeSpec.Builder statisticClass = TypeSpec.enumBuilder(statisticClassName)
|
||||
.addSuperinterface(ClassName.get("net.kyori.adventure.key", "Keyed"))
|
||||
.addModifiers(Modifier.PUBLIC).addJavadoc("AUTOGENERATED by " + getClass().getSimpleName());
|
||||
|
||||
statisticClass.addField(
|
||||
FieldSpec.builder(namespaceIDClassName, "id")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.FINAL).addAnnotation(NotNull.class).build()
|
||||
);
|
||||
// static field
|
||||
statisticClass.addField(
|
||||
FieldSpec.builder(ArrayTypeName.of(statisticClassName), "VALUES")
|
||||
.addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL)
|
||||
.initializer("values()")
|
||||
.build()
|
||||
);
|
||||
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.constructorBuilder()
|
||||
.addParameter(ParameterSpec.builder(namespaceIDClassName, "id").addAnnotation(NotNull.class).build())
|
||||
.addStatement("this.id = id")
|
||||
.addStatement("$T.statisticTypes.put(id, this)", registriesClassName)
|
||||
.build()
|
||||
);
|
||||
// Override key method (adventure)
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.methodBuilder("key")
|
||||
.returns(ClassName.get("net.kyori.adventure.key", "Key"))
|
||||
.addAnnotation(Override.class)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getId method
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.methodBuilder("getId")
|
||||
.returns(TypeName.SHORT)
|
||||
.addStatement("return (short) ordinal()")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// getNamespaceID method
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.methodBuilder("getNamespaceID")
|
||||
.returns(namespaceIDClassName)
|
||||
.addAnnotation(NotNull.class)
|
||||
.addStatement("return this.id")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
// fromId Method
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.methodBuilder("fromId")
|
||||
.returns(statisticClassName)
|
||||
.addAnnotation(Nullable.class)
|
||||
.addParameter(TypeName.SHORT, "id")
|
||||
.beginControlFlow("if(id >= 0 && id < VALUES.length)")
|
||||
.addStatement("return VALUES[id]")
|
||||
.endControlFlow()
|
||||
.addStatement("return null")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.build()
|
||||
);
|
||||
// toString method
|
||||
statisticClass.addMethod(
|
||||
MethodSpec.methodBuilder("toString")
|
||||
.addAnnotation(NotNull.class)
|
||||
.addAnnotation(Override.class)
|
||||
.returns(String.class)
|
||||
// this resolves to [Namespace]
|
||||
.addStatement("return \"[\" + this.id + \"]\"")
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Use data
|
||||
for (JsonElement s : statistics) {
|
||||
JsonObject statistic = s.getAsJsonObject();
|
||||
|
||||
String statisticName = statistic.get("name").getAsString();
|
||||
|
||||
statisticClass.addEnumConstant(statisticName, TypeSpec.anonymousClassBuilder(
|
||||
"$T.from($S)",
|
||||
namespaceIDClassName,
|
||||
statistic.get("id").getAsString()
|
||||
).build()
|
||||
);
|
||||
}
|
||||
|
||||
// Write files to outputFolder
|
||||
writeFiles(
|
||||
Collections.singletonList(
|
||||
JavaFile.builder("net.minestom.server.statistic", statisticClass.build())
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true)
|
||||
.build()
|
||||
),
|
||||
outputFolder
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package net.minestom.codegen.util;
|
||||
|
||||
public final class NameUtil {
|
||||
private NameUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static String convertSnakeCaseToCamelCase(String snakeCase) {
|
||||
StringBuilder sb = new StringBuilder(snakeCase);
|
||||
for (int i = 0; i < sb.length(); i++) {
|
||||
if (sb.charAt(i) == '_') {
|
||||
sb.deleteCharAt(i);
|
||||
sb.replace(i, i + 1, String.valueOf(Character.toUpperCase(sb.charAt(i))));
|
||||
}
|
||||
}
|
||||
|
||||
// Capitalize first letter.
|
||||
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
# Update with every release
|
||||
mcVersion = 1.16.5
|
||||
asmVersion=9.0
|
||||
mixinVersion=0.8.1
|
||||
hephaistosVersion=v1.1.8
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
rootProject.name = 'Minestom'
|
||||
|
||||
include 'code-generators'
|
||||
|
|
|
@ -1,11 +1,31 @@
|
|||
package net.minestom.server.entity;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.PlayerMeta;
|
||||
import net.minestom.server.entity.metadata.ambient.BatMeta;
|
||||
import net.minestom.server.entity.metadata.animal.*;
|
||||
import net.minestom.server.entity.metadata.animal.BeeMeta;
|
||||
import net.minestom.server.entity.metadata.animal.ChickenMeta;
|
||||
import net.minestom.server.entity.metadata.animal.CowMeta;
|
||||
import net.minestom.server.entity.metadata.animal.DonkeyMeta;
|
||||
import net.minestom.server.entity.metadata.animal.FoxMeta;
|
||||
import net.minestom.server.entity.metadata.animal.HoglinMeta;
|
||||
import net.minestom.server.entity.metadata.animal.HorseMeta;
|
||||
import net.minestom.server.entity.metadata.animal.LlamaMeta;
|
||||
import net.minestom.server.entity.metadata.animal.MooshroomMeta;
|
||||
import net.minestom.server.entity.metadata.animal.MuleMeta;
|
||||
import net.minestom.server.entity.metadata.animal.OcelotMeta;
|
||||
import net.minestom.server.entity.metadata.animal.PandaMeta;
|
||||
import net.minestom.server.entity.metadata.animal.PigMeta;
|
||||
import net.minestom.server.entity.metadata.animal.PolarBearMeta;
|
||||
import net.minestom.server.entity.metadata.animal.RabbitMeta;
|
||||
import net.minestom.server.entity.metadata.animal.SheepMeta;
|
||||
import net.minestom.server.entity.metadata.animal.SkeletonHorseMeta;
|
||||
import net.minestom.server.entity.metadata.animal.StriderMeta;
|
||||
import net.minestom.server.entity.metadata.animal.TurtleMeta;
|
||||
import net.minestom.server.entity.metadata.animal.ZombieHorseMeta;
|
||||
import net.minestom.server.entity.metadata.animal.tameable.CatMeta;
|
||||
import net.minestom.server.entity.metadata.animal.tameable.ParrotMeta;
|
||||
import net.minestom.server.entity.metadata.animal.tameable.WolfMeta;
|
||||
|
@ -17,15 +37,73 @@ import net.minestom.server.entity.metadata.flying.PhantomMeta;
|
|||
import net.minestom.server.entity.metadata.golem.IronGolemMeta;
|
||||
import net.minestom.server.entity.metadata.golem.ShulkerMeta;
|
||||
import net.minestom.server.entity.metadata.golem.SnowGolemMeta;
|
||||
import net.minestom.server.entity.metadata.item.*;
|
||||
import net.minestom.server.entity.metadata.minecart.*;
|
||||
import net.minestom.server.entity.metadata.monster.*;
|
||||
import net.minestom.server.entity.metadata.monster.raider.*;
|
||||
import net.minestom.server.entity.metadata.item.EyeOfEnderMeta;
|
||||
import net.minestom.server.entity.metadata.item.FireballMeta;
|
||||
import net.minestom.server.entity.metadata.item.ItemEntityMeta;
|
||||
import net.minestom.server.entity.metadata.item.SmallFireballMeta;
|
||||
import net.minestom.server.entity.metadata.item.SnowballMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownEggMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownEnderPearlMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownExperienceBottleMeta;
|
||||
import net.minestom.server.entity.metadata.item.ThrownPotionMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.ChestMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.CommandBlockMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.FurnaceMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.HopperMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.MinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.SpawnerMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.minecart.TntMinecartMeta;
|
||||
import net.minestom.server.entity.metadata.monster.BlazeMeta;
|
||||
import net.minestom.server.entity.metadata.monster.CaveSpiderMeta;
|
||||
import net.minestom.server.entity.metadata.monster.CreeperMeta;
|
||||
import net.minestom.server.entity.metadata.monster.ElderGuardianMeta;
|
||||
import net.minestom.server.entity.metadata.monster.EndermanMeta;
|
||||
import net.minestom.server.entity.metadata.monster.EndermiteMeta;
|
||||
import net.minestom.server.entity.metadata.monster.GiantMeta;
|
||||
import net.minestom.server.entity.metadata.monster.GuardianMeta;
|
||||
import net.minestom.server.entity.metadata.monster.PiglinBruteMeta;
|
||||
import net.minestom.server.entity.metadata.monster.PiglinMeta;
|
||||
import net.minestom.server.entity.metadata.monster.SilverfishMeta;
|
||||
import net.minestom.server.entity.metadata.monster.SpiderMeta;
|
||||
import net.minestom.server.entity.metadata.monster.VexMeta;
|
||||
import net.minestom.server.entity.metadata.monster.WitherMeta;
|
||||
import net.minestom.server.entity.metadata.monster.ZoglinMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.EvokerMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.IllusionerMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.PillagerMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.RavagerMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.VindicatorMeta;
|
||||
import net.minestom.server.entity.metadata.monster.raider.WitchMeta;
|
||||
import net.minestom.server.entity.metadata.monster.skeleton.SkeletonMeta;
|
||||
import net.minestom.server.entity.metadata.monster.skeleton.StrayMeta;
|
||||
import net.minestom.server.entity.metadata.monster.skeleton.WitherSkeletonMeta;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.*;
|
||||
import net.minestom.server.entity.metadata.other.*;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.DrownedMeta;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.HuskMeta;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.ZombieMeta;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.ZombieVillagerMeta;
|
||||
import net.minestom.server.entity.metadata.monster.zombie.ZombifiedPiglinMeta;
|
||||
import net.minestom.server.entity.metadata.other.AreaEffectCloudMeta;
|
||||
import net.minestom.server.entity.metadata.other.ArmorStandMeta;
|
||||
import net.minestom.server.entity.metadata.other.BoatMeta;
|
||||
import net.minestom.server.entity.metadata.other.DragonFireballMeta;
|
||||
import net.minestom.server.entity.metadata.other.EndCrystalMeta;
|
||||
import net.minestom.server.entity.metadata.other.EnderDragonMeta;
|
||||
import net.minestom.server.entity.metadata.other.EvokerFangsMeta;
|
||||
import net.minestom.server.entity.metadata.other.ExperienceOrbMeta;
|
||||
import net.minestom.server.entity.metadata.other.FallingBlockMeta;
|
||||
import net.minestom.server.entity.metadata.other.FireworkRocketMeta;
|
||||
import net.minestom.server.entity.metadata.other.FishingHookMeta;
|
||||
import net.minestom.server.entity.metadata.other.ItemFrameMeta;
|
||||
import net.minestom.server.entity.metadata.other.LeashKnotMeta;
|
||||
import net.minestom.server.entity.metadata.other.LightningBoltMeta;
|
||||
import net.minestom.server.entity.metadata.other.LlamaSpitMeta;
|
||||
import net.minestom.server.entity.metadata.other.MagmaCubeMeta;
|
||||
import net.minestom.server.entity.metadata.other.PaintingMeta;
|
||||
import net.minestom.server.entity.metadata.other.PrimedTntMeta;
|
||||
import net.minestom.server.entity.metadata.other.ShulkerBulletMeta;
|
||||
import net.minestom.server.entity.metadata.other.SlimeMeta;
|
||||
import net.minestom.server.entity.metadata.other.TraderLlamaMeta;
|
||||
import net.minestom.server.entity.metadata.other.WitherSkullMeta;
|
||||
import net.minestom.server.entity.metadata.villager.VillagerMeta;
|
||||
import net.minestom.server.entity.metadata.villager.WanderingTraderMeta;
|
||||
import net.minestom.server.entity.metadata.water.DolphinMeta;
|
||||
|
@ -37,236 +115,232 @@ import net.minestom.server.entity.metadata.water.fish.TropicalFishMeta;
|
|||
import net.minestom.server.registry.Registries;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* //==============================
|
||||
* // AUTOGENERATED BY EnumGenerator
|
||||
* //==============================
|
||||
* AUTOGENERATED by EntityTypeGenerator
|
||||
*/
|
||||
@SuppressWarnings({"deprecation"})
|
||||
public enum EntityType implements Keyed {
|
||||
AREA_EFFECT_CLOUD("minecraft:area_effect_cloud", 6.0, 0.5, AreaEffectCloudMeta::new, EntitySpawnType.BASE),
|
||||
AREA_EFFECT_CLOUD(NamespaceID.from("minecraft:area_effect_cloud"), 6.0, 0.5, AreaEffectCloudMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ARMOR_STAND("minecraft:armor_stand", 0.5, 1.975, ArmorStandMeta::new, EntitySpawnType.LIVING),
|
||||
ARMOR_STAND(NamespaceID.from("minecraft:armor_stand"), 0.5, 1.975, ArmorStandMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ARROW("minecraft:arrow", 0.5, 0.5, ArrowMeta::new, EntitySpawnType.BASE),
|
||||
ARROW(NamespaceID.from("minecraft:arrow"), 0.5, 0.5, ArrowMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
BAT("minecraft:bat", 0.5, 0.9, BatMeta::new, EntitySpawnType.LIVING),
|
||||
BAT(NamespaceID.from("minecraft:bat"), 0.5, 0.9, BatMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
BEE("minecraft:bee", 0.7, 0.6, BeeMeta::new, EntitySpawnType.LIVING),
|
||||
BEE(NamespaceID.from("minecraft:bee"), 0.7, 0.6, BeeMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
BLAZE("minecraft:blaze", 0.6, 1.8, BlazeMeta::new, EntitySpawnType.LIVING),
|
||||
BLAZE(NamespaceID.from("minecraft:blaze"), 0.6, 1.8, BlazeMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
BOAT("minecraft:boat", 1.375, 0.5625, BoatMeta::new, EntitySpawnType.BASE),
|
||||
BOAT(NamespaceID.from("minecraft:boat"), 1.375, 0.5625, BoatMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CAT("minecraft:cat", 0.6, 0.7, CatMeta::new, EntitySpawnType.LIVING),
|
||||
CAT(NamespaceID.from("minecraft:cat"), 0.6, 0.7, CatMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
CAVE_SPIDER("minecraft:cave_spider", 0.7, 0.5, CaveSpiderMeta::new, EntitySpawnType.LIVING),
|
||||
CAVE_SPIDER(NamespaceID.from("minecraft:cave_spider"), 0.7, 0.5, CaveSpiderMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
CHICKEN("minecraft:chicken", 0.4, 0.7, ChickenMeta::new, EntitySpawnType.LIVING),
|
||||
CHICKEN(NamespaceID.from("minecraft:chicken"), 0.4, 0.7, ChickenMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
COD("minecraft:cod", 0.5, 0.3, CodMeta::new, EntitySpawnType.LIVING),
|
||||
COD(NamespaceID.from("minecraft:cod"), 0.5, 0.3, CodMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
COW("minecraft:cow", 0.9, 1.4, CowMeta::new, EntitySpawnType.LIVING),
|
||||
COW(NamespaceID.from("minecraft:cow"), 0.9, 1.4, CowMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
CREEPER("minecraft:creeper", 0.6, 1.7, CreeperMeta::new, EntitySpawnType.LIVING),
|
||||
CREEPER(NamespaceID.from("minecraft:creeper"), 0.6, 1.7, CreeperMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
DOLPHIN("minecraft:dolphin", 0.9, 0.6, DolphinMeta::new, EntitySpawnType.LIVING),
|
||||
DOLPHIN(NamespaceID.from("minecraft:dolphin"), 0.9, 0.6, DolphinMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
DONKEY("minecraft:donkey", 1.39648, 1.5, DonkeyMeta::new, EntitySpawnType.LIVING),
|
||||
DONKEY(NamespaceID.from("minecraft:donkey"), 1.3964844, 1.5, DonkeyMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
DRAGON_FIREBALL("minecraft:dragon_fireball", 1.0, 1.0, DragonFireballMeta::new, EntitySpawnType.BASE),
|
||||
DRAGON_FIREBALL(NamespaceID.from("minecraft:dragon_fireball"), 1.0, 1.0, DragonFireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
DROWNED("minecraft:drowned", 0.6, 1.95, DrownedMeta::new, EntitySpawnType.LIVING),
|
||||
DROWNED(NamespaceID.from("minecraft:drowned"), 0.6, 1.95, DrownedMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ELDER_GUARDIAN("minecraft:elder_guardian", 1.9975, 1.9975, ElderGuardianMeta::new, EntitySpawnType.LIVING),
|
||||
ELDER_GUARDIAN(NamespaceID.from("minecraft:elder_guardian"), 1.9975, 1.9975, ElderGuardianMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
END_CRYSTAL("minecraft:end_crystal", 2.0, 2.0, EndCrystalMeta::new, EntitySpawnType.BASE),
|
||||
END_CRYSTAL(NamespaceID.from("minecraft:end_crystal"), 2.0, 2.0, EndCrystalMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDER_DRAGON("minecraft:ender_dragon", 16.0, 8.0, EnderDragonMeta::new, EntitySpawnType.LIVING),
|
||||
ENDER_DRAGON(NamespaceID.from("minecraft:ender_dragon"), 16.0, 8.0, EnderDragonMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ENDERMAN("minecraft:enderman", 0.6, 2.9, EndermanMeta::new, EntitySpawnType.LIVING),
|
||||
ENDERMAN(NamespaceID.from("minecraft:enderman"), 0.6, 2.9, EndermanMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ENDERMITE("minecraft:endermite", 0.4, 0.3, EndermiteMeta::new, EntitySpawnType.LIVING),
|
||||
ENDERMITE(NamespaceID.from("minecraft:endermite"), 0.4, 0.3, EndermiteMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
EVOKER("minecraft:evoker", 0.6, 1.95, EvokerMeta::new, EntitySpawnType.LIVING),
|
||||
EVOKER(NamespaceID.from("minecraft:evoker"), 0.6, 1.95, EvokerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
EVOKER_FANGS("minecraft:evoker_fangs", 0.5, 0.8, EvokerFangsMeta::new, EntitySpawnType.BASE),
|
||||
EVOKER_FANGS(NamespaceID.from("minecraft:evoker_fangs"), 0.5, 0.8, EvokerFangsMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EXPERIENCE_ORB("minecraft:experience_orb", 0.5, 0.5, ExperienceOrbMeta::new, EntitySpawnType.EXPERIENCE_ORB),
|
||||
EXPERIENCE_ORB(NamespaceID.from("minecraft:experience_orb"), 0.5, 0.5, ExperienceOrbMeta::new, EntitySpawnType.EXPERIENCE_ORB),
|
||||
|
||||
EYE_OF_ENDER("minecraft:eye_of_ender", 0.25, 0.25, EyeOfEnderMeta::new, EntitySpawnType.BASE),
|
||||
EYE_OF_ENDER(NamespaceID.from("minecraft:eye_of_ender"), 0.25, 0.25, EyeOfEnderMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FALLING_BLOCK("minecraft:falling_block", 0.98, 0.98, FallingBlockMeta::new, EntitySpawnType.BASE),
|
||||
FALLING_BLOCK(NamespaceID.from("minecraft:falling_block"), 0.98, 0.98, FallingBlockMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FIREWORK_ROCKET("minecraft:firework_rocket", 0.25, 0.25, FireworkRocketMeta::new, EntitySpawnType.BASE),
|
||||
FIREWORK_ROCKET(NamespaceID.from("minecraft:firework_rocket"), 0.25, 0.25, FireworkRocketMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FOX("minecraft:fox", 0.6, 0.7, FoxMeta::new, EntitySpawnType.LIVING),
|
||||
FOX(NamespaceID.from("minecraft:fox"), 0.6, 0.7, FoxMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
GHAST("minecraft:ghast", 4.0, 4.0, GhastMeta::new, EntitySpawnType.LIVING),
|
||||
GHAST(NamespaceID.from("minecraft:ghast"), 4.0, 4.0, GhastMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
GIANT("minecraft:giant", 3.6, 12.0, GiantMeta::new, EntitySpawnType.LIVING),
|
||||
GIANT(NamespaceID.from("minecraft:giant"), 3.6, 12.0, GiantMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
GUARDIAN("minecraft:guardian", 0.85, 0.85, GuardianMeta::new, EntitySpawnType.LIVING),
|
||||
GUARDIAN(NamespaceID.from("minecraft:guardian"), 0.85, 0.85, GuardianMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
HOGLIN("minecraft:hoglin", 1.39648, 1.4, HoglinMeta::new, EntitySpawnType.LIVING),
|
||||
HOGLIN(NamespaceID.from("minecraft:hoglin"), 1.3964844, 1.4, HoglinMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
HORSE("minecraft:horse", 1.39648, 1.6, HorseMeta::new, EntitySpawnType.LIVING),
|
||||
HORSE(NamespaceID.from("minecraft:horse"), 1.3964844, 1.6, HorseMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
HUSK("minecraft:husk", 0.6, 1.95, HuskMeta::new, EntitySpawnType.LIVING),
|
||||
HUSK(NamespaceID.from("minecraft:husk"), 0.6, 1.95, HuskMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ILLUSIONER("minecraft:illusioner", 0.6, 1.95, IllusionerMeta::new, EntitySpawnType.LIVING),
|
||||
ILLUSIONER(NamespaceID.from("minecraft:illusioner"), 0.6, 1.95, IllusionerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
IRON_GOLEM("minecraft:iron_golem", 1.4, 2.7, IronGolemMeta::new, EntitySpawnType.LIVING),
|
||||
IRON_GOLEM(NamespaceID.from("minecraft:iron_golem"), 1.4, 2.7, IronGolemMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ITEM("minecraft:item", 0.25, 0.25, ItemEntityMeta::new, EntitySpawnType.BASE),
|
||||
ITEM(NamespaceID.from("minecraft:item"), 0.25, 0.25, ItemEntityMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ITEM_FRAME("minecraft:item_frame", 0.5, 0.5, ItemFrameMeta::new, EntitySpawnType.BASE),
|
||||
ITEM_FRAME(NamespaceID.from("minecraft:item_frame"), 0.5, 0.5, ItemFrameMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FIREBALL("minecraft:fireball", 1.0, 1.0, FireballMeta::new, EntitySpawnType.BASE),
|
||||
FIREBALL(NamespaceID.from("minecraft:fireball"), 1.0, 1.0, FireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LEASH_KNOT("minecraft:leash_knot", 0.5, 0.5, LeashKnotMeta::new, EntitySpawnType.BASE),
|
||||
LEASH_KNOT(NamespaceID.from("minecraft:leash_knot"), 0.5, 0.5, LeashKnotMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LIGHTNING_BOLT("minecraft:lightning_bolt", 0.0, 0.0, LightningBoltMeta::new, EntitySpawnType.BASE),
|
||||
LIGHTNING_BOLT(NamespaceID.from("minecraft:lightning_bolt"), 0.0, 0.0, LightningBoltMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
LLAMA("minecraft:llama", 0.9, 1.87, LlamaMeta::new, EntitySpawnType.LIVING),
|
||||
LLAMA(NamespaceID.from("minecraft:llama"), 0.9, 1.87, LlamaMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
LLAMA_SPIT("minecraft:llama_spit", 0.25, 0.25, LlamaSpitMeta::new, EntitySpawnType.BASE),
|
||||
LLAMA_SPIT(NamespaceID.from("minecraft:llama_spit"), 0.25, 0.25, LlamaSpitMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MAGMA_CUBE("minecraft:magma_cube", 2.04, 2.04, MagmaCubeMeta::new, EntitySpawnType.LIVING),
|
||||
MAGMA_CUBE(NamespaceID.from("minecraft:magma_cube"), 2.04, 2.04, MagmaCubeMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
MINECART("minecraft:minecart", 0.98, 0.7, MinecartMeta::new, EntitySpawnType.BASE),
|
||||
MINECART(NamespaceID.from("minecraft:minecart"), 0.98, 0.7, MinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
CHEST_MINECART("minecraft:chest_minecart", 0.98, 0.7, ChestMinecartMeta::new, EntitySpawnType.BASE),
|
||||
CHEST_MINECART(NamespaceID.from("minecraft:chest_minecart"), 0.98, 0.7, ChestMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
COMMAND_BLOCK_MINECART("minecraft:command_block_minecart", 0.98, 0.7, CommandBlockMinecartMeta::new, EntitySpawnType.BASE),
|
||||
COMMAND_BLOCK_MINECART(NamespaceID.from("minecraft:command_block_minecart"), 0.98, 0.7, CommandBlockMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
FURNACE_MINECART("minecraft:furnace_minecart", 0.98, 0.7, FurnaceMinecartMeta::new, EntitySpawnType.BASE),
|
||||
FURNACE_MINECART(NamespaceID.from("minecraft:furnace_minecart"), 0.98, 0.7, FurnaceMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
HOPPER_MINECART("minecraft:hopper_minecart", 0.98, 0.7, HopperMinecartMeta::new, EntitySpawnType.BASE),
|
||||
HOPPER_MINECART(NamespaceID.from("minecraft:hopper_minecart"), 0.98, 0.7, HopperMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPAWNER_MINECART("minecraft:spawner_minecart", 0.98, 0.7, SpawnerMinecartMeta::new, EntitySpawnType.BASE),
|
||||
SPAWNER_MINECART(NamespaceID.from("minecraft:spawner_minecart"), 0.98, 0.7, SpawnerMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TNT_MINECART("minecraft:tnt_minecart", 0.98, 0.7, TntMinecartMeta::new, EntitySpawnType.BASE),
|
||||
TNT_MINECART(NamespaceID.from("minecraft:tnt_minecart"), 0.98, 0.7, TntMinecartMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
MULE("minecraft:mule", 1.39648, 1.6, MuleMeta::new, EntitySpawnType.LIVING),
|
||||
MULE(NamespaceID.from("minecraft:mule"), 1.3964844, 1.6, MuleMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
MOOSHROOM("minecraft:mooshroom", 0.9, 1.4, MooshroomMeta::new, EntitySpawnType.LIVING),
|
||||
MOOSHROOM(NamespaceID.from("minecraft:mooshroom"), 0.9, 1.4, MooshroomMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
OCELOT("minecraft:ocelot", 0.6, 0.7, OcelotMeta::new, EntitySpawnType.LIVING),
|
||||
OCELOT(NamespaceID.from("minecraft:ocelot"), 0.6, 0.7, OcelotMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PAINTING("minecraft:painting", 0.5, 0.5, PaintingMeta::new, EntitySpawnType.PAINTING),
|
||||
PAINTING(NamespaceID.from("minecraft:painting"), 0.5, 0.5, PaintingMeta::new, EntitySpawnType.PAINTING),
|
||||
|
||||
PANDA("minecraft:panda", 1.3, 1.25, PandaMeta::new, EntitySpawnType.LIVING),
|
||||
PANDA(NamespaceID.from("minecraft:panda"), 1.3, 1.25, PandaMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PARROT("minecraft:parrot", 0.5, 0.9, ParrotMeta::new, EntitySpawnType.LIVING),
|
||||
PARROT(NamespaceID.from("minecraft:parrot"), 0.5, 0.9, ParrotMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PHANTOM("minecraft:phantom", 0.9, 0.5, PhantomMeta::new, EntitySpawnType.LIVING),
|
||||
PHANTOM(NamespaceID.from("minecraft:phantom"), 0.9, 0.5, PhantomMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PIG("minecraft:pig", 0.9, 0.9, PigMeta::new, EntitySpawnType.LIVING),
|
||||
PIG(NamespaceID.from("minecraft:pig"), 0.9, 0.9, PigMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PIGLIN("minecraft:piglin", 0.6, 1.95, PiglinMeta::new, EntitySpawnType.LIVING),
|
||||
PIGLIN(NamespaceID.from("minecraft:piglin"), 0.6, 1.95, PiglinMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PIGLIN_BRUTE("minecraft:piglin_brute", 0.6, 1.95, PiglinBruteMeta::new, EntitySpawnType.LIVING),
|
||||
PIGLIN_BRUTE(NamespaceID.from("minecraft:piglin_brute"), 0.6, 1.95, PiglinBruteMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PILLAGER("minecraft:pillager", 0.6, 1.95, PillagerMeta::new, EntitySpawnType.LIVING),
|
||||
PILLAGER(NamespaceID.from("minecraft:pillager"), 0.6, 1.95, PillagerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
POLAR_BEAR("minecraft:polar_bear", 1.4, 1.4, PolarBearMeta::new, EntitySpawnType.LIVING),
|
||||
POLAR_BEAR(NamespaceID.from("minecraft:polar_bear"), 1.4, 1.4, PolarBearMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
TNT("minecraft:tnt", 0.98, 0.98, PrimedTntMeta::new, EntitySpawnType.BASE),
|
||||
TNT(NamespaceID.from("minecraft:tnt"), 0.98, 0.98, PrimedTntMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
PUFFERFISH("minecraft:pufferfish", 0.7, 0.7, PufferfishMeta::new, EntitySpawnType.LIVING),
|
||||
PUFFERFISH(NamespaceID.from("minecraft:pufferfish"), 0.7, 0.7, PufferfishMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
RABBIT("minecraft:rabbit", 0.4, 0.5, RabbitMeta::new, EntitySpawnType.LIVING),
|
||||
RABBIT(NamespaceID.from("minecraft:rabbit"), 0.4, 0.5, RabbitMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
RAVAGER("minecraft:ravager", 1.95, 2.2, RavagerMeta::new, EntitySpawnType.LIVING),
|
||||
RAVAGER(NamespaceID.from("minecraft:ravager"), 1.95, 2.2, RavagerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SALMON("minecraft:salmon", 0.7, 0.4, SalmonMeta::new, EntitySpawnType.LIVING),
|
||||
SALMON(NamespaceID.from("minecraft:salmon"), 0.7, 0.4, SalmonMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SHEEP("minecraft:sheep", 0.9, 1.3, SheepMeta::new, EntitySpawnType.LIVING),
|
||||
SHEEP(NamespaceID.from("minecraft:sheep"), 0.9, 1.3, SheepMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SHULKER("minecraft:shulker", 1.0, 1.0, ShulkerMeta::new, EntitySpawnType.LIVING),
|
||||
SHULKER(NamespaceID.from("minecraft:shulker"), 1.0, 1.0, ShulkerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SHULKER_BULLET("minecraft:shulker_bullet", 0.3125, 0.3125, ShulkerBulletMeta::new, EntitySpawnType.BASE),
|
||||
SHULKER_BULLET(NamespaceID.from("minecraft:shulker_bullet"), 0.3125, 0.3125, ShulkerBulletMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SILVERFISH("minecraft:silverfish", 0.4, 0.3, SilverfishMeta::new, EntitySpawnType.LIVING),
|
||||
SILVERFISH(NamespaceID.from("minecraft:silverfish"), 0.4, 0.3, SilverfishMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SKELETON("minecraft:skeleton", 0.6, 1.99, SkeletonMeta::new, EntitySpawnType.LIVING),
|
||||
SKELETON(NamespaceID.from("minecraft:skeleton"), 0.6, 1.99, SkeletonMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SKELETON_HORSE("minecraft:skeleton_horse", 1.39648, 1.6, SkeletonHorseMeta::new, EntitySpawnType.LIVING),
|
||||
SKELETON_HORSE(NamespaceID.from("minecraft:skeleton_horse"), 1.3964844, 1.6, SkeletonHorseMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SLIME("minecraft:slime", 2.04, 2.04, SlimeMeta::new, EntitySpawnType.LIVING),
|
||||
SLIME(NamespaceID.from("minecraft:slime"), 2.04, 2.04, SlimeMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SMALL_FIREBALL("minecraft:small_fireball", 0.3125, 0.3125, SmallFireballMeta::new, EntitySpawnType.BASE),
|
||||
SMALL_FIREBALL(NamespaceID.from("minecraft:small_fireball"), 0.3125, 0.3125, SmallFireballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SNOW_GOLEM("minecraft:snow_golem", 0.7, 1.9, SnowGolemMeta::new, EntitySpawnType.LIVING),
|
||||
SNOW_GOLEM(NamespaceID.from("minecraft:snow_golem"), 0.7, 1.9, SnowGolemMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SNOWBALL("minecraft:snowball", 0.25, 0.25, SnowballMeta::new, EntitySpawnType.BASE),
|
||||
SNOWBALL(NamespaceID.from("minecraft:snowball"), 0.25, 0.25, SnowballMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPECTRAL_ARROW("minecraft:spectral_arrow", 0.5, 0.5, SpectralArrowMeta::new, EntitySpawnType.BASE),
|
||||
SPECTRAL_ARROW(NamespaceID.from("minecraft:spectral_arrow"), 0.5, 0.5, SpectralArrowMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
SPIDER("minecraft:spider", 1.4, 0.9, SpiderMeta::new, EntitySpawnType.LIVING),
|
||||
SPIDER(NamespaceID.from("minecraft:spider"), 1.4, 0.9, SpiderMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
SQUID("minecraft:squid", 0.8, 0.8, SquidMeta::new, EntitySpawnType.LIVING),
|
||||
SQUID(NamespaceID.from("minecraft:squid"), 0.8, 0.8, SquidMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
STRAY("minecraft:stray", 0.6, 1.99, StrayMeta::new, EntitySpawnType.LIVING),
|
||||
STRAY(NamespaceID.from("minecraft:stray"), 0.6, 1.99, StrayMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
STRIDER("minecraft:strider", 0.9, 1.7, StriderMeta::new, EntitySpawnType.LIVING),
|
||||
STRIDER(NamespaceID.from("minecraft:strider"), 0.9, 1.7, StriderMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
EGG("minecraft:egg", 0.25, 0.25, ThrownEggMeta::new, EntitySpawnType.BASE),
|
||||
EGG(NamespaceID.from("minecraft:egg"), 0.25, 0.25, ThrownEggMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
ENDER_PEARL("minecraft:ender_pearl", 0.25, 0.25, ThrownEnderPearlMeta::new, EntitySpawnType.BASE),
|
||||
ENDER_PEARL(NamespaceID.from("minecraft:ender_pearl"), 0.25, 0.25, ThrownEnderPearlMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
EXPERIENCE_BOTTLE("minecraft:experience_bottle", 0.25, 0.25, ThrownExperienceBottleMeta::new, EntitySpawnType.BASE),
|
||||
EXPERIENCE_BOTTLE(NamespaceID.from("minecraft:experience_bottle"), 0.25, 0.25, ThrownExperienceBottleMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
POTION("minecraft:potion", 0.25, 0.25, ThrownPotionMeta::new, EntitySpawnType.BASE),
|
||||
POTION(NamespaceID.from("minecraft:potion"), 0.25, 0.25, ThrownPotionMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TRIDENT("minecraft:trident", 0.5, 0.5, ThrownTridentMeta::new, EntitySpawnType.BASE),
|
||||
TRIDENT(NamespaceID.from("minecraft:trident"), 0.5, 0.5, ThrownTridentMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
TRADER_LLAMA("minecraft:trader_llama", 0.9, 1.87, TraderLlamaMeta::new, EntitySpawnType.BASE),
|
||||
TRADER_LLAMA(NamespaceID.from("minecraft:trader_llama"), 0.9, 1.87, TraderLlamaMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
TROPICAL_FISH("minecraft:tropical_fish", 0.5, 0.4, TropicalFishMeta::new, EntitySpawnType.LIVING),
|
||||
TROPICAL_FISH(NamespaceID.from("minecraft:tropical_fish"), 0.5, 0.4, TropicalFishMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
TURTLE("minecraft:turtle", 1.2, 0.4, TurtleMeta::new, EntitySpawnType.LIVING),
|
||||
TURTLE(NamespaceID.from("minecraft:turtle"), 1.2, 0.4, TurtleMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
VEX("minecraft:vex", 0.4, 0.8, VexMeta::new, EntitySpawnType.LIVING),
|
||||
VEX(NamespaceID.from("minecraft:vex"), 0.4, 0.8, VexMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
VILLAGER("minecraft:villager", 0.6, 1.95, VillagerMeta::new, EntitySpawnType.LIVING),
|
||||
VILLAGER(NamespaceID.from("minecraft:villager"), 0.6, 1.95, VillagerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
VINDICATOR("minecraft:vindicator", 0.6, 1.95, VindicatorMeta::new, EntitySpawnType.LIVING),
|
||||
VINDICATOR(NamespaceID.from("minecraft:vindicator"), 0.6, 1.95, VindicatorMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
WANDERING_TRADER("minecraft:wandering_trader", 0.6, 1.95, WanderingTraderMeta::new, EntitySpawnType.LIVING),
|
||||
WANDERING_TRADER(NamespaceID.from("minecraft:wandering_trader"), 0.6, 1.95, WanderingTraderMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
WITCH("minecraft:witch", 0.6, 1.95, WitchMeta::new, EntitySpawnType.LIVING),
|
||||
WITCH(NamespaceID.from("minecraft:witch"), 0.6, 1.95, WitchMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
WITHER("minecraft:wither", 0.9, 3.5, WitherMeta::new, EntitySpawnType.LIVING),
|
||||
WITHER(NamespaceID.from("minecraft:wither"), 0.9, 3.5, WitherMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
WITHER_SKELETON("minecraft:wither_skeleton", 0.7, 2.4, WitherSkeletonMeta::new, EntitySpawnType.LIVING),
|
||||
WITHER_SKELETON(NamespaceID.from("minecraft:wither_skeleton"), 0.7, 2.4, WitherSkeletonMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
WITHER_SKULL("minecraft:wither_skull", 0.3125, 0.3125, WitherSkullMeta::new, EntitySpawnType.BASE),
|
||||
WITHER_SKULL(NamespaceID.from("minecraft:wither_skull"), 0.3125, 0.3125, WitherSkullMeta::new, EntitySpawnType.BASE),
|
||||
|
||||
WOLF("minecraft:wolf", 0.6, 0.85, WolfMeta::new, EntitySpawnType.LIVING),
|
||||
WOLF(NamespaceID.from("minecraft:wolf"), 0.6, 0.85, WolfMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ZOGLIN("minecraft:zoglin", 1.39648, 1.4, ZoglinMeta::new, EntitySpawnType.LIVING),
|
||||
ZOGLIN(NamespaceID.from("minecraft:zoglin"), 1.3964844, 1.4, ZoglinMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ZOMBIE("minecraft:zombie", 0.6, 1.95, ZombieMeta::new, EntitySpawnType.LIVING),
|
||||
ZOMBIE(NamespaceID.from("minecraft:zombie"), 0.6, 1.95, ZombieMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ZOMBIE_HORSE("minecraft:zombie_horse", 1.39648, 1.6, ZombieHorseMeta::new, EntitySpawnType.LIVING),
|
||||
ZOMBIE_HORSE(NamespaceID.from("minecraft:zombie_horse"), 1.3964844, 1.6, ZombieHorseMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ZOMBIE_VILLAGER("minecraft:zombie_villager", 0.6, 1.95, ZombieVillagerMeta::new, EntitySpawnType.LIVING),
|
||||
ZOMBIE_VILLAGER(NamespaceID.from("minecraft:zombie_villager"), 0.6, 1.95, ZombieVillagerMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
ZOMBIFIED_PIGLIN("minecraft:zombified_piglin", 0.6, 1.95, ZombifiedPiglinMeta::new, EntitySpawnType.LIVING),
|
||||
ZOMBIFIED_PIGLIN(NamespaceID.from("minecraft:zombified_piglin"), 0.6, 1.95, ZombifiedPiglinMeta::new, EntitySpawnType.LIVING),
|
||||
|
||||
PLAYER("minecraft:player", 0.6, 1.8, PlayerMeta::new, EntitySpawnType.PLAYER),
|
||||
PLAYER(NamespaceID.from("minecraft:player"), 0.6, 1.8, PlayerMeta::new, EntitySpawnType.PLAYER),
|
||||
|
||||
FISHING_BOBBER("minecraft:fishing_bobber", 0.25, 0.25, FishingHookMeta::new, EntitySpawnType.BASE);
|
||||
FISHING_BOBBER(NamespaceID.from("minecraft:fishing_bobber"), 0.25, 0.25, FishingHookMeta::new, EntitySpawnType.BASE);
|
||||
|
||||
private static final EntityType[] VALUES = values();
|
||||
|
||||
@NotNull
|
||||
private final String namespaceID;
|
||||
private final NamespaceID id;
|
||||
|
||||
private final double width;
|
||||
|
||||
|
@ -278,26 +352,30 @@ public enum EntityType implements Keyed {
|
|||
@NotNull
|
||||
private final EntitySpawnType spawnType;
|
||||
|
||||
private final Key key;
|
||||
|
||||
EntityType(@NotNull String namespaceID, double width, double height,
|
||||
EntityType(@NotNull NamespaceID id, double width, double height,
|
||||
@NotNull BiFunction<Entity, Metadata, EntityMeta> metaConstructor,
|
||||
@NotNull EntitySpawnType spawnType) {
|
||||
this.namespaceID = namespaceID;
|
||||
this.id = id;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.metaConstructor = metaConstructor;
|
||||
this.spawnType = spawnType;
|
||||
Registries.entityTypes.put(NamespaceID.from(namespaceID), this);
|
||||
this.key = Key.key(this.namespaceID);
|
||||
Registries.entityTypes.put(id, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Key key() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public short getId() {
|
||||
return (short) ordinal();
|
||||
}
|
||||
|
||||
public String getNamespaceID() {
|
||||
return this.namespaceID;
|
||||
@NotNull
|
||||
public NamespaceID getNamespaceID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
|
@ -316,6 +394,7 @@ public enum EntityType implements Keyed {
|
|||
return this.spawnType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static EntityType fromId(short id) {
|
||||
if(id >= 0 && id < VALUES.length) {
|
||||
return VALUES[id];
|
||||
|
@ -323,7 +402,9 @@ public enum EntityType implements Keyed {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Key key() {
|
||||
return this.key;
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + this.id + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package net.minestom.server.fluid;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import net.minestom.server.registry.Registries;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by FluidGenerator
|
||||
*/
|
||||
public enum Fluid implements Keyed {
|
||||
EMPTY(NamespaceID.from("minecraft:empty")),
|
||||
|
||||
FLOWING_WATER(NamespaceID.from("minecraft:flowing_water")),
|
||||
|
||||
WATER(NamespaceID.from("minecraft:water")),
|
||||
|
||||
FLOWING_LAVA(NamespaceID.from("minecraft:flowing_lava")),
|
||||
|
||||
LAVA(NamespaceID.from("minecraft:lava"));
|
||||
|
||||
private static final Fluid[] VALUES = values();
|
||||
|
||||
@NotNull
|
||||
private final NamespaceID id;
|
||||
|
||||
Fluid(@NotNull NamespaceID id) {
|
||||
this.id = id;
|
||||
Registries.fluids.put(id, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Key key() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public short getId() {
|
||||
return (short) ordinal();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public NamespaceID getNamespaceID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + this.id + "]";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Fluid fromId(short id) {
|
||||
if(id >= 0 && id < VALUES.length) {
|
||||
return VALUES[id];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package net.minestom.server.fluids;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import net.minestom.server.registry.Registries;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
|
||||
/**
|
||||
* //==============================
|
||||
* // AUTOGENERATED BY EnumGenerator
|
||||
* //==============================
|
||||
*/
|
||||
@SuppressWarnings({"deprecation"})
|
||||
public enum Fluid implements Keyed {
|
||||
EMPTY("minecraft:empty"),
|
||||
|
||||
FLOWING_WATER("minecraft:flowing_water"),
|
||||
|
||||
WATER("minecraft:water"),
|
||||
|
||||
FLOWING_LAVA("minecraft:flowing_lava"),
|
||||
|
||||
LAVA("minecraft:lava");
|
||||
|
||||
private final String namespaceID;
|
||||
|
||||
private final Key key;
|
||||
|
||||
Fluid(String namespaceID) {
|
||||
this.namespaceID = namespaceID;
|
||||
Registries.fluids.put(NamespaceID.from(namespaceID), this);
|
||||
this.key = Key.key(this.namespaceID);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
public String getNamespaceID() {
|
||||
return namespaceID;
|
||||
}
|
||||
|
||||
public Key key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public static Fluid fromId(int id) {
|
||||
if (id >= 0 && id < values().length) {
|
||||
return values()[id];
|
||||
}
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,47 +1,41 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaButton {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6446, "face=floor", "facing=north", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6447, "face=floor", "facing=north", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6448, "face=floor", "facing=south", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6449, "face=floor", "facing=south", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6450, "face=floor", "facing=west", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6451, "face=floor", "facing=west", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6452, "face=floor", "facing=east", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6453, "face=floor", "facing=east", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6454, "face=wall", "facing=north", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6455, "face=wall", "facing=north", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6456, "face=wall", "facing=south", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6457, "face=wall", "facing=south", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6458, "face=wall", "facing=west", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6459, "face=wall", "facing=west", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6460, "face=wall", "facing=east", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6461, "face=wall", "facing=east", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6462, "face=ceiling", "facing=north", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6463, "face=ceiling", "facing=north", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6464, "face=ceiling", "facing=south", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6465, "face=ceiling", "facing=south", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6466, "face=ceiling", "facing=west", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6467, "face=ceiling", "facing=west", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6468, "face=ceiling", "facing=east", "powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6469, "face=ceiling", "facing=east", "powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6446, "face=FLOOR","facing=north","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6447, "face=FLOOR","facing=north","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6448, "face=FLOOR","facing=south","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6449, "face=FLOOR","facing=south","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6450, "face=FLOOR","facing=west","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6451, "face=FLOOR","facing=west","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6452, "face=FLOOR","facing=east","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6453, "face=FLOOR","facing=east","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6454, "face=WALL","facing=north","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6455, "face=WALL","facing=north","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6456, "face=WALL","facing=south","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6457, "face=WALL","facing=south","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6458, "face=WALL","facing=west","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6459, "face=WALL","facing=west","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6460, "face=WALL","facing=east","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6461, "face=WALL","facing=east","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6462, "face=CEILING","facing=north","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6463, "face=CEILING","facing=north","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6464, "face=CEILING","facing=south","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6465, "face=CEILING","facing=south","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6466, "face=CEILING","facing=west","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6467, "face=CEILING","facing=west","powered=false"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6468, "face=CEILING","facing=east","powered=true"));
|
||||
Block.ACACIA_BUTTON.addBlockAlternative(new BlockAlternative((short) 6469, "face=CEILING","facing=east","powered=false"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaDoor {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_DOOR.addBlockAlternative(new BlockAlternative((short) 8934, "facing=north","half=upper","hinge=left","open=true","powered=true"));
|
||||
Block.ACACIA_DOOR.addBlockAlternative(new BlockAlternative((short) 8935, "facing=north","half=upper","hinge=left","open=true","powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaFence {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_FENCE.addBlockAlternative(new BlockAlternative((short) 8678, "east=true","north=true","south=true","waterlogged=true","west=true"));
|
||||
Block.ACACIA_FENCE.addBlockAlternative(new BlockAlternative((short) 8679, "east=true","north=true","south=true","waterlogged=true","west=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaFenceGate {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_FENCE_GATE.addBlockAlternative(new BlockAlternative((short) 8518, "facing=north","in_wall=true","open=true","powered=true"));
|
||||
Block.ACACIA_FENCE_GATE.addBlockAlternative(new BlockAlternative((short) 8519, "facing=north","in_wall=true","open=true","powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaLeaves {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_LEAVES.addBlockAlternative(new BlockAlternative((short) 201, "distance=1","persistent=true"));
|
||||
Block.ACACIA_LEAVES.addBlockAlternative(new BlockAlternative((short) 202, "distance=1","persistent=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaLog {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_LOG.addBlockAlternative(new BlockAlternative((short) 85, "axis=x"));
|
||||
Block.ACACIA_LOG.addBlockAlternative(new BlockAlternative((short) 86, "axis=y"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaPlanks {
|
||||
public static void initStates() {
|
||||
Block.ACACIA_PLANKS.addBlockAlternative(new BlockAlternative((short) 19));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaPressurePlate {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_PRESSURE_PLATE.addBlockAlternative(new BlockAlternative((short) 3881, "powered=true"));
|
||||
Block.ACACIA_PRESSURE_PLATE.addBlockAlternative(new BlockAlternative((short) 3882, "powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaSapling {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_SAPLING.addBlockAlternative(new BlockAlternative((short) 29, "stage=0"));
|
||||
Block.ACACIA_SAPLING.addBlockAlternative(new BlockAlternative((short) 30, "stage=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaSign {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_SIGN.addBlockAlternative(new BlockAlternative((short) 3477, "rotation=0","waterlogged=true"));
|
||||
Block.ACACIA_SIGN.addBlockAlternative(new BlockAlternative((short) 3478, "rotation=0","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaSlab {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_SLAB.addBlockAlternative(new BlockAlternative((short) 8328, "type=top","waterlogged=true"));
|
||||
Block.ACACIA_SLAB.addBlockAlternative(new BlockAlternative((short) 8329, "type=top","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaStairs {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_STAIRS.addBlockAlternative(new BlockAlternative((short) 7379, "facing=north","half=top","shape=straight","waterlogged=true"));
|
||||
Block.ACACIA_STAIRS.addBlockAlternative(new BlockAlternative((short) 7380, "facing=north","half=top","shape=straight","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaTrapdoor {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_TRAPDOOR.addBlockAlternative(new BlockAlternative((short) 4367, "facing=north","half=top","open=true","powered=true","waterlogged=true"));
|
||||
Block.ACACIA_TRAPDOOR.addBlockAlternative(new BlockAlternative((short) 4368, "facing=north","half=top","open=true","powered=true","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaWallSign {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_WALL_SIGN.addBlockAlternative(new BlockAlternative((short) 3759, "facing=north","waterlogged=true"));
|
||||
Block.ACACIA_WALL_SIGN.addBlockAlternative(new BlockAlternative((short) 3760, "facing=north","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AcaciaWood {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACACIA_WOOD.addBlockAlternative(new BlockAlternative((short) 121, "axis=x"));
|
||||
Block.ACACIA_WOOD.addBlockAlternative(new BlockAlternative((short) 122, "axis=y"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class ActivatorRail {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ACTIVATOR_RAIL.addBlockAlternative(new BlockAlternative((short) 6827, "powered=true","shape=north_south"));
|
||||
Block.ACTIVATOR_RAIL.addBlockAlternative(new BlockAlternative((short) 6828, "powered=true","shape=east_west"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Air {
|
||||
public static void initStates() {
|
||||
Block.AIR.addBlockAlternative(new BlockAlternative((short) 0));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Allium {
|
||||
public static void initStates() {
|
||||
Block.ALLIUM.addBlockAlternative(new BlockAlternative((short) 1415));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AncientDebris {
|
||||
public static void initStates() {
|
||||
Block.ANCIENT_DEBRIS.addBlockAlternative(new BlockAlternative((short) 15835));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Andesite {
|
||||
public static void initStates() {
|
||||
Block.ANDESITE.addBlockAlternative(new BlockAlternative((short) 6));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AndesiteSlab {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ANDESITE_SLAB.addBlockAlternative(new BlockAlternative((short) 10847, "type=top","waterlogged=true"));
|
||||
Block.ANDESITE_SLAB.addBlockAlternative(new BlockAlternative((short) 10848, "type=top","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AndesiteStairs {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ANDESITE_STAIRS.addBlockAlternative(new BlockAlternative((short) 10473, "facing=north","half=top","shape=straight","waterlogged=true"));
|
||||
Block.ANDESITE_STAIRS.addBlockAlternative(new BlockAlternative((short) 10474, "facing=north","half=top","shape=straight","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AndesiteWall {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ANDESITE_WALL.addBlockAlternative(new BlockAlternative((short) 13139, "east=none","north=none","south=none","up=true","waterlogged=true","west=none"));
|
||||
Block.ANDESITE_WALL.addBlockAlternative(new BlockAlternative((short) 13140, "east=none","north=none","south=none","up=true","waterlogged=true","west=low"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Anvil {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ANVIL.addBlockAlternative(new BlockAlternative((short) 6614, "facing=north"));
|
||||
Block.ANVIL.addBlockAlternative(new BlockAlternative((short) 6615, "facing=south"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AttachedMelonStem {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ATTACHED_MELON_STEM.addBlockAlternative(new BlockAlternative((short) 4772, "facing=north"));
|
||||
Block.ATTACHED_MELON_STEM.addBlockAlternative(new BlockAlternative((short) 4773, "facing=south"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AttachedPumpkinStem {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.ATTACHED_PUMPKIN_STEM.addBlockAlternative(new BlockAlternative((short) 4768, "facing=north"));
|
||||
Block.ATTACHED_PUMPKIN_STEM.addBlockAlternative(new BlockAlternative((short) 4769, "facing=south"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class AzureBluet {
|
||||
public static void initStates() {
|
||||
Block.AZURE_BLUET.addBlockAlternative(new BlockAlternative((short) 1416));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Bamboo {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BAMBOO.addBlockAlternative(new BlockAlternative((short) 9656, "age=0","leaves=none","stage=0"));
|
||||
Block.BAMBOO.addBlockAlternative(new BlockAlternative((short) 9657, "age=0","leaves=none","stage=1"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BambooSapling {
|
||||
public static void initStates() {
|
||||
Block.BAMBOO_SAPLING.addBlockAlternative(new BlockAlternative((short) 9655));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Barrel {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BARREL.addBlockAlternative(new BlockAlternative((short) 14795, "facing=north","open=true"));
|
||||
Block.BARREL.addBlockAlternative(new BlockAlternative((short) 14796, "facing=north","open=false"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Barrier {
|
||||
public static void initStates() {
|
||||
Block.BARRIER.addBlockAlternative(new BlockAlternative((short) 7540));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Basalt {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BASALT.addBlockAlternative(new BlockAlternative((short) 4002, "axis=x"));
|
||||
Block.BASALT.addBlockAlternative(new BlockAlternative((short) 4003, "axis=y"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Beacon {
|
||||
public static void initStates() {
|
||||
Block.BEACON.addBlockAlternative(new BlockAlternative((short) 5660));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Bedrock {
|
||||
public static void initStates() {
|
||||
Block.BEDROCK.addBlockAlternative(new BlockAlternative((short) 33));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BeeNest {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BEE_NEST.addBlockAlternative(new BlockAlternative((short) 15784, "facing=north","honey_level=0"));
|
||||
Block.BEE_NEST.addBlockAlternative(new BlockAlternative((short) 15785, "facing=north","honey_level=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Beehive {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BEEHIVE.addBlockAlternative(new BlockAlternative((short) 15808, "facing=north","honey_level=0"));
|
||||
Block.BEEHIVE.addBlockAlternative(new BlockAlternative((short) 15809, "facing=north","honey_level=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Beetroots {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BEETROOTS.addBlockAlternative(new BlockAlternative((short) 9223, "age=0"));
|
||||
Block.BEETROOTS.addBlockAlternative(new BlockAlternative((short) 9224, "age=1"));
|
||||
|
|
|
@ -1,55 +1,49 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Bell {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14858, "attachment=floor", "facing=north", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14859, "attachment=floor", "facing=north", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14860, "attachment=floor", "facing=south", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14861, "attachment=floor", "facing=south", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14862, "attachment=floor", "facing=west", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14863, "attachment=floor", "facing=west", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14864, "attachment=floor", "facing=east", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14865, "attachment=floor", "facing=east", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14866, "attachment=ceiling", "facing=north", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14867, "attachment=ceiling", "facing=north", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14868, "attachment=ceiling", "facing=south", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14869, "attachment=ceiling", "facing=south", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14870, "attachment=ceiling", "facing=west", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14871, "attachment=ceiling", "facing=west", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14872, "attachment=ceiling", "facing=east", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14873, "attachment=ceiling", "facing=east", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14874, "attachment=single_wall", "facing=north", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14875, "attachment=single_wall", "facing=north", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14876, "attachment=single_wall", "facing=south", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14877, "attachment=single_wall", "facing=south", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14878, "attachment=single_wall", "facing=west", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14879, "attachment=single_wall", "facing=west", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14880, "attachment=single_wall", "facing=east", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14881, "attachment=single_wall", "facing=east", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14882, "attachment=double_wall", "facing=north", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14883, "attachment=double_wall", "facing=north", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14884, "attachment=double_wall", "facing=south", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14885, "attachment=double_wall", "facing=south", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14886, "attachment=double_wall", "facing=west", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14887, "attachment=double_wall", "facing=west", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14888, "attachment=double_wall", "facing=east", "powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14889, "attachment=double_wall", "facing=east", "powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14858, "attachment=FLOOR","facing=north","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14859, "attachment=FLOOR","facing=north","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14860, "attachment=FLOOR","facing=south","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14861, "attachment=FLOOR","facing=south","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14862, "attachment=FLOOR","facing=west","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14863, "attachment=FLOOR","facing=west","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14864, "attachment=FLOOR","facing=east","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14865, "attachment=FLOOR","facing=east","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14866, "attachment=CEILING","facing=north","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14867, "attachment=CEILING","facing=north","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14868, "attachment=CEILING","facing=south","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14869, "attachment=CEILING","facing=south","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14870, "attachment=CEILING","facing=west","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14871, "attachment=CEILING","facing=west","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14872, "attachment=CEILING","facing=east","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14873, "attachment=CEILING","facing=east","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14874, "attachment=SINGLE_WALL","facing=north","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14875, "attachment=SINGLE_WALL","facing=north","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14876, "attachment=SINGLE_WALL","facing=south","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14877, "attachment=SINGLE_WALL","facing=south","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14878, "attachment=SINGLE_WALL","facing=west","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14879, "attachment=SINGLE_WALL","facing=west","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14880, "attachment=SINGLE_WALL","facing=east","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14881, "attachment=SINGLE_WALL","facing=east","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14882, "attachment=DOUBLE_WALL","facing=north","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14883, "attachment=DOUBLE_WALL","facing=north","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14884, "attachment=DOUBLE_WALL","facing=south","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14885, "attachment=DOUBLE_WALL","facing=south","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14886, "attachment=DOUBLE_WALL","facing=west","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14887, "attachment=DOUBLE_WALL","facing=west","powered=false"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14888, "attachment=DOUBLE_WALL","facing=east","powered=true"));
|
||||
Block.BELL.addBlockAlternative(new BlockAlternative((short) 14889, "attachment=DOUBLE_WALL","facing=east","powered=false"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +1,41 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchButton {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6398, "face=floor", "facing=north", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6399, "face=floor", "facing=north", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6400, "face=floor", "facing=south", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6401, "face=floor", "facing=south", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6402, "face=floor", "facing=west", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6403, "face=floor", "facing=west", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6404, "face=floor", "facing=east", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6405, "face=floor", "facing=east", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6406, "face=wall", "facing=north", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6407, "face=wall", "facing=north", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6408, "face=wall", "facing=south", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6409, "face=wall", "facing=south", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6410, "face=wall", "facing=west", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6411, "face=wall", "facing=west", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6412, "face=wall", "facing=east", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6413, "face=wall", "facing=east", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6414, "face=ceiling", "facing=north", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6415, "face=ceiling", "facing=north", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6416, "face=ceiling", "facing=south", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6417, "face=ceiling", "facing=south", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6418, "face=ceiling", "facing=west", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6419, "face=ceiling", "facing=west", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6420, "face=ceiling", "facing=east", "powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6421, "face=ceiling", "facing=east", "powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6398, "face=FLOOR","facing=north","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6399, "face=FLOOR","facing=north","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6400, "face=FLOOR","facing=south","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6401, "face=FLOOR","facing=south","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6402, "face=FLOOR","facing=west","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6403, "face=FLOOR","facing=west","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6404, "face=FLOOR","facing=east","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6405, "face=FLOOR","facing=east","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6406, "face=WALL","facing=north","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6407, "face=WALL","facing=north","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6408, "face=WALL","facing=south","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6409, "face=WALL","facing=south","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6410, "face=WALL","facing=west","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6411, "face=WALL","facing=west","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6412, "face=WALL","facing=east","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6413, "face=WALL","facing=east","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6414, "face=CEILING","facing=north","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6415, "face=CEILING","facing=north","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6416, "face=CEILING","facing=south","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6417, "face=CEILING","facing=south","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6418, "face=CEILING","facing=west","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6419, "face=CEILING","facing=west","powered=false"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6420, "face=CEILING","facing=east","powered=true"));
|
||||
Block.BIRCH_BUTTON.addBlockAlternative(new BlockAlternative((short) 6421, "face=CEILING","facing=east","powered=false"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchDoor {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_DOOR.addBlockAlternative(new BlockAlternative((short) 8806, "facing=north","half=upper","hinge=left","open=true","powered=true"));
|
||||
Block.BIRCH_DOOR.addBlockAlternative(new BlockAlternative((short) 8807, "facing=north","half=upper","hinge=left","open=true","powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchFence {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_FENCE.addBlockAlternative(new BlockAlternative((short) 8614, "east=true","north=true","south=true","waterlogged=true","west=true"));
|
||||
Block.BIRCH_FENCE.addBlockAlternative(new BlockAlternative((short) 8615, "east=true","north=true","south=true","waterlogged=true","west=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchFenceGate {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_FENCE_GATE.addBlockAlternative(new BlockAlternative((short) 8454, "facing=north","in_wall=true","open=true","powered=true"));
|
||||
Block.BIRCH_FENCE_GATE.addBlockAlternative(new BlockAlternative((short) 8455, "facing=north","in_wall=true","open=true","powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchLeaves {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_LEAVES.addBlockAlternative(new BlockAlternative((short) 173, "distance=1","persistent=true"));
|
||||
Block.BIRCH_LEAVES.addBlockAlternative(new BlockAlternative((short) 174, "distance=1","persistent=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchLog {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_LOG.addBlockAlternative(new BlockAlternative((short) 79, "axis=x"));
|
||||
Block.BIRCH_LOG.addBlockAlternative(new BlockAlternative((short) 80, "axis=y"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchPlanks {
|
||||
public static void initStates() {
|
||||
Block.BIRCH_PLANKS.addBlockAlternative(new BlockAlternative((short) 17));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchPressurePlate {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_PRESSURE_PLATE.addBlockAlternative(new BlockAlternative((short) 3877, "powered=true"));
|
||||
Block.BIRCH_PRESSURE_PLATE.addBlockAlternative(new BlockAlternative((short) 3878, "powered=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchSapling {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_SAPLING.addBlockAlternative(new BlockAlternative((short) 25, "stage=0"));
|
||||
Block.BIRCH_SAPLING.addBlockAlternative(new BlockAlternative((short) 26, "stage=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchSign {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_SIGN.addBlockAlternative(new BlockAlternative((short) 3445, "rotation=0","waterlogged=true"));
|
||||
Block.BIRCH_SIGN.addBlockAlternative(new BlockAlternative((short) 3446, "rotation=0","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchSlab {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_SLAB.addBlockAlternative(new BlockAlternative((short) 8316, "type=top","waterlogged=true"));
|
||||
Block.BIRCH_SLAB.addBlockAlternative(new BlockAlternative((short) 8317, "type=top","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchStairs {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_STAIRS.addBlockAlternative(new BlockAlternative((short) 5488, "facing=north","half=top","shape=straight","waterlogged=true"));
|
||||
Block.BIRCH_STAIRS.addBlockAlternative(new BlockAlternative((short) 5489, "facing=north","half=top","shape=straight","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchTrapdoor {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_TRAPDOOR.addBlockAlternative(new BlockAlternative((short) 4239, "facing=north","half=top","open=true","powered=true","waterlogged=true"));
|
||||
Block.BIRCH_TRAPDOOR.addBlockAlternative(new BlockAlternative((short) 4240, "facing=north","half=top","open=true","powered=true","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchWallSign {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_WALL_SIGN.addBlockAlternative(new BlockAlternative((short) 3751, "facing=north","waterlogged=true"));
|
||||
Block.BIRCH_WALL_SIGN.addBlockAlternative(new BlockAlternative((short) 3752, "facing=north","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BirchWood {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BIRCH_WOOD.addBlockAlternative(new BlockAlternative((short) 115, "axis=x"));
|
||||
Block.BIRCH_WOOD.addBlockAlternative(new BlockAlternative((short) 116, "axis=y"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackBanner {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_BANNER.addBlockAlternative(new BlockAlternative((short) 8141, "rotation=0"));
|
||||
Block.BLACK_BANNER.addBlockAlternative(new BlockAlternative((short) 8142, "rotation=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackBed {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_BED.addBlockAlternative(new BlockAlternative((short) 1289, "facing=north","occupied=true","part=head"));
|
||||
Block.BLACK_BED.addBlockAlternative(new BlockAlternative((short) 1290, "facing=north","occupied=true","part=foot"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackCarpet {
|
||||
public static void initStates() {
|
||||
Block.BLACK_CARPET.addBlockAlternative(new BlockAlternative((short) 7885));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackConcrete {
|
||||
public static void initStates() {
|
||||
Block.BLACK_CONCRETE.addBlockAlternative(new BlockAlternative((short) 9457));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackConcretePowder {
|
||||
public static void initStates() {
|
||||
Block.BLACK_CONCRETE_POWDER.addBlockAlternative(new BlockAlternative((short) 9473));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackGlazedTerracotta {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_GLAZED_TERRACOTTA.addBlockAlternative(new BlockAlternative((short) 9438, "facing=north"));
|
||||
Block.BLACK_GLAZED_TERRACOTTA.addBlockAlternative(new BlockAlternative((short) 9439, "facing=south"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackShulkerBox {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_SHULKER_BOX.addBlockAlternative(new BlockAlternative((short) 9372, "facing=north"));
|
||||
Block.BLACK_SHULKER_BOX.addBlockAlternative(new BlockAlternative((short) 9373, "facing=east"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackStainedGlass {
|
||||
public static void initStates() {
|
||||
Block.BLACK_STAINED_GLASS.addBlockAlternative(new BlockAlternative((short) 4110));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackStainedGlassPane {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_STAINED_GLASS_PANE.addBlockAlternative(new BlockAlternative((short) 7347, "east=true","north=true","south=true","waterlogged=true","west=true"));
|
||||
Block.BLACK_STAINED_GLASS_PANE.addBlockAlternative(new BlockAlternative((short) 7348, "east=true","north=true","south=true","waterlogged=true","west=false"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackTerracotta {
|
||||
public static void initStates() {
|
||||
Block.BLACK_TERRACOTTA.addBlockAlternative(new BlockAlternative((short) 6866));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackWallBanner {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACK_WALL_BANNER.addBlockAlternative(new BlockAlternative((short) 8217, "facing=north"));
|
||||
Block.BLACK_WALL_BANNER.addBlockAlternative(new BlockAlternative((short) 8218, "facing=south"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackWool {
|
||||
public static void initStates() {
|
||||
Block.BLACK_WOOL.addBlockAlternative(new BlockAlternative((short) 1399));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class Blackstone {
|
||||
public static void initStates() {
|
||||
Block.BLACKSTONE.addBlockAlternative(new BlockAlternative((short) 15847));
|
||||
}
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackstoneSlab {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACKSTONE_SLAB.addBlockAlternative(new BlockAlternative((short) 16252, "type=top","waterlogged=true"));
|
||||
Block.BLACKSTONE_SLAB.addBlockAlternative(new BlockAlternative((short) 16253, "type=top","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackstoneStairs {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACKSTONE_STAIRS.addBlockAlternative(new BlockAlternative((short) 15848, "facing=north","half=top","shape=straight","waterlogged=true"));
|
||||
Block.BLACKSTONE_STAIRS.addBlockAlternative(new BlockAlternative((short) 15849, "facing=north","half=top","shape=straight","waterlogged=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlackstoneWall {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLACKSTONE_WALL.addBlockAlternative(new BlockAlternative((short) 15928, "east=none","north=none","south=none","up=true","waterlogged=true","west=none"));
|
||||
Block.BLACKSTONE_WALL.addBlockAlternative(new BlockAlternative((short) 15929, "east=none","north=none","south=none","up=true","waterlogged=true","west=low"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlastFurnace {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLAST_FURNACE.addBlockAlternative(new BlockAlternative((short) 14815, "facing=north","lit=true"));
|
||||
Block.BLAST_FURNACE.addBlockAlternative(new BlockAlternative((short) 14816, "facing=north","lit=false"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlueBanner {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLUE_BANNER.addBlockAlternative(new BlockAlternative((short) 8077, "rotation=0"));
|
||||
Block.BLUE_BANNER.addBlockAlternative(new BlockAlternative((short) 8078, "rotation=1"));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlueBed {
|
||||
/**
|
||||
* Completely internal. DO NOT USE. IF YOU ARE A USER AND FACE A PROBLEM WHILE USING THIS CODE, THAT'S ON YOU.
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public static void initStates() {
|
||||
Block.BLUE_BED.addBlockAlternative(new BlockAlternative((short) 1225, "facing=north","occupied=true","part=head"));
|
||||
Block.BLUE_BED.addBlockAlternative(new BlockAlternative((short) 1226, "facing=north","occupied=true","part=foot"));
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlueCarpet {
|
||||
public static void initStates() {
|
||||
Block.BLUE_CARPET.addBlockAlternative(new BlockAlternative((short) 7881));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlueConcrete {
|
||||
public static void initStates() {
|
||||
Block.BLUE_CONCRETE.addBlockAlternative(new BlockAlternative((short) 9453));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.minestom.server.instance.block.states;
|
||||
|
||||
import java.lang.Deprecated;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockAlternative;
|
||||
|
||||
/**
|
||||
* AUTOGENERATED by BlockGenerator
|
||||
*/
|
||||
@Deprecated(
|
||||
since = "forever",
|
||||
forRemoval = false
|
||||
)
|
||||
public final class BlueConcretePowder {
|
||||
public static void initStates() {
|
||||
Block.BLUE_CONCRETE_POWDER.addBlockAlternative(new BlockAlternative((short) 9469));
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue