Added in Leaf decay drops + melon break drop

master
sigonasr2 6 years ago
parent d6db2ce6e2
commit 8ffdf2e3b0
  1. 3
      MCRandomizer/src/scramble/plugin/Template.java
  2. 16
      MCRandomizer/src/scramble/plugin/listener/ExampleListener.java

@ -64,6 +64,7 @@ public class Template
public static boolean enableRecipeModifications = false;
public static HashMap<EntityType,List<ItemStack>> monsterDropTable = new HashMap<EntityType,List<ItemStack>>();
public static HashMap<String,FurnaceRecipeStore> furnaceRecipeTables = new HashMap<String,FurnaceRecipeStore>();
public static ItemStack randomMelonItem;
PluginDescriptionFile pdfFile;
@ -385,6 +386,8 @@ public class Template
AddInDefaultRecipes();
setBreedingTable();
randomMelonItem = new ItemStack(Material.getMaterial(Template.archivedshufflelist.get(Template.r.nextInt(Template.archivedshufflelist.size()))));
for (String s : recipeTypeMap.keySet()) {
Bukkit.getLogger().info(" Randomized " + recipeTypeMap.get(s) + " " + s + " recipes.");
}

@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityBreedEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.VillagerAcquireTradeEvent;
@ -38,6 +39,21 @@ import scramble.plugin.Template;
public class ExampleListener implements Listener {
@EventHandler
public void breakingTheMelons(BlockBreakEvent ev) {
if (ev.getBlock().getType()==Material.MELON) {
ev.setDropItems(false);
ev.getBlock().getWorld().dropItemNaturally(ev.getBlock().getLocation(), Template.randomMelonItem);
}
}
@EventHandler
public void decayleave(LeavesDecayEvent ev) {
if (Template.r.nextInt(100)==0) {
ev.getBlock().getWorld().dropItemNaturally(ev.getBlock().getLocation(), new ItemStack(Material.getMaterial(Template.archivedshufflelist.get(Template.r.nextInt(Template.archivedshufflelist.size())))));
}
}
@EventHandler
public void AcquireTrades(VillagerAcquireTradeEvent ev) {
//Bukkit.getLogger().info(ev.getEntity()+" getting "+ev.getRecipe());

Loading…
Cancel
Save