mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Add more configuration to shake treasures
This commit is contained in:
parent
cb5d38c11f
commit
ee02a19e9a
@ -36,33 +36,7 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
|
||||||
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
|
||||||
|
|
||||||
public List<ShakeTreasure> shakeFromBlaze = new ArrayList<ShakeTreasure>();
|
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||||
public List<ShakeTreasure> shakeFromCaveSpider = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSpider = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromChicken = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromCow = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromPig = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromPigZombie = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromPlayer = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSheep = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromShulker = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSkeleton = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSlime = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromWitherSkeleton = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromRabbit = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromElderGuardian = new ArrayList<ShakeTreasure>();
|
|
||||||
public List<ShakeTreasure> shakeFromGuardian = new ArrayList<ShakeTreasure>();
|
|
||||||
|
|
||||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||||
@ -174,7 +148,9 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
material = Material.COAL;
|
material = Material.COAL;
|
||||||
} else if (materialName.contains("INVENTORY")) {
|
} else if (materialName.contains("INVENTORY")) {
|
||||||
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||||
shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
if (!shakeMap.containsKey(EntityType.PLAYER))
|
||||||
|
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
||||||
|
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
material = Material.matchMaterial(materialName);
|
material = Material.matchMaterial(materialName);
|
||||||
@ -317,61 +293,10 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
} else if (isShake) {
|
} else if (isShake) {
|
||||||
ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
||||||
|
|
||||||
if (type.equals("Shake.BLAZE")) {
|
EntityType entityType = EntityType.valueOf(type.substring(6));
|
||||||
shakeFromBlaze.add(shakeTreasure);
|
if (!shakeMap.containsKey(entityType))
|
||||||
} else if (type.equals("Shake.CAVE_SPIDER")) {
|
shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
|
||||||
shakeFromCaveSpider.add(shakeTreasure);
|
shakeMap.get(entityType).add(shakeTreasure);
|
||||||
} else if (type.equals("Shake.CHICKEN")) {
|
|
||||||
shakeFromChicken.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.COW")) {
|
|
||||||
shakeFromCow.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.CREEPER")) {
|
|
||||||
shakeFromCreeper.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.ENDERMAN")) {
|
|
||||||
shakeFromEnderman.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.GHAST")) {
|
|
||||||
shakeFromGhast.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.HORSE")) {
|
|
||||||
shakeFromHorse.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.IRON_GOLEM")) {
|
|
||||||
shakeFromIronGolem.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.MAGMA_CUBE")) {
|
|
||||||
shakeFromMagmaCube.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.MUSHROOM_COW")) {
|
|
||||||
shakeFromMushroomCow.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.PIG")) {
|
|
||||||
shakeFromPig.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.PIG_ZOMBIE")) {
|
|
||||||
shakeFromPigZombie.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.PLAYER")) {
|
|
||||||
shakeFromPlayer.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SHEEP")) {
|
|
||||||
shakeFromSheep.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SHULKER")) {
|
|
||||||
shakeFromShulker.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SKELETON")) {
|
|
||||||
shakeFromSkeleton.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SLIME")) {
|
|
||||||
shakeFromSlime.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SPIDER")) {
|
|
||||||
shakeFromSpider.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SNOWMAN")) {
|
|
||||||
shakeFromSnowman.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.SQUID")) {
|
|
||||||
shakeFromSquid.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.WITCH")) {
|
|
||||||
shakeFromWitch.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.WITHER_SKELETON")) {
|
|
||||||
shakeFromWitherSkeleton.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.ZOMBIE")) {
|
|
||||||
shakeFromZombie.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.RABBIT")) {
|
|
||||||
shakeFromRabbit.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.GUARDIAN")) {
|
|
||||||
shakeFromGuardian.add(shakeTreasure);
|
|
||||||
} else if (type.equals("Shake.ELDER_GUARDIAN")) {
|
|
||||||
shakeFromElderGuardian.add(shakeTreasure);
|
|
||||||
}
|
|
||||||
} else if (isExcavation) {
|
} else if (isExcavation) {
|
||||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||||
@ -401,9 +326,6 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fallthrough if not specified
|
|
||||||
if (shakeFromElderGuardian.isEmpty())
|
|
||||||
shakeFromElderGuardian = shakeFromGuardian;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadEnchantments() {
|
private void loadEnchantments() {
|
||||||
|
@ -18,16 +18,10 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.adapter.BiomeAdapter;
|
import com.gmail.nossr50.util.adapter.BiomeAdapter;
|
||||||
|
|
||||||
public final class Fishing {
|
public final class Fishing {
|
||||||
|
|
||||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||||
public enum Tier {
|
public enum Tier {
|
||||||
EIGHT(8),
|
EIGHT(8), SEVEN(7), SIX(6), FIVE(5), FOUR(4), THREE(3), TWO(2), ONE(1);
|
||||||
SEVEN(7),
|
|
||||||
SIX(6),
|
|
||||||
FIVE(5),
|
|
||||||
FOUR(4),
|
|
||||||
THREE(3),
|
|
||||||
TWO(2),
|
|
||||||
ONE(1);
|
|
||||||
|
|
||||||
int numerical;
|
int numerical;
|
||||||
|
|
||||||
@ -66,96 +60,22 @@ public final class Fishing {
|
|||||||
/**
|
/**
|
||||||
* Finds the possible drops of an entity
|
* Finds the possible drops of an entity
|
||||||
*
|
*
|
||||||
* @param target Targeted entity
|
* @param target
|
||||||
|
* Targeted entity
|
||||||
* @return possibleDrops List of ItemStack that can be dropped
|
* @return possibleDrops List of ItemStack that can be dropped
|
||||||
*/
|
*/
|
||||||
protected static List<ShakeTreasure> findPossibleDrops(LivingEntity target) {
|
protected static List<ShakeTreasure> findPossibleDrops(LivingEntity target) {
|
||||||
switch (target.getType()) {
|
if (TreasureConfig.getInstance().shakeMap.containsKey(target.getType()))
|
||||||
case BLAZE:
|
return TreasureConfig.getInstance().shakeMap.get(target.getType());
|
||||||
return TreasureConfig.getInstance().shakeFromBlaze;
|
|
||||||
|
|
||||||
case CAVE_SPIDER:
|
|
||||||
return TreasureConfig.getInstance().shakeFromCaveSpider;
|
|
||||||
|
|
||||||
case CHICKEN:
|
|
||||||
return TreasureConfig.getInstance().shakeFromChicken;
|
|
||||||
|
|
||||||
case COW:
|
|
||||||
return TreasureConfig.getInstance().shakeFromCow;
|
|
||||||
|
|
||||||
case CREEPER:
|
|
||||||
return TreasureConfig.getInstance().shakeFromCreeper;
|
|
||||||
|
|
||||||
case ENDERMAN:
|
|
||||||
return TreasureConfig.getInstance().shakeFromEnderman;
|
|
||||||
|
|
||||||
case GHAST:
|
|
||||||
return TreasureConfig.getInstance().shakeFromGhast;
|
|
||||||
|
|
||||||
case IRON_GOLEM:
|
|
||||||
return TreasureConfig.getInstance().shakeFromIronGolem;
|
|
||||||
|
|
||||||
case MAGMA_CUBE:
|
|
||||||
return TreasureConfig.getInstance().shakeFromMagmaCube;
|
|
||||||
|
|
||||||
case MUSHROOM_COW:
|
|
||||||
return TreasureConfig.getInstance().shakeFromMushroomCow;
|
|
||||||
|
|
||||||
case PIG:
|
|
||||||
return TreasureConfig.getInstance().shakeFromPig;
|
|
||||||
|
|
||||||
case PIG_ZOMBIE:
|
|
||||||
return TreasureConfig.getInstance().shakeFromPigZombie;
|
|
||||||
|
|
||||||
case PLAYER:
|
|
||||||
return TreasureConfig.getInstance().shakeFromPlayer;
|
|
||||||
|
|
||||||
case SHEEP:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSheep;
|
|
||||||
|
|
||||||
case SHULKER:
|
|
||||||
return TreasureConfig.getInstance().shakeFromShulker;
|
|
||||||
|
|
||||||
case SKELETON:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSkeleton;
|
|
||||||
|
|
||||||
case SLIME:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSlime;
|
|
||||||
|
|
||||||
case SNOWMAN:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSnowman;
|
|
||||||
|
|
||||||
case SPIDER:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSpider;
|
|
||||||
|
|
||||||
case SQUID:
|
|
||||||
return TreasureConfig.getInstance().shakeFromSquid;
|
|
||||||
|
|
||||||
case WITCH:
|
|
||||||
return TreasureConfig.getInstance().shakeFromWitch;
|
|
||||||
case WITHER_SKELETON:
|
|
||||||
return TreasureConfig.getInstance().shakeFromWitherSkeleton;
|
|
||||||
|
|
||||||
case ZOMBIE:
|
|
||||||
return TreasureConfig.getInstance().shakeFromZombie;
|
|
||||||
|
|
||||||
case RABBIT:
|
|
||||||
return TreasureConfig.getInstance().shakeFromRabbit;
|
|
||||||
|
|
||||||
case GUARDIAN:
|
|
||||||
if (((Guardian) target).isElder())
|
|
||||||
return TreasureConfig.getInstance().shakeFromElderGuardian;
|
|
||||||
return TreasureConfig.getInstance().shakeFromGuardian;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Randomly chooses a drop among the list
|
* Randomly chooses a drop among the list
|
||||||
*
|
*
|
||||||
* @param possibleDrops List of ItemStack that can be dropped
|
* @param possibleDrops
|
||||||
|
* List of ItemStack that can be dropped
|
||||||
* @return Chosen ItemStack
|
* @return Chosen ItemStack
|
||||||
*/
|
*/
|
||||||
protected static ItemStack chooseDrop(List<ShakeTreasure> possibleDrops) {
|
protected static ItemStack chooseDrop(List<ShakeTreasure> possibleDrops) {
|
||||||
|
Loading…
Reference in New Issue
Block a user