11package de .eydamos .backpack .helper ;
22
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 ;
73import cpw .mods .fml .relauncher .Side ;
84import cpw .mods .fml .relauncher .SideOnly ;
95import de .eydamos .backpack .Backpack ;
106import de .eydamos .backpack .factory .FactoryBackpack ;
117import de .eydamos .backpack .gui .GuiBackpackRename ;
8+ import de .eydamos .backpack .misc .ConfigurationBackpack ;
129import de .eydamos .backpack .network .message .MessageGuiCommand ;
1310import de .eydamos .backpack .network .message .MessageOpenBackpack ;
1411import de .eydamos .backpack .network .message .MessageOpenGui ;
1512import de .eydamos .backpack .network .message .MessageOpenPersonalSlot ;
1613import de .eydamos .backpack .network .message .MessageRenameBackpack ;
1714import de .eydamos .backpack .saves .BackpackSave ;
1815import 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 ;
1920
2021public class GuiHelper {
2122 @ SideOnly (Side .CLIENT )
@@ -24,6 +25,9 @@ public static void displayRenameGui() {
2425 }
2526
2627 public static void displayBackpack (BackpackSave backpackSave , IInventory inventory , EntityPlayerMP entityPlayer ) {
28+
29+ if (!isDimensionAllowed (entityPlayer )) return ;
30+
2731 prepare (entityPlayer );
2832
2933 MessageOpenBackpack message = new MessageOpenBackpack (backpackSave , inventory , entityPlayer .currentWindowId );
@@ -34,6 +38,9 @@ public static void displayBackpack(BackpackSave backpackSave, IInventory invento
3438 }
3539
3640 public static void displayPersonalSlot (EntityPlayerMP entityPlayer ) {
41+
42+ if (!isDimensionAllowed (entityPlayer )) return ;
43+
3744 PlayerSave playerSave = new PlayerSave (entityPlayer );
3845 playerSave .setType ((byte ) -1 );
3946
@@ -46,6 +53,14 @@ public static void displayPersonalSlot(EntityPlayerMP entityPlayer) {
4653 openContainer (container , entityPlayer );
4754 }
4855
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+
4964 @ SideOnly (Side .CLIENT )
5065 public static void sendOpenPersonalGui (byte gui ) {
5166 MessageOpenGui message = new MessageOpenGui (gui );
0 commit comments