@@ -34,10 +34,7 @@ public class DisabledHandler {
3434 private static ArrayList <String > registeredItems ;
3535
3636 public static void init (){
37- //Logger.log(EntityList.classToStringMapping.toString());
3837 ConfigHandler .init (DimensionGuard .config );
39- //disabledBlocks = new ArrayList<Disabled>();
40- //registeredBlocks=new ArrayList<String>();
4138 registeredItems =new ArrayList <String >();
4239
4340// for (Object key:GameData.getBlockRegistry().getKeys()){
@@ -149,29 +146,32 @@ public static void scanInventory(EntityPlayer player, boolean setCanBeDisabled){
149146 }
150147
151148 public static ItemStack scanStack (ItemStack thisStack , int dim , boolean setCanBeDisabled ){
152- if (thisStack .stackTagCompound ==null ){
153- thisStack .stackTagCompound =new NBTTagCompound ();
154- }
155- if (!thisStack .stackTagCompound .hasKey ("DimensionGuard" ))
156- thisStack .stackTagCompound .setTag ("DimensionGuard" , new NBTTagCompound ());
157- if (!thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).hasKey ("CanBeDisabled" )||setCanBeDisabled )
158- thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setBoolean ("CanBeDisabled" ,
159- DisabledHandler .canBeDisabled (GameRegistry .findUniqueIdentifierFor (thisStack .getItem ()).toString (), thisStack .getItemDamage ()));
160- if (thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).getBoolean ("CanBeDisabled" )||thisStack .getItem ()==ModItems .disable ){
161- if (!thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).hasKey ("LastDimChecked" ))
162- thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setInteger ("LastDimChecked" ,Integer .MIN_VALUE );
163- if (thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).getInteger ("LastDimChecked" )!=dim ){
164- if (thisStack .getItem ()==ModItems .disable ){
165- ItemStack storeStack = DisableItem .recoverItemStack (thisStack );
166- //Logger.log(storeStack.getDisplayName());
167- if (!DisabledHandler .isDisabled (GameRegistry .findUniqueIdentifierFor (storeStack .getItem ()).toString (), storeStack .getItemDamage (),dim )){
168- return storeStack ;
169- }
170- }else {
171- if (DisabledHandler .isDisabled (GameRegistry .findUniqueIdentifierFor (thisStack .getItem ()).toString (), thisStack .getItemDamage (),dim )){
172- return DisableItem .storeItem (new ItemStack (ModItems .disable ,1 ), thisStack );
149+ if (thisStack !=null &&thisStack .getItem ()!=null )
150+ {
151+ if (thisStack .stackTagCompound ==null ){
152+ thisStack .stackTagCompound =new NBTTagCompound ();
153+ }
154+ if (!thisStack .stackTagCompound .hasKey ("DimensionGuard" ))
155+ thisStack .stackTagCompound .setTag ("DimensionGuard" , new NBTTagCompound ());
156+ if (!thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).hasKey ("CanBeDisabled" )||setCanBeDisabled )
157+ thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setBoolean ("CanBeDisabled" ,
158+ DisabledHandler .canBeDisabled (GameRegistry .findUniqueIdentifierFor (thisStack .getItem ()).toString (), thisStack .getItemDamage ()));
159+ if (thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).getBoolean ("CanBeDisabled" )||thisStack .getItem ()==ModItems .disable ){
160+ if (!thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).hasKey ("LastDimChecked" ))
161+ thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setInteger ("LastDimChecked" ,Integer .MIN_VALUE );
162+ if (thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).getInteger ("LastDimChecked" )!=dim ){
163+ if (thisStack .getItem ()==ModItems .disable ){
164+ ItemStack storeStack = DisableItem .recoverItemStack (thisStack );
165+ //Logger.log(storeStack.getDisplayName());
166+ if (!DisabledHandler .isDisabled (GameRegistry .findUniqueIdentifierFor (storeStack .getItem ()).toString (), storeStack .getItemDamage (),dim )){
167+ return storeStack ;
168+ }
173169 }else {
174- thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setInteger ("LastDimChecked" ,dim );
170+ if (DisabledHandler .isDisabled (GameRegistry .findUniqueIdentifierFor (thisStack .getItem ()).toString (), thisStack .getItemDamage (),dim )){
171+ return DisableItem .storeItem (new ItemStack (ModItems .disable ,1 ), thisStack );
172+ }else {
173+ thisStack .stackTagCompound .getCompoundTag ("DimensionGuard" ).setInteger ("LastDimChecked" ,dim );
174+ }
175175 }
176176 }
177177 }
0 commit comments