Skip to content

Commit

Permalink
Implement more entity data
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 26, 2024
1 parent 98a1b7f commit ff418b9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static JsonObject generateEntity(EntityType<?> entityType) {
entityDesc.addProperty("summonable", true);
}

if (entityType.fireImmune()) {
entityDesc.addProperty("fireImmune", true);
}

var defaultEntity = MCHelper.createEntity(entityType);
if (defaultEntity.isAttackable()) {
entityDesc.addProperty("attackable", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public record EntityType(
String category,
boolean friendly,
boolean summonable,
boolean fireImmune,
boolean attackable,
boolean boatEntity,
boolean minecartEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public record EntityType(
String category,
boolean friendly,
boolean summonable,
boolean fireImmune,
boolean attackable,
boolean boatEntity,
boolean minecartEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public abstract class Entity {
private static final int FLAG_INVISIBLE = 5;
protected static final int FLAG_GLOWING = 6;
protected static final int FLAG_FALL_FLYING = 7;
public static final float BREATHING_DISTANCE_BELOW_EYES = 0.11111111F;
private static final AABB INITIAL_AABB = new AABB(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
protected final EntityAttributeState attributeState = new EntityAttributeState();
protected final EntityEffectState effectState = new EntityEffectState();
Expand Down Expand Up @@ -270,6 +269,18 @@ protected void checkSupportingBlock(boolean onGround, @Nullable Vector3d movemen
}
}

public boolean fireImmune() {
return this.entityType.fireImmune();
}

public boolean isCurrentlyGlowing() {
return this.getSharedFlag(FLAG_GLOWING);
}

public boolean isInvisible() {
return this.getSharedFlag(FLAG_INVISIBLE);
}

public boolean onGround() {
return this.onGround;
}
Expand Down
17 changes: 17 additions & 0 deletions server/src/main/resources/minecraft/entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"category": "misc",
"friendly": true,
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"area_effect_cloud",
Expand Down Expand Up @@ -335,6 +336,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"blaze",
Expand Down Expand Up @@ -696,6 +698,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"creaking",
Expand All @@ -718,6 +721,7 @@
"updateInterval": 3,
"clientTrackingRange": 8,
"category": "monster",
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"creaking_transient",
Expand Down Expand Up @@ -1003,6 +1007,7 @@
"clientTrackingRange": 10,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"ender_dragon",
Expand Down Expand Up @@ -1048,6 +1053,7 @@
"category": "misc",
"friendly": true,
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"end_crystal",
Expand Down Expand Up @@ -1310,6 +1316,7 @@
"clientTrackingRange": 10,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"ghast",
Expand Down Expand Up @@ -1819,6 +1826,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"magma_cube",
Expand Down Expand Up @@ -2492,6 +2500,7 @@
"clientTrackingRange": 10,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"shulker",
Expand Down Expand Up @@ -2889,6 +2898,7 @@
"category": "creature",
"friendly": true,
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"strider",
Expand Down Expand Up @@ -2960,6 +2970,7 @@
"category": "misc",
"friendly": true,
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"primed_tnt",
Expand Down Expand Up @@ -3102,6 +3113,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"vex",
Expand Down Expand Up @@ -3201,6 +3213,7 @@
"clientTrackingRange": 16,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"warden",
Expand Down Expand Up @@ -3273,6 +3286,7 @@
"clientTrackingRange": 10,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"wither_boss",
Expand All @@ -3296,6 +3310,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"wither_skeleton",
Expand Down Expand Up @@ -3368,6 +3383,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"zoglin",
Expand Down Expand Up @@ -3464,6 +3480,7 @@
"clientTrackingRange": 8,
"category": "monster",
"summonable": true,
"fireImmune": true,
"attackable": true,
"inheritedClasses": [
"zombified_piglin",
Expand Down

0 comments on commit ff418b9

Please sign in to comment.