Skip to content

Commit

Permalink
Fix #987
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLane committed Jan 7, 2019
1 parent 71dc31d commit 8667bbd
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -6,6 +6,7 @@

import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -279,13 +280,21 @@ public Block getRandomWeaponBox(Random rand)
if(rand.nextInt(4) == 0)
{
//Get armour box
return ArmourBoxType.boxes.get(new ArrayList<>(ArmourBoxType.boxes.keySet()).get(rand.nextInt(ArmourBoxType.boxes.size()))).block;
if(ArmourBoxType.boxes.size() > 0)
{
return ArmourBoxType.boxes.get(new ArrayList<>(ArmourBoxType.boxes.keySet()).get(rand.nextInt(ArmourBoxType.boxes.size()))).block;
}
}
else
{
//Get weapon box
return GunBoxType.gunBoxMap.get(new ArrayList<>(GunBoxType.gunBoxMap.keySet()).get(rand.nextInt(GunBoxType.gunBoxMap.size()))).block;
if(GunBoxType.gunBoxMap.size() > 0)
{
return GunBoxType.gunBoxMap.get(new ArrayList<>(GunBoxType.gunBoxMap.keySet()).get(rand.nextInt(GunBoxType.gunBoxMap.size()))).block;
}
}

return Blocks.AIR;
}

public DriveableType getRandomDriveable(Random rand)
Expand Down

0 comments on commit 8667bbd

Please sign in to comment.