From 050d88e9eb66cd2f28b3907c3c8465eaac33cbfb Mon Sep 17 00:00:00 2001 From: NightKosh Date: Sun, 28 Oct 2018 20:57:47 +0300 Subject: [PATCH] Create grave at falling into the void in end dimension, #289 --- .../gravestone/helper/GraveGenerationHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/nightkosh/gravestone/helper/GraveGenerationHelper.java b/src/main/java/nightkosh/gravestone/helper/GraveGenerationHelper.java index 9440ff02..b612ad73 100644 --- a/src/main/java/nightkosh/gravestone/helper/GraveGenerationHelper.java +++ b/src/main/java/nightkosh/gravestone/helper/GraveGenerationHelper.java @@ -7,6 +7,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.*; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -17,6 +18,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.translation.I18n; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.event.entity.living.LivingDeathEvent; @@ -672,6 +674,14 @@ private static BlockPos findPlaceForGrave(World world, Entity entity, BlockPos p } } + if (world.provider.getDimensionType() == DimensionType.THE_END && pos.getY() <= 0) { + BlockPos groundPos = new BlockPos(pos.getX(), 0, pos.getZ()); + if (world.isAirBlock(pos)) { + world.setBlockState(groundPos, Blocks.END_STONE.getDefaultState()); + return groundPos.up(); + } + } + int x = pos.getX(); int y = pos.getY(); int z = pos.getZ();