@@ -100,8 +100,8 @@ private static boolean handle0(ItemStack aStack, EntityPlayer aPlayer, World aWo
100100
101101 var placedBlocks = 0 ;
102102
103- for (int i = 0 ; i < aPlayer .inventory .getSizeInventory () ; i ++) {
104- val itemstack = aPlayer .inventory .getStackInSlot ( i ) ;
103+ for (int i = 0 ; i < aPlayer .inventory .mainInventory . length ; i ++) {
104+ val itemstack = aPlayer .inventory .mainInventory [ i ] ;
105105
106106 if (itemstack == null ) {
107107 continue ;
@@ -141,7 +141,7 @@ private static boolean handle0(ItemStack aStack, EntityPlayer aPlayer, World aWo
141141 val y = position .get1 ();
142142 val z = position .get2 ();
143143
144- if (aWorld .isAirBlock (x , y , z )) {
144+ if (aWorld .isAirBlock (x , y , z ) && aPlayer . inventory . mainInventory [ i ] != null ) {
145145 val didPlace = aWorld .setBlock (x , y , z , blockInfo .block , blockInfo .meta , 3 );
146146
147147 if (didPlace ) {
@@ -190,7 +190,19 @@ private static boolean handle0(ItemStack aStack, EntityPlayer aPlayer, World aWo
190190 return false ;
191191 }
192192 } else {
193+ if (!aPlayer .capabilities .isCreativeMode ) {
194+ ICallbackable <?> callbackable = null ;
195+
196+ if (tTileEntity instanceof ICallbackableProvider ) {
197+ callbackable = ((ICallbackableProvider ) tTileEntity ).getCallbackable ();
198+ } else if (tTileEntity instanceof ICallbackable <?>) {
199+ callbackable = (ICallbackable <?>) tTileEntity ;
200+ }
193201
202+ if (callbackable != null ) {
203+ aPlayer .swingItem ();
204+ }
205+ }
194206 }
195207 }
196208 return false ;
0 commit comments