|
30 | 30 | using MiNET.Crafting; |
31 | 31 | using MiNET.Items; |
32 | 32 | using MiNET.Utils; |
| 33 | +using Newtonsoft.Json.Linq; |
33 | 34 |
|
34 | 35 | namespace MiNET |
35 | 36 | { |
@@ -340,10 +341,27 @@ protected virtual void ProcessPlaceAction(PlaceAction action, List<StackResponse |
340 | 341 | SetContainerItem(destination.ContainerId, destination.Slot, destItem); |
341 | 342 | } |
342 | 343 |
|
343 | | - if (destination.ContainerId == 21 || destination.ContainerId == 22) |
| 344 | + if (destination.ContainerId == 22) |
344 | 345 | { |
345 | | - if (!(GetContainerItem(21, 14) is ItemAir) && !(GetContainerItem(22, 15) is ItemAir)) Enchantment.SendEnchantments(_player, GetContainerItem(21, 14)); |
346 | | - else Enchantment.SendEmptyEnchantments(_player); |
| 346 | + if (Enum.IsDefined(typeof(ItemType), GetContainerItem(21, 14).ItemType) && !(GetContainerItem(22, 15) is ItemAir)) |
| 347 | + { |
| 348 | + Enchantment.SendEnchantments(_player, GetContainerItem(21, 14)); |
| 349 | + } |
| 350 | + else |
| 351 | + { |
| 352 | + Enchantment.SendEmptyEnchantments(_player); |
| 353 | + } |
| 354 | + } |
| 355 | + else if (destination.ContainerId == 23) |
| 356 | + { |
| 357 | + if (Enum.IsDefined(typeof(ItemType), GetContainerItem(21, 14).ItemType) && !(GetContainerItem(21, 14) is ItemAir) && !(GetContainerItem(22, 15) is ItemAir)) |
| 358 | + { |
| 359 | + Enchantment.SendEnchantments(_player, GetContainerItem(21, 14)); |
| 360 | + } |
| 361 | + else |
| 362 | + { |
| 363 | + Enchantment.SendEmptyEnchantments(_player); |
| 364 | + } |
347 | 365 | } |
348 | 366 |
|
349 | 367 | stackResponses.Add(new StackResponseContainerInfo |
@@ -405,10 +423,9 @@ protected virtual void ProcessTakeAction(TakeAction action, List<StackResponseCo |
405 | 423 |
|
406 | 424 | SetContainerItem(destination.ContainerId, destination.Slot, destItem); |
407 | 425 |
|
408 | | - if (source.ContainerId == 21 || source.ContainerId == 22) |
| 426 | + if (source.ContainerId == 22 || source.ContainerId == 23) |
409 | 427 | { |
410 | | - if (!(GetContainerItem(21, 14) is ItemAir) && !(GetContainerItem(22, 15) is ItemAir)) Enchantment.SendEnchantments(_player, GetContainerItem(21, 14)); |
411 | | - else Enchantment.SendEmptyEnchantments(_player); |
| 428 | + Enchantment.SendEmptyEnchantments(_player); |
412 | 429 | } |
413 | 430 |
|
414 | 431 | stackResponses.Add(new StackResponseContainerInfo |
|
0 commit comments