Skip to content

Commit

Permalink
fix: Iesnium Golem fell out world (#1290)
Browse files Browse the repository at this point in the history
* Update IesniumGolemEntity.java

* missing import
  • Loading branch information
Eqis-Edu authored Jan 17, 2025
1 parent 5e960f9 commit d0082bf
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
Expand Down Expand Up @@ -82,6 +83,15 @@ public boolean canAttackType(EntityType<?> type) {

@Override
public boolean isInvulnerableTo(DamageSource source) {
if(source.is(DamageTypes.FELL_OUT_OF_WORLD)) {
this.teleportTo(this.level().getSharedSpawnPos().getX(), this.level().getSharedSpawnPos().getY(), this.level().getSharedSpawnPos().getZ());
while (!level().getBlockState(this.getOnPos()).getBlock().isPossibleToRespawnInThis(level().getBlockState(this.getOnPos()))
|| !level().getBlockState(this.getOnPos(1)).getBlock().isPossibleToRespawnInThis(level().getBlockState(this.getOnPos(1)))
|| !level().getBlockState(this.getOnPos(2)).getBlock().isPossibleToRespawnInThis(level().getBlockState(this.getOnPos(2)))
|| !level().getBlockState(this.getOnPos(3)).getBlock().isPossibleToRespawnInThis(level().getBlockState(this.getOnPos(3))))
this.teleportRelative(0, 1, 0);
}

if (source.getEntity() == null || !source.getEntity().isCrouching())
return true;

Expand Down

0 comments on commit d0082bf

Please sign in to comment.