-
-
Save adudewithapc/b7dae26e3b1d084132fd297f8acb65a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package thatmartinguy.thedarkness.world.gen; | |
import net.minecraft.init.Blocks; | |
import net.minecraft.tileentity.TileEntityShulkerBox; | |
import net.minecraft.util.EnumFacing; | |
import net.minecraft.util.math.BlockPos; | |
import net.minecraft.world.DimensionType; | |
import net.minecraft.world.World; | |
import net.minecraft.world.chunk.Chunk; | |
import net.minecraft.world.chunk.IChunkProvider; | |
import net.minecraft.world.gen.IChunkGenerator; | |
import net.minecraftforge.fml.common.IWorldGenerator; | |
import thatmartinguy.thedarkness.init.ModLootTables; | |
import java.util.Random; | |
public class WorldGenReliquaryChest implements IWorldGenerator | |
{ | |
@Override | |
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) | |
{ | |
int spawnX = world.getSpawnPoint().getX(); | |
int spawnZ = world.getSpawnPoint().getZ(); | |
Chunk spawnChunk = world.getChunkFromBlockCoords(new BlockPos(spawnX >> 4, world.getSpawnPoint().getY(), spawnZ >> 4)); | |
if(world.provider.getDimensionType() == DimensionType.THE_END && chunkX == spawnChunk.x && chunkZ == spawnChunk.z) | |
{ | |
BlockPos chestPosition = world.getSpawnPoint().offset(EnumFacing.NORTH); | |
world.setBlockState(chestPosition, Blocks.BLACK_SHULKER_BOX.getDefaultState(), 3); | |
if (world.getTileEntity(chestPosition) instanceof TileEntityShulkerBox) | |
{ | |
TileEntityShulkerBox entityBox = (TileEntityShulkerBox) world.getTileEntity(chestPosition); | |
entityBox.setLootTable(ModLootTables.lootReliquary, 1); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment