Add snow to excavation. No treasures will drop from snow by default,

but they can be added to the treasures.yml file by specifying

"Drops_From:
	Snow: true"

Adds #1229
This commit is contained in:
GJ 2013-07-11 14:41:23 -04:00
parent 01a1cf5765
commit 04224b309a
5 changed files with 35 additions and 8 deletions

View File

@ -8,6 +8,7 @@ Key:
- Removal - Removal
Version 1.4.07-dev Version 1.4.07-dev
+ Added snow to excavation
! Improved profile saving ! Improved profile saving
! Updated localization files ! Updated localization files

View File

@ -25,13 +25,14 @@ import com.gmail.nossr50.datatypes.treasure.Treasure;
public class TreasureConfig extends ConfigLoader { public class TreasureConfig extends ConfigLoader {
private static TreasureConfig instance; private static TreasureConfig instance;
public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSnow = new ArrayList<ExcavationTreasure>();
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
@ -248,6 +249,10 @@ public class TreasureConfig extends ConfigLoader {
eTreasure.setDropsFromSoulSand(); eTreasure.setDropsFromSoulSand();
} }
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Snow", false)) {
eTreasure.setDropsFromSnow();
}
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) { if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) {
hTreasure.setDropsFromBushes(); hTreasure.setDropsFromBushes();
} }
@ -437,6 +442,10 @@ public class TreasureConfig extends ConfigLoader {
if (eTreasure.getDropsFromSoulSand()) { if (eTreasure.getDropsFromSoulSand()) {
excavationFromSoulSand.add(eTreasure); excavationFromSoulSand.add(eTreasure);
} }
if (eTreasure.getDropsFromSnow()) {
excavationFromSnow.add(eTreasure);
}
} }
} }
} }

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class ExcavationTreasure extends Treasure { public class ExcavationTreasure extends Treasure {
// dirt | grass | sand | gravel | clay | mycel | soulsand // dirt | grass | sand | gravel | clay | mycel | soulsand | snow
// 00000001 - dirt 1 // 00000001 - dirt 1
// 00000010 - grass 2 // 00000010 - grass 2
// 00000100 - sand 4 // 00000100 - sand 4
@ -11,6 +11,7 @@ public class ExcavationTreasure extends Treasure {
// 00010000 - clay 16 // 00010000 - clay 16
// 00100000 - mycel 32 // 00100000 - mycel 32
// 01000000 - soulsand 64 // 01000000 - soulsand 64
// 10000000 - snow 128
private byte dropsFrom = 0x0; private byte dropsFrom = 0x0;
public ExcavationTreasure(ItemStack drop, int xp, double dropChance, int dropLevel) { public ExcavationTreasure(ItemStack drop, int xp, double dropChance, int dropLevel) {
@ -55,6 +56,10 @@ public class ExcavationTreasure extends Treasure {
return getDropFromMask(64); return getDropFromMask(64);
} }
public boolean getDropsFromSnow() {
return getDropFromMask(128);
}
private boolean getDropFromMask(int mask) { private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false; return ((dropsFrom & mask) > 0) ? true : false;
} }
@ -88,6 +93,10 @@ public class ExcavationTreasure extends Treasure {
setDropFromMask(64); setDropFromMask(64);
} }
public void setDropsFromSnow() {
setDropFromMask(128);
}
private void setDropFromMask(int mask) { private void setDropFromMask(int mask) {
dropsFrom |= mask; dropsFrom |= mask;
} }
@ -121,6 +130,10 @@ public class ExcavationTreasure extends Treasure {
unsetDropFromMask(64); unsetDropFromMask(64);
} }
public void unsetDropsFromSnow() {
unsetDropFromMask(128);
}
private void unsetDropFromMask(int mask) { private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask; dropsFrom &= ~mask;
} }

View File

@ -180,6 +180,8 @@ public final class BlockUtils {
case GRAVEL: case GRAVEL:
case MYCEL: case MYCEL:
case SAND: case SAND:
case SNOW:
case SNOW_BLOCK:
case SOUL_SAND: case SOUL_SAND:
return true; return true;

View File

@ -313,6 +313,8 @@ Experience:
Gravel: 40 Gravel: 40
Mycel: 40 Mycel: 40
Sand: 40 Sand: 40
Snow: 20
Snow_Block: 40
Soul_Sand: 40 Soul_Sand: 40
Woodcutting: Woodcutting:
Oak: 70 Oak: 70