├── jitpack.yml ├── .git-blame-ignore-revs ├── CODEOWNERS ├── repositories.gradle ├── src └── main │ ├── resources │ ├── title.png │ ├── assets │ │ ├── questbook │ │ │ ├── lang │ │ │ │ └── en_US.lang │ │ │ └── textures │ │ │ │ └── items │ │ │ │ └── ItemQuestBook.png │ │ ├── bq_standard │ │ │ └── textures │ │ │ │ ├── gui │ │ │ │ ├── nei.png │ │ │ │ └── gui_elements.png │ │ │ │ └── items │ │ │ │ └── loot_chest.png │ │ ├── betterquesting │ │ │ ├── sounds │ │ │ │ ├── page_flip0.wav │ │ │ │ └── page_flip1.wav │ │ │ └── textures │ │ │ │ ├── gui │ │ │ │ ├── new_gui.png │ │ │ │ ├── gui_themes.png │ │ │ │ ├── default_title.png │ │ │ │ ├── editor_icons.png │ │ │ │ ├── null_texture.png │ │ │ │ ├── quest_frames.png │ │ │ │ └── simple_frames.png │ │ │ │ ├── items │ │ │ │ ├── heart_full.png │ │ │ │ ├── heart_half.png │ │ │ │ ├── placeholder.png │ │ │ │ └── heart_quarter.png │ │ │ │ └── blocks │ │ │ │ ├── fluid_placeholder.png │ │ │ │ ├── submit_station_top.png │ │ │ │ ├── submit_station_side.png │ │ │ │ ├── observation_station_top.png │ │ │ │ └── observation_station_side.png │ │ └── cb4bq │ │ │ └── lang │ │ │ └── en_US.lang │ └── META-INF │ │ └── bq_standard_at.cfg │ └── java │ ├── betterquesting │ ├── api │ │ ├── api │ │ │ └── ApiKey.java │ │ ├── misc │ │ │ └── ICallback.java │ │ ├── enums │ │ │ ├── EnumPartyStatus.java │ │ │ ├── EnumQuestState.java │ │ │ ├── EnumQuestVisibility.java │ │ │ └── EnumLogic.java │ │ ├── package-info.java │ │ ├── client │ │ │ ├── gui │ │ │ │ ├── misc │ │ │ │ │ ├── IVolatileScreen.java │ │ │ │ │ └── INeedsRefresh.java │ │ │ │ └── GuiYesNoLocked.java │ │ │ ├── importers │ │ │ │ ├── IImportRegistry.java │ │ │ │ └── IImporter.java │ │ │ └── toolbox │ │ │ │ ├── IToolRegistry.java │ │ │ │ └── IToolboxTool.java │ │ ├── storage │ │ │ ├── IQuestSettings.java │ │ │ ├── ILifeDatabase.java │ │ │ └── INameCache.java │ │ ├── placeholders │ │ │ ├── FluidPlaceholder.java │ │ │ ├── tasks │ │ │ │ └── FactoryTaskPlaceholder.java │ │ │ ├── rewards │ │ │ │ └── FactoryRewardPlaceholder.java │ │ │ └── EntityPlaceholder.java │ │ ├── properties │ │ │ ├── IPropertyType.java │ │ │ ├── basic │ │ │ │ ├── PropertyTypeBase.java │ │ │ │ ├── PropertyTypeString.java │ │ │ │ ├── PropertyTypeByte.java │ │ │ │ ├── PropertyTypeFloat.java │ │ │ │ ├── PropertyTypeDouble.java │ │ │ │ ├── PropertyTypeInteger.java │ │ │ │ ├── PropertyTypeBoolean.java │ │ │ │ ├── PropertyTypeItemStack.java │ │ │ │ └── PropertyTypeEnum.java │ │ │ └── IPropertyContainer.java │ │ ├── nbt_doc │ │ │ ├── INbtDoc.java │ │ │ └── NbtDocBasic.java │ │ ├── questing │ │ │ ├── IQuestDatabase.java │ │ │ ├── IQuestLineEntry.java │ │ │ ├── party │ │ │ │ ├── IPartyDatabase.java │ │ │ │ └── IParty.java │ │ │ ├── tasks │ │ │ │ ├── IItemTask.java │ │ │ │ └── IFluidTask.java │ │ │ ├── rewards │ │ │ │ └── IReward.java │ │ │ └── IQuestLine.java │ │ ├── events │ │ │ ├── BQLivingUpdateEvent.java │ │ │ ├── NbtDocEvent.java │ │ │ ├── MarkDirtyPlayerEvent.java │ │ │ ├── QuestEvent.java │ │ │ └── DatabaseEvent.java │ │ ├── utils │ │ │ └── FileExtensionFilter.java │ │ └── network │ │ │ ├── IPacketSender.java │ │ │ ├── QuestingPacket.java │ │ │ └── IPacketRegistry.java │ ├── api2 │ │ ├── package-info.java │ │ ├── client │ │ │ ├── gui │ │ │ │ ├── events │ │ │ │ │ ├── IPEventListener.java │ │ │ │ │ ├── PanelEvent.java │ │ │ │ │ ├── types │ │ │ │ │ │ └── PEventButton.java │ │ │ │ │ ├── PEventFilter.java │ │ │ │ │ └── PEventEntry.java │ │ │ │ ├── controls │ │ │ │ │ ├── IFieldFilter.java │ │ │ │ │ ├── IPanelButton.java │ │ │ │ │ ├── IValueIO.java │ │ │ │ │ ├── callbacks │ │ │ │ │ │ ├── CallbackMulti.java │ │ │ │ │ │ └── CallbackNBTTagString.java │ │ │ │ │ ├── io │ │ │ │ │ │ └── ValueFuncIO.java │ │ │ │ │ ├── filters │ │ │ │ │ │ └── FieldFilterString.java │ │ │ │ │ └── PanelButtonStorage.java │ │ │ │ ├── resources │ │ │ │ │ ├── colors │ │ │ │ │ │ ├── IGuiColor.java │ │ │ │ │ │ ├── GuiColorSequence.java │ │ │ │ │ │ └── GuiColorStatic.java │ │ │ │ │ ├── lines │ │ │ │ │ │ ├── IGuiLine.java │ │ │ │ │ │ ├── GuiLineSequence.java │ │ │ │ │ │ └── SimpleLine.java │ │ │ │ │ ├── textures │ │ │ │ │ │ ├── IGuiTexture.java │ │ │ │ │ │ ├── LayeredTexture.java │ │ │ │ │ │ └── GuiTextureColored.java │ │ │ │ │ └── factories │ │ │ │ │ │ ├── colors │ │ │ │ │ │ └── FactoryColorStatic.java │ │ │ │ │ │ └── lines │ │ │ │ │ │ └── FactorySimpleLine.java │ │ │ │ ├── themes │ │ │ │ │ ├── gui_args │ │ │ │ │ │ ├── GArgsNone.java │ │ │ │ │ │ ├── GArgsCallback.java │ │ │ │ │ │ ├── GArgsNBT.java │ │ │ │ │ │ └── GArgsFileBrowser.java │ │ │ │ │ ├── GuiKey.java │ │ │ │ │ ├── IResourceReg.java │ │ │ │ │ ├── IGuiTheme.java │ │ │ │ │ └── IThemeRegistry.java │ │ │ │ ├── panels │ │ │ │ │ ├── IGuiCanvas.java │ │ │ │ │ ├── bars │ │ │ │ │ │ ├── IScrollBar.java │ │ │ │ │ │ └── IBarFill.java │ │ │ │ │ ├── IGuiPanel.java │ │ │ │ │ ├── CanvasTextured.java │ │ │ │ │ └── lists │ │ │ │ │ │ └── CanvasQuestDatabase.java │ │ │ │ ├── misc │ │ │ │ │ ├── ComparatorGuiDepth.java │ │ │ │ │ ├── IGuiRect.java │ │ │ │ │ ├── GuiPadding.java │ │ │ │ │ └── ProxyRect.java │ │ │ │ ├── help │ │ │ │ │ ├── HelpTopic.java │ │ │ │ │ └── HelpRegistry.java │ │ │ │ ├── SceneController.java │ │ │ │ └── IScene.java │ │ │ └── toolbox │ │ │ │ └── IToolTab.java │ │ ├── registry │ │ │ ├── IFactoryData.java │ │ │ ├── IFactory.java │ │ │ ├── IRegistry.java │ │ │ └── SimpleRegistry.java │ │ ├── storage │ │ │ ├── IDatabaseNBT.java │ │ │ ├── INBTSaveLoad.java │ │ │ ├── EmptyLookupLogic.java │ │ │ ├── INBTPartial.java │ │ │ ├── IDatabase.java │ │ │ ├── INBTProgress.java │ │ │ ├── BigDatabase.java │ │ │ ├── LookupLogic.java │ │ │ ├── DBEntry.java │ │ │ ├── NaiveLookupLogic.java │ │ │ ├── IUuidDatabase.java │ │ │ └── LookupLogicType.java │ │ └── utils │ │ │ ├── Tuple2.java │ │ │ ├── DirtyPlayerMarker.java │ │ │ ├── QuestLineSorter.java │ │ │ ├── EntityPlayerPreview.java │ │ │ └── OreIngredient.java │ ├── client │ │ ├── importers │ │ │ ├── ImportedQuestLines.java │ │ │ ├── ImportedQuests.java │ │ │ └── ImporterRegistry.java │ │ ├── CreativeTabQuesting.java │ │ ├── BQ_Keybindings.java │ │ ├── renderer │ │ │ └── EntityPlaceholderRenderer.java │ │ ├── gui2 │ │ │ └── editors │ │ │ │ └── nbt │ │ │ │ └── callback │ │ │ │ ├── NbtItemCallback.java │ │ │ │ ├── NbtFluidCallback.java │ │ │ │ └── NbtEntityCallback.java │ │ ├── gui │ │ │ └── GuiBQConfig.java │ │ └── toolbox │ │ │ └── ToolboxRegistry.java │ ├── commands │ │ ├── BQ_CommandDebug.java │ │ ├── user │ │ │ └── QuestCommandHelp.java │ │ └── admin │ │ │ └── QuestCommandPurge.java │ ├── handlers │ │ ├── ConfigGuiFactory.java │ │ └── GuiHandler.java │ ├── misc │ │ └── QuestSearchEntry.java │ └── core │ │ └── proxies │ │ └── CommonProxy.java │ ├── bq_standard │ ├── core │ │ ├── BQS_Settings.java │ │ └── proxies │ │ │ └── ClientProxy.java │ ├── tasks │ │ ├── ITaskItemInput.java │ │ ├── ITaskTickable.java │ │ ├── ITaskInventory.java │ │ ├── TaskOptionalRetrieval.java │ │ └── factory │ │ │ ├── FactoryTaskXP.java │ │ │ ├── FactoryTaskHunt.java │ │ │ ├── FactoryTaskFluid.java │ │ │ ├── FactoryTaskMeeting.java │ │ │ ├── FactoryTaskCheckbox.java │ │ │ ├── FactoryTaskCrafting.java │ │ │ ├── FactoryTaskLocation.java │ │ │ ├── FactoryTaskRetrieval.java │ │ │ ├── FactoryTaskScoreboard.java │ │ │ ├── FactoryTaskBlockBreak.java │ │ │ ├── FactoryTaskInteractItem.java │ │ │ ├── FactoryTaskOptionalRetrieval.java │ │ │ └── FactoryTaskInteractEntity.java │ ├── rewards │ │ ├── IRewardItemOutput.java │ │ └── factory │ │ │ ├── FactoryRewardXP.java │ │ │ ├── FactoryRewardItem.java │ │ │ ├── FactoryRewardChoice.java │ │ │ ├── FactoryRewardCommand.java │ │ │ ├── FactoryRewardScoreboard.java │ │ │ └── FactoryRewardQuestCompletion.java │ ├── importers │ │ └── hqm │ │ │ └── converters │ │ │ ├── items │ │ │ ├── HQMItem.java │ │ │ ├── HQMItemBag.java │ │ │ └── HQMItemHeart.java │ │ │ ├── tasks │ │ │ ├── HQMTaskTame.java │ │ │ ├── HQMTaskAdvancement.java │ │ │ ├── HQMTaskCraft.java │ │ │ ├── HQMTaskKill.java │ │ │ ├── HQMTaskBlockPlace.java │ │ │ ├── HQMTaskDetect.java │ │ │ └── HQMTaskLocation.java │ │ │ ├── HQMRep.java │ │ │ └── rewards │ │ │ ├── HQMRewardStandard.java │ │ │ ├── HQMRewardChoice.java │ │ │ └── HQMRewardCommand.java │ ├── integration │ │ ├── nei │ │ │ ├── NEIConfig.java │ │ │ └── CustomPositionedStack.java │ │ └── vendingmachine │ │ │ └── VmAdapter.java │ ├── handlers │ │ ├── GuiHandler.java │ │ ├── ConfigGuiFactory.java │ │ └── ConfigHandler.java │ ├── client │ │ └── gui │ │ │ ├── GuiContainerFake.java │ │ │ └── GuiBQSConfig.java │ ├── AdminExecute.java │ └── NBTReplaceUtil.java │ ├── drethic │ └── questbook │ │ ├── crafting │ │ ├── QBCrafting.java │ │ └── CraftQuestBook.java │ │ ├── logger │ │ └── QBLogger.java │ │ ├── item │ │ └── QBItems.java │ │ ├── proxy │ │ ├── ClientProxy.java │ │ ├── ServerProxy.java │ │ └── CommonProxy.java │ │ └── events │ │ └── FMLEventHandler.java │ └── lokko12 │ └── CB4BQ │ ├── ServerProxy.java │ ├── BlockHSB.java │ ├── BlockDLB.java │ ├── BlockDSB.java │ ├── CommonProxy.java │ ├── BlockREB.java │ └── CB4BQ.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github └── workflows │ ├── release-tags.yml │ └── build-and-test.yml ├── dependencies.gradle ├── addon.gradle ├── settings.gradle ├── .gitignore ├── README.md ├── LICENSE.cb-for-bq ├── LICENSE ├── LICENSE.command-blocks └── .gitattributes /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./gradlew setupCIWorkspace -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Initial spotlessApply 2 | 6c9fac5e9eb85dde746e37f8b3aa270a47ef12cf 3 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Any Github changes require admin approval 2 | /.github/** @GTNewHorizons/admin 3 | 4 | -------------------------------------------------------------------------------- /repositories.gradle: -------------------------------------------------------------------------------- 1 | // Add any additional repositories for your dependencies here 2 | 3 | repositories { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/title.png -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/api/ApiKey.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.api; 2 | 3 | public class ApiKey { 4 | } 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/questbook/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | < en_US.lang - English localization file for the mod Tutorial > 2 | item.ItemQuestBook.name=Quest Book -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/misc/ICallback.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.misc; 2 | 3 | public interface ICallback { 4 | 5 | void setValue(T value); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/core/BQS_Settings.java: -------------------------------------------------------------------------------- 1 | package bq_standard.core; 2 | 3 | public class BQS_Settings { 4 | 5 | public static boolean hideUpdates = false; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bq_standard/textures/gui/nei.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/bq_standard/textures/gui/nei.png -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/enums/EnumPartyStatus.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.enums; 2 | 3 | public enum EnumPartyStatus { 4 | MEMBER, 5 | ADMIN, 6 | OWNER 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/sounds/page_flip0.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/sounds/page_flip0.wav -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/sounds/page_flip1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/sounds/page_flip1.wav -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/new_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/new_gui.png -------------------------------------------------------------------------------- /src/main/resources/assets/bq_standard/textures/gui/gui_elements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/bq_standard/textures/gui/gui_elements.png -------------------------------------------------------------------------------- /src/main/resources/assets/bq_standard/textures/items/loot_chest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/bq_standard/textures/items/loot_chest.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/gui_themes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/gui_themes.png -------------------------------------------------------------------------------- /src/main/resources/assets/questbook/textures/items/ItemQuestBook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/questbook/textures/items/ItemQuestBook.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/default_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/default_title.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/editor_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/editor_icons.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/null_texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/null_texture.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/quest_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/quest_frames.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/gui/simple_frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/gui/simple_frames.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/items/heart_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/items/heart_full.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/items/heart_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/items/heart_half.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/items/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/items/placeholder.png -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/package-info.java: -------------------------------------------------------------------------------- 1 | @API(owner = "betterquesting", apiVersion = "3.2", provides = "BetterQuesting|API") 2 | package betterquesting.api; 3 | 4 | import cpw.mods.fml.common.API; 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/items/heart_quarter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/items/heart_quarter.png -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/package-info.java: -------------------------------------------------------------------------------- 1 | @API(owner = "betterquesting", apiVersion = "3.1", provides = "BetterQuesting|API2") 2 | package betterquesting.api2; 3 | 4 | import cpw.mods.fml.common.API; 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/cb4bq/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | tile.CB4BQ.DLB.name=Default Load Block 2 | tile.CB4BQ.DSB.name=Default Save Block 3 | tile.CB4BQ.HSB.name=Hardcore Switch Block 4 | tile.CB4BQ.REB.name=Reset Quest Block -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/blocks/fluid_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/blocks/fluid_placeholder.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/blocks/submit_station_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/blocks/submit_station_top.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/blocks/submit_station_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/blocks/submit_station_side.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/blocks/observation_station_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/blocks/observation_station_top.png -------------------------------------------------------------------------------- /src/main/resources/assets/betterquesting/textures/blocks/observation_station_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GTNewHorizons/BetterQuesting/HEAD/src/main/resources/assets/betterquesting/textures/blocks/observation_station_side.png -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/enums/EnumQuestState.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.enums; 2 | 3 | public enum EnumQuestState { 4 | LOCKED, 5 | UNLOCKED, 6 | UNCLAIMED, 7 | COMPLETED, 8 | REPEATABLE 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/events/IPEventListener.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.events; 2 | 3 | @Deprecated 4 | public interface IPEventListener { 5 | 6 | void onPanelEvent(PanelEvent event); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/importers/ImportedQuestLines.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.importers; 2 | 3 | import betterquesting.questing.QuestLineDatabase; 4 | 5 | public class ImportedQuestLines extends QuestLineDatabase { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/crafting/QBCrafting.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.crafting; 2 | 3 | public class QBCrafting { 4 | 5 | public static final void init() { 6 | CraftQuestBook.init(); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/gui/misc/IVolatileScreen.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.gui.misc; 2 | 3 | /* 4 | * Marks questing UIs as volatile requiring confirmation to escape 5 | */ 6 | @Deprecated 7 | public interface IVolatileScreen { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/registry/IFactoryData.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.registry; 2 | 3 | @Deprecated // This is stupid and can be done with lambdas 4 | public interface IFactoryData extends IFactory { 5 | 6 | T loadFromData(E data); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/gui/misc/INeedsRefresh.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.gui.misc; 2 | 3 | @Deprecated // TODO: Replace with a proper event because this interface is dumb 4 | public interface INeedsRefresh { 5 | 6 | void refreshGui(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/registry/IFactory.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.registry; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | public interface IFactory { 6 | 7 | ResourceLocation getRegistryName(); 8 | 9 | T createNew(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/IDatabaseNBT.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | 5 | public interface IDatabaseNBT 6 | extends IDatabase, INBTPartial, INBTProgress { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/importers/IImportRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.importers; 2 | 3 | import java.util.List; 4 | 5 | public interface IImportRegistry { 6 | 7 | void registerImporter(IImporter importer); 8 | 9 | List getImporters(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/IFieldFilter.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls; 2 | 3 | public interface IFieldFilter { 4 | 5 | boolean isValid(String input); 6 | 7 | String filterText(String input); 8 | 9 | T parseValue(String input); 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.github/workflows/release-tags.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Release tagged build 3 | 4 | on: 5 | push: 6 | tags: [ '*' ] 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release-tags: 13 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master 14 | secrets: inherit 15 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/INBTSaveLoad.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | 5 | // TODO: Replace usage with INBTSerializable? 6 | public interface INBTSaveLoad { 7 | 8 | T writeToNBT(T nbt); 9 | 10 | void readFromNBT(T nbt); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/ITaskItemInput.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks; 2 | 3 | import java.util.List; 4 | 5 | import betterquesting.api.questing.tasks.ITask; 6 | import betterquesting.api.utils.BigItemStack; 7 | 8 | public interface ITaskItemInput extends ITask { 9 | 10 | List getItemInputs(); 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Build and test 3 | 4 | on: 5 | pull_request: 6 | branches: [ master, main ] 7 | push: 8 | branches: [ master, main ] 9 | 10 | jobs: 11 | build-and-test: 12 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/IRewardItemOutput.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards; 2 | 3 | import java.util.List; 4 | 5 | import betterquesting.api.questing.rewards.IReward; 6 | import betterquesting.api.utils.BigItemStack; 7 | 8 | public interface IRewardItemOutput extends IReward { 9 | 10 | List getItemOutputs(); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/items/HQMItem.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.items; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | import betterquesting.api.utils.BigItemStack; 6 | 7 | public interface HQMItem { 8 | 9 | BigItemStack convertItem(int damage, int amount, NBTTagCompound tags); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/logger/QBLogger.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.logger; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | 6 | import drethic.questbook.QuestBook; 7 | 8 | public class QBLogger { 9 | 10 | public static final Logger logger = LogManager.getLogger(QuestBook.MODID); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/colors/IGuiColor.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.colors; 2 | 3 | public interface IGuiColor { 4 | 5 | int getRGB(); 6 | 7 | float getRed(); 8 | 9 | float getGreen(); 10 | 11 | float getBlue(); 12 | 13 | float getAlpha(); 14 | 15 | void applyGlColor(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/storage/IQuestSettings.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.storage; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | 5 | import betterquesting.api.properties.IPropertyContainer; 6 | 7 | public interface IQuestSettings extends IPropertyContainer { 8 | 9 | boolean canUserEdit(EntityPlayer player); 10 | 11 | void reset(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/placeholders/FluidPlaceholder.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.placeholders; 2 | 3 | import net.minecraftforge.fluids.Fluid; 4 | 5 | public class FluidPlaceholder extends Fluid { 6 | 7 | public static Fluid fluidPlaceholder = new FluidPlaceholder(); 8 | 9 | public FluidPlaceholder() { 10 | super("betterquesting.placeholder"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/IPropertyType.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | public interface IPropertyType { 7 | 8 | ResourceLocation getKey(); 9 | 10 | T getDefault(); 11 | 12 | T readValue(NBTBase nbt); 13 | 14 | NBTBase writeValue(T value); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/IPanelButton.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls; 2 | 3 | import betterquesting.api2.client.gui.panels.IGuiPanel; 4 | 5 | public interface IPanelButton extends IGuiPanel { 6 | 7 | int getButtonID(); 8 | 9 | boolean isActive(); 10 | 11 | void setActive(boolean state); 12 | 13 | void onButtonClick(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/lines/IGuiLine.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.lines; 2 | 3 | import betterquesting.api2.client.gui.misc.IGuiRect; 4 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 5 | 6 | public interface IGuiLine { 7 | 8 | public void drawLine(IGuiRect start, IGuiRect end, int width, IGuiColor color, float partialTick); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/bq_standard_at.cfg: -------------------------------------------------------------------------------- 1 | # Standard Expansion Access Transformer configuration file 2 | public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize 3 | public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize 4 | public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft 5 | public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/item/QBItems.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.item; 2 | 3 | import net.minecraft.item.Item; 4 | 5 | import cpw.mods.fml.common.registry.GameRegistry; 6 | 7 | public final class QBItems { 8 | 9 | public static Item ItemQuestBook = new ItemQuestBook(); 10 | 11 | public static void init() { 12 | GameRegistry.registerItem(ItemQuestBook, "ItemQuestBook"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/storage/ILifeDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.storage; 2 | 3 | import java.util.UUID; 4 | 5 | import net.minecraft.nbt.NBTTagCompound; 6 | 7 | import betterquesting.api2.storage.INBTPartial; 8 | 9 | public interface ILifeDatabase extends INBTPartial { 10 | 11 | int getLives(UUID uuid); 12 | 13 | void setLives(UUID uuid, int value); 14 | 15 | void reset(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/nbt_doc/INbtDoc.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.nbt_doc; 2 | 3 | /** Used to self document the NBT editors with localised tooltips and variable naming */ 4 | public interface INbtDoc { 5 | 6 | String getUnlocalisedTitle(); 7 | 8 | String getUnlocalisedName(String key); 9 | 10 | String getUnlocalisedDesc(String key); 11 | 12 | INbtDoc getParent(); 13 | 14 | INbtDoc getChild(String key); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/registry/IRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.registry; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import net.minecraft.util.ResourceLocation; 8 | 9 | public interface IRegistry, E> { 10 | 11 | void register(T factory); 12 | 13 | T getFactory(ResourceLocation idName); 14 | 15 | @Nullable 16 | E createNew(ResourceLocation idName); 17 | 18 | List getAll(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/toolbox/IToolRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.toolbox; 2 | 3 | import java.util.Collection; 4 | 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | import betterquesting.api2.client.toolbox.IToolTab; 8 | 9 | public interface IToolRegistry { 10 | 11 | void registerToolTab(ResourceLocation tabID, IToolTab tab); 12 | 13 | IToolTab getTabByID(ResourceLocation tabID); 14 | 15 | Collection getAllTabs(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/EmptyLookupLogic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | public class EmptyLookupLogic extends LookupLogic { 7 | 8 | public EmptyLookupLogic(SimpleDatabase simpleDatabase) { 9 | super(simpleDatabase); 10 | } 11 | 12 | @Override 13 | public List> bulkLookup(int[] keys) { 14 | return Collections.emptyList(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/INBTPartial.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import net.minecraft.nbt.NBTBase; 8 | 9 | // Used when the base data set can safely be split by user. Can be used in place of INBTSaveLoad 10 | public interface INBTPartial { 11 | 12 | T writeToNBT(T nbt, @Nullable List subset); 13 | 14 | void readFromNBT(T nbt, boolean merge); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/ITaskTickable.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import betterquesting.api.questing.IQuest; 9 | import betterquesting.api.questing.tasks.ITask; 10 | import betterquesting.api2.utils.ParticipantInfo; 11 | 12 | public interface ITaskTickable extends ITask { 13 | 14 | void tickTask(@Nonnull ParticipantInfo pInfo, @Nonnull Map.Entry quest); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/gui_args/GArgsNone.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes.gui_args; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.client.gui.GuiScreen; 6 | 7 | public class GArgsNone { 8 | 9 | public static final GArgsNone NONE = new GArgsNone(null); 10 | 11 | @Nullable 12 | public final GuiScreen parent; 13 | 14 | public GArgsNone(@Nullable GuiScreen parent) { 15 | this.parent = parent; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/ITaskInventory.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import betterquesting.api.questing.IQuest; 9 | import betterquesting.api.questing.tasks.ITask; 10 | import betterquesting.api2.utils.ParticipantInfo; 11 | 12 | public interface ITaskInventory extends ITask { 13 | 14 | void onInventoryChange(@Nonnull Map.Entry quest, @Nonnull ParticipantInfo pInfo); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/IQuestDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing; 2 | 3 | import java.util.UUID; 4 | 5 | import net.minecraft.nbt.NBTTagList; 6 | 7 | import betterquesting.api2.storage.INBTPartial; 8 | import betterquesting.api2.storage.INBTProgress; 9 | import betterquesting.api2.storage.IUuidDatabase; 10 | 11 | public interface IQuestDatabase extends IUuidDatabase, INBTPartial, INBTProgress { 12 | 13 | IQuest createNew(UUID uuid); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/items/HQMItemBag.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.items; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | import betterquesting.api.utils.BigItemStack; 6 | import bq_standard.core.BQ_Standard; 7 | 8 | public class HQMItemBag implements HQMItem { 9 | 10 | @Override 11 | public BigItemStack convertItem(int damage, int amount, NBTTagCompound tags) { 12 | return new BigItemStack(BQ_Standard.lootChest, amount, damage * 25); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | // Add your dependencies here 2 | 3 | dependencies { 4 | compileOnly("org.jetbrains:annotations:26.0.2-1") 5 | compileOnly 'com.github.GTNewHorizons:DuraDisplay:1.3.4:dev' 6 | compileOnly 'com.cubefury.vendingmachine:VendingMachine:0.4.1:dev' 7 | 8 | implementation 'com.github.GTNewHorizons:NotEnoughItems:2.8.15-GTNH:dev' 9 | compileOnly 'com.github.GTNewHorizons:GTNHLib:0.7.0:dev' 10 | 11 | // For testing translations 12 | runtimeOnly 'com.github.GTNewHorizons:TX-Loader:1.8.5' 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskTame.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonObject; 7 | 8 | import betterquesting.api.questing.tasks.ITask; 9 | 10 | public class HQMTaskTame { 11 | 12 | public ITask[] convertTask(JsonObject json) { 13 | List tList = new ArrayList<>(); 14 | // No Equivalent 15 | 16 | return tList.toArray(new ITask[0]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/IValueIO.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls; 2 | 3 | public interface IValueIO { 4 | 5 | T readValue(); 6 | 7 | void writeValue(T value); 8 | 9 | // These are necessary for things like interpolating values that need to be jumped to a specific value (such as 10 | // reloading an exising GUI) 11 | // Just redirect these to the useual read and write methods if you don't need them. 12 | T readValueRaw(); 13 | 14 | void writeValueRaw(T value); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/IGuiCanvas.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public interface IGuiCanvas extends IGuiPanel { 8 | 9 | void addPanel(IGuiPanel panel); 10 | 11 | boolean removePanel(IGuiPanel panel); 12 | 13 | @Nonnull 14 | List getChildren(); 15 | 16 | /** 17 | * Removes all children and resets the canvas to its initial blank state 18 | */ 19 | void resetCanvas(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskAdvancement.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonObject; 7 | 8 | import betterquesting.api.questing.tasks.ITask; 9 | 10 | public class HQMTaskAdvancement { 11 | 12 | public ITask[] convertTask(JsonObject json) { 13 | List tasks = new ArrayList<>(); 14 | // No equivalent 15 | 16 | return tasks.toArray(new ITask[0]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/IDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.List; 4 | 5 | public interface IDatabase { 6 | 7 | int nextID(); 8 | 9 | DBEntry add(int id, T value); 10 | 11 | boolean removeID(int key); 12 | 13 | boolean removeValue(T value); 14 | 15 | int getID(T value); 16 | 17 | T getValue(int id); 18 | 19 | int size(); 20 | 21 | void reset(); 22 | 23 | List> getEntries(); 24 | 25 | List> bulkLookup(int... keys); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/misc/ComparatorGuiDepth.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.misc; 2 | 3 | import java.util.Comparator; 4 | 5 | import betterquesting.api2.client.gui.panels.IGuiPanel; 6 | 7 | public class ComparatorGuiDepth implements Comparator { 8 | 9 | public static ComparatorGuiDepth INSTANCE = new ComparatorGuiDepth(); 10 | 11 | @Override 12 | public int compare(IGuiPanel o1, IGuiPanel o2) { 13 | return o1.getTransform() 14 | .compareTo(o2.getTransform()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/crafting/CraftQuestBook.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.crafting; 2 | 3 | import net.minecraft.init.Items; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraftforge.oredict.ShapelessOreRecipe; 6 | 7 | import cpw.mods.fml.common.registry.GameRegistry; 8 | import drethic.questbook.item.QBItems; 9 | 10 | public class CraftQuestBook { 11 | 12 | public static final void init() { 13 | GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(QBItems.ItemQuestBook), Items.book, "stickWood")); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/importers/ImportedQuests.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.importers; 2 | 3 | import java.util.List; 4 | import java.util.UUID; 5 | 6 | import net.minecraft.nbt.NBTTagList; 7 | 8 | import betterquesting.questing.QuestDatabase; 9 | 10 | public class ImportedQuests extends QuestDatabase { 11 | 12 | @Override 13 | public NBTTagList writeProgressToNBT(NBTTagList nbt, List users) { 14 | return nbt; 15 | } 16 | 17 | @Override 18 | public void readProgressFromNBT(NBTTagList nbt, boolean merge) {} 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/enums/EnumQuestVisibility.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.enums; 2 | 3 | public enum EnumQuestVisibility { 4 | HIDDEN, // Never shown, and hidden from view mode. 5 | SECRET, // Like UNLOCKED, except also hidden from view mode. 6 | UNLOCKED, // Must be unlocked to be shown (all prerequisites must be completed). 7 | NORMAL, // Will be shown if all prerequisites are unlocked. 8 | COMPLETED, // Must be completed to be shown. 9 | CHAIN, // Will be shown if all prerequisites are shown. 10 | ALWAYS; // Always shown. 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/gui_args/GArgsCallback.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes.gui_args; 2 | 3 | import net.minecraft.client.gui.GuiScreen; 4 | 5 | import betterquesting.api.misc.ICallback; 6 | 7 | public class GArgsCallback extends GArgsNone { 8 | 9 | public final T value; 10 | public final ICallback callback; 11 | 12 | public GArgsCallback(GuiScreen parent, T value, ICallback callback) { 13 | super(parent); 14 | this.value = value; 15 | this.callback = callback; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/utils/Tuple2.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.utils; 2 | 3 | import net.minecraft.util.Tuple; 4 | 5 | // Purely so I don't have to do casting every damn time I want to use a Tuple 6 | public class Tuple2 extends Tuple { 7 | 8 | public Tuple2(T first, K second) { 9 | super(first, second); 10 | } 11 | 12 | @Override 13 | public T getFirst() { 14 | return (T) super.getFirst(); 15 | } 16 | 17 | @Override 18 | public K getSecond() { 19 | return (K) super.getSecond(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/CreativeTabQuesting.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.creativetab.CreativeTabs; 6 | import net.minecraft.item.Item; 7 | 8 | import betterquesting.core.BetterQuesting; 9 | 10 | public class CreativeTabQuesting extends CreativeTabs { 11 | 12 | public CreativeTabQuesting() { 13 | super(BetterQuesting.MODID); 14 | } 15 | 16 | @Nonnull 17 | @Override 18 | public Item getTabIconItem() { 19 | return BetterQuesting.extraLife; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /addon.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | options.encoding = "UTF-8" 3 | } 4 | 5 | task apiJarExtension(type: Jar) { 6 | from (sourceSets.main.allJava) { 7 | include modGroup.toString().replaceAll("\\.", "/") + "/api2/**" 8 | } 9 | 10 | from (sourceSets.main.output) { 11 | include modGroup.toString().replaceAll("\\.", "/") + "/api2/**" 12 | } 13 | 14 | from (sourceSets.main.resources.srcDirs) { 15 | include("LICENSE") 16 | } 17 | 18 | getArchiveClassifier().set('api2') 19 | } 20 | 21 | artifacts { 22 | archives apiJarExtension 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/misc/IGuiRect.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.misc; 2 | 3 | public interface IGuiRect extends Comparable { 4 | 5 | int getX(); 6 | 7 | int getY(); 8 | 9 | int getWidth(); 10 | 11 | int getHeight(); 12 | 13 | int getDepth(); 14 | 15 | IGuiRect getParent(); 16 | 17 | void setParent(IGuiRect rect); 18 | 19 | boolean contains(int x, int y); 20 | 21 | // I'll probably re-implement this at a later date when it serves more of a purpose 22 | // void translate(int x, int y); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/callbacks/CallbackMulti.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls.callbacks; 2 | 3 | import betterquesting.api.misc.ICallback; 4 | 5 | public class CallbackMulti implements ICallback { 6 | 7 | private final ICallback[] callbacks; 8 | 9 | public CallbackMulti(ICallback... callbacks) { 10 | this.callbacks = callbacks; 11 | } 12 | 13 | @Override 14 | public void setValue(T value) { 15 | for (ICallback c : callbacks) { 16 | c.setValue(value); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/commands/BQ_CommandDebug.java: -------------------------------------------------------------------------------- 1 | package betterquesting.commands; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.ICommandSender; 5 | 6 | public class BQ_CommandDebug extends CommandBase { 7 | 8 | @Override 9 | public String getCommandName() { 10 | return "bq_debug"; 11 | } 12 | 13 | @Override 14 | public String getCommandUsage(ICommandSender sender) { 15 | return "TO BE USED IN DEV ONLY"; 16 | } 17 | 18 | @Override 19 | public void processCommand(ICommandSender sender, String[] args) {} 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/ServerProxy.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import cpw.mods.fml.common.event.FMLInitializationEvent; 4 | import cpw.mods.fml.common.registry.GameRegistry; 5 | 6 | public class ServerProxy { 7 | 8 | public ServerProxy() {} 9 | 10 | public void init(FMLInitializationEvent e) { 11 | GameRegistry.registerBlock(CB4BQ.BlockDLB, "BlockDLB"); 12 | // GameRegistry.registerBlock(BlockDSB, "BlockDSB"); 13 | GameRegistry.registerBlock(CB4BQ.BlockHSB, "BlockHSB"); 14 | GameRegistry.registerBlock(CB4BQ.BlockREB, "BlockREB"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/events/BQLivingUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.events; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayerMP; 6 | 7 | import cpw.mods.fml.common.eventhandler.Event; 8 | 9 | public class BQLivingUpdateEvent extends Event { 10 | 11 | public final EntityLivingBase entityLiving; 12 | public final Entity entity; 13 | 14 | public BQLivingUpdateEvent(EntityPlayerMP player) { 15 | this.entityLiving = player; 16 | this.entity = player; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/events/PanelEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.events; 2 | 3 | public abstract class PanelEvent { 4 | 5 | private boolean cancelled = false; 6 | 7 | public abstract boolean canCancel(); 8 | 9 | public boolean isCancelled() { 10 | return this.cancelled; 11 | } 12 | 13 | public void setCancelled(boolean state) { 14 | if (!this.canCancel()) { 15 | throw new IllegalArgumentException("Attempted to cancel a non cancellable panel event"); 16 | } 17 | 18 | this.cancelled = state; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | 2 | pluginManagement { 3 | repositories { 4 | maven { 5 | // RetroFuturaGradle 6 | name "GTNH Maven" 7 | url "https://nexus.gtnewhorizons.com/repository/public/" 8 | mavenContent { 9 | includeGroup("com.gtnewhorizons") 10 | includeGroupByRegex("com\\.gtnewhorizons\\..+") 11 | } 12 | } 13 | gradlePluginPortal() 14 | mavenCentral() 15 | mavenLocal() 16 | } 17 | } 18 | 19 | plugins { 20 | id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43' 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/importers/IImporter.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.importers; 2 | 3 | import java.io.File; 4 | import java.io.FileFilter; 5 | 6 | import betterquesting.api.questing.IQuestDatabase; 7 | import betterquesting.api.questing.IQuestLineDatabase; 8 | 9 | /** 10 | * Used as a basis for quest importers 11 | */ 12 | public interface IImporter { 13 | 14 | String getUnlocalisedName(); 15 | 16 | String getUnlocalisedDescription(); 17 | 18 | FileFilter getFileFilter(); 19 | 20 | void loadFiles(IQuestDatabase questDB, IQuestLineDatabase lineDB, File[] files); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/IQuestLineEntry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | import betterquesting.api2.storage.INBTSaveLoad; 6 | 7 | public interface IQuestLineEntry extends INBTSaveLoad { 8 | 9 | @Deprecated 10 | int getSize(); 11 | 12 | int getSizeX(); 13 | 14 | int getSizeY(); 15 | 16 | int getPosX(); 17 | 18 | int getPosY(); 19 | 20 | void setPosition(int posX, int posY); 21 | 22 | @Deprecated 23 | void setSize(int size); 24 | 25 | void setSize(int sizeX, int sizeY); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/BQ_Keybindings.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client; 2 | 3 | import net.minecraft.client.settings.KeyBinding; 4 | 5 | import org.lwjgl.input.Keyboard; 6 | 7 | import betterquesting.core.BetterQuesting; 8 | import cpw.mods.fml.client.registry.ClientRegistry; 9 | 10 | public class BQ_Keybindings { 11 | 12 | public static KeyBinding openQuests; 13 | 14 | public static void RegisterKeys() { 15 | openQuests = new KeyBinding("key.betterquesting.quests", Keyboard.KEY_GRAVE, BetterQuesting.NAME); 16 | 17 | ClientRegistry.registerKeyBinding(openQuests); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/utils/DirtyPlayerMarker.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.utils; 2 | 3 | import java.util.Collection; 4 | import java.util.UUID; 5 | 6 | import net.minecraftforge.common.MinecraftForge; 7 | 8 | import betterquesting.api.events.MarkDirtyPlayerEvent; 9 | 10 | public class DirtyPlayerMarker { 11 | 12 | public static void markDirty(Collection players) { 13 | MinecraftForge.EVENT_BUS.post(new MarkDirtyPlayerEvent(players)); 14 | } 15 | 16 | public static void markDirty(UUID player) { 17 | MinecraftForge.EVENT_BUS.post(new MarkDirtyPlayerEvent(player)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/HQMRep.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters; 2 | 3 | import java.util.HashMap; 4 | 5 | public class HQMRep { 6 | 7 | public final String rName; 8 | 9 | private final HashMap markerList = new HashMap<>(); 10 | 11 | public HQMRep(String name) { 12 | this.rName = name; 13 | } 14 | 15 | public void addMarker(int id, int value) { 16 | markerList.put(id, value); 17 | } 18 | 19 | public int getMarker(int id) { 20 | Integer i = markerList.get(id); 21 | return i == null ? 0 : i; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/events/types/PEventButton.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.events.types; 2 | 3 | import betterquesting.api2.client.gui.controls.IPanelButton; 4 | import betterquesting.api2.client.gui.events.PanelEvent; 5 | 6 | public class PEventButton extends PanelEvent { 7 | 8 | private final IPanelButton btn; 9 | 10 | public PEventButton(IPanelButton btn) { 11 | this.btn = btn; 12 | } 13 | 14 | public IPanelButton getButton() { 15 | return this.btn; 16 | } 17 | 18 | @Override 19 | public boolean canCancel() { 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/party/IPartyDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing.party; 2 | 3 | import java.util.UUID; 4 | 5 | import javax.annotation.Nonnull; 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.nbt.NBTTagList; 9 | 10 | import betterquesting.api2.storage.DBEntry; 11 | import betterquesting.api2.storage.IDatabase; 12 | import betterquesting.api2.storage.INBTPartial; 13 | 14 | public interface IPartyDatabase extends IDatabase, INBTPartial { 15 | 16 | IParty createNew(int id); 17 | 18 | @Nullable 19 | DBEntry getParty(@Nonnull UUID uuid); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/utils/FileExtensionFilter.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileFilter; 5 | 6 | public class FileExtensionFilter implements FileFilter { 7 | 8 | public final String ext; 9 | 10 | public FileExtensionFilter(String extension) { 11 | ext = (extension.startsWith(".") ? extension : "." + extension).toLowerCase(); 12 | } 13 | 14 | @Override 15 | public boolean accept(File pathname) { 16 | return pathname != null && (pathname.isDirectory() || pathname.getAbsolutePath() 17 | .toLowerCase() 18 | .endsWith(ext)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/textures/IGuiTexture.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.textures; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 7 | 8 | public interface IGuiTexture { 9 | 10 | void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick); 11 | 12 | void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick, IGuiColor color); 13 | 14 | ResourceLocation getTexture(); 15 | 16 | IGuiRect getBounds(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/gui_args/GArgsNBT.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes.gui_args; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.client.gui.GuiScreen; 6 | import net.minecraft.nbt.NBTBase; 7 | 8 | import betterquesting.api.misc.ICallback; 9 | import betterquesting.api.nbt_doc.INbtDoc; 10 | 11 | public class GArgsNBT extends GArgsCallback { 12 | 13 | public final INbtDoc doc; 14 | 15 | public GArgsNBT(@Nullable GuiScreen parent, T nbt, ICallback callback, INbtDoc doc) { 16 | super(parent, nbt, callback); 17 | this.doc = doc; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .settings 3 | .java-version 4 | /.idea/ 5 | /.vscode/ 6 | /run/ 7 | /build/ 8 | /eclipse/ 9 | .classpath 10 | .project 11 | /bin/ 12 | /config/ 13 | /crash-reports/ 14 | /logs/ 15 | options.txt 16 | /saves/ 17 | usernamecache.json 18 | banned-ips.json 19 | banned-players.json 20 | eula.txt 21 | ops.json 22 | server.properties 23 | servers.dat 24 | usercache.json 25 | whitelist.json 26 | /out/ 27 | *.iml 28 | *.ipr 29 | *.iws 30 | src/main/resources/mixins.*([!.]).json 31 | *.bat 32 | *.DS_Store 33 | !gradlew.bat 34 | .factorypath 35 | addon.local.gradle 36 | addon.local.gradle.kts 37 | addon.late.local.gradle 38 | addon.late.local.gradle.kts 39 | layout.json 40 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/network/IPacketSender.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.network; 2 | 3 | import net.minecraft.entity.player.EntityPlayerMP; 4 | 5 | import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; 6 | 7 | public interface IPacketSender { 8 | 9 | // Server to Client 10 | void sendToPlayers(QuestingPacket payload, EntityPlayerMP... players); 11 | 12 | void sendToAll(QuestingPacket payload); 13 | 14 | // Client to Server 15 | void sendToServer(QuestingPacket payload); 16 | 17 | // Misc. 18 | void sendToAround(QuestingPacket payload, TargetPoint point); 19 | 20 | void sendToDimension(QuestingPacket payload, int dimension); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/network/QuestingPacket.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.network; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | public final class QuestingPacket { 7 | 8 | private final ResourceLocation handler; 9 | private final NBTTagCompound payload; 10 | 11 | public QuestingPacket(ResourceLocation handler, NBTTagCompound payload) { 12 | this.handler = handler; 13 | this.payload = payload; 14 | } 15 | 16 | public ResourceLocation getHandler() { 17 | return handler; 18 | } 19 | 20 | public NBTTagCompound getPayload() { 21 | return payload; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/toolbox/IToolTab.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.toolbox; 2 | 3 | import betterquesting.api2.client.gui.misc.IGuiRect; 4 | import betterquesting.api2.client.gui.panels.IGuiPanel; 5 | import betterquesting.api2.client.gui.panels.lists.CanvasQuestLine; 6 | import betterquesting.client.gui2.editors.designer.PanelToolController; 7 | 8 | public interface IToolTab { 9 | 10 | String getUnlocalisedName(); 11 | 12 | // TODO: Figure out a reasonable way of adding tools 13 | // void registerTool(IToolboxTool tool, ResourceLocation icon); 14 | 15 | IGuiPanel getTabGui(IGuiRect rect, CanvasQuestLine questLine, PanelToolController toolController); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/proxy/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.proxy; 2 | 3 | import cpw.mods.fml.common.event.FMLInitializationEvent; 4 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 5 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 6 | 7 | public class ClientProxy extends CommonProxy { 8 | 9 | @Override 10 | public void preInit(FMLPreInitializationEvent e) { 11 | super.preInit(e); 12 | } 13 | 14 | @Override 15 | public void init(FMLInitializationEvent e) { 16 | super.init(e); 17 | } 18 | 19 | @Override 20 | public void postInit(FMLPostInitializationEvent e) { 21 | super.postInit(e); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/proxy/ServerProxy.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.proxy; 2 | 3 | import cpw.mods.fml.common.event.FMLInitializationEvent; 4 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 5 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 6 | 7 | public class ServerProxy extends CommonProxy { 8 | 9 | @Override 10 | public void preInit(FMLPreInitializationEvent e) { 11 | super.preInit(e); 12 | } 13 | 14 | @Override 15 | public void init(FMLInitializationEvent e) { 16 | super.init(e); 17 | } 18 | 19 | @Override 20 | public void postInit(FMLPostInitializationEvent e) { 21 | super.postInit(e); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeBase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import betterquesting.api.properties.IPropertyType; 6 | 7 | public abstract class PropertyTypeBase implements IPropertyType { 8 | 9 | private final ResourceLocation key; 10 | private final T def; 11 | 12 | public PropertyTypeBase(ResourceLocation key, T def) { 13 | this.key = key; 14 | this.def = def; 15 | } 16 | 17 | @Override 18 | public ResourceLocation getKey() { 19 | return key; 20 | } 21 | 22 | @Override 23 | public T getDefault() { 24 | return def; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/GuiKey.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | // This class is mostly for convenience and including type info to the ID 8 | public class GuiKey { 9 | 10 | private final ResourceLocation ID; 11 | 12 | public GuiKey(@Nonnull ResourceLocation id) { 13 | this.ID = id; 14 | } 15 | 16 | @Nonnull 17 | public ResourceLocation getID() { 18 | return this.ID; 19 | } 20 | 21 | @Override 22 | public boolean equals(Object obj) { 23 | return obj instanceof GuiKey && ((GuiKey) obj).ID.equals(ID); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/integration/nei/NEIConfig.java: -------------------------------------------------------------------------------- 1 | package bq_standard.integration.nei; 2 | 3 | import bq_standard.core.BQ_Standard; 4 | import codechicken.nei.api.API; 5 | import codechicken.nei.api.IConfigureNEI; 6 | 7 | @SuppressWarnings("unused") 8 | public class NEIConfig implements IConfigureNEI { 9 | 10 | @Override 11 | public void loadConfig() { 12 | API.registerRecipeHandler(new QuestRecipeHandler()); 13 | API.registerUsageHandler(new QuestRecipeHandler()); 14 | } 15 | 16 | @Override 17 | public String getName() { 18 | return BQ_Standard.NAME; 19 | } 20 | 21 | @Override 22 | public String getVersion() { 23 | return BQ_Standard.VERSION; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/bars/IScrollBar.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels.bars; 2 | 3 | import betterquesting.api2.client.gui.controls.IValueIO; 4 | import betterquesting.api2.client.gui.panels.IGuiPanel; 5 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 6 | 7 | public interface IScrollBar extends IValueIO, IGuiPanel { 8 | 9 | void setActive(boolean state); 10 | 11 | boolean isActive(); 12 | 13 | IScrollBar setHandleSize(int size, int inset); 14 | 15 | IScrollBar setBarTexture(IGuiTexture background, IGuiTexture handleDisabled, IGuiTexture handleIdle, 16 | IGuiTexture handleHover); 17 | 18 | IScrollBar setScrollSpeed(float spd); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/bars/IBarFill.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels.bars; 2 | 3 | import betterquesting.api2.client.gui.controls.IValueIO; 4 | import betterquesting.api2.client.gui.panels.IGuiPanel; 5 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 6 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 7 | 8 | public interface IBarFill extends IGuiPanel { 9 | 10 | IBarFill setFillDriver(IValueIO driver); 11 | 12 | IBarFill setFlipped(boolean flipped); 13 | 14 | IBarFill setFillColor(IGuiColor color); // Setup the transitional colour manually if necessary 15 | 16 | IBarFill setBarTexture(IGuiTexture back, IGuiTexture front); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/tasks/IItemTask.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing.tasks; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import net.minecraft.item.ItemStack; 7 | 8 | import betterquesting.api.questing.IQuest; 9 | import betterquesting.api2.utils.ParticipantInfo; 10 | 11 | public interface IItemTask extends ITask { 12 | 13 | boolean canAcceptItem(UUID owner, Map.Entry quest, ItemStack stack); 14 | 15 | ItemStack submitItem(UUID owner, Map.Entry quest, ItemStack stack); 16 | 17 | /** 18 | * @param items read-only list of items 19 | */ 20 | default void retrieveItems(ParticipantInfo pInfo, Map.Entry quest, ItemStack[] items) {} 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/TaskOptionalRetrieval.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks; 2 | 3 | import java.util.UUID; 4 | 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | import bq_standard.core.BQ_Standard; 8 | import bq_standard.tasks.factory.FactoryTaskOptionalRetrieval; 9 | 10 | public class TaskOptionalRetrieval extends TaskRetrieval { 11 | 12 | @Override 13 | public String getUnlocalisedName() { 14 | return BQ_Standard.MODID + ".task.optional_retrieval"; 15 | } 16 | 17 | @Override 18 | public ResourceLocation getFactoryID() { 19 | return FactoryTaskOptionalRetrieval.INSTANCE.getRegistryName(); 20 | } 21 | 22 | @Override 23 | public boolean ignored(UUID uuid) { 24 | return true; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/tasks/IFluidTask.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing.tasks; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import net.minecraftforge.fluids.FluidStack; 7 | 8 | import betterquesting.api.questing.IQuest; 9 | import betterquesting.api2.utils.ParticipantInfo; 10 | 11 | public interface IFluidTask extends ITask { 12 | 13 | boolean canAcceptFluid(UUID owner, Map.Entry quest, FluidStack fluid); 14 | 15 | FluidStack submitFluid(UUID owner, Map.Entry quest, FluidStack fluid); 16 | 17 | /** 18 | * @param fluids read-only list of fluids 19 | */ 20 | default void retrieveFluids(ParticipantInfo pInfo, Map.Entry quest, FluidStack[] fluids) {} 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/IGuiPanel.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels; 2 | 3 | import java.util.List; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | 7 | public interface IGuiPanel { 8 | 9 | IGuiRect getTransform(); 10 | 11 | void initPanel(); 12 | 13 | void setEnabled(boolean state); 14 | 15 | boolean isEnabled(); 16 | 17 | void drawPanel(int mx, int my, float partialTick); 18 | 19 | boolean onMouseClick(int mx, int my, int button); 20 | 21 | boolean onMouseRelease(int mx, int my, int button); 22 | 23 | boolean onMouseScroll(int mx, int my, int scroll); 24 | 25 | boolean onKeyTyped(char c, int keycode); 26 | 27 | List getTooltip(int mx, int my); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/integration/nei/CustomPositionedStack.java: -------------------------------------------------------------------------------- 1 | package bq_standard.integration.nei; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import codechicken.nei.PositionedStack; 7 | 8 | public class CustomPositionedStack extends PositionedStack { 9 | 10 | private final List tooltips; 11 | 12 | public CustomPositionedStack(Object object, int x, int y, List tooltips) { 13 | super(object, x, y); 14 | this.tooltips = tooltips; 15 | } 16 | 17 | public CustomPositionedStack(Object object, int x, int y, String tooltip) { 18 | this(object, x, y, Collections.singletonList(tooltip)); 19 | } 20 | 21 | public List getTooltips() { 22 | return tooltips; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/handlers/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package bq_standard.handlers; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.world.World; 5 | 6 | import bq_standard.client.gui.editors.GuiEditLootGroup; 7 | import cpw.mods.fml.common.network.IGuiHandler; 8 | 9 | public class GuiHandler implements IGuiHandler { 10 | 11 | @Override 12 | public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { 13 | return null; 14 | } 15 | 16 | @Override 17 | public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { 18 | if (ID == 0) { 19 | return new GuiEditLootGroup(null); 20 | } 21 | 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/INBTProgress.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.List; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.nbt.NBTBase; 9 | 10 | // Used when progress specific data is being handled (usually split per user) 11 | public interface INBTProgress { 12 | 13 | /** If users is not null, only the progress for the users in the list will be written to the NBT */ 14 | T writeProgressToNBT(T nbt, @Nullable List users); 15 | 16 | /** 17 | * if merge is true, the progress for some users will be merged with the existing progress, otherwise it will be 18 | * overwritten 19 | */ 20 | void readProgressFromNBT(T nbt, boolean merge); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/utils/QuestLineSorter.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.utils; 2 | 3 | import java.util.Comparator; 4 | import java.util.Map; 5 | import java.util.UUID; 6 | 7 | import betterquesting.api.questing.IQuestLine; 8 | import betterquesting.api.questing.IQuestLineDatabase; 9 | 10 | public class QuestLineSorter implements Comparator> { 11 | 12 | private final IQuestLineDatabase QL_DB; 13 | 14 | public QuestLineSorter(IQuestLineDatabase database) { 15 | this.QL_DB = database; 16 | } 17 | 18 | @Override 19 | public int compare(Map.Entry objA, Map.Entry objB) { 20 | return Integer.compare(QL_DB.getOrderIndex(objA.getKey()), QL_DB.getOrderIndex(objB.getKey())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BetterQuesting 2 | ============ 3 | 4 | A new and improved questing mod for Minecraft pack creators 5 | 6 | Standard Expansion 7 | ============ 8 | 9 | Contains all the basic tasks, rewards, importers and themes for the Better Questing mod 10 | 11 | Quest Book 12 | ============ 13 | 14 | Contains a basic quest book item to give the player something to interact with if there are keybinding conflicts. 15 | 16 | # CB-for-BQ 17 | Command Blocks for Better Questing 18 | 19 | - Adds 3 Blocks: 20 | - Default Load Block to Load Quests after an update. 21 | - Hardcore Switch Block to activate/deactivate Hardcore Mode. 22 | - Reset Block to Reset Quests of the Player thats activating it. 23 | - Blocks can be used in MP but cannot be crafted. 24 | - works with BQ1 and SHOULD work with BQ2 aswell (untested) 25 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/events/NbtDocEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.events; 2 | 3 | import betterquesting.api.nbt_doc.INbtDoc; 4 | import cpw.mods.fml.common.eventhandler.Event; 5 | 6 | /** 7 | * Can be used to override the JsonDocs in the editors with custom ones. 8 | */ 9 | public class NbtDocEvent extends Event { 10 | 11 | private final INbtDoc inJdoc; 12 | private INbtDoc outJdoc; 13 | 14 | public NbtDocEvent(INbtDoc jdoc) { 15 | inJdoc = jdoc; 16 | outJdoc = jdoc; 17 | } 18 | 19 | public INbtDoc getNbtDoc() { 20 | return inJdoc; 21 | } 22 | 23 | public void setNewDoc(INbtDoc jdoc) { 24 | this.outJdoc = jdoc; 25 | } 26 | 27 | public INbtDoc getNbtDocResult() { 28 | return outJdoc == null ? inJdoc : outJdoc; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/storage/INameCache.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.storage; 2 | 3 | import java.util.List; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.nbt.NBTTagList; 10 | 11 | import betterquesting.api2.storage.INBTPartial; 12 | 13 | public interface INameCache extends INBTPartial { 14 | 15 | boolean updateName(@Nonnull EntityPlayerMP player); 16 | 17 | String getName(@Nonnull UUID uuid); 18 | 19 | UUID getUUID(@Nonnull String name); 20 | 21 | List getAllNames(); 22 | 23 | /** 24 | * Used primarily to know if a user is an OP client side
25 | */ 26 | boolean isOP(UUID uuid); 27 | 28 | int size(); 29 | 30 | void reset(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/events/MarkDirtyPlayerEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.events; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | import java.util.TreeSet; 6 | import java.util.UUID; 7 | 8 | import cpw.mods.fml.common.eventhandler.Event; 9 | 10 | public class MarkDirtyPlayerEvent extends Event { 11 | 12 | private final Collection dirtyPlayerIDs; 13 | 14 | public MarkDirtyPlayerEvent(UUID dirtyPlayerID) { 15 | this.dirtyPlayerIDs = Collections.singleton(dirtyPlayerID); 16 | } 17 | 18 | public MarkDirtyPlayerEvent(Collection dirtyPlayerIDs) { 19 | this.dirtyPlayerIDs = Collections.unmodifiableCollection(new TreeSet<>(dirtyPlayerIDs)); 20 | } 21 | 22 | public Collection getDirtyPlayerIDs() { 23 | return dirtyPlayerIDs; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/client/gui/GuiContainerFake.java: -------------------------------------------------------------------------------- 1 | package bq_standard.client.gui; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import net.minecraft.client.gui.inventory.GuiContainer; 6 | 7 | public class GuiContainerFake extends GuiContainer { 8 | 9 | public GuiContainerFake() { 10 | super(null); 11 | } 12 | 13 | private Consumer onInitCallback; 14 | 15 | @Override 16 | public void initGui() { 17 | if (onInitCallback != null) onInitCallback.accept(null); 18 | } 19 | 20 | @Override 21 | public void onGuiClosed() {} 22 | 23 | @Override 24 | protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {} 25 | 26 | public void setOnInitCallback(Consumer onInitCallback) { 27 | this.onInitCallback = onInitCallback; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskCraft.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api.utils.JsonHelper; 8 | import bq_standard.importers.hqm.HQMUtilities; 9 | import bq_standard.tasks.TaskCrafting; 10 | 11 | public class HQMTaskCraft { 12 | 13 | public ITask[] convertTask(JsonObject json) { 14 | TaskCrafting task = new TaskCrafting(); 15 | 16 | for (JsonElement element : JsonHelper.GetArray(json, "items")) { 17 | if (!(element instanceof JsonObject)) continue; 18 | task.requiredItems.add(HQMUtilities.HQMStackT2(element.getAsJsonObject())); 19 | } 20 | 21 | return new ITask[] { task }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/IResourceReg.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes; 2 | 3 | import com.google.gson.JsonObject; 4 | 5 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 6 | import betterquesting.api2.client.gui.resources.lines.IGuiLine; 7 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 8 | import betterquesting.api2.registry.IFactoryData; 9 | import betterquesting.api2.registry.IRegistry; 10 | 11 | /** Registry for BQ GUI resource type loaders. Used primarily for loading themes from JSON */ 12 | public interface IResourceReg { 13 | 14 | IRegistry, IGuiTexture> getTexReg(); 15 | 16 | IRegistry, IGuiColor> getColorReg(); 17 | 18 | IRegistry, IGuiLine> getLineReg(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/gui/GuiYesNoLocked.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.gui; 2 | 3 | import net.minecraft.client.gui.GuiYesNo; 4 | import net.minecraft.client.gui.GuiYesNoCallback; 5 | 6 | /** 7 | * Variation of GuiYesNo that prevents users from using escape to skip the dialog 8 | */ 9 | public class GuiYesNoLocked extends GuiYesNo { 10 | 11 | public GuiYesNoLocked(GuiYesNoCallback callback, String txt1, String txt2, int id) { 12 | super(callback, txt1, txt2, id); 13 | } 14 | 15 | public GuiYesNoLocked(GuiYesNoCallback callback, String txt1, String txt2, String txtConfirm, String txtCancel, 16 | int id) { 17 | super(callback, txt1, txt2, txtConfirm, txtCancel, id); 18 | } 19 | 20 | /** 21 | * Disables escaping 22 | */ 23 | @Override 24 | protected void keyTyped(char character, int keyCode) {} 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/handlers/ConfigGuiFactory.java: -------------------------------------------------------------------------------- 1 | package betterquesting.handlers; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiScreen; 7 | 8 | import betterquesting.client.gui.GuiBQConfig; 9 | import cpw.mods.fml.client.IModGuiFactory; 10 | 11 | public class ConfigGuiFactory implements IModGuiFactory { 12 | 13 | @Override 14 | public void initialize(Minecraft minecraftInstance) {} 15 | 16 | @Override 17 | public Class mainConfigGuiClass() { 18 | return GuiBQConfig.class; 19 | } 20 | 21 | @Override 22 | public Set runtimeGuiCategories() { 23 | return null; 24 | } 25 | 26 | @Override 27 | public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/rewards/HQMRewardStandard.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.rewards; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonObject; 6 | 7 | import betterquesting.api.questing.rewards.IReward; 8 | import bq_standard.importers.hqm.HQMUtilities; 9 | import bq_standard.rewards.RewardItem; 10 | 11 | public class HQMRewardStandard { 12 | 13 | public IReward[] convertReward(JsonElement json) { 14 | if (!(json instanceof JsonArray)) return null; 15 | 16 | RewardItem reward = new RewardItem(); 17 | for (JsonElement je : json.getAsJsonArray()) { 18 | if (!(je instanceof JsonObject)) continue; 19 | reward.items.add(HQMUtilities.HQMStackT1(je.getAsJsonObject())); 20 | } 21 | 22 | return new IReward[] { reward }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/io/ValueFuncIO.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls.io; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | import betterquesting.api2.client.gui.controls.IValueIO; 6 | 7 | public class ValueFuncIO implements IValueIO { 8 | 9 | private final Callable v; 10 | 11 | public ValueFuncIO(Callable value) { 12 | this.v = value; 13 | } 14 | 15 | @Override 16 | public T readValue() { 17 | try { 18 | return v.call(); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | return null; 22 | } 23 | } 24 | 25 | @Override 26 | public void writeValue(T value) {} 27 | 28 | @Override 29 | public T readValueRaw() { 30 | return readValue(); 31 | } 32 | 33 | @Override 34 | public void writeValueRaw(T value) {} 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/handlers/ConfigGuiFactory.java: -------------------------------------------------------------------------------- 1 | package bq_standard.handlers; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiScreen; 7 | 8 | import bq_standard.client.gui.GuiBQSConfig; 9 | import cpw.mods.fml.client.IModGuiFactory; 10 | 11 | public class ConfigGuiFactory implements IModGuiFactory { 12 | 13 | @Override 14 | public void initialize(Minecraft minecraftInstance) {} 15 | 16 | @Override 17 | public Class mainConfigGuiClass() { 18 | return GuiBQSConfig.class; 19 | } 20 | 21 | @Override 22 | public Set runtimeGuiCategories() { 23 | return null; 24 | } 25 | 26 | @Override 27 | @Deprecated 28 | public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/gui_args/GArgsFileBrowser.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes.gui_args; 2 | 3 | import java.io.File; 4 | import java.io.FileFilter; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.client.gui.GuiScreen; 9 | 10 | import betterquesting.api.misc.ICallback; 11 | 12 | public class GArgsFileBrowser extends GArgsNone { 13 | 14 | public final File root; 15 | public final ICallback callback; 16 | public final FileFilter filter; 17 | public final boolean multiSelect; 18 | 19 | public GArgsFileBrowser(@Nullable GuiScreen parent, File root, ICallback callback, FileFilter filter, 20 | boolean multiSelect) { 21 | super(parent); 22 | this.root = root; 23 | this.callback = callback; 24 | this.filter = filter; 25 | this.multiSelect = multiSelect; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/rewards/HQMRewardChoice.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.rewards; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonObject; 6 | 7 | import betterquesting.api.questing.rewards.IReward; 8 | import bq_standard.importers.hqm.HQMUtilities; 9 | import bq_standard.rewards.RewardChoice; 10 | 11 | public class HQMRewardChoice { 12 | 13 | public IReward[] convertReward(JsonElement json) { 14 | if (!(json instanceof JsonArray)) return null; 15 | 16 | RewardChoice reward = new RewardChoice(); 17 | for (JsonElement je : json.getAsJsonArray()) { 18 | if (!(je instanceof JsonObject)) continue; 19 | reward.choices.add(HQMUtilities.HQMStackT1(je.getAsJsonObject())); 20 | } 21 | 22 | return new IReward[] { reward }; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/handlers/ConfigHandler.java: -------------------------------------------------------------------------------- 1 | package bq_standard.handlers; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | 5 | import org.apache.logging.log4j.Level; 6 | 7 | import bq_standard.core.BQS_Settings; 8 | import bq_standard.core.BQ_Standard; 9 | 10 | public class ConfigHandler { 11 | 12 | public static Configuration config; 13 | 14 | public static void initConfigs() { 15 | if (config == null) { 16 | BQ_Standard.logger.log(Level.ERROR, "Config attempted to be loaded before it was initialised!"); 17 | return; 18 | } 19 | 20 | config.load(); 21 | 22 | BQS_Settings.hideUpdates = config 23 | .getBoolean("Hide Updates", Configuration.CATEGORY_GENERAL, false, "Hide update notifications"); 24 | 25 | config.save(); 26 | 27 | BQ_Standard.logger.log(Level.INFO, "Loaded configs..."); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeString.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTTagString; 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | public class PropertyTypeString extends PropertyTypeBase { 8 | 9 | public PropertyTypeString(ResourceLocation key, String def) { 10 | super(key, def); 11 | } 12 | 13 | @Override 14 | public String readValue(NBTBase nbt) { 15 | if (nbt == null || nbt.getId() != 8) { 16 | return this.getDefault(); 17 | } 18 | 19 | return ((NBTTagString) nbt).func_150285_a_(); 20 | } 21 | 22 | @Override 23 | public NBTBase writeValue(String value) { 24 | if (value == null) { 25 | return new NBTTagString(this.getDefault()); 26 | } 27 | 28 | return new NBTTagString(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/BigDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | // Divides the database into smaller indexed blocks to speed up search times. 8 | @Deprecated 9 | public abstract class BigDatabase extends SimpleDatabase { 10 | 11 | public BigDatabase() {} 12 | 13 | @Deprecated 14 | public BigDatabase(int blockSize) {} 15 | 16 | public List> bulkLookup(int... ids) { 17 | if (ids == null || ids.length <= 0) return Collections.emptyList(); 18 | 19 | List> values = new ArrayList<>(); 20 | 21 | synchronized (this) { 22 | for (int i : ids) { 23 | T v = getValue(i); 24 | if (v != null) values.add(new DBEntry<>(i, v)); 25 | } 26 | } 27 | 28 | return values; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/events/PEventFilter.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.events; 2 | 3 | /** 4 | * Utility for safely casting events and their sub-types 5 | */ 6 | public class PEventFilter { 7 | 8 | private final Class type; 9 | 10 | public PEventFilter(Class type) { 11 | this.type = type; 12 | } 13 | 14 | public Class getType() { 15 | return this.type; 16 | } 17 | 18 | public boolean isCompatible(PanelEvent event) { 19 | return event != null && type.isAssignableFrom(event.getClass()); 20 | } 21 | 22 | /** 23 | * Safely casts to this filters type or returns null if incompatible 24 | */ 25 | @SuppressWarnings("unchecked") 26 | public T castEvent(PanelEvent event) { 27 | if (!isCompatible(event)) { 28 | return null; 29 | } 30 | 31 | return (T) event; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/renderer/EntityPlaceholderRenderer.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.renderer; 2 | 3 | import net.minecraft.client.renderer.entity.Render; 4 | import net.minecraft.client.renderer.entity.RenderManager; 5 | import net.minecraft.entity.Entity; 6 | import net.minecraft.entity.item.EntityItem; 7 | import net.minecraft.util.ResourceLocation; 8 | 9 | import betterquesting.api.placeholders.EntityPlaceholder; 10 | 11 | public class EntityPlaceholderRenderer extends Render { 12 | 13 | @Override 14 | public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) { 15 | EntityItem item = ((EntityPlaceholder) entity).GetItemEntity(); 16 | RenderManager.instance.renderEntityWithPosYaw(item, x, y + 1D, z, yaw, partialTick); 17 | } 18 | 19 | @Override 20 | protected ResourceLocation getEntityTexture(Entity entity) { 21 | return null; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/party/IParty.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing.party; 2 | 3 | import java.util.List; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nonnull; 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.nbt.NBTTagCompound; 10 | 11 | import betterquesting.api.enums.EnumPartyStatus; 12 | import betterquesting.api.properties.IPropertyContainer; 13 | import betterquesting.api2.storage.INBTSaveLoad; 14 | 15 | public interface IParty extends INBTSaveLoad { 16 | 17 | IPropertyContainer getProperties(); 18 | 19 | void kickUser(@Nonnull UUID uuid); 20 | 21 | void setStatus(@Nonnull UUID uuid, @Nonnull EnumPartyStatus priv); 22 | 23 | @Nullable 24 | EnumPartyStatus getStatus(@Nonnull UUID uuid); 25 | 26 | List getMembers(); 27 | 28 | NBTTagCompound writeProperties(NBTTagCompound nbt); 29 | 30 | void readProperties(NBTTagCompound nbt); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeByte.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTBase.NBTPrimitive; 5 | import net.minecraft.nbt.NBTTagByte; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | public class PropertyTypeByte extends PropertyTypeBase { 9 | 10 | public PropertyTypeByte(ResourceLocation key, Byte def) { 11 | super(key, def); 12 | } 13 | 14 | @Override 15 | public Byte readValue(NBTBase nbt) { 16 | if (nbt == null || !(nbt instanceof NBTPrimitive)) { 17 | return this.getDefault(); 18 | } 19 | 20 | return ((NBTPrimitive) nbt).func_150290_f(); 21 | } 22 | 23 | @Override 24 | public NBTBase writeValue(Byte value) { 25 | if (value == null) { 26 | return new NBTTagByte(this.getDefault()); 27 | } 28 | 29 | return new NBTTagByte(value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/gui2/editors/nbt/callback/NbtItemCallback.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.gui2.editors.nbt.callback; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | import betterquesting.api.misc.ICallback; 7 | import betterquesting.api.utils.BigItemStack; 8 | import betterquesting.api.utils.JsonHelper; 9 | 10 | public class NbtItemCallback implements ICallback { 11 | 12 | private final NBTTagCompound json; 13 | 14 | public NbtItemCallback(NBTTagCompound json) { 15 | this.json = json; 16 | } 17 | 18 | public void setValue(BigItemStack stack) { 19 | BigItemStack baseStack; 20 | 21 | if (stack != null) { 22 | baseStack = stack; 23 | } else { 24 | baseStack = new BigItemStack(Blocks.stone); 25 | } 26 | 27 | JsonHelper.ClearCompoundTag(json); 28 | JsonHelper.ItemStackToJson(baseStack, json); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeFloat.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTBase.NBTPrimitive; 5 | import net.minecraft.nbt.NBTTagFloat; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | public class PropertyTypeFloat extends PropertyTypeBase { 9 | 10 | public PropertyTypeFloat(ResourceLocation key, Float def) { 11 | super(key, def); 12 | } 13 | 14 | @Override 15 | public Float readValue(NBTBase nbt) { 16 | if (nbt == null || !(nbt instanceof NBTPrimitive)) { 17 | return this.getDefault(); 18 | } 19 | 20 | return ((NBTPrimitive) nbt).func_150288_h(); 21 | } 22 | 23 | @Override 24 | public NBTBase writeValue(Float value) { 25 | if (value == null) { 26 | return new NBTTagFloat(this.getDefault()); 27 | } 28 | 29 | return new NBTTagFloat(value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/CanvasTextured.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 7 | 8 | public class CanvasTextured extends CanvasEmpty { 9 | 10 | private final IGuiTexture bgTexture; 11 | 12 | public CanvasTextured(IGuiRect rect, IGuiTexture texture) { 13 | super(rect); 14 | 15 | this.bgTexture = texture; 16 | } 17 | 18 | @Override 19 | public void drawPanel(int mx, int my, float partialTick) { 20 | IGuiRect bounds = this.getTransform(); 21 | GL11.glPushMatrix(); 22 | GL11.glColor4f(1F, 1F, 1F, 1F); 23 | bgTexture.drawTexture(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), 0F, partialTick); 24 | GL11.glPopMatrix(); 25 | 26 | super.drawPanel(mx, my, partialTick); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskXP.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskXP; 10 | 11 | public class FactoryTaskXP implements IFactoryData { 12 | 13 | public static final FactoryTaskXP INSTANCE = new FactoryTaskXP(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":xp"); 18 | } 19 | 20 | @Override 21 | public TaskXP createNew() { 22 | return new TaskXP(); 23 | } 24 | 25 | @Override 26 | public TaskXP loadFromData(NBTTagCompound json) { 27 | TaskXP task = new TaskXP(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeDouble.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTBase.NBTPrimitive; 5 | import net.minecraft.nbt.NBTTagDouble; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | public class PropertyTypeDouble extends PropertyTypeBase { 9 | 10 | public PropertyTypeDouble(ResourceLocation key, Double def) { 11 | super(key, def); 12 | } 13 | 14 | @Override 15 | public Double readValue(NBTBase nbt) { 16 | if (nbt == null || !(nbt instanceof NBTPrimitive)) { 17 | return this.getDefault(); 18 | } 19 | 20 | return ((NBTPrimitive) nbt).func_150286_g(); 21 | } 22 | 23 | @Override 24 | public NBTBase writeValue(Double value) { 25 | if (value == null) { 26 | return new NBTTagDouble(this.getDefault()); 27 | } 28 | 29 | return new NBTTagDouble(value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeInteger.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTBase.NBTPrimitive; 5 | import net.minecraft.nbt.NBTTagInt; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | public class PropertyTypeInteger extends PropertyTypeBase { 9 | 10 | public PropertyTypeInteger(ResourceLocation key, Integer def) { 11 | super(key, def); 12 | } 13 | 14 | @Override 15 | public Integer readValue(NBTBase nbt) { 16 | if (nbt == null || !(nbt instanceof NBTPrimitive)) { 17 | return this.getDefault(); 18 | } 19 | 20 | return ((NBTPrimitive) nbt).func_150287_d(); 21 | } 22 | 23 | @Override 24 | public NBTBase writeValue(Integer value) { 25 | if (value == null) { 26 | return new NBTTagInt(this.getDefault()); 27 | } 28 | 29 | return new NBTTagInt(value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/help/HelpTopic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.help; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import betterquesting.api2.utils.QuestTranslation; 6 | 7 | public class HelpTopic { 8 | 9 | private final String title; 10 | private final String description; 11 | 12 | public HelpTopic(@Nonnull String title, @Nonnull String description) { 13 | this.title = title; 14 | this.description = description; 15 | } 16 | 17 | public String getTitle() { 18 | return QuestTranslation.translate(title); 19 | } 20 | 21 | public String getDescription() { 22 | return QuestTranslation.translate(description); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (!(o instanceof HelpTopic)) return false; 28 | 29 | HelpTopic ht = (HelpTopic) o; 30 | 31 | return ht.title.equals(this.title) && ht.description.equals(this.description); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/gui2/editors/nbt/callback/NbtFluidCallback.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.gui2.editors.nbt.callback; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraftforge.fluids.FluidRegistry; 5 | import net.minecraftforge.fluids.FluidStack; 6 | 7 | import betterquesting.api.misc.ICallback; 8 | import betterquesting.api.utils.JsonHelper; 9 | 10 | public class NbtFluidCallback implements ICallback { 11 | 12 | private final NBTTagCompound json; 13 | 14 | public NbtFluidCallback(NBTTagCompound json) { 15 | this.json = json; 16 | } 17 | 18 | public void setValue(FluidStack stack) { 19 | FluidStack baseStack; 20 | 21 | if (stack != null) { 22 | baseStack = stack; 23 | } else { 24 | baseStack = new FluidStack(FluidRegistry.WATER, 1000); 25 | } 26 | 27 | JsonHelper.ClearCompoundTag(json); 28 | JsonHelper.FluidStackToJson(baseStack, json); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskHunt.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskHunt; 10 | 11 | public class FactoryTaskHunt implements IFactoryData { 12 | 13 | public static final FactoryTaskHunt INSTANCE = new FactoryTaskHunt(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":hunt"); 18 | } 19 | 20 | @Override 21 | public TaskHunt createNew() { 22 | return new TaskHunt(); 23 | } 24 | 25 | @Override 26 | public TaskHunt loadFromData(NBTTagCompound json) { 27 | TaskHunt task = new TaskHunt(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskFluid.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskFluid; 10 | 11 | public class FactoryTaskFluid implements IFactoryData { 12 | 13 | public static final FactoryTaskFluid INSTANCE = new FactoryTaskFluid(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":fluid"); 18 | } 19 | 20 | @Override 21 | public TaskFluid createNew() { 22 | return new TaskFluid(); 23 | } 24 | 25 | @Override 26 | public TaskFluid loadFromData(NBTTagCompound json) { 27 | TaskFluid task = new TaskFluid(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardXP.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardXP; 10 | 11 | public class FactoryRewardXP implements IFactoryData { 12 | 13 | public static final FactoryRewardXP INSTANCE = new FactoryRewardXP(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "xp"); 18 | } 19 | 20 | @Override 21 | public RewardXP createNew() { 22 | return new RewardXP(); 23 | } 24 | 25 | @Override 26 | public RewardXP loadFromData(NBTTagCompound json) { 27 | RewardXP reward = new RewardXP(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/gui2/editors/nbt/callback/NbtEntityCallback.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.gui2.editors.nbt.callback; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.entity.passive.EntityPig; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | 8 | import betterquesting.api.misc.ICallback; 9 | import betterquesting.api.utils.JsonHelper; 10 | 11 | public class NbtEntityCallback implements ICallback { 12 | 13 | private final NBTTagCompound json; 14 | 15 | public NbtEntityCallback(NBTTagCompound json) { 16 | this.json = json; 17 | } 18 | 19 | public void setValue(Entity entity) { 20 | Entity baseEntity; 21 | 22 | if (entity != null) { 23 | baseEntity = entity; 24 | } else { 25 | baseEntity = new EntityPig(Minecraft.getMinecraft().theWorld); 26 | } 27 | 28 | JsonHelper.ClearCompoundTag(json); 29 | JsonHelper.EntityToJson(baseEntity, json); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/filters/FieldFilterString.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls.filters; 2 | 3 | import betterquesting.api2.client.gui.controls.IFieldFilter; 4 | 5 | public class FieldFilterString implements IFieldFilter { 6 | 7 | public static final FieldFilterString INSTANCE = new FieldFilterString(null); 8 | 9 | private final String regex; 10 | 11 | public FieldFilterString(String regex) { 12 | this.regex = null; 13 | } 14 | 15 | @Override 16 | public boolean isValid(String input) { 17 | if (regex != null) { 18 | return input.matches(regex); 19 | } 20 | 21 | return true; 22 | } 23 | 24 | @Override 25 | public String filterText(String input) { 26 | if (regex != null) { 27 | return input.replaceAll(regex, ""); 28 | } 29 | 30 | return input; 31 | } 32 | 33 | @Override 34 | public String parseValue(String input) { 35 | return input; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/events/PEventEntry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.events; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.function.Consumer; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public class PEventEntry { 10 | 11 | private final List> listeners = new ArrayList<>(); 12 | private final Class cType; 13 | 14 | public PEventEntry(Class type) { 15 | this.cType = type; 16 | } 17 | 18 | public void registerListener(@Nonnull Consumer consumer) { 19 | if (listeners.contains(consumer)) return; 20 | listeners.add(consumer); 21 | } 22 | 23 | public void unregisterListener(@Nonnull Consumer consumer) { 24 | listeners.remove(consumer); 25 | } 26 | 27 | public void fire(@Nonnull PanelEvent event) { 28 | if (!cType.isAssignableFrom(event.getClass())) return; 29 | listeners.forEach((l) -> l.accept(event)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/lines/GuiLineSequence.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.lines; 2 | 3 | import betterquesting.api2.client.gui.misc.IGuiRect; 4 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 5 | 6 | public class GuiLineSequence implements IGuiLine { 7 | 8 | public final IGuiLine[] lines; 9 | private final float interval; 10 | 11 | public GuiLineSequence(float interval, IGuiLine... lines) { 12 | this.lines = lines; 13 | this.interval = interval; 14 | } 15 | 16 | @Override 17 | public void drawLine(IGuiRect start, IGuiRect end, int width, IGuiColor color, float partialTick) { 18 | getCurrentLine().drawLine(start, end, width, color, partialTick); 19 | } 20 | 21 | public IGuiLine getCurrentLine() { 22 | return lines[(int) Math.floor((System.currentTimeMillis() / 1000D) % (lines.length * interval) / interval)]; 23 | } 24 | 25 | public IGuiLine[] getAllLines() { 26 | return lines; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/rewards/HQMRewardCommand.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.rewards; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonArray; 7 | import com.google.gson.JsonElement; 8 | import com.google.gson.JsonPrimitive; 9 | 10 | import betterquesting.api.questing.rewards.IReward; 11 | import bq_standard.rewards.RewardCommand; 12 | 13 | public class HQMRewardCommand { 14 | 15 | public IReward[] convertReward(JsonElement json) { 16 | if (!(json instanceof JsonArray)) return null; 17 | 18 | List rList = new ArrayList<>(); 19 | 20 | for (JsonElement je : json.getAsJsonArray()) { 21 | if (!(je instanceof JsonPrimitive)) continue; 22 | RewardCommand reward = new RewardCommand(); 23 | reward.command = je.getAsString(); 24 | reward.viaPlayer = true; 25 | rList.add(reward); 26 | } 27 | 28 | return rList.toArray(new IReward[0]); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskMeeting.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskMeeting; 10 | 11 | public class FactoryTaskMeeting implements IFactoryData { 12 | 13 | public static final FactoryTaskMeeting INSTANCE = new FactoryTaskMeeting(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":meeting"); 18 | } 19 | 20 | @Override 21 | public TaskMeeting createNew() { 22 | return new TaskMeeting(); 23 | } 24 | 25 | @Override 26 | public TaskMeeting loadFromData(NBTTagCompound json) { 27 | TaskMeeting task = new TaskMeeting(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardItem.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardItem; 10 | 11 | public class FactoryRewardItem implements IFactoryData { 12 | 13 | public static final FactoryRewardItem INSTANCE = new FactoryRewardItem(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "item"); 18 | } 19 | 20 | @Override 21 | public RewardItem createNew() { 22 | return new RewardItem(); 23 | } 24 | 25 | @Override 26 | public RewardItem loadFromData(NBTTagCompound json) { 27 | RewardItem reward = new RewardItem(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/items/HQMItemHeart.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.items; 2 | 3 | import net.minecraft.item.Item; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | import betterquesting.api.utils.BigItemStack; 7 | 8 | public class HQMItemHeart implements HQMItem { 9 | 10 | private final Item bqHeart; 11 | 12 | public HQMItemHeart() { 13 | bqHeart = (Item) Item.itemRegistry.getObject("betterquesting:extra_life"); 14 | } 15 | 16 | @Override 17 | public BigItemStack convertItem(int damage, int amount, NBTTagCompound tags) { 18 | int amt = amount; 19 | int dmg = 0; 20 | 21 | switch (damage) { 22 | case 0: 23 | dmg = 2; 24 | break; 25 | case 1: 26 | dmg = 1; 27 | break; 28 | case 2: 29 | dmg = 2; 30 | amt *= 3; 31 | break; 32 | } 33 | 34 | return new BigItemStack(bqHeart, amt, dmg); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskCheckbox.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskCheckbox; 10 | 11 | public class FactoryTaskCheckbox implements IFactoryData { 12 | 13 | public static final FactoryTaskCheckbox INSTANCE = new FactoryTaskCheckbox(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":checkbox"); 18 | } 19 | 20 | @Override 21 | public TaskCheckbox createNew() { 22 | return new TaskCheckbox(); 23 | } 24 | 25 | @Override 26 | public TaskCheckbox loadFromData(NBTTagCompound json) { 27 | TaskCheckbox task = new TaskCheckbox(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskCrafting.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskCrafting; 10 | 11 | public class FactoryTaskCrafting implements IFactoryData { 12 | 13 | public static final FactoryTaskCrafting INSTANCE = new FactoryTaskCrafting(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":crafting"); 18 | } 19 | 20 | @Override 21 | public TaskCrafting createNew() { 22 | return new TaskCrafting(); 23 | } 24 | 25 | @Override 26 | public TaskCrafting loadFromData(NBTTagCompound json) { 27 | TaskCrafting task = new TaskCrafting(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskLocation.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskLocation; 10 | 11 | public class FactoryTaskLocation implements IFactoryData { 12 | 13 | public static final FactoryTaskLocation INSTANCE = new FactoryTaskLocation(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":location"); 18 | } 19 | 20 | @Override 21 | public TaskLocation createNew() { 22 | return new TaskLocation(); 23 | } 24 | 25 | @Override 26 | public TaskLocation loadFromData(NBTTagCompound json) { 27 | TaskLocation task = new TaskLocation(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/importers/ImporterRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.importers; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import betterquesting.api.client.importers.IImportRegistry; 7 | import betterquesting.api.client.importers.IImporter; 8 | 9 | public final class ImporterRegistry implements IImportRegistry { 10 | 11 | public static final ImporterRegistry INSTANCE = new ImporterRegistry(); 12 | 13 | private final List importers = new ArrayList<>(); 14 | 15 | @Override 16 | public void registerImporter(IImporter imp) { 17 | if (imp == null) { 18 | throw new NullPointerException("Tried to register null quest importer"); 19 | } 20 | 21 | if (importers.contains(imp)) { 22 | throw new IllegalArgumentException("Unable to register duplicate quest importer"); 23 | } 24 | 25 | importers.add(imp); 26 | } 27 | 28 | @Override 29 | public List getImporters() { 30 | return importers; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/placeholders/tasks/FactoryTaskPlaceholder.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.placeholders.tasks; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api2.registry.IFactoryData; 7 | 8 | public class FactoryTaskPlaceholder implements IFactoryData { 9 | 10 | public static final FactoryTaskPlaceholder INSTANCE = new FactoryTaskPlaceholder(); 11 | 12 | private final ResourceLocation ID = new ResourceLocation("betterquesting:placeholder"); 13 | 14 | private FactoryTaskPlaceholder() {} 15 | 16 | @Override 17 | public ResourceLocation getRegistryName() { 18 | return ID; 19 | } 20 | 21 | @Override 22 | public TaskPlaceholder createNew() { 23 | return new TaskPlaceholder(); 24 | } 25 | 26 | @Override 27 | public TaskPlaceholder loadFromData(NBTTagCompound nbt) { 28 | TaskPlaceholder task = createNew(); 29 | task.readFromNBT(nbt); 30 | return task; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardChoice.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardChoice; 10 | 11 | public class FactoryRewardChoice implements IFactoryData { 12 | 13 | public static final FactoryRewardChoice INSTANCE = new FactoryRewardChoice(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "choice"); 18 | } 19 | 20 | @Override 21 | public RewardChoice createNew() { 22 | return new RewardChoice(); 23 | } 24 | 25 | @Override 26 | public RewardChoice loadFromData(NBTTagCompound json) { 27 | RewardChoice reward = new RewardChoice(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskRetrieval.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskRetrieval; 10 | 11 | public class FactoryTaskRetrieval implements IFactoryData { 12 | 13 | public static final FactoryTaskRetrieval INSTANCE = new FactoryTaskRetrieval(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":retrieval"); 18 | } 19 | 20 | @Override 21 | public TaskRetrieval createNew() { 22 | return new TaskRetrieval(); 23 | } 24 | 25 | @Override 26 | public TaskRetrieval loadFromData(NBTTagCompound json) { 27 | TaskRetrieval task = new TaskRetrieval(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/client/gui/GuiBQSConfig.java: -------------------------------------------------------------------------------- 1 | package bq_standard.client.gui; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.client.gui.GuiScreen; 6 | import net.minecraftforge.common.config.ConfigElement; 7 | import net.minecraftforge.common.config.Configuration; 8 | 9 | import bq_standard.core.BQ_Standard; 10 | import bq_standard.handlers.ConfigHandler; 11 | import cpw.mods.fml.client.config.GuiConfig; 12 | import cpw.mods.fml.client.config.IConfigElement; 13 | import cpw.mods.fml.relauncher.Side; 14 | import cpw.mods.fml.relauncher.SideOnly; 15 | 16 | @SideOnly(Side.CLIENT) 17 | public class GuiBQSConfig extends GuiConfig { 18 | 19 | @SuppressWarnings("unchecked") 20 | public GuiBQSConfig(GuiScreen parent) { 21 | super( 22 | parent, 23 | (List) new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)) 24 | .getChildElements(), 25 | BQ_Standard.MODID, 26 | false, 27 | false, 28 | BQ_Standard.NAME); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/misc/QuestSearchEntry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.misc; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import betterquesting.api.questing.IQuest; 7 | import betterquesting.api.questing.IQuestLine; 8 | 9 | public class QuestSearchEntry { 10 | 11 | public QuestSearchEntry(Map.Entry quest, Map.Entry questLineEntry) { 12 | this.quest = quest; 13 | this.questLineEntry = questLineEntry; 14 | } 15 | 16 | private Map.Entry quest; 17 | 18 | public Map.Entry getQuest() { 19 | return quest; 20 | } 21 | 22 | public void setQuest(Map.Entry quest) { 23 | this.quest = quest; 24 | } 25 | 26 | public Map.Entry getQuestLineEntry() { 27 | return questLineEntry; 28 | } 29 | 30 | public void setQuestLineEntry(Map.Entry questLineEntry) { 31 | this.questLineEntry = questLineEntry; 32 | } 33 | 34 | private Map.Entry questLineEntry; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskScoreboard.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskScoreboard; 10 | 11 | public class FactoryTaskScoreboard implements IFactoryData { 12 | 13 | public static final FactoryTaskScoreboard INSTANCE = new FactoryTaskScoreboard(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":scoreboard"); 18 | } 19 | 20 | @Override 21 | public TaskScoreboard createNew() { 22 | return new TaskScoreboard(); 23 | } 24 | 25 | @Override 26 | public TaskScoreboard loadFromData(NBTTagCompound json) { 27 | TaskScoreboard task = new TaskScoreboard(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardCommand.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardCommand; 10 | 11 | public class FactoryRewardCommand implements IFactoryData { 12 | 13 | public static final FactoryRewardCommand INSTANCE = new FactoryRewardCommand(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "command"); 18 | } 19 | 20 | @Override 21 | public RewardCommand createNew() { 22 | return new RewardCommand(); 23 | } 24 | 25 | @Override 26 | public RewardCommand loadFromData(NBTTagCompound json) { 27 | RewardCommand reward = new RewardCommand(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/core/proxies/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package betterquesting.core.proxies; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | 5 | import betterquesting.core.BetterQuesting; 6 | import betterquesting.core.ExpansionLoader; 7 | import betterquesting.handlers.EventHandler; 8 | import betterquesting.handlers.GuiHandler; 9 | import cpw.mods.fml.common.FMLCommonHandler; 10 | import cpw.mods.fml.common.network.NetworkRegistry; 11 | 12 | public class CommonProxy { 13 | 14 | public boolean isClient() { 15 | return false; 16 | } 17 | 18 | public void registerHandlers() { 19 | ExpansionLoader.INSTANCE.initCommonAPIs(); 20 | 21 | MinecraftForge.EVENT_BUS.register(EventHandler.INSTANCE); 22 | MinecraftForge.TERRAIN_GEN_BUS.register(EventHandler.INSTANCE); 23 | FMLCommonHandler.instance() 24 | .bus() 25 | .register(EventHandler.INSTANCE); 26 | 27 | NetworkRegistry.INSTANCE.registerGuiHandler(BetterQuesting.instance, new GuiHandler()); 28 | } 29 | 30 | public void registerRenderers() {} 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/placeholders/rewards/FactoryRewardPlaceholder.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.placeholders.rewards; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api2.registry.IFactoryData; 7 | 8 | public class FactoryRewardPlaceholder implements IFactoryData { 9 | 10 | public static final FactoryRewardPlaceholder INSTANCE = new FactoryRewardPlaceholder(); 11 | 12 | private final ResourceLocation ID = new ResourceLocation("betterquesting:placeholder"); 13 | 14 | private FactoryRewardPlaceholder() {} 15 | 16 | @Override 17 | public ResourceLocation getRegistryName() { 18 | return ID; 19 | } 20 | 21 | @Override 22 | public RewardPlaceholder createNew() { 23 | return new RewardPlaceholder(); 24 | } 25 | 26 | @Override 27 | public RewardPlaceholder loadFromData(NBTTagCompound nbt) { 28 | RewardPlaceholder reward = createNew(); 29 | reward.readFromNBT(nbt); 30 | return reward; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/SceneController.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraftforge.client.event.GuiOpenEvent; 6 | 7 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 8 | import cpw.mods.fml.relauncher.Side; 9 | import cpw.mods.fml.relauncher.SideOnly; 10 | 11 | public class SceneController { 12 | 13 | private static IScene curScene = null; 14 | 15 | @Nullable 16 | public static IScene getActiveScene() { 17 | return curScene; 18 | } 19 | 20 | public static void setActiveScene(@Nullable IScene scene) { 21 | curScene = scene; 22 | } 23 | 24 | @SubscribeEvent 25 | @SideOnly(Side.CLIENT) 26 | public void onGuiOpened(GuiOpenEvent event) { 27 | if (event.gui instanceof IScene) { 28 | // TODO: Review the following 29 | // Does this need to be cleared if the GUI isn't compatible? 30 | // Would this interfere with an overlay canvas? 31 | curScene = (IScene) event.gui; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/misc/GuiPadding.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.misc; 2 | 3 | public class GuiPadding { 4 | 5 | public int l, t, r, b = 0; 6 | 7 | public GuiPadding() { 8 | this(0, 0, 0, 0); 9 | } 10 | 11 | public GuiPadding(int left, int top, int right, int bottom) { 12 | this.setPadding(left, top, right, bottom); 13 | } 14 | 15 | public GuiPadding setPadding(int left, int top, int right, int bottom) { 16 | this.l = left; 17 | this.t = top; 18 | 19 | this.r = right; 20 | this.b = bottom; 21 | 22 | return this; 23 | } 24 | 25 | public int getLeft() { 26 | return l; 27 | } 28 | 29 | public int getTop() { 30 | return t; 31 | } 32 | 33 | public int getRight() { 34 | return r; 35 | } 36 | 37 | public int getBottom() { 38 | return b; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return getClass().getName() + "[left=" + l + ",top=" + t + ",right=" + r + ",bottom=" + b + "]"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/IScene.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import betterquesting.api2.client.gui.panels.IGuiCanvas; 6 | import betterquesting.api2.client.gui.panels.IGuiPanel; 7 | 8 | // The root canvas in charge of extra top level functions. Should idealy be attached to a GuiScreen but left open for 9 | // other embedded use cases 10 | // Inner panels can make use of the fact that this is an IGuiCanvas to search through the whole heirachy of panel 11 | // content on screen 12 | public interface IScene extends IGuiCanvas { 13 | // Unadjusted canvas representing the entire screen's bounds 14 | // IGuiCanvas getRootCanvas(); 15 | 16 | // TODO: Force isolate all UI interaction to this panel until manually unfocused. NOTE: Escape key will always 17 | // unfocus to prevent softlocking 18 | // void forceFocus(@Nonnull IGuiPanel panel); 19 | // void resetFocus(); 20 | 21 | // Opens a top level canvas off the root canvas 22 | void openPopup(@Nonnull IGuiPanel panel); 23 | 24 | void closePopup(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/commands/user/QuestCommandHelp.java: -------------------------------------------------------------------------------- 1 | package betterquesting.commands.user; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.ICommandSender; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.server.MinecraftServer; 8 | 9 | import betterquesting.commands.QuestCommandBase; 10 | import betterquesting.core.BetterQuesting; 11 | 12 | public class QuestCommandHelp extends QuestCommandBase { 13 | 14 | @Override 15 | public String getCommand() { 16 | return "help"; 17 | } 18 | 19 | @Override 20 | public void runCommand(MinecraftServer server, CommandBase command, ICommandSender sender, String[] args) { 21 | if (sender instanceof EntityPlayer) { 22 | EntityPlayer player = (EntityPlayer) sender; 23 | if (!player.inventory.addItemStackToInventory(new ItemStack(BetterQuesting.guideBook))) { 24 | player.dropPlayerItemWithRandomChoice(new ItemStack(BetterQuesting.guideBook), false); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardScoreboard.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardScoreboard; 10 | 11 | public class FactoryRewardScoreboard implements IFactoryData { 12 | 13 | public static final FactoryRewardScoreboard INSTANCE = new FactoryRewardScoreboard(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "scoreboard"); 18 | } 19 | 20 | @Override 21 | public RewardScoreboard createNew() { 22 | return new RewardScoreboard(); 23 | } 24 | 25 | @Override 26 | public RewardScoreboard loadFromData(NBTTagCompound json) { 27 | RewardScoreboard reward = new RewardScoreboard(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/network/IPacketRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.network; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import javax.annotation.Nonnull; 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.nbt.NBTTagCompound; 10 | import net.minecraft.util.ResourceLocation; 11 | 12 | import betterquesting.api2.utils.Tuple2; 13 | import cpw.mods.fml.relauncher.Side; 14 | import cpw.mods.fml.relauncher.SideOnly; 15 | 16 | public interface IPacketRegistry { 17 | 18 | void registerServerHandler(@Nonnull ResourceLocation idName, 19 | @Nonnull Consumer> method); 20 | 21 | @SideOnly(Side.CLIENT) 22 | void registerClientHandler(@Nonnull ResourceLocation idName, @Nonnull Consumer method); 23 | 24 | @Nullable 25 | Consumer> getServerHandler(@Nonnull ResourceLocation idName); 26 | 27 | @Nullable 28 | @SideOnly(Side.CLIENT) 29 | Consumer getClientHandler(@Nonnull ResourceLocation idName); 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE.cb-for-bq: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/IGuiTheme.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes; 2 | 3 | import java.util.function.Function; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import net.minecraft.client.gui.GuiScreen; 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 11 | import betterquesting.api2.client.gui.resources.lines.IGuiLine; 12 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 13 | 14 | public interface IGuiTheme extends Comparable { 15 | 16 | String getName(); 17 | 18 | ResourceLocation getID(); 19 | 20 | @Nullable 21 | IGuiTexture getTexture(ResourceLocation key); 22 | 23 | @Nullable 24 | IGuiLine getLine(ResourceLocation key); 25 | 26 | @Nullable 27 | IGuiColor getColor(ResourceLocation key); 28 | 29 | @Nullable 30 | Function getGui(GuiKey key); 31 | 32 | @Override 33 | default int compareTo(IGuiTheme iGuiTheme) { 34 | return this.getName() 35 | .compareTo(iGuiTheme.getName()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Funwayguy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskBlockBreak.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskBlockBreak; 10 | 11 | public class FactoryTaskBlockBreak implements IFactoryData { 12 | 13 | public static final FactoryTaskBlockBreak INSTANCE = new FactoryTaskBlockBreak(); 14 | 15 | private final ResourceLocation REG_ID = new ResourceLocation(BQ_Standard.MODID, "block_break"); 16 | 17 | @Override 18 | public ResourceLocation getRegistryName() { 19 | return REG_ID; 20 | } 21 | 22 | @Override 23 | public TaskBlockBreak createNew() { 24 | return new TaskBlockBreak(); 25 | } 26 | 27 | @Override 28 | public TaskBlockBreak loadFromData(NBTTagCompound json) { 29 | TaskBlockBreak task = new TaskBlockBreak(); 30 | task.readFromNBT(json); 31 | return task; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE.command-blocks: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskInteractItem.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskInteractItem; 10 | 11 | public class FactoryTaskInteractItem implements IFactoryData { 12 | 13 | public static final FactoryTaskInteractItem INSTANCE = new FactoryTaskInteractItem(); 14 | 15 | private final ResourceLocation REG_ID = new ResourceLocation(BQ_Standard.MODID, "interact_item"); 16 | 17 | @Override 18 | public ResourceLocation getRegistryName() { 19 | return REG_ID; 20 | } 21 | 22 | @Override 23 | public TaskInteractItem createNew() { 24 | return new TaskInteractItem(); 25 | } 26 | 27 | @Override 28 | public TaskInteractItem loadFromData(NBTTagCompound nbt) { 29 | TaskInteractItem task = new TaskInteractItem(); 30 | task.readFromNBT(nbt); 31 | return task; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskOptionalRetrieval.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskOptionalRetrieval; 10 | 11 | public class FactoryTaskOptionalRetrieval implements IFactoryData { 12 | 13 | public static final FactoryTaskOptionalRetrieval INSTANCE = new FactoryTaskOptionalRetrieval(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID + ":optional_retrieval"); 18 | } 19 | 20 | @Override 21 | public TaskOptionalRetrieval createNew() { 22 | return new TaskOptionalRetrieval(); 23 | } 24 | 25 | @Override 26 | public TaskOptionalRetrieval loadFromData(NBTTagCompound json) { 27 | TaskOptionalRetrieval task = new TaskOptionalRetrieval(); 28 | task.readFromNBT(json); 29 | return task; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeBoolean.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTBase.NBTPrimitive; 5 | import net.minecraft.nbt.NBTTagByte; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | public class PropertyTypeBoolean extends PropertyTypeBase { 9 | 10 | public PropertyTypeBoolean(ResourceLocation key, Boolean def) { 11 | super(key, def); 12 | } 13 | 14 | @Override 15 | public Boolean readValue(NBTBase nbt) { 16 | if (nbt == null || nbt.getId() < 1 || nbt.getId() > 6) { 17 | return this.getDefault(); 18 | } 19 | 20 | try { 21 | return ((NBTPrimitive) nbt).func_150290_f() > 0; 22 | } catch (Exception e) { 23 | return this.getDefault(); 24 | } 25 | } 26 | 27 | @Override 28 | public NBTBase writeValue(Boolean value) { 29 | if (value == null) { 30 | return new NBTTagByte(this.getDefault() ? (byte) 1 : (byte) 0); 31 | } 32 | 33 | return new NBTTagByte(value ? (byte) 1 : (byte) 0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/PanelButtonStorage.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls; 2 | 3 | import betterquesting.api.misc.ICallback; 4 | import betterquesting.api2.client.gui.misc.IGuiRect; 5 | 6 | public class PanelButtonStorage extends PanelButton { 7 | 8 | private T stored = null; 9 | private ICallback callback = null; 10 | 11 | public PanelButtonStorage(IGuiRect rect, int id, String txt, T value) { 12 | super(rect, id, txt); 13 | this.setStoredValue(value); 14 | } 15 | 16 | public PanelButtonStorage setStoredValue(T value) { 17 | this.stored = value; 18 | return this; 19 | } 20 | 21 | public T getStoredValue() { 22 | return stored; 23 | } 24 | 25 | public PanelButtonStorage setCallback(ICallback callback) { 26 | this.callback = callback; 27 | return this; 28 | } 29 | 30 | public ICallback getCallback() { 31 | return this.callback; 32 | } 33 | 34 | @Override 35 | public void onButtonClick() { 36 | if (callback != null) this.callback.setValue(this.getStoredValue()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/rewards/factory/FactoryRewardQuestCompletion.java: -------------------------------------------------------------------------------- 1 | package bq_standard.rewards.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.rewards.IReward; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.rewards.RewardQuestCompletion; 10 | 11 | public class FactoryRewardQuestCompletion implements IFactoryData { 12 | 13 | public static final FactoryRewardQuestCompletion INSTANCE = new FactoryRewardQuestCompletion(); 14 | 15 | @Override 16 | public ResourceLocation getRegistryName() { 17 | return new ResourceLocation(BQ_Standard.MODID, "questcompletion"); 18 | } 19 | 20 | @Override 21 | public RewardQuestCompletion createNew() { 22 | return new RewardQuestCompletion(); 23 | } 24 | 25 | @Override 26 | public RewardQuestCompletion loadFromData(NBTTagCompound json) { 27 | RewardQuestCompletion reward = new RewardQuestCompletion(); 28 | reward.readFromNBT(json); 29 | return reward; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeItemStack.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | import betterquesting.api.utils.BigItemStack; 8 | import betterquesting.api.utils.JsonHelper; 9 | 10 | public class PropertyTypeItemStack extends PropertyTypeBase { 11 | 12 | public PropertyTypeItemStack(ResourceLocation key, BigItemStack def) { 13 | super(key, def); 14 | } 15 | 16 | @Override 17 | public BigItemStack readValue(NBTBase nbt) { 18 | if (nbt == null || nbt.getId() != 10) { 19 | return this.getDefault(); 20 | } 21 | 22 | return JsonHelper.JsonToItemStack((NBTTagCompound) nbt); 23 | } 24 | 25 | @Override 26 | public NBTBase writeValue(BigItemStack value) { 27 | NBTTagCompound nbt = new NBTTagCompound(); 28 | 29 | if (value == null) { 30 | getDefault().writeToNBT(nbt); 31 | } else { 32 | value.writeToNBT(nbt); 33 | } 34 | 35 | return nbt; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/LookupLogic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | abstract class LookupLogic { 9 | 10 | protected final SimpleDatabase simpleDatabase; 11 | protected List> refCache = null; 12 | 13 | public LookupLogic(SimpleDatabase simpleDatabase) { 14 | this.simpleDatabase = simpleDatabase; 15 | } 16 | 17 | public void onDataChange() { 18 | refCache = null; 19 | } 20 | 21 | public List> getRefCache() { 22 | if (refCache != null) return refCache; 23 | computeRefCache(); 24 | return refCache; 25 | } 26 | 27 | public abstract List> bulkLookup(int[] keys); 28 | 29 | protected void computeRefCache() { 30 | List> temp = new ArrayList<>(); 31 | for (Map.Entry entry : simpleDatabase.mapDB.entrySet()) { 32 | temp.add(new DBEntry<>(entry.getKey(), entry.getValue())); 33 | } 34 | refCache = Collections.unmodifiableList(temp); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/controls/callbacks/CallbackNBTTagString.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.controls.callbacks; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | import net.minecraft.nbt.NBTTagList; 6 | import net.minecraft.nbt.NBTTagString; 7 | 8 | import betterquesting.api.misc.ICallback; 9 | 10 | public class CallbackNBTTagString implements ICallback { 11 | 12 | private final NBTBase tag; 13 | private final String sKey; 14 | private final int iKey; 15 | 16 | public CallbackNBTTagString(NBTTagCompound tag, String key) { 17 | this.tag = tag; 18 | this.sKey = key; 19 | this.iKey = -1; 20 | } 21 | 22 | public CallbackNBTTagString(NBTTagList tag, int key) { 23 | this.tag = tag; 24 | this.sKey = null; 25 | this.iKey = key; 26 | } 27 | 28 | @Override 29 | public void setValue(String value) { 30 | if (tag.getId() == 10) { 31 | ((NBTTagCompound) tag).setString(sKey, value); 32 | } else { 33 | ((NBTTagList) tag).func_150304_a(iKey, new NBTTagString(value)); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskKill.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonElement; 7 | import com.google.gson.JsonObject; 8 | 9 | import betterquesting.api.questing.tasks.ITask; 10 | import betterquesting.api.utils.JsonHelper; 11 | import bq_standard.tasks.TaskHunt; 12 | 13 | public class HQMTaskKill { 14 | 15 | public ITask[] convertTask(JsonObject json) { 16 | List tList = new ArrayList<>(); 17 | 18 | for (JsonElement je : JsonHelper.GetArray(json, "mobs")) { 19 | if (!(je instanceof JsonObject)) continue; 20 | JsonObject jMob = je.getAsJsonObject(); 21 | 22 | TaskHunt task = new TaskHunt(); 23 | task.idName = JsonHelper.GetString(jMob, "mob", "minecraft:zombie"); 24 | task.required = JsonHelper.GetNumber(jMob, "kills", 1) 25 | .intValue(); 26 | task.subtypes = !JsonHelper.GetBoolean(jMob, "exact", false); 27 | tList.add(task); 28 | } 29 | 30 | return tList.toArray(new ITask[0]); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/tasks/factory/FactoryTaskInteractEntity.java: -------------------------------------------------------------------------------- 1 | package bq_standard.tasks.factory; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | import betterquesting.api.questing.tasks.ITask; 7 | import betterquesting.api2.registry.IFactoryData; 8 | import bq_standard.core.BQ_Standard; 9 | import bq_standard.tasks.TaskInteractEntity; 10 | 11 | public class FactoryTaskInteractEntity implements IFactoryData { 12 | 13 | public static final FactoryTaskInteractEntity INSTANCE = new FactoryTaskInteractEntity(); 14 | 15 | private final ResourceLocation REG_ID = new ResourceLocation(BQ_Standard.MODID, "interact_entity"); 16 | 17 | @Override 18 | public ResourceLocation getRegistryName() { 19 | return REG_ID; 20 | } 21 | 22 | @Override 23 | public TaskInteractEntity createNew() { 24 | return new TaskInteractEntity(); 25 | } 26 | 27 | @Override 28 | public TaskInteractEntity loadFromData(NBTTagCompound nbt) { 29 | TaskInteractEntity task = new TaskInteractEntity(); 30 | task.readFromNBT(nbt); 31 | return task; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/gui/GuiBQConfig.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.gui; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.client.gui.GuiScreen; 7 | import net.minecraftforge.common.config.ConfigElement; 8 | import net.minecraftforge.common.config.Configuration; 9 | 10 | import betterquesting.core.BetterQuesting; 11 | import betterquesting.handlers.ConfigHandler; 12 | import cpw.mods.fml.client.config.GuiConfig; 13 | import cpw.mods.fml.client.config.IConfigElement; 14 | import cpw.mods.fml.relauncher.Side; 15 | import cpw.mods.fml.relauncher.SideOnly; 16 | 17 | @SideOnly(Side.CLIENT) 18 | public class GuiBQConfig extends GuiConfig { 19 | 20 | public GuiBQConfig(GuiScreen parent) { 21 | super(parent, getCategories(ConfigHandler.config), BetterQuesting.MODID, false, false, BetterQuesting.NAME); 22 | } 23 | 24 | public static List getCategories(Configuration config) { 25 | List cats = new ArrayList<>(); 26 | 27 | for (String s : config.getCategoryNames()) { 28 | cats.add(new ConfigElement(config.getCategory(s))); 29 | } 30 | 31 | return cats; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/IPropertyContainer.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | import org.jetbrains.annotations.Contract; 6 | 7 | import betterquesting.api2.storage.INBTSaveLoad; 8 | 9 | public interface IPropertyContainer extends INBTSaveLoad { 10 | 11 | T getProperty(IPropertyType prop); 12 | 13 | T getProperty(IPropertyType prop, T def); 14 | 15 | /// Similar to {@link #getProperty(IPropertyType, Object)}, except it returns the default if the property was set to 16 | /// null. 17 | /// @param prop The property queried. 18 | /// @param def Returned instead of null 19 | /// @return The value stored for the given property 20 | @Contract("_, !null -> !null") 21 | default T getOrDefault(IPropertyType prop, T def) { 22 | final T ret = getProperty(prop); 23 | if (ret != null) return ret; 24 | else return def; 25 | } 26 | 27 | boolean hasProperty(IPropertyType prop); 28 | 29 | void removeProperty(IPropertyType prop); 30 | 31 | void setProperty(IPropertyType prop, T value); 32 | 33 | void removeAllProps(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/properties/basic/PropertyTypeEnum.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.properties.basic; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTTagString; 5 | import net.minecraft.util.ResourceLocation; 6 | 7 | public class PropertyTypeEnum> extends PropertyTypeBase { 8 | 9 | private final Class eClazz; 10 | 11 | public PropertyTypeEnum(ResourceLocation key, E def) { 12 | super(key, def); 13 | 14 | eClazz = def.getDeclaringClass(); 15 | } 16 | 17 | @Override 18 | public E readValue(NBTBase nbt) { 19 | if (nbt == null || nbt.getId() != 8) { 20 | return this.getDefault(); 21 | } 22 | 23 | try { 24 | return Enum.valueOf(eClazz, ((NBTTagString) nbt).func_150285_a_()); 25 | } catch (Exception e) { 26 | return this.getDefault(); 27 | } 28 | } 29 | 30 | @Override 31 | public NBTBase writeValue(E value) { 32 | if (value == null) { 33 | return new NBTTagString( 34 | this.getDefault() 35 | .toString()); 36 | } 37 | 38 | return new NBTTagString(value.toString()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/BlockHSB.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.block.BlockCommandBlock; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.world.World; 6 | 7 | import betterquesting.commands.BQ_CommandAdmin; 8 | import betterquesting.commands.admin.QuestCommandHardcore; 9 | import betterquesting.core.BetterQuesting; 10 | import cpw.mods.fml.common.FMLCommonHandler; 11 | 12 | public class BlockHSB extends BlockCommandBlock { 13 | 14 | public BlockHSB() { 15 | this.setHardness(1.0f); 16 | this.setBlockName("CB4BQ.HSB"); 17 | this.setBlockTextureName("command_block"); 18 | this.setCreativeTab(BetterQuesting.tabQuesting); 19 | } 20 | 21 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, 22 | float hitY, float hitZ) { 23 | if (!world.isRemote) { 24 | new QuestCommandHardcore().runCommand( 25 | FMLCommonHandler.instance() 26 | .getMinecraftServerInstance(), 27 | new BQ_CommandAdmin(), 28 | player, 29 | new String[] { "hardcore" }); 30 | } 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/nbt_doc/NbtDocBasic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.nbt_doc; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | 5 | import betterquesting.api.events.NbtDocEvent; 6 | 7 | public class NbtDocBasic implements INbtDoc { 8 | 9 | private final INbtDoc parent; 10 | private final String prefix; 11 | 12 | public NbtDocBasic(INbtDoc parent, String prefix) { 13 | this.parent = parent; 14 | this.prefix = prefix; 15 | } 16 | 17 | @Override 18 | public String getUnlocalisedTitle() { 19 | return prefix + ".name"; 20 | } 21 | 22 | @Override 23 | public String getUnlocalisedName(String key) { 24 | return prefix + "." + key + ".name"; 25 | } 26 | 27 | @Override 28 | public String getUnlocalisedDesc(String key) { 29 | return prefix + "." + key + ".desc"; 30 | } 31 | 32 | @Override 33 | public INbtDoc getParent() { 34 | return parent; 35 | } 36 | 37 | @Override 38 | public INbtDoc getChild(String child) { 39 | NbtDocEvent event = new NbtDocEvent(new NbtDocBasic(this, prefix + "." + child)); 40 | MinecraftForge.EVENT_BUS.post(event); 41 | return event.getNbtDocResult(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/BlockDLB.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.block.BlockCommandBlock; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.world.World; 6 | 7 | import betterquesting.commands.BQ_CommandAdmin; 8 | import betterquesting.commands.admin.QuestCommandDefaults; 9 | import betterquesting.core.BetterQuesting; 10 | import cpw.mods.fml.common.FMLCommonHandler; 11 | 12 | public class BlockDLB extends BlockCommandBlock { 13 | 14 | public BlockDLB() { 15 | this.setHardness(1.0f); 16 | this.setBlockName("CB4BQ.DLB"); 17 | this.setBlockTextureName("command_block"); 18 | this.setCreativeTab(BetterQuesting.tabQuesting); 19 | } 20 | 21 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, 22 | float hitY, float hitZ) { 23 | if (!world.isRemote) { 24 | new QuestCommandDefaults().runCommand( 25 | FMLCommonHandler.instance() 26 | .getMinecraftServerInstance(), 27 | new BQ_CommandAdmin(), 28 | player, 29 | new String[] { "default", "load" }); 30 | } 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/BlockDSB.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.block.BlockCommandBlock; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.world.World; 6 | 7 | import betterquesting.commands.BQ_CommandAdmin; 8 | import betterquesting.commands.admin.QuestCommandDefaults; 9 | import betterquesting.core.BetterQuesting; 10 | import cpw.mods.fml.common.FMLCommonHandler; 11 | 12 | public class BlockDSB extends BlockCommandBlock { 13 | 14 | public BlockDSB() { 15 | this.setHardness(1.0f); 16 | this.setBlockName("CB4BQ.DSB"); 17 | this.setBlockTextureName("command_block"); 18 | this.setCreativeTab(BetterQuesting.tabQuesting); 19 | } 20 | 21 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, 22 | float hitY, float hitZ) { 23 | if (!world.isRemote) { 24 | new QuestCommandDefaults().runCommand( 25 | FMLCommonHandler.instance() 26 | .getMinecraftServerInstance(), 27 | new BQ_CommandAdmin(), 28 | player, 29 | new String[] { "default", "save" }); 30 | } 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/core/proxies/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package bq_standard.core.proxies; 2 | 3 | import betterquesting.api.api.ApiReference; 4 | import betterquesting.api.api.QuestingAPI; 5 | import bq_standard.client.theme.BQSTextures; 6 | import bq_standard.importers.DummyImporter; 7 | import bq_standard.importers.hqm.HQMBagImporter; 8 | import bq_standard.importers.hqm.HQMQuestImporter; 9 | import bq_standard.integration.nei.IMCForNEI; 10 | 11 | public class ClientProxy extends CommonProxy { 12 | 13 | @Override 14 | public boolean isClient() { 15 | return true; 16 | } 17 | 18 | @Override 19 | public void registerHandlers() { 20 | super.registerHandlers(); 21 | 22 | IMCForNEI.IMCSender(); 23 | } 24 | 25 | @Override 26 | public void registerExpansion() { 27 | super.registerExpansion(); 28 | 29 | QuestingAPI.getAPI(ApiReference.IMPORT_REG) 30 | .registerImporter(DummyImporter.INSTANCE); 31 | QuestingAPI.getAPI(ApiReference.IMPORT_REG) 32 | .registerImporter(HQMQuestImporter.INSTANCE); 33 | QuestingAPI.getAPI(ApiReference.IMPORT_REG) 34 | .registerImporter(HQMBagImporter.INSTANCE); 35 | 36 | BQSTextures.registerTextures(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/DBEntry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public final class DBEntry implements Comparable> { 6 | 7 | private final int id; 8 | @Nonnull 9 | private final T obj; 10 | 11 | public DBEntry(int id, T obj) { 12 | if (id < 0) { 13 | throw new IllegalArgumentException("Entry ID cannot be negative"); 14 | } else if (obj == null) { 15 | throw new NullPointerException("Entry value cannot be null"); 16 | } 17 | 18 | this.id = id; 19 | this.obj = obj; 20 | } 21 | 22 | public final int getID() { 23 | return this.id; 24 | } 25 | 26 | @Nonnull 27 | public final T getValue() { 28 | return obj; 29 | } 30 | 31 | @Override 32 | public int compareTo(DBEntry o) { 33 | return Integer.compare(id, o.id); 34 | } 35 | 36 | @Override 37 | public boolean equals(Object obj) { 38 | if (!(obj instanceof DBEntry)) { 39 | return false; 40 | } 41 | 42 | DBEntry entry = (DBEntry) obj; 43 | 44 | return this.getID() == entry.getID() && this.getValue() 45 | .equals(entry.getValue()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/events/QuestEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.events; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | import java.util.UUID; 8 | 9 | import cpw.mods.fml.common.eventhandler.Event; 10 | 11 | public class QuestEvent extends Event { 12 | 13 | private final Type type; 14 | private final UUID playerID; 15 | private final Set questIDs; 16 | 17 | public Set getQuestIDs() { 18 | return this.questIDs; 19 | } 20 | 21 | public UUID getPlayerID() { 22 | return this.playerID; 23 | } 24 | 25 | public Type getType() { 26 | return this.type; 27 | } 28 | 29 | public QuestEvent(Type type, UUID playerID, UUID questID) { 30 | this.type = type; 31 | this.playerID = playerID; 32 | this.questIDs = Collections.singleton(questID); 33 | } 34 | 35 | public QuestEvent(Type type, UUID playerID, Collection questIDs) { 36 | this.type = type; 37 | this.playerID = playerID; 38 | this.questIDs = Collections.unmodifiableSet(new HashSet<>(questIDs)); 39 | } 40 | 41 | public enum Type { 42 | COMPLETED, 43 | UPDATED, 44 | RESET 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/NaiveLookupLogic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import gnu.trove.map.TIntObjectMap; 7 | import gnu.trove.map.hash.TIntObjectHashMap; 8 | 9 | class NaiveLookupLogic extends LookupLogic { 10 | 11 | private TIntObjectMap> backingMap; 12 | 13 | public NaiveLookupLogic(SimpleDatabase simpleDatabase) { 14 | super(simpleDatabase); 15 | } 16 | 17 | @Override 18 | public void onDataChange() { 19 | super.onDataChange(); 20 | backingMap = null; 21 | } 22 | 23 | @Override 24 | public List> bulkLookup(int[] keys) { 25 | if (backingMap == null) { 26 | backingMap = new TIntObjectHashMap<>(simpleDatabase.mapDB.size()); 27 | for (DBEntry entry : getRefCache()) { 28 | backingMap.put(entry.getID(), entry); 29 | } 30 | } 31 | List> list = new ArrayList<>(keys.length); 32 | for (int k : keys) { 33 | final DBEntry element = backingMap.get(k); 34 | if (element != null) { 35 | list.add(element); 36 | } 37 | } 38 | return list; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/rewards/IReward.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing.rewards; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.client.gui.GuiScreen; 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.nbt.NBTTagCompound; 11 | import net.minecraft.util.ResourceLocation; 12 | 13 | import betterquesting.api.questing.IQuest; 14 | import betterquesting.api2.client.gui.misc.IGuiRect; 15 | import betterquesting.api2.client.gui.panels.IGuiPanel; 16 | import betterquesting.api2.storage.INBTSaveLoad; 17 | import cpw.mods.fml.relauncher.Side; 18 | import cpw.mods.fml.relauncher.SideOnly; 19 | 20 | public interface IReward extends INBTSaveLoad { 21 | 22 | String getUnlocalisedName(); 23 | 24 | ResourceLocation getFactoryID(); 25 | 26 | boolean canClaim(EntityPlayer player, Map.Entry quest); 27 | 28 | void claimReward(EntityPlayer player, Map.Entry quest); 29 | 30 | @SideOnly(Side.CLIENT) 31 | IGuiPanel getRewardGui(IGuiRect rect, Map.Entry quest); 32 | 33 | @Nullable 34 | @SideOnly(Side.CLIENT) 35 | GuiScreen getRewardEditor(GuiScreen parent, Map.Entry quest); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/client/toolbox/ToolboxRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.client.toolbox; 2 | 3 | import java.util.Collection; 4 | import java.util.HashMap; 5 | 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | import betterquesting.api.client.toolbox.IToolRegistry; 9 | import betterquesting.api2.client.toolbox.IToolTab; 10 | 11 | public class ToolboxRegistry implements IToolRegistry { 12 | 13 | public static final ToolboxRegistry INSTANCE = new ToolboxRegistry(); 14 | 15 | private final HashMap toolTabs = new HashMap<>(); 16 | 17 | @Override 18 | public void registerToolTab(ResourceLocation tabID, IToolTab tab) { 19 | if (tabID == null || tab == null) { 20 | throw new NullPointerException("Tried to register null tab or null ID"); 21 | } else if (toolTabs.containsKey(tabID)) { 22 | throw new IllegalArgumentException("Cannot register duplicate tab ID: " + tabID); 23 | } 24 | 25 | toolTabs.put(tabID, tab); 26 | } 27 | 28 | @Override 29 | public IToolTab getTabByID(ResourceLocation tabID) { 30 | return toolTabs.get(tabID); 31 | } 32 | 33 | @Override 34 | public Collection getAllTabs() { 35 | return toolTabs.values(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.init.Blocks; 4 | import net.minecraft.init.Items; 5 | import net.minecraft.item.ItemStack; 6 | 7 | import cpw.mods.fml.common.event.FMLInitializationEvent; 8 | import cpw.mods.fml.common.registry.GameRegistry; 9 | 10 | public class CommonProxy extends ServerProxy { 11 | 12 | public CommonProxy() { 13 | super(); 14 | } 15 | 16 | @Override 17 | public void init(FMLInitializationEvent e) { 18 | super.init(e); 19 | GameRegistry.addShapelessRecipe( 20 | new ItemStack(CB4BQ.BlockDLB), 21 | new ItemStack(Items.stick), 22 | new ItemStack(Blocks.dirt), 23 | new ItemStack(Blocks.gravel)); 24 | // GameRegistry.addShapelessRecipe(new ItemStack(BlockDLB), new ItemStack(BlockDSB)); 25 | // GameRegistry.addShapelessRecipe(new ItemStack(BlockDSB), new ItemStack(BlockHSB)); 26 | GameRegistry.addShapelessRecipe(new ItemStack(CB4BQ.BlockDLB), new ItemStack(CB4BQ.BlockHSB)); 27 | GameRegistry.addShapelessRecipe(new ItemStack(CB4BQ.BlockHSB), new ItemStack(CB4BQ.BlockREB)); 28 | GameRegistry.addShapelessRecipe(new ItemStack(CB4BQ.BlockREB), new ItemStack(CB4BQ.BlockDLB)); 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/BlockREB.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.block.BlockCommandBlock; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.world.World; 6 | 7 | import betterquesting.commands.BQ_CommandAdmin; 8 | import betterquesting.commands.admin.QuestCommandReset; 9 | import betterquesting.core.BetterQuesting; 10 | import cpw.mods.fml.common.FMLCommonHandler; 11 | 12 | public class BlockREB extends BlockCommandBlock { 13 | 14 | public BlockREB() { 15 | this.setHardness(1.0f); 16 | this.setBlockName("CB4BQ.REB"); 17 | this.setBlockTextureName("command_block"); 18 | this.setCreativeTab(BetterQuesting.tabQuesting); 19 | } 20 | 21 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, 22 | float hitY, float hitZ) { 23 | if (!world.isRemote) { 24 | new QuestCommandReset().runCommand( 25 | FMLCommonHandler.instance() 26 | .getMinecraftServerInstance(), 27 | new BQ_CommandAdmin(), 28 | player, 29 | new String[] { "reset", "all", player.getUniqueID() 30 | .toString() }); 31 | } 32 | return true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/questing/IQuestLine.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.questing; 2 | 3 | import java.util.Map; 4 | import java.util.UUID; 5 | 6 | import net.minecraft.nbt.NBTBase; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | 9 | import betterquesting.api.properties.IPropertyContainer; 10 | import betterquesting.api2.storage.INBTPartial; 11 | import betterquesting.api2.storage.IUuidDatabase; 12 | 13 | public interface IQuestLine 14 | extends IUuidDatabase, INBTPartial, IPropertyContainer { 15 | 16 | IQuestLineEntry createNew(UUID uuid); 17 | 18 | String getUnlocalisedName(); 19 | 20 | String getUnlocalisedDescription(); 21 | 22 | Map.Entry getEntryAt(int x, int y); 23 | 24 | /** 25 | * Variant of {@link #writeToNBT(NBTBase)} which allows skipping writing quests. 26 | * 27 | *

28 | * The reason why we want to skip writing quests is that, when exporting the quest database, 29 | * we want to try to avoid merge conflicts. The fact that quests are exported to NBT in 30 | * sequential order (as an {@code NBTTagList}) makes this format particularly prone to merge 31 | * conflicts. 32 | */ 33 | NBTTagCompound writeToNBT(NBTTagCompound json, boolean skipQuests); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/proxy/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.proxy; 2 | 3 | import bq_standard.handlers.EventHandler; 4 | import bq_standard.handlers.PlayerContainerListener; 5 | import cpw.mods.fml.common.FMLCommonHandler; 6 | import cpw.mods.fml.common.event.FMLInitializationEvent; 7 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 8 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 9 | import cpw.mods.fml.common.event.FMLServerStoppedEvent; 10 | import drethic.questbook.config.QBConfig; 11 | import drethic.questbook.crafting.QBCrafting; 12 | import drethic.questbook.events.FMLEventHandler; 13 | import drethic.questbook.item.QBItems; 14 | 15 | public class CommonProxy { 16 | 17 | public void preInit(FMLPreInitializationEvent e) { 18 | QBItems.init(); 19 | QBCrafting.init(); 20 | QBConfig.init(e); 21 | } 22 | 23 | public void init(FMLInitializationEvent e) { 24 | FMLCommonHandler.instance() 25 | .bus() 26 | .register(FMLEventHandler.INSTANCE); 27 | } 28 | 29 | public void postInit(FMLPostInitializationEvent e) { 30 | 31 | } 32 | 33 | public void onServerStopped(FMLServerStoppedEvent e) { 34 | EventHandler.cleanup(); 35 | PlayerContainerListener.cleanup(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | *.[jJ][aA][rR] binary 4 | 5 | *.[pP][nN][gG] binary 6 | *.[jJ][pP][gG] binary 7 | *.[jJ][pP][eE][gG] binary 8 | *.[gG][iI][fF] binary 9 | *.[tT][iI][fF] binary 10 | *.[tT][iI][fF][fF] binary 11 | *.[iI][cC][oO] binary 12 | *.[sS][vV][gG] text 13 | *.[eE][pP][sS] binary 14 | *.[xX][cC][fF] binary 15 | 16 | *.[kK][aA][rR] binary 17 | *.[mM]4[aA] binary 18 | *.[mM][iI][dD] binary 19 | *.[mM][iI][dD][iI] binary 20 | *.[mM][pP]3 binary 21 | *.[oO][gG][gG] binary 22 | *.[rR][aA] binary 23 | 24 | *.7[zZ] binary 25 | *.[gG][zZ] binary 26 | *.[tT][aA][rR] binary 27 | *.[tT][gG][zZ] binary 28 | *.[zZ][iI][pP] binary 29 | 30 | *.[tT][cC][nN] binary 31 | *.[sS][oO] binary 32 | *.[dD][lL][lL] binary 33 | *.[dD][yY][lL][iI][bB] binary 34 | *.[pP][sS][dD] binary 35 | *.[tT][tT][fF] binary 36 | *.[oO][tT][fF] binary 37 | 38 | *.[pP][aA][tT][cC][hH] -text 39 | 40 | *.[bB][aA][tT] text eol=crlf 41 | *.[cC][mM][dD] text eol=crlf 42 | *.[pP][sS]1 text eol=crlf 43 | 44 | *[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary 45 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/IUuidDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import java.util.Collection; 4 | import java.util.Map; 5 | import java.util.UUID; 6 | import java.util.function.BiPredicate; 7 | import java.util.stream.Stream; 8 | 9 | import javax.annotation.Nullable; 10 | 11 | import com.google.common.collect.BiMap; 12 | 13 | /** Database that uses randomly-generated UUIDs as keys. */ 14 | public interface IUuidDatabase extends BiMap { 15 | 16 | /** Returns an unused UUID. */ 17 | UUID generateKey(); 18 | 19 | @Nullable 20 | UUID lookupKey(T value); 21 | 22 | /** 23 | * Returns this database's entries in a stable order. 24 | * Useful for ensuring that exported files change as little as possible. 25 | */ 26 | Stream> orderedEntries(); 27 | 28 | Stream getAll(Collection keys); 29 | 30 | Map filterKeys(Collection keys); 31 | 32 | BiMap filterValues(Collection values); 33 | 34 | BiMap filterEntries(BiPredicate filter); 35 | 36 | /** 37 | * Removes {@code value} from the database, and returns its corresponding key. 38 | * Returns null if {@code value} is not present in the database. 39 | */ 40 | @Nullable 41 | UUID removeValue(T value); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/lokko12/CB4BQ/CB4BQ.java: -------------------------------------------------------------------------------- 1 | package lokko12.CB4BQ; 2 | 3 | import net.minecraft.block.Block; 4 | 5 | import org.apache.logging.log4j.LogManager; 6 | 7 | import betterquesting.core.BetterQuesting; 8 | import cpw.mods.fml.common.Mod; 9 | import cpw.mods.fml.common.Mod.EventHandler; 10 | import cpw.mods.fml.common.Mod.Instance; 11 | import cpw.mods.fml.common.SidedProxy; 12 | import cpw.mods.fml.common.event.FMLInitializationEvent; 13 | 14 | @Mod( 15 | modid = "cb4bq", 16 | name = "Command Blocks for Better Questing", 17 | version = BetterQuesting.VERSION, 18 | dependencies = "required-after:betterquesting") 19 | public class CB4BQ { 20 | 21 | public static Block BlockDLB = new BlockDLB(); 22 | public static Block BlockDSB = new BlockDSB(); 23 | public static Block BlockHSB = new BlockHSB(); 24 | public static Block BlockREB = new BlockREB(); 25 | 26 | public static final org.apache.logging.log4j.Logger CLClogger = LogManager.getLogger("cb4bq"); 27 | 28 | @Instance(value = "CropLoadCore") 29 | public static CB4BQ instance; 30 | 31 | @SidedProxy(clientSide = "lokko12.CB4BQ.CommonProxy", serverSide = "lokko12.CB4BQ.ServerProxy") 32 | public static ServerProxy proxy; 33 | 34 | @EventHandler 35 | public void init(FMLInitializationEvent e) { 36 | proxy.init(e); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/drethic/questbook/events/FMLEventHandler.java: -------------------------------------------------------------------------------- 1 | package drethic.questbook.events; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.nbt.NBTTagCompound; 6 | 7 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 8 | import cpw.mods.fml.common.gameevent.PlayerEvent; 9 | import drethic.questbook.config.QBConfig; 10 | import drethic.questbook.item.QBItems; 11 | 12 | public enum FMLEventHandler { 13 | 14 | INSTANCE; 15 | 16 | private static final String NBT_KEY = "questbook.firstjoin"; 17 | 18 | @SubscribeEvent 19 | public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) { 20 | if (!QBConfig.spawnWithBook) { 21 | return; 22 | } 23 | 24 | NBTTagCompound data = event.player.getEntityData(); 25 | NBTTagCompound persistent; 26 | if (!data.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) { 27 | data.setTag(EntityPlayer.PERSISTED_NBT_TAG, (persistent = new NBTTagCompound())); 28 | } else { 29 | persistent = data.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); 30 | } 31 | 32 | if (!persistent.hasKey(NBT_KEY)) { 33 | persistent.setBoolean(NBT_KEY, true); 34 | event.player.inventory.addItemStackToInventory(new ItemStack(QBItems.ItemQuestBook)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/placeholders/EntityPlaceholder.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.placeholders; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.entity.item.EntityItem; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import net.minecraft.world.World; 8 | 9 | public class EntityPlaceholder extends Entity { 10 | 11 | EntityItem eItem; 12 | NBTTagCompound original = new NBTTagCompound(); 13 | 14 | public EntityPlaceholder(World world) { 15 | super(world); 16 | eItem = new EntityItem(world); 17 | eItem.setEntityItemStack(new ItemStack(ItemPlaceholder.placeholder)); 18 | } 19 | 20 | public EntityPlaceholder SetOriginalTags(NBTTagCompound tags) { 21 | this.original = tags; 22 | return this; 23 | } 24 | 25 | public NBTTagCompound GetOriginalTags() { 26 | return this.original; 27 | } 28 | 29 | public EntityItem GetItemEntity() { 30 | return eItem; 31 | } 32 | 33 | @Override 34 | protected void entityInit() {} 35 | 36 | @Override 37 | protected void readEntityFromNBT(NBTTagCompound tags) { 38 | original = tags.getCompoundTag("original"); 39 | } 40 | 41 | @Override 42 | protected void writeEntityToNBT(NBTTagCompound tags) { 43 | tags.setTag("original", this.original); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/storage/LookupLogicType.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.storage; 2 | 3 | import static betterquesting.api2.storage.SimpleDatabase.CACHE_MAX_SIZE; 4 | import static betterquesting.api2.storage.SimpleDatabase.SPARSE_RATIO; 5 | 6 | import java.util.function.Function; 7 | import java.util.function.Predicate; 8 | 9 | enum LookupLogicType { 10 | 11 | Empty(db -> db.mapDB.isEmpty(), EmptyLookupLogic::new), 12 | ArrayCache(db -> db.mapDB.size() < CACHE_MAX_SIZE 13 | && db.mapDB.size() > SPARSE_RATIO * (db.mapDB.lastKey() - db.mapDB.firstKey()), ArrayCacheLookupLogic::new), 14 | Naive(db -> true, NaiveLookupLogic::new); 15 | 16 | private final Predicate> shouldUse; 17 | private final Function, LookupLogic> factory; 18 | 19 | LookupLogicType(Predicate> shouldUse, Function, LookupLogic> factory) { 20 | this.shouldUse = shouldUse; 21 | this.factory = factory; 22 | } 23 | 24 | static LookupLogicType determine(SimpleDatabase db) { 25 | for (LookupLogicType type : values()) { 26 | if (type.shouldUse.test(db)) return type; 27 | } 28 | return Naive; 29 | } 30 | 31 | @SuppressWarnings("unchecked") 32 | LookupLogic get(SimpleDatabase db) { 33 | return (LookupLogic) factory.apply(db); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskBlockPlace.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.nbt.NBTTagCompound; 7 | 8 | import com.google.gson.JsonElement; 9 | import com.google.gson.JsonObject; 10 | 11 | import betterquesting.api.questing.tasks.ITask; 12 | import betterquesting.api.utils.BigItemStack; 13 | import betterquesting.api.utils.JsonHelper; 14 | import bq_standard.importers.hqm.HQMUtilities; 15 | import bq_standard.tasks.TaskInteractItem; 16 | 17 | public class HQMTaskBlockPlace { 18 | 19 | public ITask[] convertTask(JsonObject json) { 20 | List tList = new ArrayList<>(); 21 | 22 | for (JsonElement je : JsonHelper.GetArray(json, "blocks")) { 23 | if (!(je instanceof JsonObject)) continue; 24 | JsonObject jObj = je.getAsJsonObject(); 25 | 26 | TaskInteractItem task = new TaskInteractItem(); 27 | BigItemStack stack = HQMUtilities.HQMStackT1(JsonHelper.GetObject(jObj, "item")); 28 | task.targetItem = BigItemStack.loadItemStackFromNBT(stack.writeToNBT(new NBTTagCompound())); 29 | task.required = JsonHelper.GetNumber(jObj, "required", 1) 30 | .intValue(); 31 | tList.add(task); 32 | } 33 | 34 | return tList.toArray(new ITask[0]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/events/DatabaseEvent.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.events; 2 | 3 | import cpw.mods.fml.common.eventhandler.Event; 4 | 5 | /** 6 | * Fired when the whole questing database for world is modified, loaded or saved. 7 | * Can be used to save/load custom databases in expansions or update dependent GUIs 8 | */ 9 | // TODO: Replace with a better system. Stop using this for updating screens too 10 | @Deprecated 11 | public abstract class DatabaseEvent extends Event { 12 | 13 | private final DBType TYPE; 14 | 15 | public DatabaseEvent(DBType type) { 16 | this.TYPE = type; 17 | } 18 | 19 | public DBType getType() { 20 | return this.TYPE; 21 | } 22 | 23 | @Deprecated 24 | public static class Update extends DatabaseEvent { 25 | 26 | public Update(DBType type) { 27 | super(type); 28 | } 29 | } 30 | 31 | @Deprecated 32 | public static class Load extends DatabaseEvent { 33 | 34 | public Load(DBType type) { 35 | super(type); 36 | } 37 | } 38 | 39 | @Deprecated 40 | public static class Save extends DatabaseEvent { 41 | 42 | public Save(DBType type) { 43 | super(type); 44 | } 45 | } 46 | 47 | public enum DBType { 48 | QUEST, 49 | CHAPTER, 50 | PARTY, 51 | NAMES, 52 | ALL, 53 | OTHER 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/AdminExecute.java: -------------------------------------------------------------------------------- 1 | package bq_standard; 2 | 3 | import net.minecraft.command.ICommandSender; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.util.ChunkCoordinates; 6 | import net.minecraft.util.IChatComponent; 7 | import net.minecraft.world.World; 8 | 9 | /** 10 | * Elevates the player's privileges to OP level for use in command rewards 11 | */ 12 | public class AdminExecute implements ICommandSender { 13 | 14 | private final EntityPlayer player; 15 | 16 | public AdminExecute(EntityPlayer player) { 17 | this.player = player; 18 | } 19 | 20 | @Override 21 | public String getCommandSenderName() { 22 | return player.getCommandSenderName(); 23 | } 24 | 25 | @Override 26 | public IChatComponent func_145748_c_() { 27 | return player.func_145748_c_(); 28 | } 29 | 30 | @Override 31 | public void addChatMessage(IChatComponent p_145747_1_) { 32 | player.addChatMessage(p_145747_1_); 33 | } 34 | 35 | @Override 36 | public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_) { 37 | return true; 38 | } 39 | 40 | @Override 41 | public ChunkCoordinates getPlayerCoordinates() { 42 | return player.getPlayerCoordinates(); 43 | } 44 | 45 | @Override 46 | public World getEntityWorld() { 47 | return player.getEntityWorld(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/utils/EntityPlayerPreview.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.utils; 2 | 3 | import net.minecraft.client.entity.EntityOtherPlayerMP; 4 | import net.minecraft.util.ResourceLocation; 5 | import net.minecraft.world.World; 6 | 7 | import com.mojang.authlib.GameProfile; 8 | 9 | import betterquesting.core.BetterQuesting; 10 | 11 | public class EntityPlayerPreview extends EntityOtherPlayerMP { 12 | 13 | private final ResourceLocation resource; 14 | 15 | /** 16 | * Backup constructor. DO NOT USE 17 | */ 18 | public EntityPlayerPreview(World worldIn) { 19 | this(worldIn, new GameProfile(null, "Notch")); 20 | } 21 | 22 | public EntityPlayerPreview(World worldIn, GameProfile gameProfileIn) { 23 | super(worldIn, gameProfileIn); 24 | this.resource = new ResourceLocation(BetterQuesting.MODID, "textures/skin_cache/" + gameProfileIn.getName()); 25 | } 26 | 27 | @Override 28 | public ResourceLocation getLocationSkin() { 29 | return this.resource; 30 | } 31 | 32 | @Override 33 | public ResourceLocation getLocationCape() { 34 | return null; 35 | } 36 | 37 | @Override 38 | public boolean func_152123_o() { 39 | return true; 40 | } 41 | 42 | @Override 43 | public String getDisplayName() { 44 | return ""; 45 | } 46 | 47 | @Override 48 | public boolean getHideCape() { 49 | return true; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/colors/GuiColorSequence.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.colors; 2 | 3 | public class GuiColorSequence implements IGuiColor { 4 | 5 | private final IGuiColor[] colors; 6 | private final float interval; 7 | 8 | public GuiColorSequence(float interval, IGuiColor... colors) { 9 | this.colors = colors; 10 | this.interval = interval; 11 | } 12 | 13 | @Override 14 | public int getRGB() { 15 | return getCurrentColor().getRGB(); 16 | } 17 | 18 | @Override 19 | public float getRed() { 20 | return getCurrentColor().getRed(); 21 | } 22 | 23 | @Override 24 | public float getGreen() { 25 | return getCurrentColor().getGreen(); 26 | } 27 | 28 | @Override 29 | public float getBlue() { 30 | return getCurrentColor().getBlue(); 31 | } 32 | 33 | @Override 34 | public float getAlpha() { 35 | return getCurrentColor().getAlpha(); 36 | } 37 | 38 | @Override 39 | public void applyGlColor() { 40 | getCurrentColor().applyGlColor(); 41 | } 42 | 43 | public IGuiColor getCurrentColor() { 44 | if (colors.length <= 0) return null; 45 | return colors[(int) Math.floor((System.currentTimeMillis() / 1000D) % (colors.length * interval) / interval)]; 46 | } 47 | 48 | public IGuiColor[] getAllColors() { 49 | return this.colors; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/handlers/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package betterquesting.handlers; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.tileentity.TileEntity; 5 | import net.minecraft.world.World; 6 | 7 | import betterquesting.blocks.TileSubmitStation; 8 | import betterquesting.client.gui2.GuiQuestHelp; 9 | import betterquesting.client.gui2.inventory.ContainerSubmitStation; 10 | import betterquesting.client.gui2.inventory.GuiSubmitStation; 11 | import cpw.mods.fml.common.network.IGuiHandler; 12 | 13 | public class GuiHandler implements IGuiHandler { 14 | 15 | @Override 16 | public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { 17 | TileEntity tile = world.getTileEntity(x, y, z); 18 | 19 | if (ID == 0 && tile instanceof TileSubmitStation) { 20 | return new ContainerSubmitStation(player.inventory, (TileSubmitStation) tile); 21 | } 22 | 23 | return null; 24 | } 25 | 26 | @Override 27 | public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { 28 | TileEntity tile = world.getTileEntity(x, y, z); 29 | 30 | if (ID == 0 && tile instanceof TileSubmitStation) { 31 | return new GuiSubmitStation(null, player.inventory, (TileSubmitStation) tile); 32 | } else if (ID == 1) { 33 | return new GuiQuestHelp(null); 34 | } 35 | 36 | return null; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/registry/SimpleRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.registry; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.util.ResourceLocation; 10 | 11 | public class SimpleRegistry, E> implements IRegistry { 12 | 13 | private final HashMap factories = new HashMap<>(); 14 | 15 | @Override 16 | public void register(T factory) { 17 | if (factory == null || factory.getRegistryName() == null) { 18 | throw new NullPointerException("Factory or registry name is null!"); 19 | } else if (factories.containsKey(factory.getRegistryName()) || factories.containsValue(factory)) { 20 | throw new IllegalArgumentException("Cannot register duplicate factory or registry name"); 21 | } 22 | 23 | factories.put(factory.getRegistryName(), factory); 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public T getFactory(ResourceLocation idName) { 29 | return factories.get(idName); 30 | } 31 | 32 | @Nullable 33 | @Override 34 | public E createNew(ResourceLocation idName) { 35 | IFactory fact = getFactory(idName); 36 | 37 | return fact == null ? null : fact.createNew(); 38 | } 39 | 40 | @Override 41 | public List getAll() { 42 | return new ArrayList<>(factories.values()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/textures/LayeredTexture.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.textures; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 7 | 8 | public class LayeredTexture implements IGuiTexture { 9 | 10 | private final IGuiTexture[] layers; 11 | 12 | public LayeredTexture(IGuiTexture... layers) { 13 | this.layers = layers; 14 | } 15 | 16 | @Override 17 | public void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick) { 18 | if (width <= 0 || height <= 0) return; 19 | 20 | for (IGuiTexture tex : layers) { 21 | tex.drawTexture(x, y, width, height, zDepth, partialTick); 22 | } 23 | } 24 | 25 | @Override 26 | public void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick, IGuiColor color) { 27 | if (width <= 0 || height <= 0) return; 28 | 29 | for (IGuiTexture tex : layers) { 30 | tex.drawTexture(x, y, width, height, zDepth, partialTick, color); 31 | } 32 | } 33 | 34 | @Override 35 | public ResourceLocation getTexture() { 36 | return layers.length <= 0 ? null : layers[0].getTexture(); 37 | } 38 | 39 | @Override 40 | public IGuiRect getBounds() { 41 | return layers.length <= 0 ? null : layers[0].getBounds(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/textures/GuiTextureColored.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.textures; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 7 | 8 | /** 9 | * Wraps an existing IGuiTexture with an IGuiColor 10 | */ 11 | public class GuiTextureColored implements IGuiTexture { 12 | 13 | private final IGuiTexture texture; 14 | private final IGuiColor color; 15 | 16 | public GuiTextureColored(IGuiTexture texture, IGuiColor color) { 17 | this.texture = texture; 18 | this.color = color; 19 | } 20 | 21 | @Override 22 | public void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick) { 23 | if (width <= 0 || height <= 0) return; 24 | 25 | texture.drawTexture(x, y, width, height, zDepth, partialTick, color); 26 | } 27 | 28 | @Override 29 | @Deprecated 30 | public void drawTexture(int x, int y, int width, int height, float zDepth, float partialTick, IGuiColor c) { 31 | if (width <= 0 || height <= 0) return; 32 | 33 | texture.drawTexture(x, y, width, height, zDepth, partialTick, c); 34 | } 35 | 36 | @Override 37 | public ResourceLocation getTexture() { 38 | return texture.getTexture(); 39 | } 40 | 41 | @Override 42 | public IGuiRect getBounds() { 43 | return texture.getBounds(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/factories/colors/FactoryColorStatic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.factories.colors; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import com.google.gson.JsonObject; 6 | 7 | import betterquesting.api.utils.JsonHelper; 8 | import betterquesting.api2.client.gui.resources.colors.GuiColorStatic; 9 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 10 | import betterquesting.api2.registry.IFactoryData; 11 | 12 | public class FactoryColorStatic implements IFactoryData { 13 | 14 | public static final FactoryColorStatic INSTANCE = new FactoryColorStatic(); 15 | 16 | private static final ResourceLocation RES_ID = new ResourceLocation("betterquesting", "color_static"); 17 | 18 | @Override 19 | public GuiColorStatic loadFromData(JsonObject data) { 20 | int color; 21 | 22 | try { 23 | // Needs to be done through long so that the signed bit isn't dropped 24 | color = (int) Long.parseLong(JsonHelper.GetString(data, "color", "FFFFFFFF"), 16); 25 | } catch (NumberFormatException ignored) { 26 | color = 0xFFFFFFFF; 27 | } 28 | 29 | return new GuiColorStatic(color); 30 | } 31 | 32 | @Override 33 | public ResourceLocation getRegistryName() { 34 | return RES_ID; 35 | } 36 | 37 | @Override 38 | public GuiColorStatic createNew() { 39 | return new GuiColorStatic(0xFFFFFFFF); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/client/toolbox/IToolboxTool.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.client.toolbox; 2 | 3 | import java.util.List; 4 | 5 | import betterquesting.api2.client.gui.controls.PanelButtonQuest; 6 | import betterquesting.api2.client.gui.panels.lists.CanvasQuestLine; 7 | 8 | public interface IToolboxTool { 9 | 10 | /** Starts up the tool in its initial starting state */ 11 | void initTool(CanvasQuestLine gui); 12 | 13 | /** Canvas has been refreshed. Restore references to buttons, etc. */ 14 | void refresh(CanvasQuestLine gui); 15 | 16 | /** Shut down tool and reset values */ 17 | void disableTool(); 18 | 19 | /** Draws within the relative scrolling portion of the canvas */ 20 | void drawCanvas(int mx, int my, float partialTick); 21 | 22 | /** Draws over the top of the canvas without being affected by scrolling */ 23 | void drawOverlay(int mx, int my, float partialTick); 24 | 25 | /** Fired when the tool controller has changed its multi-selection */ 26 | void onSelection(List buttons); 27 | 28 | boolean onMouseClick(int mx, int my, int click); 29 | 30 | boolean onMouseRelease(int mx, int my, int click); 31 | 32 | boolean onMouseScroll(int mx, int my, int scroll); 33 | 34 | boolean onKeyPressed(char c, int key); 35 | 36 | List getTooltip(int mx, int my); 37 | 38 | boolean clampScrolling(); 39 | 40 | /** Allows the tool controller to intercept some interactions to perform multi-quest selections */ 41 | boolean useSelection(); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/colors/GuiColorStatic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.colors; 2 | 3 | import java.awt.Color; 4 | 5 | import org.lwjgl.opengl.GL11; 6 | 7 | public class GuiColorStatic implements IGuiColor { 8 | 9 | private final int argb; 10 | 11 | public GuiColorStatic(int color) { 12 | this.argb = color; 13 | } 14 | 15 | public GuiColorStatic(int red, int green, int blue, int alpha) { 16 | this.argb = ((alpha & 255) << 24) | ((red & 255) << 16) | ((green & 255) << 8) | (blue & 255); 17 | } 18 | 19 | public GuiColorStatic(float red, float green, float blue, float alpha) { 20 | this((int) (red * 255), (int) (green * 255), (int) (blue * 255), (int) (alpha * 255)); 21 | } 22 | 23 | public GuiColorStatic(Color color) { 24 | this(color.getRGB()); 25 | } 26 | 27 | @Override 28 | public int getRGB() { 29 | return argb; 30 | } 31 | 32 | @Override 33 | public float getRed() { 34 | return (argb >> 16 & 255) / 255F; 35 | } 36 | 37 | @Override 38 | public float getGreen() { 39 | return (argb >> 8 & 255) / 255F; 40 | } 41 | 42 | @Override 43 | public float getBlue() { 44 | return (argb & 255) / 255F; 45 | } 46 | 47 | @Override 48 | public float getAlpha() { 49 | return (argb >> 24 & 255) / 255F; 50 | } 51 | 52 | @Override 53 | public void applyGlColor() { 54 | GL11.glColor4f(getRed(), getGreen(), getBlue(), getAlpha()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/integration/vendingmachine/VmAdapter.java: -------------------------------------------------------------------------------- 1 | package bq_standard.integration.vendingmachine; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | import java.util.UUID; 6 | 7 | import com.cubefury.vendingmachine.integration.betterquesting.BqAdapter; 8 | import com.cubefury.vendingmachine.integration.betterquesting.gui.BqTradeGroup; 9 | import com.cubefury.vendingmachine.network.handlers.NetSatisfiedQuestSync; 10 | 11 | import betterquesting.api2.client.gui.misc.IGuiRect; 12 | import betterquesting.api2.client.gui.panels.lists.CanvasScrolling; 13 | 14 | public class VmAdapter { 15 | 16 | public static void addBqConditions(UUID player, List completedQuests) { 17 | for (UUID quest : completedQuests) { 18 | BqAdapter.INSTANCE.setQuestFinished(player, quest); 19 | } 20 | } 21 | 22 | public static void resetCompletedQuests(UUID player) { 23 | BqAdapter.INSTANCE.resetQuests(player); 24 | } 25 | 26 | public static void sendPlayerSatisfiedCache() { 27 | NetSatisfiedQuestSync.sendSync(); 28 | } 29 | 30 | public static Set getTrades(UUID quest) { 31 | return BqAdapter.INSTANCE.getTrades(quest); 32 | } 33 | 34 | public static boolean questHasTrades(UUID quest) { 35 | return BqAdapter.INSTANCE.questHasTrades(quest); 36 | } 37 | 38 | public static int addTradePanel(CanvasScrolling csReward, IGuiRect rectReward, UUID tradeGroup, int startYOffset) { 39 | return BqTradeGroup.addTradePanel(csReward, rectReward, tradeGroup, startYOffset); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/themes/IThemeRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.themes; 2 | 3 | import java.util.List; 4 | import java.util.function.Function; 5 | 6 | import net.minecraft.client.gui.GuiScreen; 7 | import net.minecraft.util.ResourceLocation; 8 | 9 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 10 | import betterquesting.api2.client.gui.resources.lines.IGuiLine; 11 | import betterquesting.api2.client.gui.resources.textures.IGuiTexture; 12 | 13 | public interface IThemeRegistry { 14 | 15 | void registerTheme(IGuiTheme theme); 16 | 17 | IGuiTheme getCurrentTheme(); 18 | 19 | IGuiTheme getTheme(ResourceLocation key); 20 | 21 | void setTheme(ResourceLocation key); 22 | 23 | void loadResourceThemes(); 24 | 25 | IGuiTexture getTexture(ResourceLocation key); 26 | 27 | IGuiColor getColor(ResourceLocation key); 28 | 29 | IGuiLine getLine(ResourceLocation key); 30 | 31 | GuiScreen getGui(GuiKey key, T args); 32 | 33 | void setDefaultTexture(ResourceLocation key, IGuiTexture tex); 34 | 35 | void setDefaultColor(ResourceLocation key, IGuiColor color); 36 | 37 | void setDefaultLine(ResourceLocation key, IGuiLine line); 38 | 39 | void setDefaultGui(GuiKey key, Function func); 40 | 41 | List getAllThemes(); 42 | 43 | // === Future Editor Stuff === 44 | ResourceLocation[] getKnownTextures(); 45 | 46 | ResourceLocation[] getKnownColors(); 47 | 48 | ResourceLocation[] getKnownLines(); 49 | 50 | GuiKey[] getKnownGuis(); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/commands/admin/QuestCommandPurge.java: -------------------------------------------------------------------------------- 1 | package betterquesting.commands.admin; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | import java.util.UUID; 6 | import java.util.stream.Collectors; 7 | 8 | import net.minecraft.command.CommandBase; 9 | import net.minecraft.command.ICommandSender; 10 | import net.minecraft.server.MinecraftServer; 11 | import net.minecraft.util.ChatComponentTranslation; 12 | 13 | import com.google.common.collect.Sets; 14 | 15 | import betterquesting.api2.storage.IUuidDatabase; 16 | import betterquesting.commands.QuestCommandBase; 17 | import betterquesting.network.handlers.NetQuestEdit; 18 | import betterquesting.questing.QuestDatabase; 19 | import betterquesting.questing.QuestLineDatabase; 20 | 21 | public class QuestCommandPurge extends QuestCommandBase { 22 | 23 | @Override 24 | public String getCommand() { 25 | return "purge_hidden_quests"; 26 | } 27 | 28 | @Override 29 | public void runCommand(MinecraftServer server, CommandBase command, ICommandSender sender, String[] args) { 30 | HashSet knownKeys = QuestLineDatabase.INSTANCE.values() 31 | .stream() 32 | .map(IUuidDatabase::keySet) 33 | .flatMap(Set::stream) 34 | .collect(Collectors.toCollection(HashSet::new)); 35 | 36 | Set hiddenQuests = Sets.difference(QuestDatabase.INSTANCE.keySet(), knownKeys); 37 | NetQuestEdit.deleteQuests(hiddenQuests); 38 | 39 | sender.addChatMessage(new ChatComponentTranslation("betterquesting.cmd.purge_hidden", hiddenQuests.size())); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api/enums/EnumLogic.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api.enums; 2 | 3 | public enum EnumLogic { 4 | 5 | AND, // All true 6 | NAND, // Any false 7 | OR, // Any true 8 | NOR, // All false 9 | XOR, // Only one true 10 | XNOR; // Only one false 11 | 12 | public boolean isTrivial() { 13 | switch (this) { 14 | case AND: 15 | case OR: 16 | return true; 17 | default: 18 | return false; 19 | } 20 | } 21 | 22 | public boolean isUnlockable(int inputs, int total) { 23 | switch (this) { 24 | case AND: 25 | case OR: 26 | return true; 27 | case NAND: 28 | case XNOR: 29 | return inputs < total; 30 | case NOR: 31 | return inputs == 0; 32 | case XOR: 33 | return inputs <= 1; 34 | default: 35 | return false; 36 | } 37 | } 38 | 39 | public boolean getResult(int inputs, int total) { 40 | switch (this) { 41 | case AND: 42 | return inputs >= total; 43 | case NAND: 44 | return inputs < total; 45 | case NOR: 46 | return inputs == 0; 47 | case OR: 48 | return inputs > 0; 49 | case XNOR: 50 | return inputs == total - 1; 51 | case XOR: 52 | return inputs == 1; 53 | default: 54 | return false; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/help/HelpRegistry.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.help; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | // Could probably be more refined and fleshed out in functionality at a later date but for now this is just to decouple 7 | // it from the GUIs 8 | public class HelpRegistry { 9 | 10 | public static final HelpRegistry INSTANCE = new HelpRegistry(); 11 | 12 | private final List topicList = new ArrayList<>(); 13 | 14 | public HelpRegistry() { 15 | registerTopic(new HelpTopic("betterquesting.btn.help1", "betterquesting.help.page1")); 16 | registerTopic(new HelpTopic("betterquesting.btn.help2", "betterquesting.help.page2")); 17 | registerTopic(new HelpTopic("betterquesting.btn.help3", "betterquesting.help.page3")); 18 | registerTopic(new HelpTopic("betterquesting.btn.help4", "betterquesting.help.page4")); 19 | registerTopic(new HelpTopic("betterquesting.btn.help5", "betterquesting.help.page5")); 20 | registerTopic(new HelpTopic("betterquesting.btn.help6", "betterquesting.help.page6")); 21 | registerTopic(new HelpTopic("betterquesting.btn.help7", "betterquesting.help.page7")); 22 | registerTopic(new HelpTopic("betterquesting.btn.help8", "betterquesting.help.page8")); 23 | } 24 | 25 | public boolean registerTopic(HelpTopic topic) { 26 | if (topicList.contains(topic)) return false; 27 | return topicList.add(topic); 28 | } 29 | 30 | public HelpTopic[] getTopics() { 31 | return topicList.toArray(new HelpTopic[0]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/lines/SimpleLine.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.lines; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import betterquesting.api2.client.gui.misc.IGuiRect; 6 | import betterquesting.api2.client.gui.resources.colors.IGuiColor; 7 | 8 | public class SimpleLine implements IGuiLine { 9 | 10 | private final short pattern; 11 | private final int scale; 12 | 13 | public SimpleLine() { 14 | this(1, (short) 0xFFFF); 15 | } 16 | 17 | public SimpleLine(int stippleScale, short stipplePattern) { 18 | this.pattern = stipplePattern; 19 | this.scale = stippleScale; 20 | } 21 | 22 | @Override 23 | public void drawLine(IGuiRect start, IGuiRect end, int width, IGuiColor color, float partialTick) { 24 | GL11.glPushMatrix(); 25 | 26 | GL11.glDisable(GL11.GL_TEXTURE_2D); 27 | GL11.glEnable(GL11.GL_LINE_STIPPLE); 28 | color.applyGlColor(); 29 | GL11.glLineWidth(width); 30 | GL11.glLineStipple(scale, pattern); 31 | 32 | GL11.glBegin(GL11.GL_LINES); 33 | GL11.glVertex2f(start.getX() + start.getWidth() / 2F, start.getY() + start.getHeight() / 2F); 34 | GL11.glVertex2f(end.getX() + end.getWidth() / 2F, end.getY() + end.getHeight() / 2F); 35 | GL11.glEnd(); 36 | 37 | GL11.glLineStipple(1, (short) 0xFFFF); 38 | GL11.glLineWidth(1F); 39 | GL11.glDisable(GL11.GL_LINE_STIPPLE); 40 | GL11.glEnable(GL11.GL_TEXTURE_2D); 41 | GL11.glColor4f(1F, 1F, 1F, 1F); 42 | 43 | GL11.glPopMatrix(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskDetect.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonElement; 7 | import com.google.gson.JsonObject; 8 | 9 | import betterquesting.api.questing.tasks.ITask; 10 | import betterquesting.api.utils.JsonHelper; 11 | import bq_standard.importers.hqm.HQMUtilities; 12 | import bq_standard.tasks.TaskFluid; 13 | import bq_standard.tasks.TaskRetrieval; 14 | 15 | public class HQMTaskDetect { 16 | 17 | private final boolean consume; 18 | 19 | public HQMTaskDetect(boolean consume) { 20 | this.consume = consume; 21 | } 22 | 23 | public ITask[] convertTask(JsonObject json) { 24 | List tList = new ArrayList<>(); 25 | TaskRetrieval retTask = new TaskRetrieval(); 26 | TaskFluid fluTask = new TaskFluid(); 27 | 28 | retTask.consume = this.consume; 29 | 30 | for (JsonElement je : JsonHelper.GetArray(json, "items")) { 31 | if (!(je instanceof JsonObject)) continue; 32 | JsonObject ji = je.getAsJsonObject(); 33 | 34 | if (ji.has("fluid")) { 35 | fluTask.requiredFluids.add(HQMUtilities.HQMStackT3(ji)); 36 | } else { 37 | retTask.requiredItems.add(HQMUtilities.HQMStackT2(ji)); 38 | } 39 | } 40 | 41 | if (retTask.requiredItems.size() > 0) tList.add(retTask); 42 | 43 | if (fluTask.requiredFluids.size() > 0) tList.add(fluTask); 44 | 45 | return tList.toArray(new ITask[0]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/NBTReplaceUtil.java: -------------------------------------------------------------------------------- 1 | package bq_standard; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import net.minecraft.nbt.NBTBase; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | import net.minecraft.nbt.NBTTagList; 9 | import net.minecraft.nbt.NBTTagString; 10 | 11 | import betterquesting.api.utils.NBTConverter; 12 | 13 | public class NBTReplaceUtil { 14 | 15 | @SuppressWarnings("unchecked") 16 | public static T replaceStrings(T baseTag, String key, String replace) { 17 | if (baseTag == null) { 18 | return null; 19 | } 20 | 21 | if (baseTag instanceof NBTTagCompound) { 22 | NBTTagCompound compound = (NBTTagCompound) baseTag; 23 | 24 | for (String k : (Set) compound.func_150296_c()) { 25 | compound.setTag(k, replaceStrings(compound.getTag(k), key, replace)); 26 | } 27 | } else if (baseTag instanceof NBTTagList) { 28 | NBTTagList list = (NBTTagList) baseTag; 29 | List tList = NBTConverter.getTagList(list); 30 | 31 | for (int i = 0; i < tList.size(); i++) { 32 | tList.set(i, replaceStrings(tList.get(i), key, replace)); 33 | } 34 | } else if (baseTag instanceof NBTTagString) { 35 | NBTTagString tString = (NBTTagString) baseTag; 36 | return (T) new NBTTagString( 37 | tString.func_150285_a_() 38 | .replaceAll(key, replace)); 39 | } 40 | 41 | return baseTag; // Either isn't a string or doesn't contain one 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/utils/OreIngredient.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.utils; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import javax.annotation.Nonnull; 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.creativetab.CreativeTabs; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraftforge.oredict.OreDictionary; 12 | 13 | // Cut down version from 1.12 14 | public class OreIngredient { 15 | 16 | private final List ores; 17 | private ItemStack[] array = null; 18 | private int lastSizeA = -1; 19 | 20 | public OreIngredient(String ore) { 21 | ores = OreDictionary.getOres(ore); 22 | } 23 | 24 | public boolean apply(@Nullable ItemStack input) { 25 | if (input == null) return false; 26 | 27 | for (ItemStack target : this.ores) if (OreDictionary.itemMatches(target, input, false)) return true; 28 | 29 | return false; 30 | } 31 | 32 | @Nonnull 33 | public ItemStack[] getMatchingStacks() { 34 | if (array == null || this.lastSizeA != ores.size()) { 35 | List lst = new ArrayList<>(); 36 | for (ItemStack itemstack : this.ores) { 37 | if (itemstack.getItemDamage() == OreDictionary.WILDCARD_VALUE) itemstack.getItem() 38 | .getSubItems(itemstack.getItem(), CreativeTabs.tabAllSearch, lst); 39 | else lst.add(itemstack.copy()); 40 | } 41 | this.array = lst.toArray(new ItemStack[0]); 42 | this.lastSizeA = ores.size(); 43 | } 44 | return this.array; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/bq_standard/importers/hqm/converters/tasks/HQMTaskLocation.java: -------------------------------------------------------------------------------- 1 | package bq_standard.importers.hqm.converters.tasks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.google.gson.JsonElement; 7 | import com.google.gson.JsonObject; 8 | 9 | import betterquesting.api.questing.tasks.ITask; 10 | import betterquesting.api.utils.JsonHelper; 11 | import bq_standard.tasks.TaskLocation; 12 | 13 | public class HQMTaskLocation { 14 | 15 | public ITask[] convertTask(JsonObject json) { 16 | List tList = new ArrayList<>(); 17 | 18 | for (JsonElement element : JsonHelper.GetArray(json, "locations")) { 19 | if (!(element instanceof JsonObject)) continue; 20 | JsonObject jLoc = element.getAsJsonObject(); 21 | 22 | TaskLocation task = new TaskLocation(); 23 | task.name = JsonHelper.GetString(jLoc, "name", "New Location"); 24 | task.x = JsonHelper.GetNumber(jLoc, "posX", 0) 25 | .intValue(); 26 | task.y = JsonHelper.GetNumber(jLoc, "posY", 0) 27 | .intValue(); 28 | task.z = JsonHelper.GetNumber(jLoc, "posZ", 0) 29 | .intValue(); 30 | task.dim = JsonHelper.GetNumber(jLoc, "dim", 0) 31 | .intValue(); 32 | task.range = JsonHelper.GetNumber(jLoc, "radius", -1) 33 | .intValue(); 34 | task.hideInfo = JsonHelper.GetString(jLoc, "", "") 35 | .equalsIgnoreCase("NONE"); 36 | tList.add(task); 37 | } 38 | 39 | return tList.toArray(new ITask[0]); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/misc/ProxyRect.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.misc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | // Used as a means to hotswap a rect without disturbing the parenting heirachy 6 | public class ProxyRect implements IGuiRect { 7 | 8 | private IGuiRect ref; 9 | 10 | public ProxyRect(IGuiRect refRect) { 11 | this.ref = refRect; 12 | } 13 | 14 | public void changeReference(IGuiRect refRect) { 15 | this.ref = refRect; 16 | } 17 | 18 | @Override 19 | public int getX() { 20 | return ref != null ? ref.getX() : 0; 21 | } 22 | 23 | @Override 24 | public int getY() { 25 | return ref != null ? ref.getY() : 0; 26 | } 27 | 28 | @Override 29 | public int getWidth() { 30 | return ref != null ? ref.getWidth() : 0; 31 | } 32 | 33 | @Override 34 | public int getHeight() { 35 | return ref != null ? ref.getHeight() : 0; 36 | } 37 | 38 | @Override 39 | public int getDepth() { 40 | return ref != null ? ref.getDepth() : 0; 41 | } 42 | 43 | @Override 44 | public IGuiRect getParent() { 45 | return ref != null ? ref.getParent() : null; 46 | } 47 | 48 | @Override 49 | public void setParent(IGuiRect rect) { 50 | if (ref != null) ref.setParent(rect); 51 | } 52 | 53 | @Override 54 | public boolean contains(int x, int y) { 55 | return ref != null && ref.contains(x, y); 56 | } 57 | 58 | @Override 59 | public int compareTo(@Nonnull IGuiRect o) { 60 | return ref != null ? ref.compareTo(o) : 0; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/resources/factories/lines/FactorySimpleLine.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.resources.factories.lines; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import com.google.gson.JsonObject; 6 | 7 | import betterquesting.api.utils.JsonHelper; 8 | import betterquesting.api2.client.gui.resources.lines.IGuiLine; 9 | import betterquesting.api2.client.gui.resources.lines.SimpleLine; 10 | import betterquesting.api2.registry.IFactoryData; 11 | 12 | public class FactorySimpleLine implements IFactoryData { 13 | 14 | public static final FactorySimpleLine INSTANCE = new FactorySimpleLine(); 15 | 16 | private static final ResourceLocation RES_ID = new ResourceLocation("betterquesting", "line_simple"); 17 | 18 | @Override 19 | public SimpleLine loadFromData(JsonObject data) { 20 | int stippleScale = JsonHelper.GetNumber(data, "stippleScale", 1) 21 | .intValue(); 22 | short stippleMask; 23 | 24 | try { 25 | // Needs to be done through int so that the signed bit isn't dropped 26 | stippleMask = (short) Integer.parseInt(JsonHelper.GetString(data, "stippleMask", "1111111111111111"), 2); 27 | } catch (NumberFormatException ignored) { 28 | stippleMask = (short) 0xFFFF; 29 | } 30 | 31 | return new SimpleLine(stippleScale, stippleMask); 32 | } 33 | 34 | @Override 35 | public ResourceLocation getRegistryName() { 36 | return RES_ID; 37 | } 38 | 39 | @Override 40 | public SimpleLine createNew() { 41 | return new SimpleLine(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/betterquesting/api2/client/gui/panels/lists/CanvasQuestDatabase.java: -------------------------------------------------------------------------------- 1 | package betterquesting.api2.client.gui.panels.lists; 2 | 3 | import java.util.ArrayDeque; 4 | import java.util.Iterator; 5 | import java.util.Map; 6 | import java.util.UUID; 7 | 8 | import betterquesting.api.properties.NativeProps; 9 | import betterquesting.api.questing.IQuest; 10 | import betterquesting.api.utils.UuidConverter; 11 | import betterquesting.api2.client.gui.misc.IGuiRect; 12 | import betterquesting.api2.utils.QuestTranslation; 13 | import betterquesting.questing.QuestDatabase; 14 | 15 | @SuppressWarnings("WeakerAccess") 16 | public abstract class CanvasQuestDatabase extends CanvasSearch, Map.Entry> { 17 | 18 | public CanvasQuestDatabase(IGuiRect rect) { 19 | super(rect); 20 | } 21 | 22 | @Override 23 | protected Iterator> getIterator() { 24 | return QuestDatabase.INSTANCE.entrySet() 25 | .iterator(); 26 | } 27 | 28 | @Override 29 | protected void queryMatches(Map.Entry entry, String query, 30 | final ArrayDeque> results) { 31 | if (UuidConverter.encodeUuid(entry.getKey()) 32 | .toLowerCase() 33 | .contains(query) 34 | || entry.getValue() 35 | .getProperty(NativeProps.NAME) 36 | .toLowerCase() 37 | .contains(query) 38 | || QuestTranslation.translateQuestName(entry) 39 | .toLowerCase() 40 | .contains(query)) { 41 | results.add(entry); 42 | } 43 | } 44 | } 45 | --------------------------------------------------------------------------------