11package useless .moonsteel ;
22
33import net .minecraft .core .InventoryAction ;
4- import net .minecraft .core .entity .player .EntityPlayer ;
5- import net .minecraft .core .player .inventory .Container ;
4+ import net .minecraft .core .entity .player .Player ;
5+ import net .minecraft .core .player .inventory .menu . MenuAbstract ;
66import net .minecraft .core .player .inventory .slot .Slot ;
77import useless .moonsteel .interfaces .IStarBackpack ;
88
99import java .util .List ;
1010
11- public class ContainerStarBackpack extends Container {
11+ public class ContainerStarBackpack extends MenuAbstract {
1212 public StarBackpackInventory backpackInventory ;
13- public ContainerStarBackpack (EntityPlayer player ) {
14- backpackInventory = ((IStarBackpack )player ).moonsteel$getStarBackpackInventory ();
15- int slotsNum = this .backpackInventory .getSizeInventory ();
16- int rows = (int )Math .ceil ((double )slotsNum / 9.0 );
13+ public ContainerStarBackpack (final Player player ) {
14+ this . backpackInventory = ((IStarBackpack )player ).moonsteel$getStarBackpackInventory ();
15+ final int slotsNum = this .backpackInventory .getContainerSize ();
16+ final int rows = (int )Math .ceil ((double )slotsNum / 9.0 );
1717
1818 for (int i = 0 ; i < rows ; ++i ) {
1919 int width = 9 ;
@@ -37,34 +37,37 @@ public ContainerStarBackpack(EntityPlayer player) {
3737 }
3838 }
3939
40- public List <Integer > getMoveSlots (InventoryAction inventoryAction , Slot slot , int i , EntityPlayer entityPlayer ) {
41- int chestSize = this .backpackInventory .getSizeInventory ();
42- if (slot .id >= 0 && slot .id < chestSize ) {
40+ @ Override
41+ public List <Integer > getMoveSlots (final InventoryAction inventoryAction , final Slot slot , final int i , final Player entityPlayer ) {
42+ final int chestSize = this .backpackInventory .getContainerSize ();
43+ if (slot .index >= 0 && slot .index < chestSize ) {
4344 return this .getSlots (0 , chestSize , false );
4445 } else {
4546 if (inventoryAction == InventoryAction .MOVE_ALL ) {
46- if (slot .id >= chestSize && slot .id < chestSize + 27 ) {
47+ if (slot .index >= chestSize && slot .index < chestSize + 27 ) {
4748 return this .getSlots (chestSize , 27 , false );
4849 }
4950
50- if (slot .id >= chestSize + 27 && slot .id < chestSize + 36 ) {
51+ if (slot .index >= chestSize + 27 && slot .index < chestSize + 36 ) {
5152 return this .getSlots (chestSize + 27 , 9 , false );
5253 }
53- } else if (slot .id >= chestSize && slot .id < chestSize + 36 ) {
54+ } else if (slot .index >= chestSize && slot .index < chestSize + 36 ) {
5455 return this .getSlots (chestSize , 36 , false );
5556 }
5657
5758 return null ;
5859 }
5960 }
6061
61- public List <Integer > getTargetSlots (InventoryAction inventoryAction , Slot slot , int i , EntityPlayer entityPlayer ) {
62- int chestSize = this .backpackInventory .getSizeInventory ();
63- return slot .id < chestSize ? this .getSlots (chestSize , 36 , true ) : this .getSlots (0 , chestSize , false );
62+ @ Override
63+ public List <Integer > getTargetSlots (final InventoryAction inventoryAction , final Slot slot , final int i , final Player entityPlayer ) {
64+ final int chestSize = this .backpackInventory .getContainerSize ();
65+ return slot .index < chestSize ? this .getSlots (chestSize , 36 , true ) : this .getSlots (0 , chestSize , false );
6466 }
6567
66- public boolean isUsableByPlayer (EntityPlayer entityPlayer ) {
67- return this .backpackInventory .canInteractWith (entityPlayer );
68+ @ Override
69+ public boolean stillValid (final Player entityPlayer ) {
70+ return this .backpackInventory .stillValid (entityPlayer );
6871 }
6972
7073}
0 commit comments