Skip to content

Commit

Permalink
Fix #5, mobs may only join a raid if they can see the sky
Browse files Browse the repository at this point in the history
  • Loading branch information
rikka0w0 committed May 29, 2022
1 parent 8c8375c commit 789644d
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fabric/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ org.gradle.daemon=false
fabric_version=0.48.0+1.18.2

# Mod Properties
mod_version = 3.3.3
mod_version = 3.3.4
dev_group = net.mobz
archives_base_name = mobz

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MobZ (Reborn)
A port of [Globox1997's MobZ](https://www.curseforge.com/minecraft/mc-mods/mobz), for Minecraft 1.18.1, 1.17.1, and 1.16.5. Supports both Forge and Fabric.
A port of [Globox1997's MobZ](https://www.curseforge.com/minecraft/mc-mods/mobz), for Minecraft 1.18.2, 1.17.1, and 1.16.5. Supports both Forge and Fabric.

1.16.5 only has Forge version, for 1.16.5 Fabric version, check out [the original MobZ](https://github.com/Globox1997/MobZ).

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/mobz/entity/Archer2Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public boolean checkSpawnObstruction(LevelReader view) {

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}

@Override
protected void dropCustomDeathLoot(DamageSource damageSource_1, int int_1, boolean boolean_1) {
return;
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/mobz/entity/ArcherEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,20 @@ protected void registerGoals() {
this.targetSelector.addGoal(4, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers(IceGolem.class));
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}

@Override
public boolean checkSpawnObstruction(LevelReader view) {
BlockPos blockunderentity = new BlockPos(this.getX(), this.getY() - 1, this.getZ());
BlockPos posentity = new BlockPos(this.getX(), this.getY(), this.getZ());
return view.isUnobstructed(this) && this.level.isDay() && !level.containsAnyLiquid(this.getBoundingBox())
&& view.canSeeSky(blockunderentity)
&& this.level.getBlockState(posentity).getBlock().isPossibleToRespawnInThis() && this.level
.getBlockState(blockunderentity).isValidSpawn(view, blockunderentity, MobZEntities.ARCHERENTITY.get())
&& MobZ.configs.BowmanSpawn;

}

}
5 changes: 5 additions & 0 deletions src/main/java/net/mobz/entity/DwarfEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@ public boolean checkSpawnObstruction(LevelReader view) {
&& MobZ.configs.DwarfSpawn;

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
5 changes: 5 additions & 0 deletions src/main/java/net/mobz/entity/Illusioner.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ protected SoundEvent getHurtSound(DamageSource damageSource_1) {
return MobZSounds.ILLUHURTEVENT.get();
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}

@Override
public boolean checkSpawnObstruction(LevelReader view) {
BlockPos blockunderentity = new BlockPos(this.getX(), this.getY() - 1, this.getZ());
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/mobz/entity/IslandKing.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ public void attack(LivingEntity target, float f) {
IslandKing.this.level.addFreshEntity(vexEntity);
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/mobz/entity/IslandKnightNormal.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ protected SoundEvent getDeathSound() {
return SoundEvents.PLAYER_DEATH;
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/mobz/entity/IslandKnightSpecial2.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ public void doEnchantDamageEffects(LivingEntity attacker, Entity target) {
}
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
4 changes: 4 additions & 0 deletions src/main/java/net/mobz/entity/Knight2Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ public boolean checkSpawnObstruction(LevelReader view) {

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
6 changes: 5 additions & 1 deletion src/main/java/net/mobz/entity/Knight3Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public boolean checkSpawnObstruction(LevelReader view) {
&& this.level.getBlockState(blockunderentity).isValidSpawn(view, blockunderentity,
MobZEntities.KNIGHT3ENTITY.get())
&& MobZ.configs.EnderKnightSpawn;

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
5 changes: 4 additions & 1 deletion src/main/java/net/mobz/entity/Knight5Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ public boolean checkSpawnObstruction(LevelReader view) {
&& this.level.getBlockState(blockunderentity).isValidSpawn(view, blockunderentity,
MobZEntities.KNIGHT5ENTITY.get())
&& MobZ.configs.LordofDarknessSpawn;

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}
}
6 changes: 5 additions & 1 deletion src/main/java/net/mobz/entity/Mage2Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ public boolean checkSpawnObstruction(LevelReader view) {
&& this.level.getBlockState(posentity).getBlock().isPossibleToRespawnInThis()
&& this.level.getBlockState(blockunderentity).isValidSpawn(view, blockunderentity, MobZEntities.MAGE2ENTITY.get())
&& MobZ.configs.ZombieMageSpawn;

}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}

@Override
protected void defineSynchedData() {
super.defineSynchedData();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/mobz/entity/MageEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ protected void registerGoals() {
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, IronGolem.class, false));
}

@Override
public boolean canJoinRaid() {
return super.canJoinRaid() && this.level.canSeeSky(this.blockPosition());
}

@Override
protected void defineSynchedData() {
super.defineSynchedData();
Expand Down

0 comments on commit 789644d

Please sign in to comment.