Skip to content

Commit

Permalink
prevented dungeon chests from refilling on world load
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj42 committed Mar 19, 2019
1 parent f6ca01c commit e4bff68
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/minicraft/entity/furniture/DungeonChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public class DungeonChest extends Chest {

/**
* Creates a custom chest with the name Dungeon Chest.
* @param populateInv
*/
public DungeonChest() {
public DungeonChest(boolean populateInv) {
super("Dungeon Chest", lockCol);
populateInv();
if(populateInv)
populateInv();

isLocked = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/minicraft/level/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void checkChestCount(boolean check) {

/// make DungeonChests!
for (int i = numChests; i < 10 * (w / 128); i++) {
DungeonChest d = new DungeonChest();
DungeonChest d = new DungeonChest(true);
boolean addedchest = false;
while(!addedchest) { // keep running until we successfully add a DungeonChest
//pick a random tile:
Expand Down
2 changes: 1 addition & 1 deletion src/minicraft/saveload/LegacyLoad.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public Entity getEntity(String string, Player player, int moblvl) {
case "Workbench": return new Crafter(Crafter.Type.Workbench);
case "Chest": return new Chest();
case "DeathChest": return new DeathChest();
case "DungeonChest": return new DungeonChest();
case "DungeonChest": return new DungeonChest(false);
case "Anvil": return new Crafter(Crafter.Type.Anvil);
case "Enchanter": return new Crafter(Crafter.Type.Enchanter);
case "Loom": return new Crafter(Crafter.Type.Loom);
Expand Down
2 changes: 1 addition & 1 deletion src/minicraft/saveload/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ private static Entity getEntity(String string, int moblvl) {
case "Workbench": return new Crafter(Crafter.Type.Workbench);
case "Chest": return new Chest();
case "DeathChest": return new DeathChest();
case "DungeonChest": return new DungeonChest();
case "DungeonChest": return new DungeonChest(false);
case "Anvil": return new Crafter(Crafter.Type.Anvil);
case "Enchanter": return new Crafter(Crafter.Type.Enchanter);
case "Loom": return new Crafter(Crafter.Type.Loom);
Expand Down

0 comments on commit e4bff68

Please sign in to comment.