forked from Funwayguy/BetterQuesting
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use UUID for quest ID, and split up giant quest JSON file (#89)
* Delete legacy loaders Removing code that we don't need, to reduce the amount of code that needs to be updated * Delete importers Removing code that we don't need, to reduce the amount of code that needs to be updated * Define UUID database class * Update quest database interfaces to use UUID * Add NBT conversion methods for UUIDs * Update quest database implementations * Update QuestCache and imported DB classes * Update misc handlers * Update network handlers * Update more network handlers * Update more handlers * Update commands * Update misc code * Update GUI 1 * Update GUI 2 * Update GUI 3 * Update blocks * Update ParticipantInfo * Update interfaces, placeholders, QuestEvent * Update tools * Update rewards * Update tasks * Update format version * Update localized strings * Add button to copy quest ID to clipboard * Improve formatting of QuestCommandDefaults.java * Refactor in preparation for implementing multi-file * Implement multi-file saving * Replace other instances of database loading with references to new loading code We should probably refactor this code out of QuestCommandDefaults at some point * Fix ConcurrentModificationException This isn't directly related to my other changes, but somehow something I changed seems to be triggering this latent bug. * Optimize UuidDatabase.filterKeys * Fix bug where we weren't restoring world-specific settings * Delete old save files when saving over it Also fix incorrect method of deleting directories * Add check to avoid deleting non-database directories * Add `savelegacy` command to save in old format * Add translation methods for names and descriptions * Refactor to use new translation methods * Write lang file when saving * Refactor quest lines to use new translation methods * Fix obfuscated reflection field name and add missing `String.format()` call * Fix lang file format * Add non-obfuscated reflection field name Now works in non-obfuscated dev client environment * Fix typo * Group up quests in `en_US.lang` Quests are now grouped by quest line, and ordered within a quest line by an algorithm approximating depth-first traversal of the requirements graph * Refactor NBTConverter UUID methods Share code for quest IDs and quest line IDs * Update QuestDatabase * Update to new NBTConverter methods * Fix bad type in subset param * Update QuestLineDatabase to use UUID Also remove code duplication in ImportedQuestLines * Refactor quest ID code to new methods * Update core code * Update GUI code * Update toolbox code * Update command code * Update net code
- Loading branch information
1 parent
a8eb2f4
commit 2769b7c
Showing
154 changed files
with
3,181 additions
and
4,216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/main/java/betterquesting/api/questing/IQuestDatabase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package betterquesting.api.questing; | ||
|
||
import betterquesting.api2.storage.IDatabase; | ||
import betterquesting.api2.storage.INBTPartial; | ||
import betterquesting.api2.storage.INBTProgress; | ||
import betterquesting.api2.storage.IUuidDatabase; | ||
import net.minecraft.nbt.NBTTagList; | ||
|
||
public interface IQuestDatabase extends IDatabase<IQuest>, INBTPartial<NBTTagList, Integer>, INBTProgress<NBTTagList> | ||
import java.util.UUID; | ||
|
||
public interface IQuestDatabase extends IUuidDatabase<IQuest>, INBTPartial<NBTTagList, UUID>, INBTProgress<NBTTagList> | ||
{ | ||
IQuest createNew(int id); | ||
IQuest createNew(UUID uuid); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package betterquesting.api.questing; | ||
|
||
import betterquesting.api.properties.IPropertyContainer; | ||
import betterquesting.api2.storage.DBEntry; | ||
import betterquesting.api2.storage.IDatabase; | ||
import betterquesting.api2.storage.INBTPartial; | ||
import betterquesting.api2.storage.IUuidDatabase; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
public interface IQuestLine extends IDatabase<IQuestLineEntry>, INBTPartial<NBTTagCompound, Integer>, IPropertyContainer | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public interface IQuestLine extends IUuidDatabase<IQuestLineEntry>, INBTPartial<NBTTagCompound, Integer>, IPropertyContainer | ||
{ | ||
IQuestLineEntry createNew(int id); | ||
IQuestLineEntry createNew(UUID uuid); | ||
|
||
String getUnlocalisedName(); | ||
|
||
String getUnlocalisedDescription(); | ||
|
||
DBEntry<IQuestLineEntry> getEntryAt(int x, int y); | ||
Map.Entry<UUID, IQuestLineEntry> getEntryAt(int x, int y); | ||
} |
17 changes: 9 additions & 8 deletions
17
src/main/java/betterquesting/api/questing/IQuestLineDatabase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
package betterquesting.api.questing; | ||
|
||
import betterquesting.api2.storage.DBEntry; | ||
import betterquesting.api2.storage.IDatabase; | ||
import betterquesting.api2.storage.INBTPartial; | ||
import betterquesting.api2.storage.IUuidDatabase; | ||
import net.minecraft.nbt.NBTTagList; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public interface IQuestLineDatabase extends IDatabase<IQuestLine>, INBTPartial<NBTTagList, Integer> | ||
public interface IQuestLineDatabase extends IUuidDatabase<IQuestLine>, INBTPartial<NBTTagList, UUID> | ||
{ | ||
IQuestLine createNew(int id); | ||
IQuestLine createNew(UUID lineID); | ||
|
||
/** | ||
* Deletes quest from all quest lines | ||
*/ | ||
void removeQuest(int questID); | ||
void removeQuest(UUID questID); | ||
|
||
int getOrderIndex(int lineID); | ||
void setOrderIndex(int lineID, int index); | ||
int getOrderIndex(UUID lineID); | ||
void setOrderIndex(UUID lineID, int index); | ||
|
||
List<DBEntry<IQuestLine>> getSortedEntries(); | ||
List<Map.Entry<UUID, IQuestLine>> getOrderedEntries(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/main/java/betterquesting/api/questing/tasks/IFluidTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package betterquesting.api.questing.tasks; | ||
|
||
import betterquesting.api.questing.IQuest; | ||
import betterquesting.api2.storage.DBEntry; | ||
import betterquesting.api2.utils.ParticipantInfo; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public interface IFluidTask extends ITask | ||
{ | ||
boolean canAcceptFluid(UUID owner, DBEntry<IQuest> quest, FluidStack fluid); | ||
FluidStack submitFluid(UUID owner, DBEntry<IQuest> quest, FluidStack fluid); | ||
boolean canAcceptFluid(UUID owner, Map.Entry<UUID, IQuest> quest, FluidStack fluid); | ||
FluidStack submitFluid(UUID owner, Map.Entry<UUID, IQuest> quest, FluidStack fluid); | ||
|
||
/** | ||
* @param fluids read-only list of fluids | ||
*/ | ||
default void retrieveFluids(ParticipantInfo pInfo, DBEntry<IQuest> quest, FluidStack[] fluids) {} | ||
default void retrieveFluids(ParticipantInfo pInfo, Map.Entry<UUID, IQuest> quest, FluidStack[] fluids) {} | ||
} |
8 changes: 4 additions & 4 deletions
8
src/main/java/betterquesting/api/questing/tasks/IItemTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package betterquesting.api.questing.tasks; | ||
|
||
import betterquesting.api.questing.IQuest; | ||
import betterquesting.api2.storage.DBEntry; | ||
import betterquesting.api2.utils.ParticipantInfo; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public interface IItemTask extends ITask | ||
{ | ||
boolean canAcceptItem(UUID owner, DBEntry<IQuest> quest, ItemStack stack); | ||
ItemStack submitItem(UUID owner, DBEntry<IQuest> quest, ItemStack stack); | ||
boolean canAcceptItem(UUID owner, Map.Entry<UUID, IQuest> quest, ItemStack stack); | ||
ItemStack submitItem(UUID owner, Map.Entry<UUID, IQuest> quest, ItemStack stack); | ||
|
||
/** | ||
* @param items read-only list of items | ||
*/ | ||
default void retrieveItems(ParticipantInfo pInfo, DBEntry<IQuest> quest, ItemStack[] items) {} | ||
default void retrieveItems(ParticipantInfo pInfo, Map.Entry<UUID, IQuest> quest, ItemStack[] items) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.