Skip to content

Commit

Permalink
Merge branch '1.5.0' into 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gottsch authored Jul 27, 2019
2 parents 7fdea7c + b4bd48a commit e57fc26
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 41 deletions.
3 changes: 2 additions & 1 deletion Treasure2-1.12.2/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mod_name=Treasure2
package_group=someguyssoftware.treasure2
# user alpha, beta, or v (for version)
mod_version_type=v
mod_version=1.4.3
mod_version=1.5.0



mc_version=1.12.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Treasure extends AbstractMod {
// constants
public static final String MODID = "treasure2";
protected static final String NAME = "Treasure2";
protected static final String VERSION = "1.4.3";
protected static final String VERSION = "1.5.0";
public static final String UPDATE_JSON_URL = "https://raw.githubusercontent.com/gottsch/gottsch-minecraft-Treasure/master/Treasure2-1.12.2/update.json";

private static final String VERSION_URL = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,25 @@ public class TreasureConfig extends AbstractConfig {
public static int rubyOreMinY;
public static int rubyOreVeinSize;

// TODO add wells properties

// TODO add wandering antiquities peddler properties

// TODO add treasure/unique items properties

public static int woodKeyMaxUses;
public static int stoneKeyMaxUses;
public static int ironKeyMaxUses;
public static int goldKeyMaxUses;
public static int diamondKeyMaxUses;
public static int emeraldKeyMaxUses;
public static int rubyKeyMaxUses;
public static int sapphireKeyMaxUses;
public static int jewelledKeyMaxUses;
public static int metallurgistsKeyMaxUses;
public static int skeletonKeyMaxUses;
public static int spiderKeyMaxUses;
public static int witherKeyMaxUses;
public static int pilferersLockPickMaxUses;
public static int thiefsLockPickMaxUses;

// biome type white/black lists
public static String[] generalChestBiomeWhiteList;
public static String[] generalChestBiomeBlackList;
Expand Down Expand Up @@ -317,6 +330,22 @@ public Configuration load(File file) {
rubyOreMaxY = config.getInt("rubyOreMaxY", "04-gen", 14, 1, 255, "");
rubyOreVeinSize = config.getInt("rubyOreVeinSize", "04-gen", 3, 1, 20, "");

// treasure items/keys/locks
woodKeyMaxUses = config.getInt("woodKeyMaxUses", "04-gen", 20, 1, 32000, "The maximum uses for a given wooden key.");
stoneKeyMaxUses = config.getInt("stoneKeyMaxUses", "04-gen", 10, 1, 32000, "The maximum uses for a given stone key.");
ironKeyMaxUses = config.getInt("ironKeyMaxUses", "04-gen", 10, 1, 32000, "The maximum uses for a given iron key.");
goldKeyMaxUses = config.getInt("goldKeyMaxUses", "04-gen", 15, 1, 32000, "The maximum uses for a given gold key.");
diamondKeyMaxUses = config.getInt("diamondKeyMaxUses", "04-gen", 20, 1, 32000, "The maximum uses for a given diamond key.");
emeraldKeyMaxUses = config.getInt("emeraldKeyMaxUses", "04-gen", 10, 1, 32000, "The maximum uses for a given emerald key.");
rubyKeyMaxUses = config.getInt("rubyKeyMaxUses", "04-gen", 8, 1, 32000, "The maximum uses for a given ruby key.");
sapphireKeyMaxUses = config.getInt("sapphireKeyMaxUses", "04-gen", 5, 1, 32000, "The maximum uses for a given sapphire key.");
jewelledKeyMaxUses = config.getInt("jewelledKeyMaxUses", "04-gen", 5, 1, 32000, "The maximum uses for a given jewelled key.");
metallurgistsKeyMaxUses = config.getInt("metallurgistsKeyMaxUses", "04-gen", 25, 1, 32000, "The maximum uses for a given metallurgists key.");
skeletonKeyMaxUses = config.getInt("skeletonKeyMaxUses", "04-gen", 5, 1, 32000, "The maximum uses for a given skeleton key.");
spiderKeyMaxUses = config.getInt("spiderKeyMaxUses", "04-gen", 5, 1, 32000, "The maximum uses for a given spider key.");
witherKeyMaxUses = config.getInt("witherKeyMaxUses", "04-gen", 5, 1, 32000, "The maximum uses for a given wither key.");
pilferersLockPickMaxUses = config.getInt("pilferersLockPickMaxUses", "04-gen", 10, 1, 32000, "The maximum uses for a given pilferers lock pick.");
thiefsLockPickMaxUses = config.getInt("thiefsLockPickMaxUses", "04-gen", 10, 1, 32000, "The maximum uses for a given thiefs lock pick.");
// the the default values
if(config.hasChanged()) {
config.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,103 +136,103 @@ public class TreasureItems {
.setCategory(Category.BASIC)
.setRarity(Rarity.COMMON)
.setCraftable(false)
.setMaxDamage(10);
.setMaxDamage(TreasureConfig.woodKeyMaxUses);

STONE_KEY = new KeyItem(Treasure.MODID, TreasureConfig.STONE_KEY_ID)
.setCategory(Category.BASIC)
.setRarity(Rarity.COMMON)
.setCraftable(false)
.setMaxDamage(10);
.setMaxDamage(TreasureConfig.stoneKeyMaxUses);

IRON_KEY = new KeyItem(Treasure.MODID, TreasureConfig.IRON_KEY_ID)
.setCategory(Category.METALS)
.setRarity(Rarity.UNCOMMON)
.setCraftable(false)
.setMaxDamage(10);
.setMaxDamage(TreasureConfig.ironKeyMaxUses);

GOLD_KEY = new KeyItem(Treasure.MODID, TreasureConfig.GOLD_KEY_ID)
.setCategory(Category.METALS)
.setRarity(Rarity.SCARCE)
.setCraftable(false)
.setMaxDamage(15);
.setMaxDamage(TreasureConfig.goldKeyMaxUses);

DIAMOND_KEY = new KeyItem(Treasure.MODID, TreasureConfig.DIAMOND_KEY_ID)
.setCategory(Category.GEMS)
.setRarity(Rarity.RARE)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(20);
.setMaxDamage(TreasureConfig.diamondKeyMaxUses);

EMERALD_KEY = new KeyItem(Treasure.MODID, TreasureConfig.EMERALD_KEY_ID)
.setCategory(Category.GEMS)
.setRarity(Rarity.RARE)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(10);
.setMaxDamage(TreasureConfig.emeraldKeyMaxUses);

RUBY_KEY = new KeyItem(Treasure.MODID, TreasureConfig.RUBY_KEY_ID)
.setCategory(Category.GEMS)
.setRarity(Rarity.EPIC)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(8);
.setMaxDamage(TreasureConfig.rubyKeyMaxUses);

SAPPHIRE_KEY = new KeyItem(Treasure.MODID, TreasureConfig.SAPPHIRE_KEY_ID)
.setCategory(Category.GEMS)
.setRarity(Rarity.EPIC)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(5);
.setMaxDamage(TreasureConfig.sapphireKeyMaxUses);

JEWELLED_KEY = new JewelledKey(Treasure.MODID, TreasureConfig.JEWELLED_KEY_ID)
.setCategory(Category.GEMS)
.setRarity(Rarity.EPIC)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(5);
.setMaxDamage(TreasureConfig.jewelledKeyMaxUses);

METALLURGISTS_KEY = new MetallurgistsKey(Treasure.MODID, TreasureConfig.METALLURGISTS_KEY_ID)
.setCategory(Category.METALS)
.setRarity(Rarity.RARE)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(25);
.setMaxDamage(TreasureConfig.metallurgistsKeyMaxUses);

SKELETON_KEY = new SkeletonKey(Treasure.MODID, TreasureConfig.SKELETON_KEY_ID)
.setCategory(Category.BASIC)
.setRarity(Rarity.RARE)
.setBreakable(false)
.setCraftable(false)
.setMaxDamage(5);
.setMaxDamage(TreasureConfig.skeletonKeyMaxUses);

SPIDER_KEY = new KeyItem(Treasure.MODID, TreasureConfig.SPIDER_KEY_ID)
.setCategory(Category.MOB)
.setRarity(Rarity.SCARCE)
.setBreakable(true)
.setCraftable(true)
.setMaxDamage(5);
.setMaxDamage(TreasureConfig.spiderKeyMaxUses);

WITHER_KEY = new KeyItem(Treasure.MODID, TreasureConfig.WITHER_KEY_ID)
.setCategory(Category.WITHER)
.setRarity(Rarity.RARE)
.setBreakable(false)
.setCraftable(true)
.setMaxDamage(5);
.setMaxDamage(TreasureConfig.witherKeyMaxUses);

PILFERERS_LOCK_PICK = new PilferersLockPick(Treasure.MODID, TreasureConfig.PILFERERS_LOCK_PICK_ID)
.setCategory(Category.BASIC)
.setRarity(Rarity.COMMON)
.setBreakable(true)
.setCraftable(true)
.setMaxDamage(10)
.setMaxDamage(TreasureConfig.pilferersLockPickMaxUses)
.setSuccessProbability(24);

THIEFS_LOCK_PICK = new ThiefsLockPick(Treasure.MODID, TreasureConfig.THIEFS_LOCK_PICK_ID)
.setCategory(Category.BASIC)
.setRarity(Rarity.UNCOMMON)
.setBreakable(true)
.setCraftable(true)
.setMaxDamage(10)
.setMaxDamage(TreasureConfig.thiefsLockPickMaxUses)
.setSuccessProbability(32);

// KEY RING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -18,6 +21,8 @@
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import com.someguyssoftware.gottschcore.GottschCore;
import com.someguyssoftware.gottschcore.mod.IMod;
import com.someguyssoftware.treasure2.Treasure;
import com.someguyssoftware.treasure2.enums.Rarity;
import com.someguyssoftware.treasure2.enums.StructureMarkers;
Expand All @@ -42,12 +47,19 @@
*/
// TODO redo this. doesn't work well for specials like witch's den, plus doesn't work well with generic template manager unless they key wasn't StructureType but a String or Integer etc
public class TreasureTemplateManager {
private static final String CUSTOM_TEMPLATE_RESOURCE_PATH = "/structures/";

/*
* NOTE this enum is key for external templates. all templates are
* categorized and placed into folders according to the type.
*/
public enum StructureType {
ABOVEGROUND,
UNDERGROUND,
WITCH
UNDERGROUND
};

private IMod mod;

/*
* templates is the master map where the key is the String representation resource location.
*/
Expand All @@ -56,8 +68,8 @@ public enum StructureType {
private final String baseFolder;
private final DataFixer fixer;

// TODO this could've been a multiMap
private final Map<StructureType, List<Template>> templatesByType = Maps.<StructureType, List<Template>>newHashMap();
/** NOTE not in use yet. can organize tempaltes by type and rarity */
private final Table<StructureType, Rarity, List<Template>> templateTable = HashBasedTable.create();

/*
Expand All @@ -75,7 +87,7 @@ public enum StructureType {
"treasure2:underground/crypt1"
});

/**
/*
* builtin aboveground locations for structures
*/
List<String> abovegroundLocations = Arrays.asList(new String[] {
Expand Down Expand Up @@ -128,13 +140,36 @@ public TreasureTemplateManager(String baseFolder, DataFixer fixer) {
markerMap.get(PROXIMITY_SPAWNER)
});

// load all the underground structure templates
// load all the builtin (jar) structure templates
loadAll(undergroundLocations, StructureType.UNDERGROUND);
loadAll(abovegroundLocations, StructureType.ABOVEGROUND);

// TODO add ability to load external structures
// load external structures
for (StructureType customLocation : StructureType.values()) {
createStructureFolder(customLocation.name().toLowerCase());
loadAll(Arrays.asList(customLocation.name().toLowerCase()), customLocation);
}
}

/**
*
* @param location
*/
protected void createStructureFolder(String location) {
// build a path to the specified location
Path folder = Paths.get(getBaseFolder(), ((location != null && !location.equals("")) ? (location + "/") : "")).toAbsolutePath();

if (Files.notExists(folder)) {
Treasure.logger.debug("structures folder \"{}\" will be created.", folder.toString());
try {
Files.createDirectories(folder);

} catch (IOException e) {
Treasure.logger.warn("Unable to create structure folder \"{}\"", folder.toString());
}
}
}

/**
* Convenience method.
* @param type
Expand Down Expand Up @@ -171,17 +206,6 @@ public Template getTemplate(/*@Nullable MinecraftServer server, */ResourceLocati
return template;
}

/**
*
*/
public void loadAll() {
Treasure.logger.debug("loading all structures...");
for (String s : undergroundLocations) {
Treasure.logger.debug("loading from -> {}", s);
load(new ResourceLocation(s), scanList);
}
}

/**
*
* @param locations
Expand Down Expand Up @@ -375,4 +399,23 @@ public Table<StructureType, Rarity, List<Template>> getTemplateTable() {
public Map<StructureType, List<Template>> getTemplatesByType() {
return templatesByType;
}

/**
* @return the mod
*/
protected IMod getMod() {
return mod;
}

/**
* @param mod
* the mod to set
*/
protected void setMod(IMod mod) {
this.mod = mod;
}

public String getBaseFolder() {
return baseFolder;
}
}
Loading

0 comments on commit e57fc26

Please sign in to comment.