File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ function processEasyPlace(player) {
8686 if ( ! structureBlock )
8787 return ;
8888 const worldBlock = player . dimension . getBlock ( structureBlock . location ) ;
89+ if ( ! worldBlock )
90+ return ;
8991 if ( locationsPlacedLastTick . has ( JSON . stringify ( worldBlock . location ) ) )
9092 return ;
9193 locationsPlacedLastTick . add ( JSON . stringify ( worldBlock . location ) ) ;
@@ -103,10 +105,14 @@ function preventAction(event, player) {
103105}
104106
105107function isHoldingActionItem ( player ) {
106- const mainhandItemStack = player . getComponent ( EntityComponentTypes . Equippable ) . getEquipment ( EquipmentSlot . Mainhand ) ;
107- if ( ! mainhandItemStack )
108+ try {
109+ const mainhandItemStack = player . getComponent ( EntityComponentTypes . Equippable ) . getEquipment ( EquipmentSlot . Mainhand ) ;
110+ if ( ! mainhandItemStack )
111+ return false ;
112+ return mainhandItemStack . typeId === ACTION_ITEM ;
113+ } catch {
108114 return false ;
109- return mainhandItemStack . typeId === ACTION_ITEM ;
115+ }
110116}
111117
112118function tryPlaceBlock ( player , worldBlock , structureBlock ) {
You can’t perform that action at this time.
0 commit comments