Posted September 2, 201213 yr I don't know if it needs a hook but I can't make a bed which you can sleep in it without modifying a base class. http://i.imgur.com/RvFDhZj.gif[/img]
September 3, 201213 yr At the end of Block.class you'll see forge already added things to make beds work. Your new bed block will need to override them. /** * Determines if this block is classified as a Bed, Allowing * players to sleep in it, though the block has to specifically * perform the sleeping functionality in it's activated event. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @return True to treat this as a bed */ public boolean isBed(World world, int x, int y, int z, EntityLiving player) { return blockID == Block.bed.blockID; } /** * Returns the position that the player is moved to upon * waking up, or respawning at the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @return The spawn position */ public ChunkCoordinates getBedSpawnPosition(World world, int x, int y, int z, EntityPlayer player) { return BlockBed.getNearestEmptyChunkCoordinates(world, x, y, z, 0); } /** * Called when a user either starts or stops sleeping in the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @param player The player or camera entity, null in some cases. * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed */ public void setBedOccupied(World world, int x, int y, int z, EntityPlayer player, boolean occupied) { BlockBed.setBedOccupied(world, x, y, z, occupied); } /** * Returns the direction of the block. Same values that * are returned by BlockDirectional * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @return Bed direction */ public int getBedDirection(IBlockAccess world, int x, int y, int z) { return BlockBed.getDirection(world.getBlockMetadata(x, y, z)); } /** * Determines if the current block is the foot half of the bed. * * @param world The current world * @param x X Position * @param y Y Position * @param z Z Position * @return True if the current block is the foot side of a bed. */ public boolean isBedFoot(IBlockAccess world, int x, int y, int z) { return BlockBed.isBlockHeadOfBed(world.getBlockMetadata(x, y, z)); }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.