Skip to content
Merged

26.2 #56

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
**/logs/
**/output/
/eula.txt
/gradle.properties
/MinestomData/

/src/main/resources/
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public enum DataGenType {
PAINTING_VARIANTS("painting_variant", new GenericResourceGenerator("painting_variant")),
PIG_VARIANTS("pig_variant", new GenericResourceGenerator("pig_variant")),
PIG_SOUND_VARIANTS("pig_sound_variant", new GenericResourceGenerator("pig_sound_variant")),
SULFUR_CUBE_ARCHETYPE("sulfur_cube_archetype", new GenericResourceGenerator("sulfur_cube_archetype")),
TIMELINE("timeline", new GenericResourceGenerator("timeline")),
TRIM_MATERIALS("trim_material", new GenericResourceGenerator("trim_material")),
TRIM_PATTERNS("trim_pattern", new GenericResourceGenerator("trim_pattern")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class EntityGenerator extends DataGenerator {
@Override
public JsonObject generate() {
Map<EntityType<?>, Class<?>> entityClasses = new HashMap<>();
for (Field declaredField : EntityType.class.getDeclaredFields()) {
for (Field declaredField : EntityTypes.class.getDeclaredFields()) {
if (!EntityType.class.isAssignableFrom(declaredField.getType())) {
continue;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public JsonObject generate() {
if (DefaultAttributes.hasSupplier(entityType)) {
JsonObject defaultAttributes = computeDefaultAttributes(entityType);

if (defaultAttributes != null && defaultAttributes.size() > 0) {
if (defaultAttributes != null && !defaultAttributes.isEmpty()) {
entity.add("defaultAttributes", defaultAttributes);
}
}
Expand All @@ -126,6 +126,7 @@ private JsonObject computeDefaultAttributes(EntityType<?> entityType) {
try {
EntityType<? extends LivingEntity> livingType = (EntityType<? extends LivingEntity>) entityType;
AttributeSupplier supplier = DefaultAttributes.getSupplier(livingType);
//noinspection ConstantValue, is actually nullable
if (supplier == null) return null;

Map<Holder<Attribute>, AttributeInstance> instances = getAttributeInstances(supplier);
Expand Down Expand Up @@ -161,52 +162,53 @@ private Map<Holder<Attribute>, AttributeInstance> getAttributeInstances(Attribut
private double findDrag(EntityType<?> entityType) {
if (isBoat(entityType)) return 0;

if (entityType == EntityType.LLAMA_SPIT) return 0.01;
if (entityType == EntityType.ENDER_PEARL) return 0.01;
if (entityType == EntityType.SPLASH_POTION || entityType == EntityType.LINGERING_POTION) return 0.01;
if (entityType == EntityType.SNOWBALL) return 0.01;
if (entityType == EntityType.EGG) return 0.01;
if (entityType == EntityType.TRIDENT) return 0.01;
if (entityType == EntityType.SPECTRAL_ARROW) return 0.01;
if (entityType == EntityType.ARROW) return 0.01;
if (entityType == EntityTypes.LLAMA_SPIT) return 0.01;
if (entityType == EntityTypes.ENDER_PEARL) return 0.01;
if (entityType == EntityTypes.SPLASH_POTION || entityType == EntityTypes.LINGERING_POTION) return 0.01;
if (entityType == EntityTypes.SNOWBALL) return 0.01;
if (entityType == EntityTypes.EGG) return 0.01;
if (entityType == EntityTypes.TRIDENT) return 0.01;
if (entityType == EntityTypes.SPECTRAL_ARROW) return 0.01;
if (entityType == EntityTypes.ARROW) return 0.01;

if (entityType == EntityType.MINECART) return 0.05;
if (entityType == EntityTypes.MINECART) return 0.05;

if (entityType == EntityType.FISHING_BOBBER) return 0.08;
if (entityType == EntityTypes.FISHING_BOBBER) return 0.08;

return DEFAULT_DRAG;
}

private double findAcceleration(EntityType<?> entityType) {
if (entityType == EntityType.ITEM_FRAME) return 0;
if (entityType == EntityTypes.ITEM_FRAME) return 0;

if (entityType == EntityType.EGG) return 0.03;
if (entityType == EntityType.FISHING_BOBBER) return 0.03;
if (entityType == EntityType.ENDER_PEARL) return 0.03;
if (entityType == EntityType.SNOWBALL) return 0.03;
if (entityType == EntityTypes.EGG) return 0.03;
if (entityType == EntityTypes.FISHING_BOBBER) return 0.03;
if (entityType == EntityTypes.ENDER_PEARL) return 0.03;
if (entityType == EntityTypes.SNOWBALL) return 0.03;

if (isBoat(entityType)) return 0.04;
if (entityType == EntityType.TNT) return 0.04;
if (entityType == EntityType.FALLING_BLOCK) return 0.04;
if (entityType == EntityType.ITEM) return 0.04;
if (entityType == EntityType.MINECART) return 0.04;
if (entityType == EntityTypes.TNT) return 0.04;
if (entityType == EntityTypes.FALLING_BLOCK) return 0.04;
if (entityType == EntityTypes.ITEM) return 0.04;
if (entityType == EntityTypes.MINECART) return 0.04;

if (entityType == EntityType.ARROW) return 0.05;
if (entityType == EntityType.SPECTRAL_ARROW) return 0.05;
if (entityType == EntityType.TRIDENT) return 0.05;
if (entityType == EntityType.SPLASH_POTION || entityType == EntityType.LINGERING_POTION) return 0.05;
if (entityType == EntityTypes.ARROW) return 0.05;
if (entityType == EntityTypes.SPECTRAL_ARROW) return 0.05;
if (entityType == EntityTypes.TRIDENT) return 0.05;
if (entityType == EntityTypes.SPLASH_POTION || entityType == EntityTypes.LINGERING_POTION) return 0.05;

if (entityType == EntityType.LLAMA_SPIT) return 0.06;
if (entityType == EntityTypes.LLAMA_SPIT) return 0.06;

if (entityType == EntityType.EXPERIENCE_BOTTLE) return 0.07;
if (entityType == EntityTypes.EXPERIENCE_BOTTLE) return 0.07;

if (entityType == EntityType.FIREBALL) return 0.1;
if (entityType == EntityType.WITHER_SKULL) return 0.1;
if (entityType == EntityType.DRAGON_FIREBALL) return 0.1;
if (entityType == EntityTypes.FIREBALL) return 0.1;
if (entityType == EntityTypes.WITHER_SKULL) return 0.1;
if (entityType == EntityTypes.DRAGON_FIREBALL) return 0.1;

return DEFAULT_ACCELERATION;
}

@SuppressWarnings("unchecked")
private @NotNull Map<EntityAttachment, List<Vec3>> getAttachmentMap(@NotNull EntityAttachments attachments) {
try {
var field = EntityAttachments.class.getDeclaredField("attachments");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public JsonObject generate() {
effect.addProperty("id", registry.getId(mobEffect));
effect.addProperty("translationKey", mobEffect.getDescriptionId());
effect.addProperty("color", mobEffect.getColor());
effect.addProperty("instantaneous", mobEffect.isInstantenous());
effect.addProperty("instantaneous", mobEffect.isInstantaneous());
effects.add(location.toString(), effect);
}
return effects;
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.configuration-cache=true
18 changes: 4 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
metadata.format.version = "1.1"

[versions]
gson = "2.13.2"
minecraft = "26.1.2"
gson = "2.14.0"
minecraft = "26.2"

slf4j-api = "2.0.17"
logback = "1.5.22"

loom = "1.15-SNAPSHOT"
nmcp = "1.4.4"
loom = "1.16-SNAPSHOT"
nmcp = "1.5.0"

[libraries]
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }

slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
logback-core = { group = "ch.qos.logback", name = "logback-core", version.ref = "logback" }
logback-classic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }

[bundles]
logging = ["slf4j-api", "logback-core", "logback-classic"]

[plugins]
nmcp = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }
loom = { id = "net.fabricmc.fabric-loom", version.ref = "loom" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Autogenerated data derived from <a href="https://github.com/Minestom/MinestomDataGenerator">MinestomDataGenerator</a>
*/
module net.minestom.data {
exports net.minestom.data;
}
24 changes: 20 additions & 4 deletions src/main/java/net/minestom/data/MinestomData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,26 @@ public final class MinestomData {
private static final String COMMIT = "&COMMIT";
private static final String BRANCH = "&BRANCH";

public static String commit() { return COMMIT; }
public static String branch() { return BRANCH; }
private MinestomData() {
}

/**
* Gets the commit used to generate the current data.
*
* @return the commit of the data generator used
*/
public static String commit() {
return COMMIT;
}

/**
* Gets the branch used to generate the current data.
*
* @return the branch
*/
public static String branch() {
return BRANCH;
}

/**
* Gets a resource from the data module.
Expand All @@ -24,6 +42,4 @@ public static InputStream resource(String path) {
// Otherwise would fail cause of encapsulation or would require opens.
return MinestomData.class.getResourceAsStream(path);
}

private MinestomData() {}
}