Skip to content

Commit

Permalink
fix spawn checks
Browse files Browse the repository at this point in the history
fix #1286
  • Loading branch information
Cheaterpaul committed Nov 17, 2023
1 parent a011575 commit 46a1dd0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ public void onAttachCapabilityEntity(@NotNull AttachCapabilitiesEvent<Entity> ev

@SubscribeEvent
public void onFinalizeSpawn(@NotNull MobSpawnEvent.FinalizeSpawn event) {
BlockPos pos = new BlockPos((int) (event.getX() - 0.4F), (int) event.getY(), (int) (event.getZ() - 0.4F)).below();
BlockPos pos = new BlockPos((int) (event.getX() - 0.6f), (int) event.getY(), (int) (event.getZ() - 0.6f)).below();
if (!event.getLevel().hasChunkAt(pos)) return;
BlockState blockState = event.getLevel().getBlockState(pos);

if (blockState.is(ModTags.Blocks.NO_SPAWN) || (blockState.is(ModTags.Blocks.VAMPIRE_SPAWN) || event.getEntity().getClassification(false) == VReference.VAMPIRE_CREATURE_TYPE)) {
if (blockState.is(ModTags.Blocks.NO_SPAWN) || (blockState.is(ModTags.Blocks.VAMPIRE_SPAWN) && event.getEntity().getClassification(false) != VReference.VAMPIRE_CREATURE_TYPE)) {
event.setSpawnCancelled(true);
}
}
Expand Down

0 comments on commit 46a1dd0

Please sign in to comment.