1
1
package de .eydamos .backpack .helper ;
2
2
3
- import net .minecraft .client .Minecraft ;
4
- import net .minecraft .entity .player .EntityPlayerMP ;
5
- import net .minecraft .inventory .Container ;
6
- import net .minecraft .inventory .IInventory ;
7
3
import cpw .mods .fml .relauncher .Side ;
8
4
import cpw .mods .fml .relauncher .SideOnly ;
9
5
import de .eydamos .backpack .Backpack ;
10
6
import de .eydamos .backpack .factory .FactoryBackpack ;
11
7
import de .eydamos .backpack .gui .GuiBackpackRename ;
8
+ import de .eydamos .backpack .misc .ConfigurationBackpack ;
12
9
import de .eydamos .backpack .network .message .MessageGuiCommand ;
13
10
import de .eydamos .backpack .network .message .MessageOpenBackpack ;
14
11
import de .eydamos .backpack .network .message .MessageOpenGui ;
15
12
import de .eydamos .backpack .network .message .MessageOpenPersonalSlot ;
16
13
import de .eydamos .backpack .network .message .MessageRenameBackpack ;
17
14
import de .eydamos .backpack .saves .BackpackSave ;
18
15
import de .eydamos .backpack .saves .PlayerSave ;
16
+ import net .minecraft .client .Minecraft ;
17
+ import net .minecraft .entity .player .EntityPlayerMP ;
18
+ import net .minecraft .inventory .Container ;
19
+ import net .minecraft .inventory .IInventory ;
19
20
20
21
public class GuiHelper {
21
22
@ SideOnly (Side .CLIENT )
@@ -24,6 +25,9 @@ public static void displayRenameGui() {
24
25
}
25
26
26
27
public static void displayBackpack (BackpackSave backpackSave , IInventory inventory , EntityPlayerMP entityPlayer ) {
28
+
29
+ if (!isDimensionAllowed (entityPlayer )) return ;
30
+
27
31
prepare (entityPlayer );
28
32
29
33
MessageOpenBackpack message = new MessageOpenBackpack (backpackSave , inventory , entityPlayer .currentWindowId );
@@ -34,6 +38,9 @@ public static void displayBackpack(BackpackSave backpackSave, IInventory invento
34
38
}
35
39
36
40
public static void displayPersonalSlot (EntityPlayerMP entityPlayer ) {
41
+
42
+ if (!isDimensionAllowed (entityPlayer )) return ;
43
+
37
44
PlayerSave playerSave = new PlayerSave (entityPlayer );
38
45
playerSave .setType ((byte ) -1 );
39
46
@@ -46,6 +53,14 @@ public static void displayPersonalSlot(EntityPlayerMP entityPlayer) {
46
53
openContainer (container , entityPlayer );
47
54
}
48
55
56
+ private static boolean isDimensionAllowed (EntityPlayerMP entityPlayer ) {
57
+ Integer currentDimID = (entityPlayer .worldObj .provider .dimensionId );
58
+ for (String id : ConfigurationBackpack .FORBIDDEN_DIMENSIONS ) {
59
+ if (id .equals (currentDimID .toString ())) return false ;
60
+ }
61
+ return true ;
62
+ }
63
+
49
64
@ SideOnly (Side .CLIENT )
50
65
public static void sendOpenPersonalGui (byte gui ) {
51
66
MessageOpenGui message = new MessageOpenGui (gui );
0 commit comments