Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #priority 500
- import crafttweaker.item.IItemStack;
- import crafttweaker.events.IEventManager;
- import crafttweaker.event.BlockHarvestDropsEvent;
- import crafttweaker.event.IBlockEvent;
- import crafttweaker.world.IWorld;
- import crafttweaker.util.IRandom;
- static weaponSets as IItemStack[][string] = {
- "Glock-19": [
- <mw:glock_19>,
- <mw:glockmag13>,
- <mw:bullet9x19mm> *64
- ],
- "Uzi": [
- <mw:uzi>,
- <mw:uzimag_2>,
- <mw:bullet9x19mm> *64
- ],
- "HS-12": [
- <mw:hs12>,
- <mw:shotgun12gauge> *64
- ],
- "L96A1": [
- <mw:l96a1>,
- <mw:l96a1mag_2>,
- <mw:bullet762x54> *64
- ],
- "BFG 9000": [
- <mw:bfg_9000>,
- <mw:bfgammo> *32
- ]
- };
- var minNum as int = 0;
- var maxNum as int = weaponSets.length - 1;
- events.onBlockHarvestDrops(function (event as BlockHarvestDropsEvent) {
- if ("contenttweaker:supply_crate".matches(event.block.definition.id)) {
- if (event.silkTouch) {
- event.drops = [<contenttweaker:supply_crate>];
- } else {
- val worldInstance = event.world as IWorld;
- var randomNum as int = worldInstance.random.nextInt(minNum, maxNum);
- val supplyItems = weaponSets.entrySet[randomNum];
- for item in supplyItems.value {
- event.addItem(item);
- }
- }
- }
- });
Add Comment
Please, Sign In to add comment