diff --git a/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/ComponentPushable.kt b/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/ComponentPushable.kt new file mode 100644 index 0000000..974953c --- /dev/null +++ b/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/ComponentPushable.kt @@ -0,0 +1,6 @@ +package net.easecation.bedrockloader.bedrock.entity.components + +data class ComponentPushable( + val is_pushable: Boolean?, + val is_pushable_by_piston: Boolean?, +) : IEntityComponent diff --git a/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/EntityComponents.kt b/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/EntityComponents.kt index cc44ead..eba731f 100644 --- a/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/EntityComponents.kt +++ b/src/main/kotlin/net/easecation/bedrockloader/bedrock/entity/components/EntityComponents.kt @@ -21,5 +21,6 @@ data class EntityComponents( @SerializedName("minecraft:skin_id") val minecraftSkinId: Int?, @SerializedName("minecraft:health") val minecraftHealth: ComponentHealth?, @SerializedName("minecraft:rideable") val minecraftRideable: ComponentRideable?, - @SerializedName("minecraft:is_immobile") val minecraftIsImmobile: ComponentIsImmobile? + @SerializedName("minecraft:is_immobile") val minecraftIsImmobile: ComponentIsImmobile?, + @SerializedName("minecraft:pushable") val minecraftPushable: ComponentPushable?, ) \ No newline at end of file diff --git a/src/main/kotlin/net/easecation/bedrockloader/entity/EntityDataDriven.kt b/src/main/kotlin/net/easecation/bedrockloader/entity/EntityDataDriven.kt index 9948fca..e4635ed 100644 --- a/src/main/kotlin/net/easecation/bedrockloader/entity/EntityDataDriven.kt +++ b/src/main/kotlin/net/easecation/bedrockloader/entity/EntityDataDriven.kt @@ -1,12 +1,10 @@ package net.easecation.bedrockloader.entity +import net.easecation.bedrockloader.BedrockLoader import net.easecation.bedrockloader.bedrock.entity.components.EntityComponents import net.easecation.bedrockloader.loader.BedrockAddonsRegistry import net.fabricmc.fabric.api.`object`.builder.v1.entity.FabricEntityTypeBuilder -import net.minecraft.entity.EntityDimensions -import net.minecraft.entity.EntityType -import net.minecraft.entity.EquipmentSlot -import net.minecraft.entity.SpawnGroup +import net.minecraft.entity.* import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes import net.minecraft.entity.damage.DamageSource @@ -47,6 +45,22 @@ class EntityDataDriven( } } + override fun isPushable(): Boolean { + return components.minecraftPushable?.is_pushable ?: false + } + + override fun pushAwayFrom(entity: Entity?) { + if (this.isPushable) { + super.pushAwayFrom(entity) + } + } + + override fun pushAway(entity: Entity?) { + if (this.isPushable) { + super.pushAway(entity) + } + } + override fun getArmorItems(): MutableIterable { return mutableListOf() } @@ -63,7 +77,7 @@ class EntityDataDriven( } override fun hasNoGravity(): Boolean { - return components.minecraftPhysics?.has_gravity == true + return components.minecraftPhysics?.has_gravity == false } override fun damage(source: DamageSource?, amount: Float): Boolean { diff --git a/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockBehaviorPackLoader.kt b/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockBehaviorPackLoader.kt index 3376e58..f1ad614 100644 --- a/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockBehaviorPackLoader.kt +++ b/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockBehaviorPackLoader.kt @@ -39,7 +39,6 @@ class BedrockBehaviorPackLoader( Registry.register(Registry.ITEM, id, item) BedrockAddonsRegistry.items[id] = item } - BedrockLoader.logger.info("test") // Entity context.behavior.entities.forEach { (id, beh) -> BedrockLoader.logger.info("Registering entity $id") diff --git a/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockResourcePackLoader.kt b/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockResourcePackLoader.kt index 30fa45c..54ca9a5 100644 --- a/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockResourcePackLoader.kt +++ b/src/main/kotlin/net/easecation/bedrockloader/loader/BedrockResourcePackLoader.kt @@ -388,14 +388,14 @@ class BedrockResourcePackLoader( context.resource.itemTexture[spawnEggTexture]?.textures?.let { val bedrockTexture = context.resource.textureImages[it] if (bedrockTexture == null) { - BedrockLoader.logger.warn("[BedrockResourcePackLoader] Entity spawn egg texture not found: ${spawnEggTexture}") - return - } - val namespaceDir = this.namespaceDir(identifier.namespace) - val bedrockTextureFile = namespaceDir.resolve("textures/" + model.textures!!["layer0"]!!.path + "." + bedrockTexture.type.getExtension()) - bedrockTextureFile.parentFile.mkdirs() - bedrockTexture.image.let { image -> - ImageIO.write(image, bedrockTextureFile.extension, bedrockTextureFile) + BedrockLoader.logger.warn("[BedrockResourcePackLoader] Entity spawn egg texture not found: $spawnEggTexture") + } else { + val namespaceDir = this.namespaceDir(identifier.namespace) + val bedrockTextureFile = namespaceDir.resolve("textures/" + model.textures!!["layer0"]!!.path + "." + bedrockTexture.type.getExtension()) + bedrockTextureFile.parentFile.mkdirs() + bedrockTexture.image.let { image -> + ImageIO.write(image, bedrockTextureFile.extension, bedrockTextureFile) + } } } } else {