SHARE
TWEET

moddedItemDropRandomizer.js

a guest Nov 8th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var seed=99998;
  2. function getItems(){
  3.     var output=[];
  4.     var items=item.typeList;
  5.     for(var i=0;i<items.length;i++){
  6.         output.push(items[i]);
  7.     }
  8.     output.sort();
  9.     return output;
  10. }
  11. function getNewRandomItem(i){
  12.     var index=item.list.indexOf(i);
  13.     var randomizedList=getItems();
  14.     return randomizedList[(seed+index)%randomizedList.length];
  15. }
  16. events.listen("block.break",function(event){
  17.     var ent=event.world.createEntity("item");
  18.     ent.item=getNewRandomItem(event.block.item);
  19.     ent.setPosition(event.block.x+0.5,event.block.y+0.5,event.block.z+0.5);
  20.     ent.spawn();
  21.     event.block.set("minecraft:air");
  22.     event.cancel();
  23. });
  24. events.listen("entity.drops",function(event){
  25.     var ent;
  26.     var itemmm;
  27.     for(var i=0;i<event.drops.length;i++){
  28.         ent=event.world.createEntity("item");
  29.         ent.item=getNewRandomItem(event.drops[i].item);
  30.         ent.setPosition(event.entity.x,event.entity.y,event.entity.z);
  31.         ent.spawn();
  32.     }
  33.     event.cancel();
  34. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top