<commit_before>--- /net/minecraft/entity/player
+++ /net/minecraft/entity/player
@@ -1255,7 +1255,7 @@
     }
 
     private boolean isInBed() {
-        return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.BED;
+        return xyz.openmodloader.event.impl.PlayerEvent.SleepCheck.handle(this, playerLocation);
     }
 
     @Nullable
@@ -1653,8 +1653,8 @@
             this.playEquipSound(var2);
             this.inventory.offHandInventory[0] = var2;
         } else if(var1.getSlotType() == EntityEquipmentSlot.a.ARMOR) {
-            this.playEquipSound(var2);
-            this.inventory.armorInventory[var1.getIndex()] = var2;
+            xyz.openmodloader.event.impl.ArmorEvent event = xyz.openmodloader.event.impl.ArmorEvent.handle(this, var2, var1);
+            if (event != null) { this.inventory.armorInventory[event.getSlot().getIndex()] = event.getArmor(); this.playEquipSound(var2); } else {inventory.addItemStackToInventory(var2); return;}
         }
 
     }<commit_msg>Prevent error if the player is sleeping without a bed<commit_after>--- /net/minecraft/entity/player
+++ /net/minecraft/entity/player
@@ -1174,7 +1174,8 @@
 
         this.setSize(0.2F, 0.2F);
         if(this.worldObj.isBlockLoaded(var1)) {
-            EnumFacing var7 = (EnumFacing)this.worldObj.getBlockState(var1).getValue(BlockHorizontal.FACING);
+            IBlockState state = worldObj.getBlockState(var1);
+            EnumFacing var7 = state.getProperties().containsKey(BlockHorizontal.FACING) ? this.worldObj.getBlockState(var1).getValue(BlockHorizontal.FACING) : EnumFacing.NORTH;
             float var3 = 0.5F;
             float var8 = 0.5F;
             switch(var7) {
@@ -1255,7 +1256,7 @@
     }
 
     private boolean isInBed() {
-        return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.BED;
+        return xyz.openmodloader.event.impl.PlayerEvent.SleepCheck.handle(this, playerLocation);
     }
 
     @Nullable
@@ -1279,7 +1280,8 @@
     )
     public float getBedOrientationInDegrees() {
         if(this.playerLocation != null) {
-            EnumFacing var1 = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.FACING);
+            IBlockState state = worldObj.getBlockState(playerLocation);
+            EnumFacing var1 = state.getProperties().containsKey(BlockHorizontal.FACING) ? this.worldObj.getBlockState(this.playerLocation).getValue(BlockHorizontal.FACING) : EnumFacing.NORTH;
             switch(var1) {
             case SOUTH:
                 return 90.0F;
@@ -1653,8 +1655,8 @@
             this.playEquipSound(var2);
             this.inventory.offHandInventory[0] = var2;
         } else if(var1.getSlotType() == EntityEquipmentSlot.a.ARMOR) {
-            this.playEquipSound(var2);
-            this.inventory.armorInventory[var1.getIndex()] = var2;
+            xyz.openmodloader.event.impl.ArmorEvent event = xyz.openmodloader.event.impl.ArmorEvent.handle(this, var2, var1);
+            if (event != null) { this.inventory.armorInventory[event.getSlot().getIndex()] = event.getArmor(); this.playEquipSound(var2); } else {inventory.addItemStackToInventory(var2); return;}
         }
 
     }
{'fraction_non_alphanumeric': 0.13609467455621302, 'fraction_numerical': 0.03270009342883837, 'mean_word_length': 2.9314565483476134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3017408', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1039, 'n_words': 135}