Files
2019-02-24 22:29:41 +08:00

126 lines
6.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockBed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBed.java
@@ -38,20 +38,20 @@
public class BlockBed extends BlockHorizontal implements ITileEntityProvider
{
- public static final PropertyEnum<BlockBed.EnumPartType> PART = PropertyEnum.<BlockBed.EnumPartType>create("part", BlockBed.EnumPartType.class);
+ public static final PropertyEnum<EnumPartType> PART = PropertyEnum.<EnumPartType>create("part", EnumPartType.class);
public static final PropertyBool OCCUPIED = PropertyBool.create("occupied");
protected static final AxisAlignedBB BED_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5625D, 1.0D);
public BlockBed()
{
super(Material.CLOTH);
- this.setDefaultState(this.blockState.getBaseState().withProperty(PART, BlockBed.EnumPartType.FOOT).withProperty(OCCUPIED, Boolean.valueOf(false)));
+ this.setDefaultState(this.blockState.getBaseState().withProperty(PART, EnumPartType.FOOT).withProperty(OCCUPIED, Boolean.valueOf(false)));
this.hasTileEntity = true;
}
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- if (state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+ if (state.getValue(PART) == EnumPartType.FOOT)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
@@ -73,7 +73,7 @@
}
else
{
- if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
+ if (state.getValue(PART) != EnumPartType.HEAD)
{
pos = pos.offset((EnumFacing)state.getValue(FACING));
state = worldIn.getBlockState(pos);
@@ -84,8 +84,10 @@
}
}
- if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL)
+ net.minecraft.world.WorldProvider.WorldSleepResult sleepResult = worldIn.provider.canSleepAt(playerIn, pos);
+ if (sleepResult != net.minecraft.world.WorldProvider.WorldSleepResult.BED_EXPLODES)
{
+ if (sleepResult == net.minecraft.world.WorldProvider.WorldSleepResult.DENY) return true;
if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
{
EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);
@@ -192,7 +194,7 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
- if (state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+ if (state.getValue(PART) == EnumPartType.FOOT)
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this)
{
@@ -212,7 +214,7 @@
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
- return state.getValue(PART) == BlockBed.EnumPartType.FOOT ? Items.AIR : Items.BED;
+ return state.getValue(PART) == EnumPartType.FOOT ? Items.AIR : Items.BED;
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
@@ -270,7 +272,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (state.getValue(PART) == BlockBed.EnumPartType.HEAD)
+ if (state.getValue(PART) == EnumPartType.HEAD)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
EnumDyeColor enumdyecolor = tileentity instanceof TileEntityBed ? ((TileEntityBed)tileentity).getColor() : EnumDyeColor.RED;
@@ -298,7 +300,7 @@
{
BlockPos blockpos = pos;
- if (state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+ if (state.getValue(PART) == EnumPartType.FOOT)
{
blockpos = pos.offset((EnumFacing)state.getValue(FACING));
}
@@ -310,7 +312,7 @@
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
- if (player.capabilities.isCreativeMode && state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+ if (player.capabilities.isCreativeMode && state.getValue(PART) == EnumPartType.FOOT)
{
BlockPos blockpos = pos.offset((EnumFacing)state.getValue(FACING));
@@ -323,7 +325,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
{
- if (state.getValue(PART) == BlockBed.EnumPartType.HEAD && te instanceof TileEntityBed)
+ if (state.getValue(PART) == EnumPartType.HEAD && te instanceof TileEntityBed)
{
TileEntityBed tileentitybed = (TileEntityBed)te;
ItemStack itemstack = tileentitybed.getItemStack();
@@ -344,12 +346,12 @@
public IBlockState getStateFromMeta(int meta)
{
EnumFacing enumfacing = EnumFacing.getHorizontal(meta);
- return (meta & 8) > 0 ? this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.HEAD).withProperty(FACING, enumfacing).withProperty(OCCUPIED, Boolean.valueOf((meta & 4) > 0)) : this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.FOOT).withProperty(FACING, enumfacing);
+ return (meta & 8) > 0 ? this.getDefaultState().withProperty(PART, EnumPartType.HEAD).withProperty(FACING, enumfacing).withProperty(OCCUPIED, Boolean.valueOf((meta & 4) > 0)) : this.getDefaultState().withProperty(PART, EnumPartType.FOOT).withProperty(FACING, enumfacing);
}
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- if (state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+ if (state.getValue(PART) == EnumPartType.FOOT)
{
IBlockState iblockstate = worldIn.getBlockState(pos.offset((EnumFacing)state.getValue(FACING)));
@@ -377,7 +379,7 @@
int i = 0;
i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
- if (state.getValue(PART) == BlockBed.EnumPartType.HEAD)
+ if (state.getValue(PART) == EnumPartType.HEAD)
{
i |= 8;