├── .gitattributes ├── .github └── workflows │ └── 1.18-auto-publish-release.yml ├── .gitignore ├── .gitmodules ├── CREDITS.txt ├── LICENSE.txt ├── README.md ├── build.gradle ├── changelog.txt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── src ├── generated │ └── resources │ │ └── .cache │ │ └── cache └── main │ ├── java │ └── com │ │ └── lowdragmc │ │ └── multiblocked │ │ ├── CommonProxy.java │ │ ├── MbdConfig.java │ │ ├── Multiblocked.java │ │ ├── api │ │ ├── block │ │ │ ├── BlockComponent.java │ │ │ ├── CustomProperties.java │ │ │ └── ItemComponent.java │ │ ├── capability │ │ │ ├── CommonCapabilityProxyHolder.java │ │ │ ├── GuiOnlyCapability.java │ │ │ ├── ICapabilityProxyHolder.java │ │ │ ├── IInnerCapabilityProvider.java │ │ │ ├── IO.java │ │ │ ├── MultiblockCapability.java │ │ │ ├── proxy │ │ │ │ ├── CapCapabilityProxy.java │ │ │ │ └── CapabilityProxy.java │ │ │ └── trait │ │ │ │ ├── CapabilityTrait.java │ │ │ │ ├── InterfaceUser.java │ │ │ │ ├── MultiCapabilityTrait.java │ │ │ │ ├── PlayerCapabilityTrait.java │ │ │ │ ├── ProgressCapabilityTrait.java │ │ │ │ └── SingleCapabilityTrait.java │ │ ├── definition │ │ │ ├── ComponentDefinition.java │ │ │ ├── ControllerDefinition.java │ │ │ ├── PartDefinition.java │ │ │ └── StatusProperties.java │ │ ├── gui │ │ │ ├── GuiUtils.java │ │ │ ├── blueprint_table │ │ │ │ ├── BlueprintTableWidget.java │ │ │ │ ├── ControllerBuilderWidget.java │ │ │ │ ├── PartBuilderWidget.java │ │ │ │ ├── RecipeMapBuilderWidget.java │ │ │ │ ├── RendererBuilderWidget.java │ │ │ │ ├── TemplateBuilderWidget.java │ │ │ │ └── components │ │ │ │ │ ├── ComponentWidget.java │ │ │ │ │ ├── ControllerWidget.java │ │ │ │ │ └── PartWidget.java │ │ │ ├── controller │ │ │ │ ├── IOPageWidget.java │ │ │ │ ├── PageWidget.java │ │ │ │ ├── RecipePage.java │ │ │ │ └── structure │ │ │ │ │ ├── PatternWidget.java │ │ │ │ │ └── StructurePageWidget.java │ │ │ ├── dialogs │ │ │ │ ├── IParticleWidget.java │ │ │ │ ├── IRendererWidget.java │ │ │ │ ├── IShaderWidget.java │ │ │ │ ├── IShapeWidget.java │ │ │ │ ├── ISoundWidget.java │ │ │ │ ├── JsonBlockPatternWidget.java │ │ │ │ ├── RecipeMapWidget.java │ │ │ │ └── ResourceTextureWidget.java │ │ │ ├── editor │ │ │ │ ├── MBDProject.java │ │ │ │ ├── MBDResources.java │ │ │ │ ├── RecipeResource.java │ │ │ │ └── TraitResource.java │ │ │ ├── recipe │ │ │ │ ├── ContentWidget.java │ │ │ │ ├── FuelWidget.java │ │ │ │ └── RecipeWidget.java │ │ │ └── tester │ │ │ │ ├── ControllerScriptWidget.java │ │ │ │ └── PartScriptWidget.java │ │ ├── item │ │ │ ├── ItemBlueprint.java │ │ │ └── ItemMultiblockBuilder.java │ │ ├── json │ │ │ ├── IMultiblockedRendererTypeAdapterFactory.java │ │ │ ├── RecipeMapTypeAdapter.java │ │ │ ├── RecipeTypeAdapter.java │ │ │ ├── SimplePredicateFactory.java │ │ │ └── VoxelShapAdapterFactory.java │ │ ├── kubejs │ │ │ ├── MultiblockRecipeJS.java │ │ │ ├── MultiblockedJSPlugin.java │ │ │ ├── RegistryWrapper.java │ │ │ └── events │ │ │ │ ├── CreateUIEvent.java │ │ │ │ ├── CustomShapeEvent.java │ │ │ │ ├── DropEvent.java │ │ │ │ ├── DynamicPatternEvent.java │ │ │ │ ├── InitTraitUIEvent.java │ │ │ │ ├── NeighborChangedEvent.java │ │ │ │ ├── OutputRedstoneEvent.java │ │ │ │ ├── PartAddedEvent.java │ │ │ │ ├── PartRemovedEvent.java │ │ │ │ ├── ReadInitialDataEvent.java │ │ │ │ ├── ReceiveCustomDataEvent.java │ │ │ │ ├── RecipeConverterRegisterEvent.java │ │ │ │ ├── RecipeFinishEvent.java │ │ │ │ ├── RecipeUIEvent.java │ │ │ │ ├── RightClickEvent.java │ │ │ │ ├── SearchRecipeEvent.java │ │ │ │ ├── SetupRecipeEvent.java │ │ │ │ ├── StatusChangedEvent.java │ │ │ │ ├── StructureFormedEvent.java │ │ │ │ ├── StructureInvalidEvent.java │ │ │ │ ├── UpdateFormedEvent.java │ │ │ │ ├── UpdateRendererEvent.java │ │ │ │ ├── UpdateTickEvent.java │ │ │ │ └── WriteInitialDataEvent.java │ │ ├── pattern │ │ │ ├── BlockPattern.java │ │ │ ├── FactoryBlockPattern.java │ │ │ ├── JsonBlockPattern.java │ │ │ ├── MultiblockShapeInfo.java │ │ │ ├── MultiblockState.java │ │ │ ├── Predicates.java │ │ │ ├── TraceabilityPredicate.java │ │ │ ├── error │ │ │ │ ├── PatternError.java │ │ │ │ ├── PatternStringError.java │ │ │ │ └── SinglePredicateError.java │ │ │ ├── predicates │ │ │ │ ├── PredicateAnyCapability.java │ │ │ │ ├── PredicateBlocks.java │ │ │ │ ├── PredicateComponent.java │ │ │ │ ├── PredicateCustomAny.java │ │ │ │ ├── PredicateFluids.java │ │ │ │ ├── PredicateStates.java │ │ │ │ └── SimplePredicate.java │ │ │ └── util │ │ │ │ ├── PatternMatchContext.java │ │ │ │ └── RelativeDirection.java │ │ ├── recipe │ │ │ ├── Content.java │ │ │ ├── ContentModifier.java │ │ │ ├── DynamicRecipeHandler.java │ │ │ ├── MekRecipeHelper.java │ │ │ ├── Recipe.java │ │ │ ├── RecipeBuilder.java │ │ │ ├── RecipeCondition.java │ │ │ ├── RecipeConverter.java │ │ │ ├── RecipeLogic.java │ │ │ ├── RecipeMap.java │ │ │ ├── ingredient │ │ │ │ ├── EntityIngredient.java │ │ │ │ └── SizedIngredient.java │ │ │ └── serde │ │ │ │ ├── content │ │ │ │ ├── IContentSerializer.java │ │ │ │ ├── SerializerBigInteger.java │ │ │ │ ├── SerializerDouble.java │ │ │ │ ├── SerializerFloat.java │ │ │ │ ├── SerializerFluidStack.java │ │ │ │ ├── SerializerIngredient.java │ │ │ │ ├── SerializerInteger.java │ │ │ │ └── SerializerLong.java │ │ │ │ └── recipe │ │ │ │ ├── MBDRecipeReloadListener.java │ │ │ │ ├── MBDRecipeType.java │ │ │ │ └── MultiBlockRecipe.java │ │ ├── registry │ │ │ ├── MbdCapabilities.java │ │ │ ├── MbdComponents.java │ │ │ ├── MbdItems.java │ │ │ ├── MbdPredicates.java │ │ │ ├── MbdRecipeConditions.java │ │ │ └── MbdRenderers.java │ │ ├── sound │ │ │ ├── ComponentSound.java │ │ │ └── SoundState.java │ │ └── tile │ │ │ ├── BlueprintTableTileEntity.java │ │ │ ├── ComponentTileEntity.java │ │ │ ├── ControllerTileEntity.java │ │ │ ├── ControllerTileTesterEntity.java │ │ │ ├── DummyComponentTileEntity.java │ │ │ ├── IComponent.java │ │ │ ├── IControllerComponent.java │ │ │ ├── IDynamicComponentTile.java │ │ │ └── part │ │ │ ├── IPartComponent.java │ │ │ ├── PartTileEntity.java │ │ │ └── PartTileTesterEntity.java │ │ ├── client │ │ ├── ClientProxy.java │ │ └── renderer │ │ │ ├── BlueprintRegionRenderer.java │ │ │ ├── ComponentTESR.java │ │ │ ├── IMultiblockedRenderer.java │ │ │ ├── MultiblockPreviewRenderer.java │ │ │ └── impl │ │ │ ├── CycleBlockStateRenderer.java │ │ │ ├── GTRenderer.java │ │ │ ├── GeoComponentRenderer.java │ │ │ ├── JarRenderer.java │ │ │ ├── MBDBlockStateRenderer.java │ │ │ ├── MBDIModelRenderer.java │ │ │ ├── ParticleRenderer.java │ │ │ └── PedestalRenderer.java │ │ ├── common │ │ ├── block │ │ │ └── CreateBlockComponent.java │ │ ├── capability │ │ │ ├── AuraMultiblockCapability.java │ │ │ ├── ChemicalMekanismCapability.java │ │ │ ├── CreateStressCapacityCapability.java │ │ │ ├── EMCProjectECapability.java │ │ │ ├── EntityMultiblockCapability.java │ │ │ ├── FEMultiblockCapability.java │ │ │ ├── FluidMultiblockCapability.java │ │ │ ├── HeatMekanismCapability.java │ │ │ ├── ItemDurabilityMultiblockCapability.java │ │ │ ├── ItemMultiblockCapability.java │ │ │ ├── ManaBotaniaCapability.java │ │ │ ├── PneumaticPressureCapability.java │ │ │ ├── trait │ │ │ │ ├── ChemicalCapabilityTrait.java │ │ │ │ ├── EMCPlayerCapabilityTrait.java │ │ │ │ ├── EntityCapabilityTrait.java │ │ │ │ ├── FECapabilityTrait.java │ │ │ │ ├── FluidCapabilityTrait.java │ │ │ │ ├── FuelProgressTrait.java │ │ │ │ ├── ItemCapabilityTrait.java │ │ │ │ ├── PneumaticMachineTrait.java │ │ │ │ └── RecipeProgressTrait.java │ │ │ └── widget │ │ │ │ ├── ChemicalStackWidget.java │ │ │ │ ├── EntityContentWidget.java │ │ │ │ ├── FluidContentWidget.java │ │ │ │ ├── ItemsContentWidget.java │ │ │ │ ├── NumberContentWidget.java │ │ │ │ └── PressureWidget.java │ │ ├── definition │ │ │ └── CreatePartDefinition.java │ │ ├── gui │ │ │ └── component │ │ │ │ └── CreatePartWidget.java │ │ ├── recipe │ │ │ └── conditions │ │ │ │ ├── BiomeCondition.java │ │ │ │ ├── BlockCondition.java │ │ │ │ ├── DimensionCondition.java │ │ │ │ ├── PositionYCondition.java │ │ │ │ ├── PredicateCondition.java │ │ │ │ ├── RainingCondition.java │ │ │ │ └── ThunderCondition.java │ │ └── tile │ │ │ ├── CreateKineticSourceTileEntity.java │ │ │ ├── JarTileEntity.java │ │ │ └── PedestalTileEntity.java │ │ ├── core │ │ ├── core │ │ │ └── DynamicTileEntityGenerator.java │ │ └── mixins │ │ │ ├── BlockMixin.java │ │ │ ├── ChunkMixin.java │ │ │ ├── NBTIngredientMixin.java │ │ │ ├── RecipeManagerMixin.java │ │ │ ├── ReloadMixin.java │ │ │ ├── RenderChunkMixin.java │ │ │ ├── ServerChunkProviderMixin.java │ │ │ ├── TileEntityRendererDispatcherMixin.java │ │ │ ├── WorldMixin.java │ │ │ └── rubidium │ │ │ ├── BlockOcclusionCacheMixin.java │ │ │ └── ChunkRenderRebuildTaskMixin.java │ │ ├── events │ │ ├── ClientListeners.java │ │ └── CommonListeners.java │ │ ├── jei │ │ ├── JEIPlugin.java │ │ ├── multipage │ │ │ ├── MultiblockInfoCategory.java │ │ │ └── MultiblockInfoWrapper.java │ │ └── recipepage │ │ │ ├── FuelWrapper.java │ │ │ ├── RecipeMapCategory.java │ │ │ ├── RecipeMapFuelCategory.java │ │ │ └── RecipeWrapper.java │ │ ├── network │ │ ├── MultiblockedNetworking.java │ │ └── s2c │ │ │ ├── SPacketCommand.java │ │ │ └── SPacketRemoveDisabledRendering.java │ │ ├── persistence │ │ ├── IAsyncThreadUpdate.java │ │ └── MultiblockWorldSavedData.java │ │ └── rei │ │ ├── REIClientPlugin.java │ │ ├── multipage │ │ ├── MultiblockInfoDisplay.java │ │ └── MultiblockInfoDisplayCategory.java │ │ └── recipepage │ │ ├── FuelDisplay.java │ │ ├── RecipeDisplay.java │ │ ├── RecipeMapDisplayCategory.java │ │ └── RecipeMapFuelDisplayCategory.java │ └── resources │ ├── META-INF │ └── mods.toml │ ├── assets │ └── multiblocked │ │ ├── blockstates │ │ └── test_block.json │ │ ├── definition │ │ └── part │ │ │ ├── create │ │ │ ├── mbd_create_input.json │ │ │ └── mbd_create_output.json │ │ │ ├── mbd_energy_input.json │ │ │ ├── mbd_energy_output.json │ │ │ ├── mbd_entity.json │ │ │ ├── mbd_fluid_input.json │ │ │ ├── mbd_fluid_output.json │ │ │ ├── mbd_item_input.json │ │ │ └── mbd_item_output.json │ │ ├── lang │ │ ├── en_us.json │ │ ├── ru_ru.json │ │ └── zh_cn.json │ │ ├── models │ │ ├── block │ │ │ ├── blueprint_table.json │ │ │ ├── blueprint_table_controller.json │ │ │ ├── blueprint_table_formed.json │ │ │ ├── controller_tester.json │ │ │ ├── cube_2_layer.json │ │ │ ├── jar.json │ │ │ ├── part_tester.json │ │ │ └── pedestal.json │ │ └── item │ │ │ ├── blueprint.json │ │ │ ├── blueprint_pattern.json │ │ │ ├── multiblock_builder.json │ │ │ └── multiblock_builder_pattern.json │ │ ├── shaders │ │ ├── fbm.fsh │ │ └── start.fsh │ │ └── textures │ │ ├── blocks │ │ ├── blueprint_table.png │ │ ├── casing │ │ │ ├── base.png │ │ │ └── create.png │ │ ├── gregtech_base.png │ │ ├── gregtech_front.png │ │ ├── jar.png │ │ ├── overlay │ │ │ ├── overlay_energy_in.png │ │ │ ├── overlay_energy_out.png │ │ │ ├── overlay_entity.png │ │ │ ├── overlay_fluid_in.png │ │ │ ├── overlay_fluid_out.png │ │ │ ├── overlay_item_in.png │ │ │ └── overlay_item_out.png │ │ └── pedestal.png │ │ ├── fx │ │ ├── fx.png │ │ ├── laser.png │ │ └── laser_start.png │ │ ├── gui │ │ ├── add.png │ │ ├── axis.png │ │ ├── bar.png │ │ ├── blueprint_page.png │ │ ├── blueprint_table.png │ │ ├── boolean.png │ │ ├── bordered_background.png │ │ ├── bordered_background_blue.png │ │ ├── button_common.png │ │ ├── button_view.png │ │ ├── button_wood.png │ │ ├── component.png │ │ ├── condition_biome.png │ │ ├── condition_block.png │ │ ├── condition_dimension.png │ │ ├── condition_pos_y.png │ │ ├── condition_predicate.png │ │ ├── condition_rain.png │ │ ├── condition_thunder.png │ │ ├── copy.png │ │ ├── ct_loader_page.png │ │ ├── custom_gui.png │ │ ├── custom_gui_tab_button.png │ │ ├── darkened_slot.png │ │ ├── down.png │ │ ├── energy_bar.png │ │ ├── fluid_hatch_gui.png │ │ ├── io_page.png │ │ ├── item_bus_gui.png │ │ ├── json_block_pattern.png │ │ ├── json_loader_page.png │ │ ├── move_down.png │ │ ├── option.png │ │ ├── predicate_selector_bar.png │ │ ├── pretty.png │ │ ├── pretty_active.png │ │ ├── progress_bar_arrow.png │ │ ├── progress_bar_fuel.png │ │ ├── recipe_page.png │ │ ├── remove.png │ │ ├── repeat.png │ │ ├── save.png │ │ ├── structure_page.png │ │ ├── switch_common.png │ │ ├── tab_pattern.png │ │ ├── tab_predicate.png │ │ ├── tab_text_field.png │ │ ├── up.png │ │ └── wiki.png │ │ ├── items │ │ ├── blueprint.png │ │ ├── blueprint_pattern.png │ │ ├── multiblock_builder.png │ │ └── multiblock_builder_pattern.png │ │ └── void.png │ ├── icon.png │ ├── kubejs.plugins.txt │ ├── multiblocked.mixins.json │ └── pack.mcmeta └── version.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Disable autocrlf on generated files, they always generate with LF 2 | # Add any extra files or paths here to make git stop saying they 3 | # are changed when only line endings change. 4 | src/generated/**/.cache/cache text eol=lf 5 | src/generated/**/*.json text eol=lf 6 | -------------------------------------------------------------------------------- /.github/workflows/1.18-auto-publish-release.yml: -------------------------------------------------------------------------------- 1 | name: 1.18 Auto Build Release Publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'exp-1.18' 7 | paths: 8 | - 'version.gradle' 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | env: 14 | MAVEN_PASS: ${{ secrets.MAVEN_PASS }} 15 | MAVEN_USER: ${{ secrets.MAVEN_USER }} 16 | steps: 17 | - uses: actions/checkout@v3 18 | with: 19 | submodules: true 20 | 21 | - uses: actions/setup-java@v3 22 | with: 23 | java-version: '17' 24 | distribution: 'adopt' 25 | 26 | - name: Validate Gradle wrapper 27 | uses: gradle/wrapper-validation-action@v1 28 | 29 | - name: Grant execute permission for gradlew 30 | run: chmod +x gradlew 31 | 32 | - name: Gradle Build Action 33 | uses: gradle/gradle-build-action@v2.4.2 34 | with: 35 | arguments: build publish 36 | 37 | - name: Get file name 38 | id: var 39 | run: | 40 | MESSAGE=$(ls build/libs/* | grep sources.jar -v) 41 | echo file_path=$MESSAGE >> $GITHUB_OUTPUT 42 | 43 | - name: Upload to CurseForge 44 | uses: itsmeow/curseforge-upload@v3 45 | with: 46 | token: ${{ secrets.CURSEFORGE_TOKEN }} 47 | project_id: 604054 48 | game_endpoint: minecraft 49 | file_path: ${{ steps.var.outputs.file_path }} 50 | changelog: See recent commits [here](https://github.com/Low-Drag-MC/Multiblocked/commits/${{ github.sha }}). This is only marked as a beta release so CurseForge shows it on the front page. 51 | changelog_type: markdown 52 | # 1.12.2, Java 8 53 | game_versions: "Minecraft 1.18:1.18.2,Java 17,Forge" 54 | release_type: release 55 | relations: ldlib:requiredDependency,geckolib:optionalDependency,jei:optionalDependency,roughly-enough-items:optionalDependency 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | 20 | # other 21 | eclipse 22 | run 23 | 24 | # Files from Forge MDK 25 | forge*changelog.txt 26 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "LDLib"] 2 | path = LDLib 3 | url = https://github.com/Low-Drag-MC/LDLib 4 | branch = 1.18 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multiblocked 2 | 3 | **Multiblocked (mbd) is an extremely flexible yet vanilla-esque multiblock mod, that embraces aspects of MultiblockTweaker and Modular Machinery.** 4 | 5 | The goal was to make it as easy as possible for modpack/mod authors to create multiblocks to interacte IO from other mods, and provide as much detail control as possible. Mbd is essentially both a tweaker mod and a library mod that provides rendering and logic APIs. 6 | 7 | #### Other versions: [1.12.2](https://github.com/CleanroomMC/Multiblocked) 8 | 9 | ------ 10 | 11 | #### Features: 12 | 13 | 1. Mbd deals with all IO capability in **proxy**. This means we don't need to create specific `XXXHatch` for capabilities. For example, item input can be a chest, a furnace, or other container which items can be extracted. Besides, you could also specify a specific block or capability, mbd only care about the IO and not the interaction of the block itself. 14 | 15 | 2. We noticed that modpack authors struggled with script writing when creating multiblocks and adding recipes. We designed a **visual editor** to help users create multiblocks intuitively and interactively. You can create multiblocks, recipes, and configure their details without writing any scripts. 16 | 17 | 3. Provides modpack authors with **extensive function interfaces**, mbd exposed nearly everything via CT. For example, update logic, data sync, custom recipe logic, and so on. 18 | 19 | 4. Provides a wide variety of rendering techniques, **allowing you to create a wide variety of renderers without using Java or even ct script**. You can easily use mbd to create multiblock like gregtech style (**dynamically extensible structure**), IE style (**dynamic model**), thaumcraft style (**animation model**). Currently supported renderers: BlockState, Java Model, OBJ, B3D, Gregtech Model, Geo, Particle. Renderers are extensible, and you can register your renderer with Java. 20 | 21 | We are compatible with **Geckolib** to use render bedrock animate models. 22 | 23 | 5. Take advantage of async threads for incredible performance, 20tps forever. -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | org.gradle.daemon=false 5 | 6 | mappings_version=2022.09.04-1.18.2 7 | mod_name=Multiblocked 8 | 9 | minecraft_version=1.18.2 10 | forge_version=40.2.4 11 | 12 | jei_version=10.1.4.263 13 | rei_version=8.3.549 14 | architectury_version=4.7.78 15 | cloth_config_version=6.2.57 16 | ldlib_version=1.18.2:0.1 17 | rhino_version=1802.2.1-build.248 18 | kubejs_version=1802.5.5-build.569 19 | 20 | enable_mixin_debug = true 21 | 22 | # 23 | #systemProp.http.proxyHost=127.0.0.1 24 | #systemProp.http.proxyPort=1081 25 | #systemProp.https.proxyHost=127.0.0.1 26 | #systemProp.https.proxyPort=1081 27 | #systemProp.socks.proxyHost=127.0.0.1 28 | #systemProp.socks.proxyPort=1081 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | def folder = new File( 'LDLib' ) 2 | if(folder.exists() ) { 3 | include 'LDLib' 4 | project(':LDLib').setProjectDir(new File("LDLib")) 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/generated/resources/.cache/cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/generated/resources/.cache/cache -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/MbdConfig.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked; 2 | 3 | import net.minecraftforge.common.ForgeConfigSpec; 4 | import net.minecraftforge.fml.ModLoadingContext; 5 | import net.minecraftforge.fml.config.ModConfig; 6 | 7 | /** 8 | * @author KilaBash 9 | * @date 2022/06/22 10 | * @implNote MbdConfig 11 | */ 12 | public class MbdConfig { 13 | public static ForgeConfigSpec.IntValue naturesAura; 14 | 15 | public static void registerConfig(){ 16 | ForgeConfigSpec.Builder commonBuilder = new ForgeConfigSpec.Builder(); 17 | registerCommonConfig(commonBuilder); 18 | ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, commonBuilder.build()); 19 | } 20 | 21 | private static void registerCommonConfig(ForgeConfigSpec.Builder builder){ 22 | naturesAura = builder.comment( 23 | "set the radius of aura value consumption.", 24 | "Default: 20") 25 | .defineInRange("Natures Aura Radius",20,1,64); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/block/ItemComponent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.block; 2 | 3 | import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; 4 | import com.lowdragmc.lowdraglib.client.renderer.IRenderer; 5 | import com.lowdragmc.multiblocked.api.definition.ComponentDefinition; 6 | import net.minecraft.network.chat.Component; 7 | import net.minecraft.world.item.BlockItem; 8 | import net.minecraft.world.item.ItemStack; 9 | import net.minecraft.world.item.TooltipFlag; 10 | import net.minecraft.world.level.Level; 11 | 12 | import javax.annotation.Nonnull; 13 | import javax.annotation.Nullable; 14 | import javax.annotation.ParametersAreNonnullByDefault; 15 | import java.util.List; 16 | 17 | /** 18 | * Author: KilaBash 19 | * Date: 2022/04/23 20 | * Description: 21 | */ 22 | @ParametersAreNonnullByDefault 23 | public class ItemComponent extends BlockItem implements IItemRendererProvider { 24 | 25 | public ItemComponent(BlockComponent block) { 26 | super(block, block.definition.getItemProperties()); 27 | setRegistryName(block.definition.location); 28 | } 29 | 30 | public ComponentDefinition getDefinition() { 31 | return ((BlockComponent)getBlock()).definition; 32 | } 33 | 34 | @Nullable 35 | @Override 36 | public String getCreatorModId(@Nonnull ItemStack itemStack) { 37 | return getDefinition().location.getNamespace(); 38 | } 39 | 40 | @Override 41 | public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List pTooltip, TooltipFlag pFlag) { 42 | super.appendHoverText(pStack, pLevel, pTooltip, pFlag); 43 | } 44 | 45 | @Nonnull 46 | @Override 47 | public IRenderer getRenderer(ItemStack stack) { 48 | IRenderer renderer = getDefinition().getBaseRenderer(); 49 | return renderer == null ? IRenderer.EMPTY : renderer; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/CommonCapabilityProxyHolder.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability; 2 | 3 | import com.google.common.collect.Table; 4 | import com.google.common.collect.Tables; 5 | import com.lowdragmc.multiblocked.api.capability.proxy.CapabilityProxy; 6 | import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; 7 | import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; 8 | import net.minecraft.world.level.block.entity.BlockEntity; 9 | import net.minecraft.core.BlockPos; 10 | import net.minecraft.world.level.Level; 11 | 12 | import java.util.EnumMap; 13 | 14 | public class CommonCapabilityProxyHolder implements ICapabilityProxyHolder{ 15 | protected Table, Long2ObjectOpenHashMap>> capabilities; 16 | 17 | public CommonCapabilityProxyHolder(Level world, BlockPos pos, MultiblockCapability... capability) { 18 | BlockEntity te = world.getBlockEntity(pos); 19 | if (te != null) { 20 | capabilities = Tables.newCustomTable(new EnumMap<>(IO.class), Object2ObjectOpenHashMap::new); 21 | for (MultiblockCapability cap : capability) { 22 | if (cap.isBlockHasCapability(IO.BOTH, te)) { 23 | capabilities.put(IO.BOTH, cap, new Long2ObjectOpenHashMap<>()); 24 | capabilities.get(IO.BOTH, cap).put(te.getBlockPos().asLong(), cap.createProxy(IO.BOTH, te)); 25 | continue; 26 | } 27 | if (cap.isBlockHasCapability(IO.IN, te)) { 28 | capabilities.put(IO.IN, cap, new Long2ObjectOpenHashMap<>()); 29 | capabilities.get(IO.IN, cap).put(te.getBlockPos().asLong(), cap.createProxy(IO.IN, te)); 30 | } else if (cap.isBlockHasCapability(IO.OUT, te)) { 31 | capabilities.put(IO.OUT, cap, new Long2ObjectOpenHashMap<>()); 32 | capabilities.get(IO.OUT, cap).put(te.getBlockPos().asLong(), cap.createProxy(IO.OUT, te)); 33 | } 34 | } 35 | } 36 | } 37 | 38 | public CommonCapabilityProxyHolder(Table, Long2ObjectOpenHashMap>> capabilities) { 39 | this.capabilities = capabilities; 40 | } 41 | 42 | public ICapabilityProxyHolder mergeWith(ICapabilityProxyHolder capabilityProxyHolder) { 43 | if (hasProxies() && capabilityProxyHolder.hasProxies()) { 44 | Table, Long2ObjectOpenHashMap>> capabilities = Tables.newCustomTable(new EnumMap<>(IO.class), Object2ObjectOpenHashMap::new); 45 | capabilities.putAll(capabilities); 46 | capabilities.putAll(capabilityProxyHolder.getCapabilitiesProxy()); 47 | return new CommonCapabilityProxyHolder(capabilities); 48 | } else { 49 | return hasProxies() ? this : capabilityProxyHolder; 50 | } 51 | } 52 | 53 | @Override 54 | public Table, Long2ObjectOpenHashMap>> getCapabilitiesProxy() { 55 | return capabilities; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/GuiOnlyCapability.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability; 2 | 3 | import com.lowdragmc.lowdraglib.utils.BlockInfo; 4 | import com.lowdragmc.multiblocked.api.capability.proxy.CapabilityProxy; 5 | import com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait; 6 | import com.lowdragmc.multiblocked.api.recipe.serde.content.SerializerDouble; 7 | import net.minecraft.world.level.block.entity.BlockEntity; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | import java.util.function.Function; 11 | 12 | /** 13 | * @author KilaBash 14 | * @date 2022/11/29 15 | * @implNote GuiOnlyCapability 16 | */ 17 | public class GuiOnlyCapability extends MultiblockCapability { 18 | Function, CapabilityTrait> supplier; 19 | 20 | public GuiOnlyCapability(String name, Function, CapabilityTrait> supplier) { 21 | super(name, 0xffafafaf, SerializerDouble.INSTANCE); 22 | this.supplier = supplier; 23 | } 24 | 25 | @Override 26 | public Double defaultContent() { 27 | return 0d; 28 | } 29 | 30 | @Override 31 | public boolean isBlockHasCapability(@NotNull IO io, @NotNull BlockEntity tileEntity) { 32 | return false; 33 | } 34 | 35 | @Override 36 | public Double copyInner(Double content) { 37 | return 0d; 38 | } 39 | 40 | @Override 41 | protected CapabilityProxy createProxy(@NotNull IO io, @NotNull BlockEntity tileEntity) { 42 | return null; 43 | } 44 | 45 | @Override 46 | public BlockInfo[] getCandidates() { 47 | return new BlockInfo[0]; 48 | } 49 | 50 | @Override 51 | public boolean hasTrait() { 52 | return true; 53 | } 54 | 55 | @Override 56 | public CapabilityTrait createTrait() { 57 | return supplier.apply(this); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/ICapabilityProxyHolder.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability; 2 | 3 | import com.google.common.collect.Table; 4 | import com.lowdragmc.multiblocked.api.capability.proxy.CapabilityProxy; 5 | import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; 6 | import net.minecraft.core.BlockPos; 7 | import net.minecraft.world.level.Level; 8 | 9 | import javax.annotation.Nullable; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | 14 | public interface ICapabilityProxyHolder { 15 | 16 | default boolean hasProxies() { 17 | return getCapabilitiesProxy() != null && !getCapabilitiesProxy().isEmpty(); 18 | } 19 | 20 | default boolean hasProxy(IO io, MultiblockCapability capability) { 21 | return hasProxies() && getCapabilitiesProxy().contains(io, capability); 22 | } 23 | 24 | default ICapabilityProxyHolder mergeWith(ICapabilityProxyHolder otherHolder) { 25 | return new CommonCapabilityProxyHolder(getCapabilitiesProxy()).mergeWith(otherHolder); 26 | } 27 | 28 | @Nullable 29 | Table, Long2ObjectOpenHashMap>> getCapabilitiesProxy(); 30 | 31 | default Map> getProxies(IO io, MultiblockCapability capability){ 32 | Long2ObjectOpenHashMap> map = getCapabilitiesProxy().get(io, capability); 33 | Map> result = new HashMap<>(); 34 | if (map != null) { 35 | map.forEach((p, p2) -> result.put(BlockPos.of(p), p2)); 36 | } 37 | return result; 38 | } 39 | 40 | static ICapabilityProxyHolder fromWorldPos(Level world, BlockPos pos, MultiblockCapability... capabilities) { 41 | return new CommonCapabilityProxyHolder(world, pos, capabilities); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/IInnerCapabilityProvider.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability; 2 | 3 | import net.minecraft.core.Direction; 4 | import net.minecraftforge.common.capabilities.Capability; 5 | import net.minecraftforge.common.capabilities.ICapabilityProvider; 6 | import net.minecraftforge.common.util.LazyOptional; 7 | 8 | import javax.annotation.Nonnull; 9 | import javax.annotation.Nullable; 10 | import java.util.Set; 11 | 12 | public interface IInnerCapabilityProvider extends ICapabilityProvider { 13 | 14 | /** 15 | * inner capability used for recipe logic handling with slotName. 16 | */ 17 | default LazyOptional getInnerRecipeCapability(@Nonnull Capability capability, @Nullable Direction facing, @Nullable String slotName) { 18 | return getCapability(capability, facing); 19 | } 20 | 21 | /** 22 | * inner capability used for recipe logic handling with slotName. 23 | */ 24 | default LazyOptional getInnerGuiCapability(@Nonnull Capability capability, @Nullable Direction facing) { 25 | return getCapability(capability, facing); 26 | } 27 | 28 | /** 29 | * additional slot names 30 | */ 31 | default Set getSlotNames() { 32 | return Set.of(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/IO.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability; 2 | 3 | /** 4 | * The capability can be input or output or both 5 | */ 6 | public enum IO { 7 | IN, 8 | OUT, 9 | BOTH, 10 | NONE; 11 | 12 | public static final IO[] VALUES = IO.values(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/proxy/CapCapabilityProxy.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability.proxy; 2 | 3 | import com.lowdragmc.multiblocked.api.capability.MultiblockCapability; 4 | import net.minecraft.world.level.block.entity.BlockEntity; 5 | import net.minecraftforge.common.capabilities.Capability; 6 | 7 | import javax.annotation.Nullable; 8 | import java.util.Objects; 9 | 10 | /** 11 | * The Proxy of a Capability {@link Capability} 12 | */ 13 | public abstract class CapCapabilityProxy extends CapabilityProxy{ 14 | public final Capability CAP; 15 | 16 | public CapCapabilityProxy(MultiblockCapability capability, BlockEntity tileEntity, Capability cap) { 17 | super(capability, tileEntity); 18 | CAP = cap; 19 | } 20 | 21 | public C getCapability(@Nullable String slotName) { 22 | return super.getCapability(CAP, slotName); 23 | } 24 | 25 | public C getGuiCapability() { 26 | return super.getGuiCapability(CAP); 27 | } 28 | 29 | @Override 30 | public boolean equals(Object obj) { 31 | return obj instanceof CapCapabilityProxy && Objects.equals(getCapability(null), ((CapCapabilityProxy) obj).getCapability(null)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/capability/trait/InterfaceUser.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.capability.trait; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Mark a {@link CapabilityTrait} that the target mod requires tile entities to implement its interface to use its system. 10 | * 11 | * @author youyihj 12 | */ 13 | @Target(ElementType.TYPE) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface InterfaceUser { 16 | /** 17 | * The interface that the target mod requires to implement. The trait should implement the interface. 18 | */ 19 | Class value(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/definition/PartDefinition.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.definition; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.part.IPartComponent; 4 | import com.lowdragmc.multiblocked.api.tile.part.PartTileEntity; 5 | import net.minecraft.resources.ResourceLocation; 6 | import com.google.gson.JsonObject; 7 | import net.minecraft.util.GsonHelper; 8 | 9 | 10 | public class PartDefinition extends ComponentDefinition { 11 | 12 | public boolean canShared = true; 13 | 14 | public PartDefinition(ResourceLocation location, Class clazz) { 15 | super(location, clazz); 16 | } 17 | 18 | public PartDefinition(ResourceLocation location) { 19 | this(location, PartTileEntity.PartSimpleTileEntity.class); 20 | } 21 | 22 | @Override 23 | public void fromJson(JsonObject json) { 24 | super.fromJson(json); 25 | canShared = GsonHelper.getAsBoolean(json, "canShared", canShared); 26 | } 27 | 28 | @Override 29 | public JsonObject toJson(JsonObject json) { 30 | json = super.toJson(json); 31 | json.addProperty("canShared", canShared); 32 | return json; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/blueprint_table/RendererBuilderWidget.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.blueprint_table; 2 | 3 | import com.lowdragmc.lowdraglib.gui.modular.ModularUI; 4 | import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; 5 | import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 6 | import com.lowdragmc.lowdraglib.gui.texture.ShaderTexture; 7 | import com.lowdragmc.lowdraglib.gui.util.ClickData; 8 | import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget; 9 | import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; 10 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 11 | import com.lowdragmc.multiblocked.Multiblocked; 12 | import com.lowdragmc.multiblocked.api.gui.dialogs.IRendererWidget; 13 | import com.lowdragmc.multiblocked.api.gui.dialogs.IShaderWidget; 14 | import net.minecraft.resources.ResourceLocation; 15 | import net.minecraft.world.level.block.Blocks; 16 | import net.minecraft.world.item.ItemStack; 17 | 18 | public class RendererBuilderWidget extends WidgetGroup { 19 | public final ShaderTexture shaderTexture; 20 | 21 | public RendererBuilderWidget() { 22 | super(0, 0, 384, 256); 23 | setClientSideWidget(); 24 | this.addWidget(0, new ImageWidget(0, 0, getSize().width, getSize().height, new ResourceTexture("multiblocked:textures/gui/blueprint_page.png"))); 25 | this.addWidget(new ButtonWidget(40, 40, 40, 40, new ItemStackTexture(new ItemStack(Blocks.BEACON)), this::renderer).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.builder.renderer.irenderer")); 26 | // this.addWidget(new ButtonWidget(90, 40, 40, 40, new ResourceTexture("multiblocked:textures/fx/fx.png"), this::particle).setHoverBorderTexture(1, -1).setHoverTooltip("multiblocked.gui.builder.renderer.particle")); 27 | this.addWidget(new ButtonWidget(140, 40, 40, 40, shaderTexture = ShaderTexture.createShader(new ResourceLocation(Multiblocked.MODID, "fbm")), this::shader).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.builder.renderer.shader")); 28 | } 29 | 30 | private void shader(ClickData clickData) { 31 | new IShaderWidget(this, shaderTexture.getRawShader()); 32 | } 33 | // 34 | // private void particle(ClickData clickData) { 35 | // new IParticleWidget(this); 36 | // } 37 | 38 | private void renderer(ClickData clickData) { 39 | new IRendererWidget(this, null, null); 40 | } 41 | 42 | @Override 43 | public void setGui(ModularUI gui) { 44 | super.setGui(gui); 45 | if (gui == null && shaderTexture != null) { 46 | shaderTexture.dispose(); 47 | } 48 | if (gui != null && shaderTexture != null) { 49 | gui.registerCloseListener(shaderTexture::dispose); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/blueprint_table/components/PartWidget.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.blueprint_table.components; 2 | 3 | import com.google.gson.JsonObject; 4 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 5 | import com.lowdragmc.multiblocked.api.definition.PartDefinition; 6 | import com.lowdragmc.multiblocked.api.gui.GuiUtils; 7 | 8 | import java.util.function.Consumer; 9 | 10 | public class PartWidget extends ComponentWidget{ 11 | 12 | public PartWidget(WidgetGroup group, PartDefinition definition, Consumer onSave) { 13 | super(group, definition, onSave); 14 | int x = 47; 15 | S1.addWidget(GuiUtils.createBoolSwitch(x + 100, 150, "canShared", "multiblocked.gui.widget.part.shared", definition.canShared, r -> definition.canShared = r)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/controller/PageWidget.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.controller; 2 | 3 | 4 | import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 5 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 6 | import com.lowdragmc.lowdraglib.gui.widget.TabButton; 7 | import com.lowdragmc.lowdraglib.gui.widget.TabContainer; 8 | 9 | public abstract class PageWidget extends WidgetGroup { 10 | protected final ResourceTexture page; 11 | 12 | public PageWidget(ResourceTexture page, TabContainer tabContainer) { 13 | super(20, 0, 176, 256); 14 | this.page = page; 15 | setBackground(page.getSubTexture(0, 0, 176 / 256.0, 1)); 16 | tabContainer.addTab(new TabButton(0, tabContainer.containerGroup.widgets.size() * 20, 20, 20) 17 | .setTexture(page.getSubTexture(176 / 256.0, 216 / 256.0, 20 / 256.0, 20 / 256.0), 18 | page.getSubTexture(176 / 256.0, 236 / 256.0, 20 / 256.0, 20 / 256.0)), 19 | this); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/controller/structure/StructurePageWidget.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.controller.structure; 2 | 3 | import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 4 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 5 | import com.lowdragmc.lowdraglib.gui.widget.TabButton; 6 | import com.lowdragmc.lowdraglib.gui.widget.TabContainer; 7 | import com.lowdragmc.multiblocked.api.definition.ControllerDefinition; 8 | import net.minecraftforge.api.distmarker.Dist; 9 | import net.minecraftforge.api.distmarker.OnlyIn; 10 | 11 | public class StructurePageWidget extends WidgetGroup { 12 | 13 | public StructurePageWidget(ControllerDefinition controllerDefinition, TabContainer tabContainer) { 14 | super(20, 0, 176, 256); 15 | ResourceTexture page = new ResourceTexture("multiblocked:textures/gui/structure_page.png"); 16 | tabContainer.addTab(new TabButton(0, tabContainer.widgets.size() * 10, 20, 20) 17 | .setTexture(page.getSubTexture(202 / 256.0, 0 / 256.0, 20 / 256.0, 20 / 256.0), 18 | page.getSubTexture(202 / 256.0, 20 / 256.0, 20 / 256.0, 20 / 256.0)), 19 | this); 20 | setClientSideWidget(); 21 | if (isRemote()) { 22 | addWidget(getPatternWidget(controllerDefinition)); 23 | } 24 | } 25 | 26 | @OnlyIn(Dist.CLIENT) 27 | public WidgetGroup getPatternWidget(ControllerDefinition controllerDefinition) { 28 | if (isRemote()) { 29 | return PatternWidget.getPatternWidget(controllerDefinition); 30 | } 31 | return null; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/editor/MBDProject.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.editor; 2 | 3 | import com.lowdragmc.lowdraglib.gui.editor.annotation.RegisterUI; 4 | import com.lowdragmc.lowdraglib.gui.editor.data.Project; 5 | import com.lowdragmc.lowdraglib.gui.editor.data.UIProject; 6 | import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; 7 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 8 | import net.minecraft.nbt.CompoundTag; 9 | import net.minecraft.nbt.NbtIo; 10 | 11 | import java.io.File; 12 | import java.io.IOException; 13 | 14 | /** 15 | * @author KilaBash 16 | * @date 2022/12/10 17 | * @implNote MBDProject 18 | */ 19 | @RegisterUI(name = "mbdui", group = "project") 20 | public class MBDProject extends UIProject { 21 | 22 | private MBDProject() { 23 | this(null, null); 24 | } 25 | 26 | public MBDProject(MBDResources resources, WidgetGroup root) { 27 | super(resources, root); 28 | } 29 | 30 | public MBDProject(CompoundTag tag) { 31 | super(tag); 32 | } 33 | 34 | public MBDProject newEmptyProject() { 35 | return new MBDProject(MBDResources.defaultResource(), 36 | (WidgetGroup) new WidgetGroup(30, 30, 200, 200).setBackground(ResourceBorderTexture.BORDERED_BACKGROUND)); 37 | } 38 | 39 | @Override 40 | public Project loadProject(File file) { 41 | try { 42 | var tag = NbtIo.read(file); 43 | if (tag != null) { 44 | return new MBDProject(tag); 45 | } 46 | } catch (IOException ignored) {} 47 | return null; 48 | } 49 | 50 | @Override 51 | public MBDResources loadResources(CompoundTag tag) { 52 | return MBDResources.fromNBT(tag); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/gui/editor/MBDResources.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.gui.editor; 2 | 3 | import com.lowdragmc.lowdraglib.gui.editor.data.Resources; 4 | import com.lowdragmc.lowdraglib.gui.editor.data.resource.Resource; 5 | import net.minecraft.nbt.CompoundTag; 6 | 7 | /** 8 | * @author KilaBash 9 | * @date 2022/12/11 10 | * @implNote MBDResources 11 | */ 12 | public class MBDResources extends Resources { 13 | protected MBDResources() { 14 | resources.put(TraitResource.RESOURCE_NAME, new TraitResource()); 15 | resources.put(RecipeResource.RESOURCE_NAME, new RecipeResource()); 16 | } 17 | 18 | public static MBDResources fromNBT(CompoundTag tag) { 19 | var resource = new MBDResources(); 20 | resource.deserializeNBT(tag); 21 | return resource; 22 | } 23 | 24 | public static MBDResources defaultResource() { // default 25 | MBDResources resources = new MBDResources(); 26 | resources.resources.values().forEach(Resource::buildDefault); 27 | return resources; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/json/RecipeMapTypeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.json; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonDeserializationContext; 5 | import com.google.gson.JsonDeserializer; 6 | import com.google.gson.JsonElement; 7 | import com.google.gson.JsonObject; 8 | import com.google.gson.JsonParseException; 9 | import com.google.gson.JsonSerializationContext; 10 | import com.google.gson.JsonSerializer; 11 | import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 12 | import com.lowdragmc.multiblocked.Multiblocked; 13 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 14 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 15 | import net.minecraft.nbt.NbtIo; 16 | import net.minecraft.util.GsonHelper; 17 | 18 | import java.io.File; 19 | import java.io.IOException; 20 | import java.lang.reflect.Type; 21 | 22 | public class RecipeMapTypeAdapter implements JsonSerializer, 23 | JsonDeserializer { 24 | public static final RecipeMapTypeAdapter INSTANCE = new RecipeMapTypeAdapter(); 25 | 26 | @Override 27 | public RecipeMap deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { 28 | JsonObject json = (JsonObject) jsonElement; 29 | RecipeMap recipeMap = new RecipeMap(json.get("name").getAsString()); 30 | recipeMap.progressTexture = new ResourceTexture(json.get("progressTexture").getAsString()); 31 | recipeMap.fuelTexture = new ResourceTexture(GsonHelper.getAsString(json, "fuelTexture", recipeMap.fuelTexture.imageLocation.toString())); 32 | for (JsonElement recipe : json.get("recipes").getAsJsonArray()) { 33 | recipeMap.addRecipe(Multiblocked.GSON.fromJson(recipe, Recipe.class)); 34 | } 35 | if (json.has("fuelRecipes")) { 36 | for (JsonElement recipe : json.get("fuelRecipes").getAsJsonArray()) { 37 | recipeMap.addFuelRecipe(Multiblocked.GSON.fromJson(recipe, Recipe.class)); 38 | } 39 | } 40 | recipeMap.uiLocation = GsonHelper.getAsString(json, "ui", ""); 41 | return recipeMap; 42 | } 43 | 44 | @Override 45 | public JsonElement serialize(RecipeMap recipeMap, Type type, JsonSerializationContext jsonSerializationContext) { 46 | JsonObject json = new JsonObject(); 47 | json.addProperty("name", recipeMap.name); 48 | json.addProperty("progressTexture", recipeMap.progressTexture.imageLocation.toString()); 49 | json.addProperty("fuelTexture", recipeMap.fuelTexture.imageLocation.toString()); 50 | JsonArray recipes = new JsonArray(); 51 | recipeMap.recipes.values().forEach(v -> recipes.add(Multiblocked.GSON.toJsonTree(v))); 52 | json.add("recipes", recipes); 53 | if (recipeMap.isFuelRecipeMap()) { 54 | json.add("fuelRecipes", Multiblocked.GSON.toJsonTree(recipeMap.fuelRecipes)); 55 | } 56 | if (recipeMap.uiLocation != null && !recipeMap.uiLocation.isEmpty()) { 57 | json.addProperty("ui", recipeMap.uiLocation); 58 | } 59 | return json; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/json/SimplePredicateFactory.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.json; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonNull; 6 | import com.google.gson.JsonObject; 7 | import com.google.gson.TypeAdapter; 8 | import com.google.gson.TypeAdapterFactory; 9 | import com.google.gson.reflect.TypeToken; 10 | import com.google.gson.stream.JsonReader; 11 | import com.google.gson.stream.JsonWriter; 12 | import com.lowdragmc.multiblocked.api.pattern.predicates.SimplePredicate; 13 | import com.lowdragmc.multiblocked.api.registry.MbdPredicates; 14 | 15 | public class SimplePredicateFactory implements TypeAdapterFactory { 16 | public static final SimplePredicateFactory INSTANCE = new SimplePredicateFactory(); 17 | 18 | @SuppressWarnings("unchecked") 19 | @Override 20 | public TypeAdapter create(Gson gson, TypeToken type) { 21 | if (SimplePredicate.class.isAssignableFrom(type.getRawType())) { 22 | return (TypeAdapter) new SimplePredicateTypeAdapter(gson); 23 | } 24 | return null; 25 | } 26 | 27 | private static final class SimplePredicateTypeAdapter extends TypeAdapter { 28 | 29 | private final Gson gson; 30 | 31 | private SimplePredicateTypeAdapter(final Gson gson) { 32 | this.gson = gson; 33 | } 34 | 35 | @Override 36 | public void write(final JsonWriter out, final SimplePredicate src) { 37 | if (src == null) { 38 | gson.toJson(JsonNull.INSTANCE, out); 39 | return; 40 | } 41 | gson.toJson(src.toJson(new JsonObject()), out); 42 | } 43 | 44 | @Override 45 | public SimplePredicate read(final JsonReader in) { 46 | final JsonElement jsonElement = gson.fromJson(in, JsonElement.class); 47 | if (jsonElement.isJsonNull()) return null; 48 | JsonObject jsonObj = jsonElement.getAsJsonObject(); 49 | final String type = jsonObj.get("type").getAsString(); 50 | return MbdPredicates.createPredicate(type, jsonObj); 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/json/VoxelShapAdapterFactory.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.json; 2 | 3 | import com.google.gson.*; 4 | import com.google.gson.reflect.TypeToken; 5 | import com.google.gson.stream.JsonReader; 6 | import com.google.gson.stream.JsonWriter; 7 | import net.minecraft.world.phys.AABB; 8 | import net.minecraft.world.phys.shapes.Shapes; 9 | import net.minecraft.world.phys.shapes.VoxelShape; 10 | 11 | public class VoxelShapAdapterFactory implements TypeAdapterFactory { 12 | public static final VoxelShapAdapterFactory INSTANCE = new VoxelShapAdapterFactory(); 13 | 14 | @SuppressWarnings("unchecked") 15 | @Override 16 | public TypeAdapter create(Gson gson, TypeToken type) { 17 | if (!VoxelShape.class.isAssignableFrom(type.getRawType())) return null; 18 | return (TypeAdapter) new VoxelShapeTypeAdapter(gson); 19 | } 20 | 21 | private static final class VoxelShapeTypeAdapter extends TypeAdapter { 22 | 23 | private final Gson gson; 24 | 25 | private VoxelShapeTypeAdapter(final Gson gson) { 26 | this.gson = gson; 27 | } 28 | 29 | @Override 30 | public void write(final JsonWriter out, final VoxelShape value) { 31 | final JsonArray jsonArray = new JsonArray(); 32 | for (AABB aabb : value.toAabbs()) { 33 | JsonArray aaBB = new JsonArray(); 34 | aaBB.add(aabb.minX); 35 | aaBB.add(aabb.minY); 36 | aaBB.add(aabb.minZ); 37 | aaBB.add(aabb.maxX); 38 | aaBB.add(aabb.maxY); 39 | aaBB.add(aabb.maxZ); 40 | jsonArray.add(aaBB); 41 | } 42 | gson.toJson(jsonArray, out); 43 | } 44 | 45 | @Override 46 | public VoxelShape read(final JsonReader in) { 47 | final JsonElement jsonElement = gson.fromJson(in, JsonElement.class); 48 | if (jsonElement.isJsonArray() && jsonElement.getAsJsonArray().size() > 0) { 49 | JsonArray jsonArray = jsonElement.getAsJsonArray(); 50 | VoxelShape voxelShape = null; 51 | for (int i = 0; i < jsonArray.size(); i++) { 52 | JsonArray array = jsonArray.get(i).getAsJsonArray(); 53 | VoxelShape shape = Shapes.box( 54 | array.get(0).getAsFloat(), 55 | array.get(1).getAsFloat(), 56 | array.get(2).getAsFloat(), 57 | array.get(3).getAsFloat(), 58 | array.get(4).getAsFloat(), 59 | array.get(5).getAsFloat() 60 | ); 61 | voxelShape = voxelShape == null ? shape : Shapes.or(voxelShape, shape); 62 | } 63 | return voxelShape; 64 | } 65 | return Shapes.block(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/RegistryWrapper.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs; 2 | 3 | import com.lowdragmc.multiblocked.api.capability.MultiblockCapability; 4 | import com.lowdragmc.multiblocked.api.definition.ComponentDefinition; 5 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 6 | import com.lowdragmc.multiblocked.api.registry.MbdCapabilities; 7 | import com.lowdragmc.multiblocked.api.registry.MbdComponents; 8 | import net.minecraft.resources.ResourceLocation; 9 | 10 | /** 11 | * @author KilaBash 12 | * @date 2022/5/23 13 | * @implNote RegistryWrapper 14 | */ 15 | public class RegistryWrapper { 16 | 17 | public static ComponentDefinition getDefinition(String name) { 18 | return MbdComponents.DEFINITION_REGISTRY.get(new ResourceLocation(name)); 19 | } 20 | 21 | public static MultiblockCapability getCapability(String name) { 22 | return MbdCapabilities.get(name); 23 | } 24 | 25 | public static RecipeMap getRecipeMap(String name) { 26 | return RecipeMap.RECIPE_MAP_REGISTRY.get(name); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/CreateUIEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.lowdraglib.gui.modular.ModularUI; 4 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | 7 | public class CreateUIEvent extends EventJS { 8 | public static final String ID = "mbd.create_ui"; 9 | private final ComponentTileEntity component; 10 | 11 | private ModularUI modularUI; 12 | 13 | public CreateUIEvent(ComponentTileEntity component, ModularUI modularUI) { 14 | this.component = component; 15 | this.modularUI = modularUI; 16 | } 17 | 18 | public ComponentTileEntity getComponent() { 19 | return component; 20 | } 21 | 22 | public ModularUI getModularUI() { 23 | return modularUI; 24 | } 25 | 26 | public void setModularUI(ModularUI modularUI) { 27 | this.modularUI = modularUI; 28 | } 29 | 30 | @Override 31 | public boolean canCancel() { 32 | return true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/CustomShapeEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.world.phys.shapes.VoxelShape; 6 | 7 | public class CustomShapeEvent extends EventJS { 8 | public static final String ID = "mbd.custom_shape"; 9 | private final ComponentTileEntity component; 10 | private VoxelShape shape; 11 | 12 | public CustomShapeEvent(ComponentTileEntity component, VoxelShape shape) { 13 | this.component = component; 14 | this.shape = shape; 15 | } 16 | 17 | public ComponentTileEntity getComponent() { 18 | return component; 19 | } 20 | 21 | public VoxelShape getShape() { 22 | return shape; 23 | } 24 | 25 | public void setShape(VoxelShape shape) { 26 | this.shape = shape; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/DropEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.core.NonNullList; 6 | import net.minecraft.world.entity.player.Player; 7 | import net.minecraft.world.item.ItemStack; 8 | 9 | public class DropEvent extends EventJS { 10 | public static final String ID = "mbd.drop"; 11 | private final ComponentTileEntity component; 12 | private final NonNullList drops; 13 | private final Player player; 14 | public DropEvent(ComponentTileEntity component, NonNullList drops, Player player) { 15 | this.component = component; 16 | this.drops = drops; 17 | this.player = player; 18 | } 19 | 20 | public ComponentTileEntity getComponent() { 21 | return component; 22 | } 23 | 24 | public NonNullList getDrops() { 25 | return drops; 26 | } 27 | 28 | public Player getPlayer() { 29 | return player; 30 | } 31 | 32 | @Override 33 | public boolean canCancel() { 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/DynamicPatternEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.pattern.BlockPattern; 4 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | 7 | public class DynamicPatternEvent extends EventJS { 8 | public static final String ID = "mbd.dynamic_pattern"; 9 | private final ControllerTileEntity controller; 10 | public BlockPattern pattern; 11 | 12 | public DynamicPatternEvent(ControllerTileEntity controller, BlockPattern basePattern) { 13 | this.controller = controller; 14 | this.pattern = basePattern; 15 | } 16 | 17 | public ControllerTileEntity getController() { 18 | return controller; 19 | } 20 | 21 | public void setPattern(BlockPattern pattern) { 22 | this.pattern = pattern; 23 | } 24 | 25 | @Override 26 | public boolean canCancel() { 27 | return true; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/InitTraitUIEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 4 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | 7 | public class InitTraitUIEvent extends EventJS { 8 | public static final String ID = "mbd.trait_ui"; 9 | private final ComponentTileEntity component; 10 | 11 | private final WidgetGroup widgetGroup; 12 | 13 | public InitTraitUIEvent(ComponentTileEntity component, WidgetGroup widgetGroup) { 14 | this.component = component; 15 | this.widgetGroup = widgetGroup; 16 | } 17 | 18 | public ComponentTileEntity getComponent() { 19 | return component; 20 | } 21 | 22 | public WidgetGroup getWidgetGroup() { 23 | return widgetGroup; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/NeighborChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class NeighborChangedEvent extends EventJS { 7 | public static final String ID = "mbd.neighbor_changed"; 8 | private final ComponentTileEntity component; 9 | 10 | public NeighborChangedEvent(ComponentTileEntity component) { 11 | this.component = component; 12 | } 13 | 14 | public ComponentTileEntity getComponent() { 15 | return component; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/OutputRedstoneEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.core.Direction; 6 | 7 | public class OutputRedstoneEvent extends EventJS { 8 | public static final String ID = "mbd.output_redstone"; 9 | private final ComponentTileEntity component; 10 | private final Direction facing; 11 | public int redstone; 12 | 13 | public OutputRedstoneEvent(ComponentTileEntity component, Direction facing) { 14 | this.component = component; 15 | this.facing = facing; 16 | } 17 | 18 | public Direction getFacing() { 19 | return facing; 20 | } 21 | 22 | public ComponentTileEntity getComponent() { 23 | return component; 24 | } 25 | 26 | public void setRedstone(int redstone) { 27 | this.redstone = redstone; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/PartAddedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class PartAddedEvent extends EventJS { 7 | public static final String ID = "mbd.part_added"; 8 | private final ControllerTileEntity controller; 9 | 10 | public PartAddedEvent(ControllerTileEntity controller) { 11 | this.controller = controller; 12 | } 13 | 14 | public ControllerTileEntity getController() { 15 | return controller; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/PartRemovedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class PartRemovedEvent extends EventJS { 7 | public static final String ID = "mbd.part_removed"; 8 | private final ControllerTileEntity controller; 9 | 10 | public PartRemovedEvent(ControllerTileEntity controller) { 11 | this.controller = controller; 12 | } 13 | 14 | public ControllerTileEntity getController() { 15 | return controller; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/ReadInitialDataEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | 7 | public class ReadInitialDataEvent extends EventJS { 8 | public static final String ID = "mbd.read_initial_data"; 9 | private final ComponentTileEntity component; 10 | private final FriendlyByteBuf packetBuffer; 11 | 12 | public ReadInitialDataEvent(ComponentTileEntity component, FriendlyByteBuf packetBuffer) { 13 | this.component = component; 14 | this.packetBuffer = packetBuffer; 15 | } 16 | 17 | public ComponentTileEntity getComponent() { 18 | return component; 19 | } 20 | 21 | public FriendlyByteBuf getPacketBuffer() { 22 | return packetBuffer; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/ReceiveCustomDataEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | 7 | public class ReceiveCustomDataEvent extends EventJS { 8 | public static final String ID = "mbd.receive_custom_data"; 9 | private final ComponentTileEntity component; 10 | private final FriendlyByteBuf packetBuffer; 11 | private final int dataId; 12 | 13 | public ReceiveCustomDataEvent(ComponentTileEntity component, int dataId, FriendlyByteBuf packetBuffer) { 14 | this.component = component; 15 | this.packetBuffer = packetBuffer; 16 | this.dataId = dataId; 17 | } 18 | 19 | public ComponentTileEntity getComponent() { 20 | return component; 21 | } 22 | 23 | public FriendlyByteBuf getPacketBuffer() { 24 | return packetBuffer; 25 | } 26 | 27 | public int getDataId() { 28 | return dataId; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/RecipeConverterRegisterEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.recipe.RecipeConverter; 4 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | import net.minecraft.world.item.crafting.Recipe; 7 | 8 | import java.util.function.BiConsumer; 9 | 10 | public class RecipeConverterRegisterEvent extends EventJS { 11 | 12 | public static final String ID = "mbd.recipe_converter_register"; 13 | 14 | public void register(String sourceType, String recipeMap, BiConsumer, RecipeMap> converter) { 15 | RecipeConverter.converters.add(new RecipeConverter(sourceType, recipeMap, converter)); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/RecipeFinishEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 4 | import com.lowdragmc.multiblocked.api.recipe.RecipeLogic; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | 7 | public class RecipeFinishEvent extends EventJS { 8 | public static final String ID = "mbd.recipe_finish"; 9 | private final RecipeLogic recipeLogic; 10 | private Recipe recipe; 11 | 12 | public RecipeFinishEvent(RecipeLogic recipeLogic) { 13 | this.recipeLogic = recipeLogic; 14 | this.recipe = recipeLogic.lastRecipe; 15 | } 16 | 17 | public RecipeLogic getRecipeLogic() { 18 | return recipeLogic; 19 | } 20 | 21 | public Recipe getRecipe() { 22 | return recipe; 23 | } 24 | 25 | public void setRecipe(Recipe recipe) { 26 | this.recipe = recipe; 27 | } 28 | 29 | @Override 30 | public boolean canCancel() { 31 | return true; 32 | } 33 | 34 | public static class Pre extends RecipeFinishEvent { 35 | public static final String ID = "mbd.recipe_finish_pre"; 36 | public Pre(RecipeLogic recipeLogic) { 37 | super(recipeLogic); 38 | } 39 | } 40 | 41 | public static class Post extends RecipeFinishEvent { 42 | public static final String ID = "mbd.recipe_finish_post"; 43 | public Post(RecipeLogic recipeLogic) { 44 | super(recipeLogic); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/RecipeUIEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class RecipeUIEvent extends EventJS { 7 | public static final String ID = "mbd.recipe_ui"; 8 | 9 | private final WidgetGroup recipeWidget; 10 | 11 | public RecipeUIEvent(WidgetGroup recipeWidget) { 12 | this.recipeWidget = recipeWidget; 13 | } 14 | 15 | public WidgetGroup getRecipeWidget() { 16 | return recipeWidget; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/RightClickEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.world.InteractionHand; 6 | import net.minecraft.world.entity.player.Player; 7 | import net.minecraft.world.phys.BlockHitResult; 8 | 9 | public class RightClickEvent extends EventJS { 10 | public static final String ID = "mbd.right_click"; 11 | private final ComponentTileEntity component; 12 | private final Player player; 13 | private final InteractionHand hand; 14 | private final BlockHitResult hit; 15 | 16 | public RightClickEvent(ComponentTileEntity component, Player player, InteractionHand hand, BlockHitResult hit) { 17 | this.component = component; 18 | this.player = player; 19 | this.hand = hand; 20 | this.hit = hit; 21 | } 22 | 23 | public ComponentTileEntity getComponent() { 24 | return component; 25 | } 26 | 27 | public Player getPlayer() { 28 | return player; 29 | } 30 | 31 | public InteractionHand getHand() { 32 | return hand; 33 | } 34 | 35 | public BlockHitResult getHit() { 36 | return hit; 37 | } 38 | 39 | @Override 40 | public boolean canCancel() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/SearchRecipeEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.pattern.util.PatternMatchContext; 4 | import com.lowdragmc.multiblocked.api.recipe.DynamicRecipeHandler; 5 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 6 | import com.lowdragmc.multiblocked.api.recipe.RecipeLogic; 7 | import dev.latvian.mods.kubejs.event.EventJS; 8 | import net.minecraft.world.level.Level; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | 11 | import java.util.Map; 12 | import java.util.stream.Collectors; 13 | 14 | public class SearchRecipeEvent extends EventJS { 15 | public static final String ID = "mbd.search_recipe"; 16 | 17 | private final RecipeLogic recipeLogic; 18 | private Recipe recipe; 19 | 20 | public SearchRecipeEvent(RecipeLogic logic) { 21 | this.recipeLogic = logic; 22 | } 23 | 24 | public DynamicRecipeHandler getHandler() { 25 | return DynamicRecipeHandler.create(); 26 | } 27 | 28 | public PatternMatchContext getMatchContext() { 29 | return recipeLogic.controller.getMultiblockState().matchContext; 30 | } 31 | 32 | public Map getComponentData() { 33 | Level level = recipeLogic.controller.self().getLevel(); 34 | return recipeLogic.controller.getMultiblockState() 35 | .getCache() 36 | .stream() 37 | .map(pos -> level.getBlockState(pos)) 38 | .collect(Collectors.toMap(state -> state, state -> 1, Integer::sum)); 39 | } 40 | 41 | public RecipeLogic getRecipeLogic() { 42 | return recipeLogic; 43 | } 44 | 45 | public Recipe getRecipe() { 46 | return recipe; 47 | } 48 | 49 | public void setRecipe(Recipe recipe) { 50 | this.recipe = recipe; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/SetupRecipeEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.pattern.util.PatternMatchContext; 4 | import com.lowdragmc.multiblocked.api.recipe.DynamicRecipeHandler; 5 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 6 | import com.lowdragmc.multiblocked.api.recipe.RecipeLogic; 7 | import dev.latvian.mods.kubejs.event.EventJS; 8 | import net.minecraft.world.level.Level; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | 11 | import java.util.Map; 12 | import java.util.stream.Collectors; 13 | 14 | public class SetupRecipeEvent extends EventJS { 15 | public static final String ID = "mbd.setup_recipe"; 16 | private final RecipeLogic recipeLogic; 17 | private Recipe recipe; 18 | 19 | public SetupRecipeEvent(RecipeLogic recipeLogic, Recipe recipe) { 20 | this.recipeLogic = recipeLogic; 21 | this.recipe = recipe; 22 | } 23 | 24 | public RecipeLogic getRecipeLogic() { 25 | return recipeLogic; 26 | } 27 | 28 | public Recipe getRecipe() { 29 | return recipe; 30 | } 31 | 32 | public DynamicRecipeHandler getHandlerFromRecipe() { 33 | return DynamicRecipeHandler.from(recipe); 34 | } 35 | 36 | public PatternMatchContext getMatchContext() { 37 | return recipeLogic.controller.getMultiblockState().matchContext; 38 | } 39 | 40 | public Map getComponentData() { 41 | Level level = recipeLogic.controller.self().getLevel(); 42 | return recipeLogic.controller.getMultiblockState() 43 | .getCache() 44 | .stream() 45 | .map(pos -> level.getBlockState(pos)) 46 | .collect(Collectors.toMap(state -> state, state -> 1, Integer::sum)); 47 | } 48 | 49 | public void setRecipe(Recipe recipe) { 50 | this.recipe = recipe; 51 | } 52 | 53 | @Override 54 | public boolean canCancel() { 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/StatusChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class StatusChangedEvent extends EventJS { 7 | public static final String ID = "mbd.status_changed"; 8 | private final ComponentTileEntity component; 9 | private String status; 10 | 11 | public StatusChangedEvent(ComponentTileEntity component, String status) { 12 | this.component = component; 13 | this.status = status; 14 | } 15 | 16 | public ComponentTileEntity getComponent() { 17 | return component; 18 | } 19 | 20 | public String getStatus() { 21 | return status; 22 | } 23 | 24 | public void setStatus(String status) { 25 | this.status = status; 26 | } 27 | 28 | @Override 29 | public boolean canCancel() { 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/StructureFormedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class StructureFormedEvent extends EventJS { 7 | public static final String ID = "mbd.structure_formed"; 8 | private final ControllerTileEntity controller; 9 | 10 | public StructureFormedEvent(ControllerTileEntity controller) { 11 | this.controller = controller; 12 | } 13 | 14 | public ControllerTileEntity getController() { 15 | return controller; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/StructureInvalidEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class StructureInvalidEvent extends EventJS { 7 | public static final String ID = "mbd.structure_invalid"; 8 | private final ControllerTileEntity controller; 9 | 10 | public StructureInvalidEvent(ControllerTileEntity controller) { 11 | this.controller = controller; 12 | } 13 | 14 | public ControllerTileEntity getController() { 15 | return controller; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/UpdateFormedEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ControllerTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class UpdateFormedEvent extends EventJS { 7 | public static final String ID = "mbd.update_formed"; 8 | private final ControllerTileEntity controller; 9 | 10 | public UpdateFormedEvent(ControllerTileEntity controller) { 11 | this.controller = controller; 12 | } 13 | 14 | public ControllerTileEntity getController() { 15 | return controller; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/UpdateRendererEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.IComponent; 4 | import com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer; 5 | import dev.latvian.mods.kubejs.event.EventJS; 6 | 7 | public class UpdateRendererEvent extends EventJS { 8 | public static final String ID = "mbd.update_renderer"; 9 | private final IComponent component; 10 | public IMultiblockedRenderer renderer; 11 | 12 | public UpdateRendererEvent(IComponent component, IMultiblockedRenderer renderer) { 13 | this.component = component; 14 | this.renderer = renderer; 15 | } 16 | 17 | public IComponent getComponent() { 18 | return component; 19 | } 20 | 21 | public IMultiblockedRenderer getRenderer() { 22 | return renderer; 23 | } 24 | 25 | public void setRenderer(IMultiblockedRenderer renderer) { 26 | this.renderer = renderer; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/UpdateTickEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | 6 | public class UpdateTickEvent extends EventJS { 7 | public static final String ID = "mbd.update_tick"; 8 | private final ComponentTileEntity component; 9 | 10 | public UpdateTickEvent(ComponentTileEntity component) { 11 | this.component = component; 12 | } 13 | 14 | public ComponentTileEntity getComponent() { 15 | return component; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/kubejs/events/WriteInitialDataEvent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.kubejs.events; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.ComponentTileEntity; 4 | import dev.latvian.mods.kubejs.event.EventJS; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | 7 | public class WriteInitialDataEvent extends EventJS { 8 | public static final String ID = "mbd.write_initial_data"; 9 | private final ComponentTileEntity component; 10 | private final FriendlyByteBuf packetBuffer; 11 | 12 | public WriteInitialDataEvent(ComponentTileEntity component, FriendlyByteBuf packetBuffer) { 13 | this.component = component; 14 | this.packetBuffer = packetBuffer; 15 | } 16 | 17 | public ComponentTileEntity getComponent() { 18 | return component; 19 | } 20 | 21 | public FriendlyByteBuf getPacketBuffer() { 22 | return packetBuffer; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/MultiblockShapeInfo.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern; 2 | 3 | import com.lowdragmc.lowdraglib.utils.BlockInfo; 4 | import net.minecraft.world.level.block.state.BlockState; 5 | 6 | import java.lang.reflect.Array; 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public class MultiblockShapeInfo { 13 | 14 | private final BlockInfo[][][] blocks; //[z][y][x] 15 | 16 | public MultiblockShapeInfo(BlockInfo[][][] blocks) { 17 | this.blocks = blocks; 18 | } 19 | 20 | public BlockInfo[][][] getBlocks() { 21 | return blocks; 22 | } 23 | 24 | public static Builder builder() { 25 | return new Builder(); 26 | } 27 | 28 | public static class Builder { 29 | 30 | private List shape = new ArrayList<>(); 31 | private Map symbolMap = new HashMap<>(); 32 | 33 | public Builder aisle(String... data) { 34 | this.shape.add(data); 35 | return this; 36 | } 37 | 38 | public Builder where(char symbol, BlockInfo value) { 39 | this.symbolMap.put(symbol, value); 40 | return this; 41 | } 42 | 43 | public Builder where(char symbol, BlockState blockState) { 44 | return where(symbol, BlockInfo.fromBlockState(blockState)); 45 | } 46 | 47 | private BlockInfo[][][] bakeArray() { 48 | BlockInfo[][][] blockInfos = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, shape.get(0)[0].length(), shape.get(0).length, shape.size()); 49 | for (int z = 0; z < blockInfos.length; z++) { //z 50 | String[] aisleEntry = shape.get(z); 51 | for (int y = 0; y < shape.get(0).length; y++) { 52 | String columnEntry = aisleEntry[y]; 53 | for (int x = 0; x < columnEntry.length(); x++) { 54 | BlockInfo info = symbolMap.getOrDefault(columnEntry.charAt(x), BlockInfo.EMPTY); 55 | blockInfos[x][y][z] = info; 56 | } 57 | } 58 | } 59 | return blockInfos; 60 | } 61 | 62 | public Builder shallowCopy() { 63 | Builder builder = new Builder(); 64 | builder.shape = new ArrayList<>(this.shape); 65 | builder.symbolMap = new HashMap<>(this.symbolMap); 66 | return builder; 67 | } 68 | 69 | public MultiblockShapeInfo build() { 70 | return new MultiblockShapeInfo(bakeArray()); 71 | } 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/Predicates.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern; 2 | 3 | import com.lowdragmc.lowdraglib.utils.BlockInfo; 4 | import com.lowdragmc.multiblocked.api.capability.MultiblockCapability; 5 | import com.lowdragmc.multiblocked.api.definition.ComponentDefinition; 6 | import com.lowdragmc.multiblocked.api.definition.ControllerDefinition; 7 | import com.lowdragmc.multiblocked.api.pattern.predicates.*; 8 | import net.minecraft.world.level.block.Block; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | import net.minecraft.world.level.material.Fluid; 11 | 12 | import java.util.function.Predicate; 13 | import java.util.function.Supplier; 14 | 15 | public class Predicates { 16 | 17 | public static TraceabilityPredicate states(BlockState... allowedStates) { 18 | return new TraceabilityPredicate(new PredicateStates(allowedStates)); 19 | } 20 | 21 | public static TraceabilityPredicate blocks(Block... blocks) { 22 | return new TraceabilityPredicate(new PredicateBlocks(blocks)); 23 | } 24 | 25 | public static TraceabilityPredicate fluids(Fluid... fluids) { 26 | return new TraceabilityPredicate(new PredicateFluids(fluids)); 27 | } 28 | 29 | /** 30 | * Use it when you require that a position must have a specific capability. 31 | */ 32 | public static TraceabilityPredicate anyCapability(MultiblockCapability capability) { 33 | return new TraceabilityPredicate(new PredicateAnyCapability(capability)); 34 | } 35 | 36 | public static TraceabilityPredicate component(ComponentDefinition definition) { 37 | TraceabilityPredicate predicate = new TraceabilityPredicate(new PredicateComponent(definition)); 38 | return definition instanceof ControllerDefinition ? predicate.setCenter() : predicate; 39 | } 40 | 41 | public static TraceabilityPredicate customAny() { 42 | return new TraceabilityPredicate(new PredicateCustomAny()); 43 | } 44 | 45 | public static TraceabilityPredicate custom(Predicate predicate, Supplier candidates) { 46 | return new TraceabilityPredicate(predicate, candidates); 47 | } 48 | public static TraceabilityPredicate any() { 49 | return new TraceabilityPredicate(SimplePredicate.ANY); 50 | } 51 | 52 | public static TraceabilityPredicate air() { 53 | return new TraceabilityPredicate(SimplePredicate.AIR); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/error/PatternError.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.error; 2 | 3 | import com.lowdragmc.lowdraglib.utils.LocalizationUtils; 4 | import com.lowdragmc.multiblocked.api.pattern.MultiblockState; 5 | import com.lowdragmc.multiblocked.api.pattern.TraceabilityPredicate; 6 | import com.lowdragmc.multiblocked.api.pattern.predicates.SimplePredicate; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.core.BlockPos; 9 | import net.minecraft.world.level.Level; 10 | import net.minecraftforge.api.distmarker.Dist; 11 | import net.minecraftforge.api.distmarker.OnlyIn; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class PatternError { 17 | 18 | protected MultiblockState worldState; 19 | 20 | public void setWorldState(MultiblockState worldState) { 21 | this.worldState = worldState; 22 | } 23 | 24 | public Level getWorld() { 25 | return worldState.getWorld(); 26 | } 27 | 28 | public BlockPos getPos() { 29 | return worldState.getPos(); 30 | } 31 | 32 | public List> getCandidates() { 33 | TraceabilityPredicate predicate = worldState.predicate; 34 | List> candidates = new ArrayList<>(); 35 | for (SimplePredicate common : predicate.common) { 36 | candidates.add(common.getCandidates()); 37 | } 38 | for (SimplePredicate limited : predicate.limited) { 39 | candidates.add(limited.getCandidates()); 40 | } 41 | return candidates; 42 | } 43 | 44 | @OnlyIn(Dist.CLIENT) 45 | public String getErrorInfo() { 46 | List> candidates = getCandidates(); 47 | StringBuilder builder = new StringBuilder(); 48 | for (List candidate : candidates) { 49 | if (!candidate.isEmpty()) { 50 | builder.append(candidate.get(0).getDisplayName()); 51 | builder.append(", "); 52 | } 53 | } 54 | builder.append("..."); 55 | return LocalizationUtils.format("gregtech.multiblock.pattern.error", builder.toString(), worldState.pos); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/error/PatternStringError.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.error; 2 | 3 | import com.lowdragmc.lowdraglib.utils.LocalizationUtils; 4 | import net.minecraft.client.resources.language.I18n; 5 | 6 | public class PatternStringError extends PatternError{ 7 | public final String translateKey; 8 | 9 | public PatternStringError(String translateKey) { 10 | this.translateKey = translateKey; 11 | } 12 | 13 | @Override 14 | public String getErrorInfo() { 15 | return LocalizationUtils.format(translateKey); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/error/SinglePredicateError.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.error; 2 | 3 | import com.lowdragmc.lowdraglib.utils.LocalizationUtils; 4 | import com.lowdragmc.multiblocked.api.pattern.predicates.SimplePredicate; 5 | import net.minecraft.client.resources.language.I18n; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraftforge.api.distmarker.Dist; 8 | import net.minecraftforge.api.distmarker.OnlyIn; 9 | 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class SinglePredicateError extends PatternError { 14 | public final SimplePredicate predicate; 15 | public final int type; 16 | 17 | public SinglePredicateError(SimplePredicate predicate, int type) { 18 | this.predicate = predicate; 19 | this.type = type; 20 | } 21 | 22 | @Override 23 | public List> getCandidates() { 24 | return Collections.singletonList(predicate.getCandidates()); 25 | } 26 | 27 | @OnlyIn(Dist.CLIENT) 28 | @Override 29 | public String getErrorInfo() { 30 | int number = -1; 31 | if (type == 0) { 32 | number = predicate.maxCount; 33 | } 34 | if (type == 1) { 35 | number = predicate.minCount; 36 | } 37 | return LocalizationUtils.format("multiblocked.pattern.error.limited." + type, number); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/predicates/PredicateCustomAny.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.predicates; 2 | 3 | public class PredicateCustomAny extends SimplePredicate { 4 | 5 | public PredicateCustomAny() { 6 | super("custom_any", x -> true, null); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/util/PatternMatchContext.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.util; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import java.util.function.Supplier; 6 | 7 | /** 8 | * Contains an context used for storing temporary data 9 | * related to current check and shared between all predicates doing it 10 | */ 11 | public class PatternMatchContext { 12 | 13 | private final Map data = new HashMap<>(); 14 | 15 | public void reset() { 16 | this.data.clear(); 17 | } 18 | 19 | public void set(String key, Object value) { 20 | this.data.put(key, value); 21 | } 22 | 23 | public int getInt(String key) { 24 | return data.containsKey(key) ? (int) data.get(key) : 0; 25 | } 26 | 27 | public void increment(String key, int value) { 28 | set(key, getOrDefault(key, 0) + value); 29 | } 30 | 31 | @SuppressWarnings("unchecked") 32 | public T getOrDefault(String key, T defaultValue) { 33 | return (T) data.getOrDefault(key, defaultValue); 34 | } 35 | 36 | @SuppressWarnings("unchecked") 37 | public T get(String key) { 38 | return (T) data.get(key); 39 | } 40 | 41 | public T getOrCreate(String key, Supplier creator) { 42 | T result = get(key); 43 | if (result == null) { 44 | result = creator.get(); 45 | set(key, result); 46 | } 47 | return result; 48 | } 49 | 50 | public T getOrPut(String key, T initialValue) { 51 | T result = get(key); 52 | if (result == null) { 53 | result = initialValue; 54 | set(key, result); 55 | } 56 | return result; 57 | } 58 | 59 | public boolean containsKey (String key) { 60 | return data.containsKey(key); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/pattern/util/RelativeDirection.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.pattern.util; 2 | 3 | import net.minecraft.core.Direction; 4 | 5 | import java.util.function.Function; 6 | 7 | /** 8 | * Relative direction when facing horizontally 9 | */ 10 | public enum RelativeDirection { 11 | UP(f -> Direction.UP, Direction.Axis.Y), 12 | DOWN(f -> Direction.DOWN, Direction.Axis.Y), 13 | LEFT(Direction::getCounterClockWise, Direction.Axis.X), 14 | RIGHT(Direction::getClockWise, Direction.Axis.X), 15 | FRONT(Function.identity(), Direction.Axis.Z), 16 | BACK(Direction::getOpposite, Direction.Axis.Z); 17 | 18 | final Function actualFacing; 19 | public final Direction.Axis axis; 20 | 21 | RelativeDirection(Function actualFacing, Direction.Axis axis) { 22 | this.actualFacing = actualFacing; 23 | this.axis = axis; 24 | } 25 | 26 | public Direction getActualFacing(Direction facing) { 27 | return actualFacing.apply(facing); 28 | } 29 | 30 | public boolean isSameAxis(RelativeDirection dir) { 31 | return this.axis == dir.axis; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/Content.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | public class Content { 6 | public transient Object content; 7 | public float chance; 8 | @Nullable 9 | public String slotName; 10 | @Nullable 11 | public String uiName; 12 | 13 | public Content(Object content, float chance, @Nullable String slotName, @Nullable String uiName) { 14 | this.content = content; 15 | this.chance = chance; 16 | this.slotName = slotName; 17 | this.uiName = uiName; 18 | } 19 | 20 | public Object getContent() { 21 | return content; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/ContentModifier.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe; 2 | 3 | import java.math.BigDecimal; 4 | import java.math.BigInteger; 5 | 6 | public class ContentModifier { 7 | 8 | private final double multiplier; 9 | private final double addition; 10 | 11 | public static ContentModifier of(double multiplier, double addition) { 12 | return new ContentModifier(multiplier, addition); 13 | } 14 | 15 | public static ContentModifier multiplier(double multiplier) { 16 | return new ContentModifier(multiplier, 0); 17 | } 18 | 19 | public static ContentModifier addition(double addition) { 20 | return new ContentModifier(1, addition); 21 | } 22 | 23 | public ContentModifier(double multiplier, double addition) { 24 | this.multiplier = multiplier; 25 | this.addition = addition; 26 | } 27 | 28 | public Number apply(Number number) { 29 | if (number instanceof BigDecimal decimal) { 30 | return decimal.multiply(BigDecimal.valueOf(multiplier)).add(BigDecimal.valueOf(addition)); 31 | } 32 | if (number instanceof BigInteger bigInteger) { 33 | return bigInteger.multiply(BigInteger.valueOf((long) multiplier)).add(BigInteger.valueOf((long) addition)); 34 | } 35 | return number.doubleValue() * multiplier + addition; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/RecipeConverter.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe; 2 | 3 | import com.lowdragmc.multiblocked.api.recipe.serde.recipe.MBDRecipeReloadListener; 4 | import net.minecraft.core.Registry; 5 | import net.minecraft.resources.ResourceLocation; 6 | import net.minecraft.world.Container; 7 | import net.minecraft.world.item.crafting.Recipe; 8 | import net.minecraft.world.item.crafting.RecipeManager; 9 | import net.minecraft.world.item.crafting.RecipeType; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.function.BiConsumer; 14 | 15 | /** 16 | * A tool for converting recipes from other sources into a particular multiblock recipe. 17 | */ 18 | public class RecipeConverter { 19 | 20 | public static final List converters = new ArrayList<>(); 21 | private final ResourceLocation sourceType; 22 | private final RecipeMap target; 23 | private final BiConsumer, RecipeMap> converter; 24 | 25 | public RecipeConverter(String sourceType, String target, BiConsumer, RecipeMap> converter) { 26 | this.sourceType = new ResourceLocation(sourceType); 27 | this.target = RecipeMap.RECIPE_MAP_REGISTRY.get(target); 28 | if (this.target == null) { 29 | throw new IllegalArgumentException("No recipe map found for " + target); 30 | } 31 | this.converter = converter; 32 | } 33 | 34 | @SuppressWarnings("unchecked") 35 | public > void apply() { 36 | RecipeManager manager = MBDRecipeReloadListener.INSTANCE.server.getRecipeManager(); 37 | RecipeType recipeType = (RecipeType) Registry.RECIPE_TYPE.get(sourceType); 38 | if (recipeType == null) { 39 | throw new IllegalArgumentException("No recipe type found for " + sourceType); 40 | } 41 | for (Recipe recipe : manager.getAllRecipesFor(recipeType)) { 42 | converter.accept(recipe, target); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/IContentSerializer.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.api.recipe.Content; 7 | import net.minecraft.network.FriendlyByteBuf; 8 | 9 | public interface IContentSerializer { 10 | 11 | default void toNetwork(FriendlyByteBuf buf, T content) { 12 | buf.writeUtf(Multiblocked.GSON.toJson(toJson(content))); 13 | } 14 | 15 | default T fromNetwork(FriendlyByteBuf buf) { 16 | return fromJson(Multiblocked.GSON.fromJson(buf.readUtf(), JsonElement.class)); 17 | } 18 | 19 | T fromJson(JsonElement json); 20 | 21 | JsonElement toJson(T content); 22 | 23 | T of(Object o); 24 | 25 | 26 | @SuppressWarnings("unchecked") 27 | default void toNetworkContent(FriendlyByteBuf buf, Content content) { 28 | T inner = (T) content.getContent(); 29 | toNetwork(buf, inner); 30 | buf.writeFloat(content.chance); 31 | buf.writeBoolean(content.slotName != null); 32 | if (content.slotName != null) { 33 | buf.writeUtf(content.slotName); 34 | } 35 | buf.writeBoolean(content.uiName != null); 36 | if (content.uiName != null) { 37 | buf.writeUtf(content.uiName); 38 | } 39 | } 40 | 41 | default Content fromNetworkContent(FriendlyByteBuf buf) { 42 | T inner = fromNetwork(buf); 43 | float chance = buf.readFloat(); 44 | String slotName = null; 45 | if (buf.readBoolean()) { 46 | slotName = buf.readUtf(); 47 | } 48 | String uiName = null; 49 | if (buf.readBoolean()) { 50 | uiName = buf.readUtf(); 51 | } 52 | return new Content(inner, chance, slotName, uiName); 53 | } 54 | 55 | @SuppressWarnings("unchecked") 56 | default JsonElement toJsonContent(Content content) { 57 | JsonObject json = new JsonObject(); 58 | json.add("content", toJson((T) content.getContent())); 59 | json.addProperty("chance", content.chance); 60 | if (content.slotName != null) 61 | json.addProperty("slotName", content.slotName); 62 | if (content.uiName != null) 63 | json.addProperty("uiName", content.uiName); 64 | return json; 65 | } 66 | 67 | default Content fromJsonContent(JsonElement json) { 68 | JsonObject jsonObject = json.getAsJsonObject(); 69 | T inner = fromJson(jsonObject.get("content")); 70 | float chance = jsonObject.has("chance") ? jsonObject.get("chance").getAsFloat() : 1; 71 | String slotName = jsonObject.has("slotName") ? jsonObject.get("slotName").getAsString() : null; 72 | String uiName = jsonObject.has("uiName") ? jsonObject.get("uiName").getAsString() : null; 73 | return new Content(inner, chance, slotName, uiName); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerBigInteger.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | 7 | import java.math.BigInteger; 8 | 9 | /** 10 | * @author KilaBash 11 | * @date 2022/06/22 12 | * @implNote SerializerBigInteger 13 | */ 14 | public class SerializerBigInteger implements IContentSerializer{ 15 | 16 | public static SerializerBigInteger INSTANCE = new SerializerBigInteger(); 17 | 18 | private SerializerBigInteger() {} 19 | 20 | @Override 21 | public void toNetwork(FriendlyByteBuf buf, BigInteger content) { 22 | buf.writeUtf(content.toString()); 23 | } 24 | 25 | @Override 26 | public BigInteger fromNetwork(FriendlyByteBuf buf) { 27 | return new BigInteger(buf.readUtf()); 28 | } 29 | 30 | @Override 31 | public BigInteger fromJson(JsonElement json) { 32 | return json.getAsBigInteger(); 33 | } 34 | 35 | @Override 36 | public JsonElement toJson(BigInteger content) { 37 | return new JsonPrimitive(content); 38 | } 39 | 40 | @Override 41 | public BigInteger of(Object o) { 42 | if (o instanceof BigInteger) { 43 | return (BigInteger) o; 44 | } else if (o instanceof Number) { 45 | return BigInteger.valueOf(((Number) o).longValue()); 46 | } else if (o instanceof CharSequence) { 47 | return new BigInteger(o.toString()); 48 | } 49 | return BigInteger.ONE; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerDouble.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | import org.apache.commons.lang3.math.NumberUtils; 7 | 8 | public class SerializerDouble implements IContentSerializer { 9 | 10 | public static SerializerDouble INSTANCE = new SerializerDouble(); 11 | 12 | private SerializerDouble() {} 13 | 14 | @Override 15 | public void toNetwork(FriendlyByteBuf buf, Double content) { 16 | buf.writeDouble(content); 17 | } 18 | 19 | @Override 20 | public Double fromNetwork(FriendlyByteBuf buf) { 21 | return buf.readDouble(); 22 | } 23 | 24 | @Override 25 | public Double fromJson(JsonElement json) { 26 | return json.getAsDouble(); 27 | } 28 | 29 | @Override 30 | public JsonElement toJson(Double content) { 31 | return new JsonPrimitive(content); 32 | } 33 | 34 | @Override 35 | public Double of(Object o) { 36 | if (o instanceof Double) { 37 | return (Double) o; 38 | } else if (o instanceof Number) { 39 | return ((Number) o).doubleValue(); 40 | } else if (o instanceof CharSequence) { 41 | return NumberUtils.toDouble(o.toString(), 1); 42 | } 43 | return 1d; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerFloat.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | import org.apache.commons.lang3.math.NumberUtils; 7 | 8 | public class SerializerFloat implements IContentSerializer { 9 | 10 | public static SerializerFloat INSTANCE = new SerializerFloat(); 11 | 12 | private SerializerFloat() {} 13 | 14 | @Override 15 | public void toNetwork(FriendlyByteBuf buf, Float content) { 16 | buf.writeFloat(content); 17 | } 18 | 19 | @Override 20 | public Float fromNetwork(FriendlyByteBuf buf) { 21 | return buf.readFloat(); 22 | } 23 | 24 | @Override 25 | public Float fromJson(JsonElement json) { 26 | return json.getAsFloat(); 27 | } 28 | 29 | @Override 30 | public JsonElement toJson(Float content) { 31 | return new JsonPrimitive(content); 32 | } 33 | 34 | @Override 35 | public Float of(Object o) { 36 | if (o instanceof Float) { 37 | return (Float) o; 38 | } else if (o instanceof Number) { 39 | return ((Number) o).floatValue(); 40 | } else if (o instanceof CharSequence) { 41 | return NumberUtils.toFloat(o.toString(), 1); 42 | } 43 | return 1f; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerFluidStack.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.api.kubejs.MultiblockedJSPlugin; 7 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 8 | import net.minecraft.nbt.TagParser; 9 | import net.minecraft.network.FriendlyByteBuf; 10 | import net.minecraft.resources.ResourceLocation; 11 | import net.minecraftforge.fluids.FluidStack; 12 | import net.minecraftforge.registries.ForgeRegistries; 13 | 14 | import java.util.Objects; 15 | 16 | public class SerializerFluidStack implements IContentSerializer { 17 | 18 | public static SerializerFluidStack INSTANCE = new SerializerFluidStack(); 19 | 20 | private SerializerFluidStack() {} 21 | 22 | @Override 23 | public void toNetwork(FriendlyByteBuf buf, FluidStack content) { 24 | content.writeToPacket(buf); 25 | } 26 | 27 | @Override 28 | public FluidStack fromNetwork(FriendlyByteBuf buf) { 29 | return FluidStack.readFromPacket(buf); 30 | } 31 | 32 | @Override 33 | public FluidStack fromJson(JsonElement json) { 34 | try { 35 | if (!json.isJsonObject()) { 36 | return FluidStack.loadFluidStackFromNBT(TagParser.parseTag(json.getAsString())); 37 | } 38 | var jObj = json.getAsJsonObject(); 39 | var fluid = new ResourceLocation(jObj.get("fluid").getAsString()); 40 | var amount = jObj.get("amount").getAsInt(); 41 | var fluidStack = new FluidStack(Objects.requireNonNull(ForgeRegistries.FLUIDS.getValue(fluid)), amount); 42 | if (jObj.has("nbt")) { 43 | try { 44 | fluidStack.setTag(TagParser.parseTag(jObj.get("nbt").getAsString())); 45 | } catch (CommandSyntaxException e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | return fluidStack; 50 | } catch (Exception e) { 51 | Multiblocked.LOGGER.error("cant parse the fluid ingredient: {}", json.toString()); 52 | return FluidStack.EMPTY; 53 | } 54 | } 55 | 56 | @Override 57 | public JsonElement toJson(FluidStack content) { 58 | var json = new JsonObject(); 59 | json.addProperty("fluid", Objects.requireNonNull(content.getFluid().getRegistryName()).toString()); 60 | json.addProperty("amount", content.getAmount()); 61 | if (content.hasTag()) 62 | json.addProperty("nbt", content.getTag().toString()); 63 | return json; 64 | } 65 | 66 | @Override 67 | public FluidStack of(Object o) { 68 | if (o instanceof FluidStack) { 69 | return ((FluidStack) o).copy(); 70 | } else if (Multiblocked.isKubeJSLoaded()) { 71 | return MultiblockedJSPlugin.FluidStackWrapper(o); 72 | } 73 | return FluidStack.EMPTY; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerIngredient.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.google.gson.JsonParseException; 6 | import com.lowdragmc.multiblocked.Multiblocked; 7 | import com.lowdragmc.multiblocked.api.recipe.ingredient.SizedIngredient; 8 | import net.minecraft.core.Registry; 9 | import net.minecraft.network.FriendlyByteBuf; 10 | import net.minecraft.resources.ResourceLocation; 11 | import net.minecraft.tags.TagKey; 12 | import net.minecraft.world.item.ItemStack; 13 | import net.minecraft.world.item.crafting.Ingredient; 14 | import net.minecraft.world.level.ItemLike; 15 | 16 | public class SerializerIngredient implements IContentSerializer { 17 | 18 | public static SerializerIngredient INSTANCE = new SerializerIngredient(); 19 | 20 | private SerializerIngredient() {} 21 | 22 | @Override 23 | public void toNetwork(FriendlyByteBuf buf, Ingredient content) { 24 | content.toNetwork(buf); 25 | } 26 | 27 | @Override 28 | public Ingredient fromNetwork(FriendlyByteBuf buf) { 29 | return Ingredient.fromNetwork(buf); 30 | } 31 | 32 | @Override 33 | public Ingredient fromJson(JsonElement json) { 34 | try { 35 | return Ingredient.fromJson(json); 36 | } catch (Exception e) { 37 | return outdatedDeserialize(json); 38 | } 39 | } 40 | 41 | @Override 42 | public JsonElement toJson(Ingredient content) { 43 | return content.toJson(); 44 | } 45 | 46 | @Override 47 | @SuppressWarnings("unchecked") 48 | public Ingredient of(Object o) { 49 | if (o instanceof Ingredient ingredient) { 50 | return ingredient; 51 | } else if (o instanceof ItemStack itemStack) { 52 | return Ingredient.of(itemStack); 53 | } else if (o instanceof ItemLike itemLike) { 54 | return Ingredient.of(itemLike); 55 | } else if (o instanceof TagKey tag) { 56 | return Ingredient.of(tag); 57 | } 58 | return Ingredient.EMPTY; 59 | } 60 | 61 | @Deprecated 62 | private Ingredient outdatedDeserialize(JsonElement jsonElement) throws JsonParseException { 63 | try { 64 | JsonObject jsonObject = jsonElement.getAsJsonObject(); 65 | if (jsonObject.has("tag")) { 66 | return new SizedIngredient(Ingredient.of(TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(jsonObject.get("tag").getAsString().toLowerCase()))), jsonObject.get("amount").getAsInt()); 67 | } else { 68 | return new SizedIngredient(Ingredient.fromJson(jsonObject.get("matches")), jsonObject.get("amount").getAsInt()); 69 | } 70 | } catch (Exception e){ 71 | Multiblocked.LOGGER.error("cant parse the item ingredient: {}", jsonElement.toString()); 72 | return Ingredient.EMPTY; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerInteger.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | import org.apache.commons.lang3.math.NumberUtils; 7 | 8 | public class SerializerInteger implements IContentSerializer { 9 | 10 | public static SerializerInteger INSTANCE = new SerializerInteger(); 11 | 12 | private SerializerInteger() {} 13 | 14 | @Override 15 | public void toNetwork(FriendlyByteBuf buf, Integer content) { 16 | buf.writeInt(content); 17 | } 18 | 19 | @Override 20 | public Integer fromNetwork(FriendlyByteBuf buf) { 21 | return buf.readInt(); 22 | } 23 | 24 | @Override 25 | public Integer fromJson(JsonElement json) { 26 | return json.getAsInt(); 27 | } 28 | 29 | @Override 30 | public JsonElement toJson(Integer content) { 31 | return new JsonPrimitive(content); 32 | } 33 | 34 | @Override 35 | public Integer of(Object o) { 36 | if (o instanceof Integer) { 37 | return (Integer) o; 38 | } else if (o instanceof Number) { 39 | return ((Number) o).intValue(); 40 | } else if (o instanceof CharSequence) { 41 | return NumberUtils.toInt(o.toString(), 1); 42 | } 43 | return 1; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/content/SerializerLong.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.content; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import net.minecraft.network.FriendlyByteBuf; 6 | import org.apache.commons.lang3.math.NumberUtils; 7 | 8 | /** 9 | * @author KilaBash 10 | * @date 2022/06/22 11 | * @implNote SerializerLong 12 | */ 13 | public class SerializerLong implements IContentSerializer{ 14 | 15 | public static SerializerLong INSTANCE = new SerializerLong(); 16 | 17 | private SerializerLong() {} 18 | 19 | @Override 20 | public void toNetwork(FriendlyByteBuf buf, Long content) { 21 | buf.writeVarLong(content); 22 | } 23 | 24 | @Override 25 | public Long fromNetwork(FriendlyByteBuf buf) { 26 | return buf.readVarLong(); 27 | } 28 | 29 | @Override 30 | public Long fromJson(JsonElement json) { 31 | return json.getAsLong(); 32 | } 33 | 34 | @Override 35 | public JsonElement toJson(Long content) { 36 | return new JsonPrimitive(content); 37 | } 38 | 39 | @Override 40 | public Long of(Object o) { 41 | if (o instanceof Long) { 42 | return (Long) o; 43 | } else if (o instanceof Number) { 44 | return ((Number) o).longValue(); 45 | } else if (o instanceof CharSequence) { 46 | return NumberUtils.toLong(o.toString(), 1); 47 | } 48 | return 1L; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/recipe/serde/recipe/MBDRecipeReloadListener.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.recipe.serde.recipe; 2 | 3 | import net.minecraft.server.MinecraftServer; 4 | import net.minecraft.server.packs.resources.ResourceManager; 5 | import net.minecraft.server.packs.resources.ResourceManagerReloadListener; 6 | 7 | public class MBDRecipeReloadListener { 8 | public MinecraftServer server; 9 | public static MBDRecipeReloadListener INSTANCE = new MBDRecipeReloadListener(); 10 | 11 | public void reloadRecipes() { 12 | if (server == null) return; 13 | MBDRecipeType.unloadRecipes(); 14 | MBDRecipeType.loadRecipes(server.getRecipeManager(), false); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/registry/MbdItems.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.registry; 2 | 3 | import com.lowdragmc.multiblocked.Multiblocked; 4 | import com.lowdragmc.multiblocked.api.item.ItemBlueprint; 5 | import com.lowdragmc.multiblocked.api.item.ItemMultiblockBuilder; 6 | import net.minecraft.client.renderer.item.ItemProperties; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.Item; 9 | import net.minecraftforge.registries.IForgeRegistry; 10 | 11 | public class MbdItems { 12 | public static ItemBlueprint BLUEPRINT = new ItemBlueprint(); 13 | public static ItemMultiblockBuilder BUILDER = new ItemMultiblockBuilder(); 14 | 15 | public static void registerItems(IForgeRegistry registry) { 16 | registry.register(BLUEPRINT); 17 | registry.register(BUILDER); 18 | } 19 | 20 | public static void registerModelsProperties() { 21 | ItemProperties.register(BLUEPRINT, new ResourceLocation(Multiblocked.MODID, "raw"), (itemStack, clientWorld, entity, seed) -> ItemBlueprint.isRaw(itemStack) ? 0 : 1); 22 | ItemProperties.register(BUILDER, new ResourceLocation(Multiblocked.MODID, "raw"), (itemStack, clientWorld, entity, seed) -> ItemMultiblockBuilder.isRaw(itemStack) ? 0 : 1); 23 | } 24 | // 25 | // @SuppressWarnings("ConstantConditions") 26 | // public static void registerModels() { 27 | // ModelLoader.setCustomModelResourceLocation(BLUEPRINT, 0, new ModelResourceLocation(BLUEPRINT.getRegistryName(), "inventory")); 28 | // ModelLoader.setCustomModelResourceLocation(BLUEPRINT, 1, new ModelResourceLocation(BLUEPRINT.getRegistryName() + "_pattern", "inventory")); 29 | // ModelLoader.setCustomModelResourceLocation(BUILDER, 0, new ModelResourceLocation(BUILDER.getRegistryName(), "inventory")); 30 | // ModelLoader.setCustomModelResourceLocation(BUILDER, 1, new ModelResourceLocation(BUILDER.getRegistryName() + "_pattern", "inventory")); 31 | // } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/registry/MbdPredicates.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.registry; 2 | 3 | import com.google.common.collect.Maps; 4 | import com.google.gson.JsonObject; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.api.pattern.predicates.*; 7 | 8 | import java.util.Map; 9 | 10 | public class MbdPredicates { 11 | public static final Map> PREDICATE_REGISTRY = Maps.newHashMap(); 12 | 13 | public static void registerPredicate(Class predicate) { 14 | try { 15 | PREDICATE_REGISTRY.put(predicate.newInstance().type, predicate); 16 | } catch (InstantiationException | IllegalAccessException e) { 17 | Multiblocked.LOGGER.error("Registered predicates require a parameterless constructor"); 18 | } 19 | } 20 | 21 | private static Class getPredicate(String type) { 22 | return PREDICATE_REGISTRY.get(type.toLowerCase()); 23 | } 24 | 25 | public static SimplePredicate createPredicate(String type) { 26 | return createPredicate(type, null); 27 | } 28 | 29 | public static SimplePredicate createPredicate(String type, JsonObject json) { 30 | if (type.equals("any")) return SimplePredicate.ANY; 31 | if (type.equals("air")) return SimplePredicate.AIR; 32 | Class clazz = getPredicate(type); 33 | if (clazz != null) { 34 | try { 35 | SimplePredicate simplePredicate = clazz.newInstance(); 36 | if (json == null) return simplePredicate.buildPredicate(); 37 | simplePredicate.fromJson(Multiblocked.GSON, json); 38 | simplePredicate.buildPredicate(); 39 | return simplePredicate; 40 | } catch (Exception ignored) { } 41 | } 42 | return null; 43 | } 44 | 45 | public static void registerPredicates() { 46 | registerPredicate(PredicateComponent.class); 47 | registerPredicate(PredicateStates.class); 48 | registerPredicate(PredicateBlocks.class); 49 | registerPredicate(PredicateAnyCapability.class); 50 | registerPredicate(PredicateCustomAny.class); 51 | registerPredicate(PredicateFluids.class); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/registry/MbdRecipeConditions.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.registry; 2 | 3 | import com.google.common.collect.Maps; 4 | import com.lowdragmc.multiblocked.api.recipe.RecipeCondition; 5 | import com.lowdragmc.multiblocked.common.recipe.conditions.*; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author KilaBash 13 | * @date 2022/05/27 14 | * @implNote RecipeConditions 15 | */ 16 | public class MbdRecipeConditions { 17 | public static final Map RECIPE_CONDITIONS_REGISTRY = Maps.newHashMap(); 18 | public static final List RECIPE_CONDITIONS_ORDER = new ArrayList<>(); 19 | 20 | public static void registerCondition(RecipeCondition condition) { 21 | RECIPE_CONDITIONS_REGISTRY.put(condition.getType(), condition); 22 | RECIPE_CONDITIONS_ORDER.add(condition.getType()); 23 | } 24 | 25 | public static RecipeCondition getCondition(String type) { 26 | return RECIPE_CONDITIONS_REGISTRY.get(type.toLowerCase()); 27 | } 28 | 29 | /** 30 | * Uses VarInt instead of direct strings in Network to reduce payload. 31 | */ 32 | public static int getConditionOrder(RecipeCondition type) { 33 | return RECIPE_CONDITIONS_ORDER.indexOf(type.getType()); 34 | } 35 | 36 | public static int getConditionOrder(String type) { 37 | return RECIPE_CONDITIONS_ORDER.indexOf(type); 38 | } 39 | 40 | public static RecipeCondition getConditionByIndex(int order) { 41 | return RECIPE_CONDITIONS_REGISTRY.get(RECIPE_CONDITIONS_ORDER.get(order)); 42 | } 43 | 44 | 45 | public static void registerConditions() { 46 | registerCondition(DimensionCondition.INSTANCE); 47 | registerCondition(ThunderCondition.INSTANCE); 48 | registerCondition(RainingCondition.INSTANCE); 49 | registerCondition(PositionYCondition.INSTANCE); 50 | registerCondition(BiomeCondition.INSTANCE); 51 | registerCondition(BlockCondition.INSTANCE); 52 | registerCondition(PredicateCondition.INSTANCE); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/registry/MbdRenderers.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.registry; 2 | 3 | 4 | import com.google.common.collect.Maps; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer; 7 | import com.lowdragmc.multiblocked.client.renderer.impl.GTRenderer; 8 | import com.lowdragmc.multiblocked.client.renderer.impl.GeoComponentRenderer; 9 | import com.lowdragmc.multiblocked.client.renderer.impl.MBDBlockStateRenderer; 10 | import com.lowdragmc.multiblocked.client.renderer.impl.MBDIModelRenderer; 11 | import com.lowdragmc.multiblocked.client.renderer.impl.ParticleRenderer; 12 | 13 | import java.util.Map; 14 | 15 | public class MbdRenderers { 16 | public static final Map RENDERER_REGISTRY = Maps.newHashMap(); 17 | 18 | public static void registerRenderer(IMultiblockedRenderer renderer) { 19 | RENDERER_REGISTRY.put(renderer.getType().toLowerCase(), renderer); 20 | } 21 | 22 | public static IMultiblockedRenderer getRenderer(String type) { 23 | return RENDERER_REGISTRY.get(type.toLowerCase()); 24 | } 25 | 26 | public static void registerRenderers() { 27 | registerRenderer(MBDIModelRenderer.INSTANCE); 28 | registerRenderer(MBDBlockStateRenderer.INSTANCE); 29 | registerRenderer(ParticleRenderer.INSTANCE); 30 | registerRenderer(GTRenderer.INSTANCE); 31 | if (Multiblocked.isGeoLoaded()) { 32 | registerRenderer(GeoComponentRenderer.INSTANCE); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/sound/ComponentSound.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.sound; 2 | 3 | import com.lowdragmc.multiblocked.api.tile.IComponent; 4 | import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; 5 | import net.minecraft.sounds.SoundEvent; 6 | import net.minecraft.sounds.SoundSource; 7 | import net.minecraftforge.api.distmarker.Dist; 8 | import net.minecraftforge.api.distmarker.OnlyIn; 9 | 10 | import javax.annotation.Nullable; 11 | 12 | /** 13 | * @author KilaBash 14 | * @date 2022/8/16 15 | * @implNote ComponentSound 16 | */ 17 | @OnlyIn(Dist.CLIENT) 18 | public class ComponentSound extends AbstractTickableSoundInstance { 19 | @Nullable 20 | public final IComponent component; 21 | public final SoundState soundState; 22 | 23 | protected ComponentSound(SoundEvent soundEvent, SoundState soundState, @Nullable IComponent component) { 24 | super(soundEvent, SoundSource.BLOCKS); 25 | this.component = component; 26 | this.soundState = soundState; 27 | this.looping = soundState.loop; 28 | this.delay = soundState.delay; 29 | this.volume = soundState.volume; 30 | this.pitch = soundState.pitch; 31 | if (component == null) { 32 | this.attenuation = Attenuation.NONE; 33 | return; 34 | } 35 | this.x = component.self().getBlockPos().getX() + 0.5; 36 | this.y = component.self().getBlockPos().getY() + 0.5; 37 | this.z = component.self().getBlockPos().getZ() + 0.5; 38 | } 39 | 40 | @Override 41 | public void tick() { 42 | if (component != null) { 43 | var level = component.self().getLevel(); 44 | if (!component.getStatus().equals(soundState.status) || level == null || component.self().isRemoved() || level.getBlockEntity(component.self().getBlockPos()) != component) { 45 | stop(); 46 | } 47 | } 48 | } 49 | 50 | public void stopSound() { 51 | super.stop(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/tile/DummyComponentTileEntity.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.tile; 2 | 3 | 4 | import com.lowdragmc.multiblocked.api.definition.ComponentDefinition; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | public class DummyComponentTileEntity extends ComponentTileEntity { 9 | public boolean isFormed; 10 | 11 | public DummyComponentTileEntity(ComponentDefinition definition, BlockPos pos, BlockState state) { 12 | super(definition, pos, state); 13 | } 14 | 15 | public void setDefinition(ComponentDefinition definition) { 16 | this.definition = definition; 17 | } 18 | 19 | 20 | @Override 21 | public boolean isFormed() { 22 | return isFormed; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/tile/IDynamicComponentTile.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.tile; 2 | 3 | import com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait; 4 | 5 | import java.util.Map; 6 | import java.util.function.BiConsumer; 7 | 8 | /** 9 | * @author youyihj 10 | */ 11 | public interface IDynamicComponentTile { 12 | Map> getTraitSetters(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/api/tile/part/IPartComponent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.api.tile.part; 2 | 3 | import com.lowdragmc.multiblocked.api.definition.PartDefinition; 4 | import com.lowdragmc.multiblocked.api.tile.IComponent; 5 | import com.lowdragmc.multiblocked.api.tile.IControllerComponent; 6 | import net.minecraft.core.BlockPos; 7 | import com.lowdragmc.multiblocked.api.definition.StatusProperties; 8 | 9 | 10 | import javax.annotation.Nonnull; 11 | import java.util.List; 12 | 13 | /** 14 | * @author KilaBash 15 | * @date 2022/06/02 16 | * @implNote IPartComponent 17 | */ 18 | public interface IPartComponent extends IComponent { 19 | List getControllers(); 20 | 21 | @Override 22 | PartDefinition getDefinition(); 23 | 24 | @Override 25 | default boolean isFormed() { 26 | for (IControllerComponent controller : getControllers()) { 27 | if (controller.isFormed()) { 28 | return true; 29 | } 30 | } 31 | return false; 32 | } 33 | 34 | @Override 35 | default String getStatus() { 36 | boolean isIdle = false; 37 | for (IControllerComponent controller : getControllers()) { 38 | if (controller.getStatus().equals(StatusProperties.IDLE)) { 39 | isIdle = true; 40 | } 41 | if (controller.getStatus().equals(StatusProperties.WORKING)) { 42 | return StatusProperties.WORKING; 43 | } 44 | } 45 | return isIdle ? StatusProperties.IDLE : StatusProperties.UNFORMED; 46 | } 47 | 48 | void addedToController(@Nonnull IControllerComponent controller); 49 | 50 | void removedFromController(@Nonnull IControllerComponent controller); 51 | 52 | default boolean canShared() { 53 | return getDefinition().canShared; 54 | } 55 | 56 | boolean hasController(BlockPos controllerPos); 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/client/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.client; 2 | 3 | import com.lowdragmc.lowdraglib.utils.CustomResourcePack; 4 | import com.lowdragmc.multiblocked.CommonProxy; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.api.registry.MbdComponents; 7 | import com.lowdragmc.multiblocked.api.registry.MbdItems; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.client.renderer.texture.TextureAtlas; 10 | import net.minecraft.resources.ResourceLocation; 11 | import net.minecraft.server.packs.repository.PackSource; 12 | import net.minecraftforge.api.distmarker.Dist; 13 | import net.minecraftforge.api.distmarker.OnlyIn; 14 | import net.minecraftforge.client.event.EntityRenderersEvent; 15 | import net.minecraftforge.client.event.TextureStitchEvent; 16 | import net.minecraftforge.eventbus.api.SubscribeEvent; 17 | import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 18 | 19 | @OnlyIn(Dist.CLIENT) 20 | public class ClientProxy extends CommonProxy { 21 | 22 | public ClientProxy() { 23 | if (Minecraft.getInstance() != null) { 24 | Minecraft.getInstance().getResourcePackRepository().addPackFinder(new CustomResourcePack(Multiblocked.location, PackSource.DEFAULT, Multiblocked.MODID, "Multiblocked Extended Resources", 6)); 25 | } 26 | } 27 | 28 | @SubscribeEvent 29 | public void clientSetup(final FMLClientSetupEvent e) { 30 | e.enqueueWork(()->{ 31 | MbdComponents.clientLastWork(); 32 | MbdItems.registerModelsProperties(); 33 | }); 34 | } 35 | 36 | @SubscribeEvent 37 | public void onRegisterRenderer(EntityRenderersEvent.RegisterRenderers event) { 38 | MbdComponents.registerBlockEntityRenderer(event); 39 | } 40 | 41 | @SubscribeEvent 42 | public void registerTextures(TextureStitchEvent.Pre event) { 43 | if (event.getAtlas().location().equals(TextureAtlas.LOCATION_BLOCKS)) { 44 | event.addSprite(new ResourceLocation("multiblocked:void")); 45 | event.addSprite(new ResourceLocation("multiblocked:blocks/gregtech_base")); 46 | event.addSprite(new ResourceLocation("multiblocked:blocks/gregtech_front")); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/client/renderer/ComponentTESR.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.client.renderer; 2 | 3 | import com.lowdragmc.lowdraglib.client.renderer.ATESRRendererProvider; 4 | 5 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; 6 | import net.minecraft.world.level.block.entity.BlockEntity; 7 | import net.minecraftforge.api.distmarker.Dist; 8 | import net.minecraftforge.api.distmarker.OnlyIn; 9 | 10 | /** 11 | * Author: KilaBash 12 | * Date: 2022/04/26 13 | * Description: 14 | */ 15 | @OnlyIn(Dist.CLIENT) 16 | public class ComponentTESR extends ATESRRendererProvider { 17 | 18 | public ComponentTESR(BlockEntityRendererProvider.Context context) { 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/client/renderer/IMultiblockedRenderer.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.client.renderer; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.JsonObject; 5 | import com.lowdragmc.lowdraglib.client.renderer.IRenderer; 6 | import com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture; 7 | import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 8 | import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; 9 | import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; 10 | import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; 11 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 12 | import com.lowdragmc.multiblocked.api.tile.IComponent; 13 | 14 | import java.util.function.Consumer; 15 | import java.util.function.Supplier; 16 | 17 | /** 18 | * Customizable renderer that supports serialization and visual configuration 19 | */ 20 | public interface IMultiblockedRenderer extends IRenderer { 21 | /** 22 | * unique type id. 23 | */ 24 | String getType(); 25 | 26 | default void onPostAccess(IComponent tileEntity) { 27 | 28 | } 29 | 30 | default void onPreAccess(IComponent tileEntity) { 31 | 32 | } 33 | 34 | default String getUnlocalizedName() { 35 | return "multiblocked.renderer." + getType(); 36 | } 37 | 38 | /** 39 | * deserialize. 40 | */ 41 | IMultiblockedRenderer fromJson(Gson gson, JsonObject jsonObject); 42 | 43 | /** 44 | * serialize. 45 | */ 46 | JsonObject toJson(Gson gson, JsonObject jsonObject); 47 | 48 | /** 49 | * should initialize renderer while it used. e.g. some renderer need to be loaded after blocks registered, like blockrenderer. 50 | */ 51 | default boolean isPostRenderer() { 52 | return false; 53 | } 54 | 55 | /** 56 | * configurator. 57 | * @param group group widget. 58 | * @param current current renderer. 59 | * @return called when updated. 60 | */ 61 | default Supplier createConfigurator(WidgetGroup parent, DraggableScrollableWidgetGroup group, IMultiblockedRenderer current) { 62 | group.addWidget(new LabelWidget(5,5,"multiblocked.gui.label.configurator")); 63 | return null; 64 | } 65 | 66 | default WidgetGroup createBoolSwitch(int x, int y, String text, String tips, boolean init, Consumer onPressed) { 67 | WidgetGroup widgetGroup = new WidgetGroup(x, y, 100, 15); 68 | widgetGroup.addWidget(new SwitchWidget(0, 0, 15, 15, (cd, r)->onPressed.accept(r)) 69 | .setBaseTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0,0,1,0.5)) 70 | .setPressedTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0,0.5,1,0.5)) 71 | .setHoverTexture(new ColorBorderTexture(1, 0xff545757)) 72 | .setPressed(init) 73 | .setHoverTooltips(tips)); 74 | widgetGroup.addWidget(new LabelWidget(20, 3, ()->text).setTextColor(-1).setDropShadow(true)); 75 | return widgetGroup; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/client/renderer/impl/MBDBlockStateRenderer.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.client.renderer.impl; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.JsonObject; 5 | import com.lowdragmc.lowdraglib.client.renderer.impl.BlockStateRenderer; 6 | import com.lowdragmc.lowdraglib.gui.widget.BlockSelectorWidget; 7 | import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; 8 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 9 | import com.lowdragmc.lowdraglib.utils.BlockInfo; 10 | import com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer; 11 | import net.minecraft.world.level.block.state.BlockState; 12 | 13 | import java.util.function.Supplier; 14 | 15 | /** 16 | * Author: KilaBash 17 | * Date: 2022/04/24 18 | * Description: 19 | */ 20 | public class MBDBlockStateRenderer extends BlockStateRenderer implements IMultiblockedRenderer { 21 | 22 | public static final IMultiblockedRenderer INSTANCE = new MBDBlockStateRenderer(); 23 | 24 | private MBDBlockStateRenderer() { } 25 | 26 | public MBDBlockStateRenderer(BlockState state) { 27 | super(state); 28 | } 29 | 30 | public MBDBlockStateRenderer(BlockInfo blockInfo) { 31 | super(blockInfo); 32 | } 33 | 34 | @Override 35 | public String getType() { 36 | return "blockstate"; 37 | } 38 | 39 | @Override 40 | public IMultiblockedRenderer fromJson(Gson gson, JsonObject jsonObject) { 41 | return new MBDBlockStateRenderer(gson.fromJson(jsonObject.get("state"), BlockState.class)); 42 | } 43 | 44 | @Override 45 | public JsonObject toJson(Gson gson, JsonObject jsonObject) { 46 | jsonObject.add("state", gson.toJsonTree(blockInfo.getBlockState(), BlockState.class)); 47 | return jsonObject; 48 | } 49 | 50 | @Override 51 | public boolean isPostRenderer() { 52 | return true; 53 | } 54 | 55 | @Override 56 | public Supplier createConfigurator(WidgetGroup parent, DraggableScrollableWidgetGroup group, IMultiblockedRenderer current) { 57 | BlockSelectorWidget blockSelectorWidget = new BlockSelectorWidget(0, 1, 180, true); 58 | if (current instanceof BlockStateRenderer) { 59 | blockSelectorWidget.setBlock(((BlockStateRenderer) current).blockInfo.getBlockState()); 60 | } 61 | group.addWidget(blockSelectorWidget); 62 | return () -> { 63 | if (blockSelectorWidget.getBlock() == null) { 64 | return null; 65 | } else { 66 | return new MBDBlockStateRenderer(blockSelectorWidget.getBlock()); 67 | } 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/client/renderer/impl/PedestalRenderer.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.client.renderer.impl; 2 | 3 | 4 | import com.lowdragmc.multiblocked.Multiblocked; 5 | import com.lowdragmc.multiblocked.common.tile.PedestalTileEntity; 6 | import com.mojang.blaze3d.vertex.PoseStack; 7 | import com.mojang.math.Vector3f; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.client.renderer.MultiBufferSource; 10 | import net.minecraft.client.renderer.block.model.ItemTransforms; 11 | import net.minecraft.client.renderer.texture.OverlayTexture; 12 | import net.minecraft.client.resources.model.BakedModel; 13 | import net.minecraft.resources.ResourceLocation; 14 | import net.minecraft.util.Mth; 15 | import net.minecraft.world.item.Item; 16 | import net.minecraft.world.item.ItemStack; 17 | import net.minecraft.world.level.block.entity.BlockEntity; 18 | import net.minecraftforge.api.distmarker.Dist; 19 | import net.minecraftforge.api.distmarker.OnlyIn; 20 | 21 | /** 22 | * @author KilaBash 23 | * @date 2022/7/20 24 | * @implNote PedestalRenderer 25 | */ 26 | public class PedestalRenderer extends MBDIModelRenderer{ 27 | public PedestalRenderer() { 28 | super(new ResourceLocation(Multiblocked.MODID,"block/pedestal")); 29 | } 30 | 31 | @Override 32 | @OnlyIn(Dist.CLIENT) 33 | public boolean hasTESR(BlockEntity BlockEntity) { 34 | return true; 35 | } 36 | 37 | @Override 38 | @OnlyIn(Dist.CLIENT) 39 | public void render(BlockEntity BlockEntity, float partialTicks, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { 40 | if (BlockEntity instanceof PedestalTileEntity tile) { 41 | ItemStack itemStack = tile.getItemStack(); 42 | Minecraft mc = Minecraft.getInstance(); 43 | if (!itemStack.isEmpty() && mc.level != null) { 44 | stack.pushPose(); 45 | int i = itemStack.isEmpty() ? 187 : Item.getId(itemStack.getItem()) + itemStack.getDamageValue(); 46 | mc.level.random.setSeed(i); 47 | BakedModel bakedmodel = mc.getItemRenderer().getModel(itemStack, tile.getLevel(), null, i); 48 | boolean flag = bakedmodel.isGui3d(); 49 | 50 | float time = (System.currentTimeMillis() % 2400000) / 50f; 51 | float yOffset = Mth.sin(time / 10.0F) * 0.1F + 1.3F; 52 | stack.translate(0.5D, yOffset, 0.5D); 53 | float rotation = time * Mth.TWO_PI / 80; 54 | stack.mulPose(Vector3f.YP.rotation(rotation)); 55 | stack.pushPose(); 56 | mc.getItemRenderer().render(itemStack, ItemTransforms.TransformType.GROUND, false, stack, buffer, combinedLight, OverlayTexture.NO_OVERLAY, bakedmodel); 57 | stack.popPose(); 58 | if (!flag) { 59 | stack.translate(0.0, 0.0, 0.09375F); 60 | } 61 | stack.popPose(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/common/block/CreateBlockComponent.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.common.block; 2 | 3 | import com.lowdragmc.multiblocked.api.block.BlockComponent; 4 | import com.lowdragmc.multiblocked.api.definition.ComponentDefinition; 5 | import com.lowdragmc.multiblocked.common.tile.CreateKineticSourceTileEntity; 6 | import com.simibubi.create.content.kinetics.base.IRotate; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.LevelReader; 9 | import net.minecraft.world.level.block.entity.BlockEntity; 10 | import net.minecraft.world.level.block.entity.BlockEntityTicker; 11 | import net.minecraft.world.level.block.entity.BlockEntityType; 12 | import net.minecraft.world.level.block.state.BlockState; 13 | import net.minecraft.world.level.block.state.properties.BlockStateProperties; 14 | import net.minecraft.core.Direction; 15 | import net.minecraft.core.BlockPos; 16 | import org.jetbrains.annotations.Nullable; 17 | 18 | /** 19 | * @author KilaBash 20 | * @date 2022/06/02 21 | * @implNote CreateBlockComponent, create block. 22 | */ 23 | public class CreateBlockComponent extends BlockComponent implements IRotate { 24 | 25 | public CreateBlockComponent(ComponentDefinition definition) { 26 | super(definition); 27 | } 28 | 29 | @Override 30 | public boolean hasShaftTowards(LevelReader levelReader, BlockPos blockPos, BlockState blockState, Direction direction) { 31 | return blockState.getValue(BlockStateProperties.FACING) == direction; 32 | } 33 | 34 | @Override 35 | public Direction.Axis getRotationAxis(BlockState state) { 36 | return state.getValue(BlockStateProperties.FACING).getAxis(); 37 | } 38 | 39 | @Nullable 40 | @Override 41 | public BlockEntityTicker getTicker(Level pLevel, BlockState pState, BlockEntityType pBlockEntityType) { 42 | return (level, blockPos, blockState, t) -> { 43 | if (level.getBlockEntity(blockPos) instanceof CreateKineticSourceTileEntity createKineticSourceTile) { 44 | createKineticSourceTile.tick(); 45 | } 46 | }; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/common/capability/trait/EMCPlayerCapabilityTrait.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.common.capability.trait; 2 | 3 | import com.lowdragmc.multiblocked.api.capability.trait.PlayerCapabilityTrait; 4 | import com.lowdragmc.multiblocked.common.capability.EMCProjectECapability; 5 | import moze_intel.projecte.api.capabilities.IKnowledgeProvider; 6 | import moze_intel.projecte.api.capabilities.PECapabilities; 7 | import net.minecraft.server.level.ServerPlayer; 8 | import net.minecraft.world.entity.player.Player; 9 | 10 | import java.math.BigInteger; 11 | 12 | public class EMCPlayerCapabilityTrait extends PlayerCapabilityTrait { 13 | 14 | public EMCPlayerCapabilityTrait() { 15 | super(EMCProjectECapability.CAP); 16 | } 17 | 18 | public IKnowledgeProvider getCapability() { 19 | Player player = getPlayer(); 20 | return player == null ? null : player.getCapability(PECapabilities.KNOWLEDGE_CAPABILITY, null).orElse(null); 21 | } 22 | 23 | public BigInteger updateEMC(BigInteger emc, boolean simulate) { 24 | Player player = getPlayer(); 25 | if (player instanceof ServerPlayer serverPlayer) { 26 | IKnowledgeProvider emcCap = getCapability(); 27 | if (emcCap != null) { 28 | BigInteger stored = emcCap.getEmc(); 29 | BigInteger emcL = stored.add(emc).max(BigInteger.ZERO); 30 | if (!simulate) { 31 | emcCap.setEmc(emcL); 32 | emcCap.sync(serverPlayer); // send to client 33 | } 34 | return emcL.subtract(stored.add(emc)).abs(); 35 | } 36 | } 37 | return emc.abs(); 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/common/capability/trait/EntityCapabilityTrait.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.common.capability.trait; 2 | 3 | import com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait; 4 | import com.lowdragmc.multiblocked.common.capability.EntityMultiblockCapability; 5 | 6 | /** 7 | * @author KilaBash 8 | * @date 2022/8/3 9 | * @implNote EntityCapabilityTrait 10 | */ 11 | public class EntityCapabilityTrait extends CapabilityTrait { 12 | 13 | public EntityCapabilityTrait() { 14 | super(EntityMultiblockCapability.CAP); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/common/definition/CreatePartDefinition.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.common.definition; 2 | 3 | import com.google.gson.JsonObject; 4 | import com.lowdragmc.multiblocked.api.definition.PartDefinition; 5 | import com.lowdragmc.multiblocked.common.tile.CreateKineticSourceTileEntity; 6 | import net.minecraft.resources.ResourceLocation; 7 | import net.minecraft.util.GsonHelper; 8 | 9 | /** 10 | * @author KilaBash 11 | * @date 2022/06/02 12 | * @implNote CreateStressDefinition 13 | */ 14 | public class CreatePartDefinition extends PartDefinition { 15 | 16 | public boolean isOutput; 17 | public float stress; 18 | 19 | // used for Gson 20 | public CreatePartDefinition() { 21 | this(null); 22 | } 23 | 24 | public CreatePartDefinition(ResourceLocation location) { 25 | super(location, CreateKineticSourceTileEntity.class); 26 | canShared = false; 27 | stress = 4; 28 | isOutput = false; 29 | } 30 | 31 | @Override 32 | public void fromJson(JsonObject json) { 33 | super.fromJson(json); 34 | isOutput = GsonHelper.getAsBoolean(json, "isOutput", isOutput); 35 | stress = GsonHelper.getAsFloat(json, "stress", stress); 36 | } 37 | 38 | @Override 39 | public JsonObject toJson(JsonObject json) { 40 | json = super.toJson(json); 41 | json.addProperty("isOutput", isOutput); 42 | json.addProperty("stress", stress); 43 | return json; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/common/gui/component/CreatePartWidget.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.common.gui.component; 2 | 3 | import com.google.gson.JsonObject; 4 | import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; 5 | import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; 6 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 7 | import com.lowdragmc.multiblocked.api.gui.GuiUtils; 8 | import com.lowdragmc.multiblocked.api.gui.blueprint_table.components.ComponentWidget; 9 | import com.lowdragmc.multiblocked.common.definition.CreatePartDefinition; 10 | import net.minecraft.util.Mth; 11 | 12 | import java.util.function.Consumer; 13 | 14 | public class CreatePartWidget extends ComponentWidget { 15 | 16 | public CreatePartWidget(WidgetGroup group, CreatePartDefinition definition, Consumer onSave) { 17 | super(group, definition, onSave); 18 | int x = 47; 19 | S1.addWidget(GuiUtils.createBoolSwitch(x + 140, 165, "isOutput", "multiblocked.gui.widget.part.create.output", definition.isOutput, r -> definition.isOutput = r)); 20 | S1.addWidget(new TextFieldWidget(x + 100, 182, 60, 11, null, stress -> definition.stress = Mth.clamp(Float.parseFloat(stress), 1, 256)).setNumbersOnly(1, 256).setCurrentString(definition.stress + "")); 21 | S1.addWidget(new LabelWidget(x + 165, 184, "basic Stress").setDropShadow(true)); 22 | S3.clearAllWidgets(); 23 | } 24 | 25 | @Override 26 | protected JsonObject getJsonObj() { 27 | JsonObject jsonObject = super.getJsonObj(); 28 | jsonObject.addProperty("type", "create_part"); 29 | return jsonObject; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/BlockMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import com.lowdragmc.multiblocked.api.block.BlockComponent; 4 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.BlockGetter; 7 | import net.minecraft.world.level.block.Block; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.core.Direction; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | @Mixin(Block.class) 16 | public class BlockMixin { 17 | 18 | @Inject(method = "shouldRenderFace", at = @At(value = "HEAD"), cancellable = true) 19 | private static void injectShouldRenderFace(BlockState state, 20 | BlockGetter p_152446_, 21 | BlockPos pos, 22 | Direction facing, 23 | BlockPos p_152449_, 24 | CallbackInfoReturnable cir) { 25 | if (state.getBlock() instanceof BlockComponent && !state.canOcclude()) { 26 | cir.setReturnValue(true); 27 | } else if (MultiblockWorldSavedData.isModelDisabled(pos.relative(facing))) { 28 | cir.setReturnValue(true); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/ChunkMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import com.lowdragmc.multiblocked.api.pattern.MultiblockState; 4 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.Level; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import net.minecraft.server.MinecraftServer; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | import org.objectweb.asm.Opcodes; 11 | import org.spongepowered.asm.mixin.Final; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.Shadow; 14 | import org.spongepowered.asm.mixin.injection.At; 15 | import org.spongepowered.asm.mixin.injection.Inject; 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 17 | 18 | @Mixin(LevelChunk.class) 19 | public class ChunkMixin { 20 | @Final @Shadow Level level; 21 | 22 | // We want to be as quick as possible here 23 | @Inject(method = "setBlockState", at =@At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/level/Level;captureBlockSnapshots:Z")) 24 | private void onAddingBlock(BlockPos pos, BlockState state, boolean isMoving, CallbackInfoReturnable cir) { 25 | MinecraftServer server = level.getServer(); 26 | if (server != null) { 27 | server.executeBlocking(() -> { 28 | for (MultiblockState structure : MultiblockWorldSavedData.getOrCreate(level).getControllerInChunk(((LevelChunk)(Object)this).getPos())) { 29 | if (structure.isPosInCache(pos)) { 30 | structure.onBlockStateChanged(pos); 31 | } 32 | } 33 | }); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/NBTIngredientMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | import net.minecraftforge.common.crafting.NBTIngredient; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(NBTIngredient.class) 9 | public interface NBTIngredientMixin { 10 | @Accessor(value = "stack", remap = false) 11 | ItemStack getStack(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/RecipeManagerMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | import net.minecraft.world.Container; 5 | import net.minecraft.world.item.crafting.Recipe; 6 | import net.minecraft.world.item.crafting.RecipeManager; 7 | import net.minecraft.world.item.crafting.RecipeType; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Invoker; 10 | 11 | import java.util.Map; 12 | 13 | @Mixin(RecipeManager.class) 14 | public interface RecipeManagerMixin { 15 | @Invoker("byType") 16 | > Map> mbd_byType(RecipeType type); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/ReloadMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import com.lowdragmc.multiblocked.api.recipe.serde.recipe.MBDRecipeReloadListener; 4 | import com.lowdragmc.multiblocked.common.recipe.conditions.PredicateCondition; 5 | import net.minecraft.commands.CommandSourceStack; 6 | import net.minecraft.server.commands.ReloadCommand; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | import java.util.Collection; 13 | 14 | @Mixin(ReloadCommand.class) 15 | public class ReloadMixin { 16 | @Inject(method = "reloadPacks", at = @At("RETURN")) 17 | private static void reloadPacks(Collection p_138236_, CommandSourceStack p_138237_, CallbackInfo ci) { 18 | MBDRecipeReloadListener.INSTANCE.reloadRecipes(); 19 | } 20 | 21 | /** 22 | * Because KubeJs add recipes too early, and the predicate map is not cleared. 23 | * We need to clear the map before the recipe added. 24 | */ 25 | @Inject(method = "reloadPacks", at = @At("HEAD")) 26 | private static void onReloadPacksHead(Collection pSelectedIds, CommandSourceStack pSource, CallbackInfo ci) { 27 | PredicateCondition.PREDICATE_MAP.clear(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/RenderChunkMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import com.mojang.blaze3d.vertex.PoseStack; 5 | import com.mojang.blaze3d.vertex.VertexConsumer; 6 | import net.minecraft.client.renderer.block.BlockRenderDispatcher; 7 | import net.minecraft.world.level.BlockAndTintGetter; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.core.BlockPos; 10 | import net.minecraftforge.client.model.data.IModelData; 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Redirect; 14 | 15 | import java.util.Random; 16 | 17 | @Mixin(targets = {"net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$RebuildTask"}) 18 | public class RenderChunkMixin { 19 | @Redirect(method = "compile", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/block/BlockRenderDispatcher;renderBatched(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLjava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Z")) 20 | private boolean injectRenderModel( 21 | BlockRenderDispatcher blockRendererDispatcher, 22 | BlockState pState, BlockPos pPos, BlockAndTintGetter pLevel, 23 | PoseStack pPoseStack, VertexConsumer pConsumer, 24 | boolean pCheckSides, Random pRandom, 25 | IModelData modelData) { 26 | MultiblockWorldSavedData.isBuildingChunk.set(true); 27 | if (MultiblockWorldSavedData.isModelDisabled(pPos)) { 28 | MultiblockWorldSavedData.isBuildingChunk.set(false); 29 | return false; 30 | } 31 | boolean result = blockRendererDispatcher.renderBatched(pState, pPos, pLevel, pPoseStack, pConsumer, pCheckSides, pRandom, modelData); 32 | MultiblockWorldSavedData.isBuildingChunk.set(false); 33 | return result; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/TileEntityRendererDispatcherMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins; 2 | 3 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; 6 | import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; 7 | import net.minecraft.world.level.block.entity.BlockEntity; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(BlockEntityRenderDispatcher.class) 14 | public class TileEntityRendererDispatcherMixin { 15 | 16 | @Inject(method = "getRenderer", at = @At(value = "HEAD"), cancellable = true) 17 | private void injectGetRenderer(T tileEntity, CallbackInfoReturnable> cir) { 18 | if (tileEntity != null) { 19 | if (tileEntity.getLevel() == Minecraft.getInstance().level && MultiblockWorldSavedData.modelDisabled.contains(tileEntity.getBlockPos())) { 20 | cir.setReturnValue(null); 21 | } 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/rubidium/BlockOcclusionCacheMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins.rubidium; 2 | 3 | import com.lowdragmc.multiblocked.api.block.BlockComponent; 4 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 5 | import me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache; 6 | import net.minecraft.core.BlockPos; 7 | import net.minecraft.core.Direction; 8 | import net.minecraft.world.level.BlockGetter; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | /** 16 | * @author KilaBash 17 | * @date 2022/05/29 18 | * @implNote BlockOcclusionCacheMixin 19 | */ 20 | @Mixin(BlockOcclusionCache.class) 21 | public class BlockOcclusionCacheMixin { 22 | @Inject(method = "shouldDrawSide", at = @At(value = "HEAD"), cancellable = true, remap = false) 23 | public void injectShouldRenderFace(BlockState state, 24 | BlockGetter view, BlockPos pos, 25 | Direction facing, 26 | CallbackInfoReturnable cir) { 27 | if (state.getBlock() instanceof BlockComponent && !state.canOcclude()) { 28 | cir.setReturnValue(true); 29 | } else if (MultiblockWorldSavedData.isModelDisabled(pos.relative(facing))) { 30 | cir.setReturnValue(true); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/core/mixins/rubidium/ChunkRenderRebuildTaskMixin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.core.mixins.rubidium; 2 | 3 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import me.jellysquid.mods.sodium.client.render.chunk.compile.buffers.ChunkModelBuilder; 5 | import me.jellysquid.mods.sodium.client.render.chunk.tasks.ChunkRenderRebuildTask; 6 | import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer; 7 | import net.minecraft.client.resources.model.BakedModel; 8 | import net.minecraft.core.BlockPos; 9 | import net.minecraft.world.level.BlockAndTintGetter; 10 | import net.minecraft.world.level.block.state.BlockState; 11 | import net.minecraftforge.client.model.data.IModelData; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Redirect; 15 | 16 | /** 17 | * @author KilaBash 18 | * @date 2022/05/29 19 | * @implNote ChunkRenderRebuildTaskMixin 20 | */ 21 | @Mixin(ChunkRenderRebuildTask.class) 22 | public class ChunkRenderRebuildTaskMixin { 23 | 24 | @Redirect(method = "performBuild", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/pipeline/BlockRenderer;renderModel(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;Lnet/minecraft/client/resources/model/BakedModel;Lme/jellysquid/mods/sodium/client/render/chunk/compile/buffers/ChunkModelBuilder;ZJLnet/minecraftforge/client/model/data/IModelData;)Z"), 25 | remap = false) 26 | public boolean injectPerformBuild(BlockRenderer blockRenderer, 27 | BlockAndTintGetter world, BlockState state, 28 | BlockPos pos, BlockPos origin, 29 | BakedModel model, 30 | ChunkModelBuilder buffers, 31 | boolean cull, 32 | long seed, 33 | IModelData modelData) { 34 | MultiblockWorldSavedData.isBuildingChunk.set(true); 35 | if (MultiblockWorldSavedData.isModelDisabled(pos)) { 36 | MultiblockWorldSavedData.isBuildingChunk.set(false); 37 | return false; 38 | } 39 | boolean result = blockRenderer.renderModel(world, state, pos, origin, model, buffers, cull, seed, modelData); 40 | MultiblockWorldSavedData.isBuildingChunk.set(false); 41 | return result; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/events/ClientListeners.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.events; 2 | 3 | import com.lowdragmc.multiblocked.Multiblocked; 4 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraftforge.api.distmarker.Dist; 7 | import net.minecraftforge.event.world.WorldEvent; 8 | import net.minecraftforge.eventbus.api.SubscribeEvent; 9 | import net.minecraftforge.fml.common.Mod; 10 | 11 | /** 12 | * Author: KilaBash 13 | * Date: 2022/04/26 14 | * Description: 15 | */ 16 | @Mod.EventBusSubscriber(modid = Multiblocked.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) 17 | public class ClientListeners { 18 | 19 | @SubscribeEvent 20 | public static void onWorldUnload(WorldEvent.Unload event) { 21 | if (Minecraft.getInstance().level == event.getWorld()) { 22 | MultiblockWorldSavedData.clearDisabled(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/jei/multipage/MultiblockInfoWrapper.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.jei.multipage; 2 | 3 | import com.lowdragmc.lowdraglib.jei.ModularWrapper; 4 | import com.lowdragmc.multiblocked.api.definition.ControllerDefinition; 5 | import com.lowdragmc.multiblocked.api.gui.controller.structure.PatternWidget; 6 | 7 | public class MultiblockInfoWrapper extends ModularWrapper { 8 | public final ControllerDefinition definition; 9 | 10 | public MultiblockInfoWrapper(ControllerDefinition definition) { 11 | super(PatternWidget.getPatternWidget(definition)); 12 | this.definition = definition; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/jei/recipepage/FuelWrapper.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.jei.recipepage; 2 | 3 | import com.lowdragmc.lowdraglib.jei.ModularWrapper; 4 | import com.lowdragmc.multiblocked.api.gui.recipe.FuelWidget; 5 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 6 | 7 | public class FuelWrapper extends ModularWrapper { 8 | 9 | public final Recipe recipe; 10 | 11 | public FuelWrapper(FuelWidget widget) { 12 | super(widget); 13 | recipe = widget.recipe; 14 | } 15 | 16 | @Override 17 | public String getUid() { 18 | return recipe.uid; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/jei/recipepage/RecipeWrapper.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.jei.recipepage; 2 | 3 | import com.lowdragmc.lowdraglib.gui.widget.Widget; 4 | import com.lowdragmc.lowdraglib.jei.ModularWrapper; 5 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 6 | 7 | public class RecipeWrapper extends ModularWrapper { 8 | 9 | public final Recipe recipe; 10 | 11 | public RecipeWrapper(Widget widget, Recipe recipe) { 12 | super(widget); 13 | this.recipe = recipe; 14 | } 15 | 16 | @Override 17 | public String getUid() { 18 | return recipe.uid; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/network/MultiblockedNetworking.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.network; 2 | 3 | import com.lowdragmc.lowdraglib.networking.IPacket; 4 | import com.lowdragmc.lowdraglib.networking.Networking; 5 | import com.lowdragmc.multiblocked.Multiblocked; 6 | import com.lowdragmc.multiblocked.network.s2c.SPacketCommand; 7 | import com.lowdragmc.multiblocked.network.s2c.SPacketRemoveDisabledRendering; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraft.server.level.ServerPlayer; 10 | 11 | /** 12 | * Author: KilaBash 13 | * Date: 2022/04/27 14 | * Description: 15 | */ 16 | public class MultiblockedNetworking { 17 | 18 | private static final Networking network = new Networking(new ResourceLocation(Multiblocked.MODID, "networking"), "0.0.1"); 19 | 20 | public static void init() { 21 | network.registerS2C(SPacketRemoveDisabledRendering.class); 22 | network.registerS2C(SPacketCommand.class); 23 | } 24 | 25 | public static void sendToServer(IPacket packet) { 26 | network.sendToServer(packet); 27 | } 28 | 29 | public static void sendToAll(IPacket packet) { 30 | network.sendToAll(packet); 31 | } 32 | 33 | public static void sendToPlayer(IPacket packet, ServerPlayer player) { 34 | network.sendToPlayer(packet, player); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/network/s2c/SPacketCommand.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.network.s2c; 2 | 3 | import com.lowdragmc.lowdraglib.networking.IPacket; 4 | import net.minecraft.network.FriendlyByteBuf; 5 | import net.minecraftforge.api.distmarker.Dist; 6 | import net.minecraftforge.api.distmarker.OnlyIn; 7 | import net.minecraftforge.network.NetworkEvent; 8 | 9 | public class SPacketCommand implements IPacket { 10 | private String cmd; 11 | 12 | public SPacketCommand() { 13 | } 14 | 15 | public SPacketCommand(String cmd) { 16 | this.cmd = cmd; 17 | } 18 | 19 | @Override 20 | public void encode(FriendlyByteBuf buf) { 21 | buf.writeUtf(cmd); 22 | } 23 | 24 | @Override 25 | public void decode(FriendlyByteBuf buf) { 26 | this.cmd = buf.readUtf(); 27 | } 28 | 29 | @Override 30 | @OnlyIn(Dist.CLIENT) 31 | public void execute(NetworkEvent.Context handler) { 32 | // if (Minecraft.getMinecraft().player != null) { 33 | // Minecraft.getMinecraft().player.sendMessage(new TextComponentString(cmd)); 34 | // } 35 | // if (cmd.startsWith("nbt: ")) { 36 | // String tag = cmd.substring(5); 37 | // if (Minecraft.getMinecraft().player != null) { 38 | // Minecraft.getMinecraft().player.sendMessage(new TextComponentString( 39 | // TextFormatting.RED + "tag has been copied to the paste board")); 40 | // GuiScreen.setClipboardString(tag); 41 | // } 42 | // 43 | // } else if (cmd.equals("reload_shaders")) { 44 | // Shaders.reload(); 45 | // ShaderTextureParticle.clearShaders(); 46 | // ShaderTextureParticle.FBOShaderHandler.FBO.deleteFramebuffer(); 47 | // ShaderTextureParticle.FBOShaderHandler.FBO.createFramebuffer(1024, 1024); 48 | // } 49 | // return null; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/network/s2c/SPacketRemoveDisabledRendering.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.network.s2c; 2 | 3 | import com.lowdragmc.lowdraglib.networking.IPacket; 4 | import com.lowdragmc.multiblocked.persistence.MultiblockWorldSavedData; 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.network.FriendlyByteBuf; 7 | import net.minecraftforge.api.distmarker.Dist; 8 | import net.minecraftforge.api.distmarker.OnlyIn; 9 | import net.minecraftforge.network.NetworkEvent; 10 | 11 | public class SPacketRemoveDisabledRendering implements IPacket { 12 | private BlockPos controllerPos; 13 | 14 | public SPacketRemoveDisabledRendering() { 15 | } 16 | 17 | public SPacketRemoveDisabledRendering(BlockPos controllerPos) { 18 | this.controllerPos = controllerPos; 19 | } 20 | 21 | @Override 22 | public void encode(FriendlyByteBuf buf) { 23 | buf.writeVarLong(controllerPos.asLong()); 24 | } 25 | 26 | @Override 27 | public void decode(FriendlyByteBuf buf) { 28 | this.controllerPos = BlockPos.of(buf.readVarLong()); 29 | } 30 | 31 | @Override 32 | @OnlyIn(Dist.CLIENT) 33 | public void execute(NetworkEvent.Context handler) { 34 | MultiblockWorldSavedData.removeDisableModel(controllerPos); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/persistence/IAsyncThreadUpdate.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.persistence; 2 | 3 | public interface IAsyncThreadUpdate { 4 | void asyncThreadLogic(long periodID); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/rei/REIClientPlugin.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.rei; 2 | 3 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 4 | import com.lowdragmc.multiblocked.api.recipe.serde.recipe.MBDRecipeType; 5 | import com.lowdragmc.multiblocked.rei.multipage.MultiblockInfoDisplayCategory; 6 | import com.lowdragmc.multiblocked.rei.recipepage.RecipeMapDisplayCategory; 7 | import com.lowdragmc.multiblocked.rei.recipepage.RecipeMapFuelDisplayCategory; 8 | import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; 9 | import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; 10 | import me.shedaniel.rei.forge.REIPluginClient; 11 | import net.minecraft.client.Minecraft; 12 | 13 | /** 14 | * @author KilaBash 15 | * @date 2022/11/27 16 | * @implNote REIPlugin 17 | */ 18 | @REIPluginClient 19 | public class REIClientPlugin implements me.shedaniel.rei.api.client.plugins.REIClientPlugin { 20 | @Override 21 | public void registerCategories(CategoryRegistry registry) { 22 | registry.add(new MultiblockInfoDisplayCategory()); 23 | for (RecipeMap recipeMap : RecipeMap.RECIPE_MAP_REGISTRY.values()) { 24 | if (recipeMap == RecipeMap.EMPTY) continue; 25 | registry.add(new RecipeMapDisplayCategory(recipeMap)); 26 | if (recipeMap.isFuelRecipeMap()) { 27 | registry.add(new RecipeMapFuelDisplayCategory(recipeMap)); 28 | } 29 | } 30 | // workstations 31 | MultiblockInfoDisplayCategory.registerWorkStations(registry); 32 | RecipeMapDisplayCategory.registerWorkStations(registry); 33 | RecipeMapFuelDisplayCategory.registerWorkStations(registry); 34 | } 35 | 36 | @Override 37 | public void registerDisplays(DisplayRegistry registry) { 38 | MBDRecipeType.loadRecipes(Minecraft.getInstance().getConnection().getRecipeManager(), true); 39 | MultiblockInfoDisplayCategory.registerDisplays(registry); 40 | RecipeMapDisplayCategory.registerDisplays(registry); 41 | RecipeMapFuelDisplayCategory.registerDisplays(registry); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/rei/multipage/MultiblockInfoDisplay.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.rei.multipage; 2 | 3 | import com.lowdragmc.lowdraglib.rei.ModularDisplay; 4 | import com.lowdragmc.multiblocked.api.definition.ControllerDefinition; 5 | import com.lowdragmc.multiblocked.api.gui.controller.structure.PatternWidget; 6 | 7 | public class MultiblockInfoDisplay extends ModularDisplay { 8 | public final ControllerDefinition definition; 9 | 10 | public MultiblockInfoDisplay(ControllerDefinition definition) { 11 | super(() -> { 12 | PatternWidget patternWidget = new PatternWidget(definition, true); 13 | patternWidget.reset(0); 14 | return patternWidget; 15 | }, MultiblockInfoDisplayCategory.CATEGORY); 16 | this.definition = definition; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/rei/recipepage/FuelDisplay.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.rei.recipepage; 2 | 3 | import com.lowdragmc.lowdraglib.rei.ModularDisplay; 4 | import com.lowdragmc.multiblocked.api.gui.recipe.FuelWidget; 5 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 6 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 7 | 8 | /** 9 | * @author KilaBash 10 | * @date 2022/11/29 11 | * @implNote FuelDisplay 12 | */ 13 | public class FuelDisplay extends ModularDisplay { 14 | public FuelDisplay(RecipeMap recipeMap, Recipe recipe) { 15 | super(() -> new FuelWidget(recipeMap, recipe), RecipeMapFuelDisplayCategory.CATEGORIES.apply(recipeMap)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lowdragmc/multiblocked/rei/recipepage/RecipeDisplay.java: -------------------------------------------------------------------------------- 1 | package com.lowdragmc.multiblocked.rei.recipepage; 2 | 3 | import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; 4 | import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; 5 | import com.lowdragmc.lowdraglib.rei.ModularDisplay; 6 | import com.lowdragmc.multiblocked.Multiblocked; 7 | import com.lowdragmc.multiblocked.api.gui.recipe.RecipeWidget; 8 | import com.lowdragmc.multiblocked.api.kubejs.events.RecipeUIEvent; 9 | import com.lowdragmc.multiblocked.api.recipe.Recipe; 10 | import com.lowdragmc.multiblocked.api.recipe.RecipeMap; 11 | import dev.latvian.mods.kubejs.script.ScriptType; 12 | 13 | public class RecipeDisplay extends ModularDisplay { 14 | 15 | public RecipeDisplay(RecipeMap recipeMap, Recipe recipe) { 16 | super(() -> { 17 | WidgetGroup recipeWidget = recipeMap.createLDLibUI(recipe); 18 | if (recipeWidget == null) { 19 | recipeWidget = new RecipeWidget( 20 | recipeMap, 21 | recipe, 22 | ProgressWidget.JEIProgress, 23 | ProgressWidget.JEIProgress); 24 | } 25 | if (Multiblocked.isKubeJSLoaded()) { 26 | new RecipeUIEvent(recipeWidget).post(ScriptType.CLIENT, RecipeUIEvent.ID, recipeMap.name); 27 | } 28 | return recipeWidget; 29 | }, RecipeMapDisplayCategory.CATEGORIES.apply(recipeMap)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/mods.toml: -------------------------------------------------------------------------------- 1 | modLoader="javafml" #mandatory 2 | loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. 3 | license="The MIT License (MIT)" 4 | #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional 5 | 6 | [[mods]] #mandatory 7 | modId="multiblocked" #mandatory 8 | version="${file.jarVersion}" #mandatory 9 | displayName="Multiblocked" #mandatory 10 | #updateJSONURL="https://change.me.example.invalid/updates.json" #optional 11 | #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional 12 | logoFile="icon.png" #optional 13 | credits="" #optional 14 | authors="KilaBash" #optional 15 | # The description text for the mod (multi line!) (#mandatory) 16 | description='''Multiblocked, a mod for custom multiblock.''' 17 | 18 | [[dependencies.multiblocked]] #optional 19 | modId="forge" #mandatory 20 | mandatory=true #mandatory 21 | versionRange="[40,)" #mandatory 22 | ordering="NONE" 23 | side="BOTH" 24 | # Here's another dependency 25 | [[dependencies.multiblocked]] 26 | modId="multiblocked" 27 | mandatory=true 28 | # This version range declares a minimum of the current minecraft version up to but not including the next major version 29 | versionRange="[1.18.2,1.19)" 30 | ordering="NONE" 31 | side="BOTH" 32 | [[dependencies.multiblocked]] 33 | modId="ldlib" 34 | mandatory=true 35 | versionRange="[1.0.8,)" 36 | ordering="AFTER" 37 | side="BOTH" 38 | [[dependencies.multiblocked]] 39 | modId="geckolib3" 40 | mandatory=false 41 | versionRange="[3.0.42,)" 42 | ordering="NONE" 43 | side="CLIENT" 44 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/blockstates/test_block.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { "model": "ldlib:block/test_block" } 4 | } 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/create/mbd_create_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "isOutput": false, 3 | "stress": 4.0, 4 | "canShared": false, 5 | "location": "multiblocked:create_input", 6 | "traits": {}, 7 | "allowRotate": true, 8 | "showInJei": true, 9 | "baseRenderer": { 10 | "baseTexture": "multiblocked:blocks/casing/create", 11 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_in", 12 | "formedAsController": true, 13 | "type": "gregtech" 14 | }, 15 | "properties": { 16 | "isOpaque": true, 17 | "destroyTime": 1.5, 18 | "explosionResistance": 6.0, 19 | "harvestLevel": 1, 20 | "lightEmissive": 0, 21 | "speedFactor": 1.0, 22 | "jumpFactor": 1.0, 23 | "friction": 0.6, 24 | "hasCollision": true, 25 | "tabGroup": "multiblocked.all", 26 | "stackSize": 64 27 | }, 28 | "type": "create_part" 29 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/create/mbd_create_output.json: -------------------------------------------------------------------------------- 1 | { 2 | "isOutput": true, 3 | "stress": 4.0, 4 | "canShared": false, 5 | "location": "multiblocked:create_output", 6 | "traits": {}, 7 | "allowRotate": true, 8 | "showInJei": true, 9 | "baseRenderer": { 10 | "baseTexture": "multiblocked:blocks/casing/create", 11 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_out", 12 | "formedAsController": true, 13 | "type": "gregtech" 14 | }, 15 | "properties": { 16 | "isOpaque": true, 17 | "destroyTime": 1.5, 18 | "explosionResistance": 6.0, 19 | "harvestLevel": 1, 20 | "lightEmissive": 0, 21 | "speedFactor": 1.0, 22 | "jumpFactor": 1.0, 23 | "friction": 0.6, 24 | "hasCollision": true, 25 | "tabGroup": "multiblocked.all", 26 | "stackSize": 64 27 | }, 28 | "type": "create_part" 29 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_energy_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:energy_input", 4 | "traits": { 5 | "gtce_energy": { 6 | "cIO": 0, 7 | "gIO": 2, 8 | "mIO": 0, 9 | "x": 8, 10 | "y": 80, 11 | "width": 160, 12 | "height": 9, 13 | "texture": "multiblocked:textures/gui/energy_bar.png", 14 | "capacity": 10000000 15 | }, 16 | "forge_energy": { 17 | "cIO": 0, 18 | "gIO": 2, 19 | "mIO": 0, 20 | "x": 30, 21 | "y": 98, 22 | "width": 120, 23 | "height": 9, 24 | "texture": "multiblocked:textures/gui/energy_bar.png", 25 | "capacity": 100000, 26 | "maxReceive": 5000, 27 | "maxExtract": 5000 28 | } 29 | }, 30 | "allowRotate": true, 31 | "showInJei": true, 32 | "baseRenderer": { 33 | "baseTexture": "multiblocked:blocks/casing/base", 34 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_in", 35 | "formedAsController": true, 36 | "type": "gregtech" 37 | }, 38 | "properties": { 39 | "isOpaque": true, 40 | "destroyTime": 5.0, 41 | "explosionResistance": 6.0, 42 | "harvestLevel": 1, 43 | "lightEmissive": 0, 44 | "speedFactor": 1.0, 45 | "jumpFactor": 1.0, 46 | "friction": 0.6, 47 | "hasCollision": true, 48 | "tabGroup": "multiblocked.all", 49 | "stackSize": 64 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_energy_output.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:energy_output", 4 | "traits": { 5 | "gtce_energy": { 6 | "cIO": 1, 7 | "gIO": 2, 8 | "mIO": 1, 9 | "x": 9, 10 | "y": 81, 11 | "width": 160, 12 | "height": 9, 13 | "texture": "multiblocked:textures/gui/energy_bar.png", 14 | "capacity": 10000 15 | }, 16 | "exu2_gp": { 17 | "x": 30, 18 | "y": 74, 19 | "width": 60, 20 | "height": 18, 21 | "textType": 3 22 | }, 23 | "forge_energy": { 24 | "cIO": 1, 25 | "gIO": 2, 26 | "mIO": 1, 27 | "x": 28, 28 | "y": 106, 29 | "width": 120, 30 | "height": 9, 31 | "texture": "multiblocked:textures/gui/energy_bar.png", 32 | "capacity": 100000, 33 | "maxReceive": 5000, 34 | "maxExtract": 5000 35 | } 36 | }, 37 | "allowRotate": true, 38 | "showInJei": true, 39 | "baseRenderer": { 40 | "baseTexture": "multiblocked:blocks/casing/base", 41 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_out", 42 | "formedAsController": true, 43 | "type": "gregtech" 44 | }, 45 | "properties": { 46 | "isOpaque": true, 47 | "destroyTime": 5.0, 48 | "explosionResistance": 6.0, 49 | "harvestLevel": 1, 50 | "lightEmissive": 0, 51 | "speedFactor": 1.0, 52 | "jumpFactor": 1.0, 53 | "friction": 0.6, 54 | "hasCollision": true, 55 | "tabGroup": "multiblocked.all", 56 | "stackSize": 64 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:entity", 4 | "traits": { 5 | "entity": {} 6 | }, 7 | "allowRotate": true, 8 | "showInJei": true, 9 | "baseRenderer": { 10 | "baseTexture": "multiblocked:blocks/casing/base", 11 | "frontTexture": "multiblocked:blocks/overlay/overlay_entity", 12 | "formedAsController": true, 13 | "type": "gregtech" 14 | }, 15 | "isOpaqueCube": true 16 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_fluid_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:fluid_input", 4 | "traits": { 5 | "background": "multiblocked:textures/gui/fluid_hatch_gui.png", 6 | "fluid": [ 7 | { 8 | "cIO": 0, 9 | "gIO": 2, 10 | "mIO": 0, 11 | "x": 79, 12 | "y": 71, 13 | "tC": 64000, 14 | "autoIO": true 15 | } 16 | ] 17 | }, 18 | "allowRotate": true, 19 | "showInJei": true, 20 | "baseRenderer": { 21 | "baseTexture": "multiblocked:blocks/casing/base", 22 | "frontTexture": "multiblocked:blocks/overlay/overlay_fluid_in", 23 | "formedAsController": true, 24 | "type": "gregtech" 25 | }, 26 | "isOpaqueCube": true 27 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_fluid_output.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:fluid_output", 4 | "traits": { 5 | "background": "multiblocked:textures/gui/fluid_hatch_gui.png", 6 | "fluid": [ 7 | { 8 | "cIO": 1, 9 | "gIO": 2, 10 | "mIO": 1, 11 | "x": 79, 12 | "y": 71, 13 | "tC": 64000, 14 | "autoIO": true 15 | } 16 | ] 17 | }, 18 | "allowRotate": true, 19 | "showInJei": true, 20 | "baseRenderer": { 21 | "baseTexture": "multiblocked:blocks/casing/base", 22 | "frontTexture": "multiblocked:blocks/overlay/overlay_fluid_out", 23 | "formedAsController": true, 24 | "type": "gregtech" 25 | }, 26 | "isOpaqueCube": true 27 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_item_input.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:item_input", 4 | "traits": { 5 | "background": "multiblocked:textures/gui/item_bus_gui.png", 6 | "item": [ 7 | { 8 | "cIO": 0, 9 | "gIO": 2, 10 | "mIO": 0, 11 | "x": 70, 12 | "y": 62, 13 | "autoIO": true 14 | }, 15 | { 16 | "cIO": 0, 17 | "gIO": 2, 18 | "mIO": 0, 19 | "x": 88, 20 | "y": 62, 21 | "autoIO": true 22 | }, 23 | { 24 | "cIO": 0, 25 | "gIO": 2, 26 | "mIO": 0, 27 | "x": 70, 28 | "y": 80, 29 | "autoIO": true 30 | }, 31 | { 32 | "cIO": 0, 33 | "gIO": 2, 34 | "mIO": 0, 35 | "x": 88, 36 | "y": 80, 37 | "autoIO": true 38 | } 39 | ] 40 | }, 41 | "allowRotate": true, 42 | "showInJei": true, 43 | "baseRenderer": { 44 | "baseTexture": "multiblocked:blocks/casing/base", 45 | "frontTexture": "multiblocked:blocks/overlay/overlay_item_in", 46 | "formedAsController": true, 47 | "type": "gregtech" 48 | }, 49 | "isOpaqueCube": true 50 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/definition/part/mbd_item_output.json: -------------------------------------------------------------------------------- 1 | { 2 | "canShared": true, 3 | "location": "multiblocked:item_output", 4 | "traits": { 5 | "background": "multiblocked:textures/gui/item_bus_gui.png", 6 | "item": [ 7 | { 8 | "cIO": 1, 9 | "gIO": 2, 10 | "mIO": 1, 11 | "x": 70, 12 | "y": 62, 13 | "autoIO": true 14 | }, 15 | { 16 | "cIO": 1, 17 | "gIO": 2, 18 | "mIO": 1, 19 | "x": 88, 20 | "y": 62, 21 | "autoIO": true 22 | }, 23 | { 24 | "cIO": 1, 25 | "gIO": 2, 26 | "mIO": 1, 27 | "x": 70, 28 | "y": 80, 29 | "autoIO": true 30 | }, 31 | { 32 | "cIO": 1, 33 | "gIO": 2, 34 | "mIO": 1, 35 | "x": 88, 36 | "y": 80, 37 | "autoIO": true 38 | } 39 | ] 40 | }, 41 | "allowRotate": true, 42 | "showInJei": true, 43 | "baseRenderer": { 44 | "baseTexture": "multiblocked:blocks/casing/base", 45 | "frontTexture": "multiblocked:blocks/overlay/overlay_item_out", 46 | "formedAsController": true, 47 | "type": "gregtech" 48 | }, 49 | "isOpaqueCube": true 50 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/block/controller_tester.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench", 3 | "textures": { 4 | "particle": "multiblocked:blocks/blueprint_table", 5 | "table": "multiblocked:blocks/blueprint_table" 6 | }, 7 | "elements": [ 8 | { 9 | "from": [0, 0, 0], 10 | "to": [16, 16, 16], 11 | "faces": { 12 | "north": {"uv": [0, 10.66667, 5.33334, 16], "texture": "#table", "cullface": "north"}, 13 | "east": {"uv": [0, 10.66667, 5.33334, 16], "texture": "#table", "cullface": "east"}, 14 | "south": {"uv": [0, 16, 5.33334, 10.66667], "texture": "#table", "cullface": "south"}, 15 | "west": {"uv": [0, 10.66667, 5.33334, 16], "texture": "#table", "cullface": "west"}, 16 | "up": {"uv": [0, 10.66667, 5.33333, 16], "texture": "#table", "cullface": "up"}, 17 | "down": {"uv": [0, 10.66667, 5.33333, 16], "texture": "#table"} 18 | } 19 | } 20 | ], 21 | "display": { 22 | "gui": { 23 | "rotation": [ 30, 225, 0 ], 24 | "translation": [ 0, 0, 0], 25 | "scale":[ 0.625, 0.625, 0.625 ] 26 | }, 27 | "ground": { 28 | "rotation": [ 0, 0, 0 ], 29 | "translation": [ 0, 3, 0], 30 | "scale":[ 0.25, 0.25, 0.25 ] 31 | }, 32 | "fixed": { 33 | "rotation": [ 0, 0, 0 ], 34 | "translation": [ 0, 0, 0], 35 | "scale":[ 0.5, 0.5, 0.5 ] 36 | }, 37 | "thirdperson_righthand": { 38 | "rotation": [ 75, 45, 0 ], 39 | "translation": [ 0, 2.5, 0], 40 | "scale": [ 0.375, 0.375, 0.375 ] 41 | }, 42 | "firstperson_righthand": { 43 | "rotation": [ 0, 45, 0 ], 44 | "translation": [ 0, 0, 0 ], 45 | "scale": [ 0.40, 0.40, 0.40 ] 46 | }, 47 | "firstperson_lefthand": { 48 | "rotation": [ 0, 225, 0 ], 49 | "translation": [ 0, 0, 0 ], 50 | "scale": [ 0.40, 0.40, 0.40 ] 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/block/cube_2_layer.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/block", 3 | "textures": { 4 | "bot_down": "multiblocked:void", 5 | "bot_up": "multiblocked:void", 6 | "bot_north": "multiblocked:void", 7 | "bot_south": "multiblocked:void", 8 | "bot_west": "multiblocked:void", 9 | "bot_east": "multiblocked:void", 10 | 11 | "top_down": "multiblocked:void", 12 | "top_up": "multiblocked:void", 13 | "top_north": "multiblocked:void", 14 | "top_south": "multiblocked:void", 15 | "top_west": "multiblocked:void", 16 | "top_east": "multiblocked:void", 17 | 18 | "particle": "multiblocked:void" 19 | }, 20 | "elements": [ 21 | { 22 | "from": [ 0, 0, 0 ], 23 | "to": [ 16, 16, 16 ], 24 | "faces": { 25 | "down": { "texture": "#bot_down", "cullface": "down" }, 26 | "up": { "texture": "#bot_up", "cullface": "up" }, 27 | "north": { "texture": "#bot_north", "cullface": "north" }, 28 | "south": { "texture": "#bot_south", "cullface": "south" }, 29 | "west": { "texture": "#bot_west", "cullface": "west" }, 30 | "east": { "texture": "#bot_east", "cullface": "east" } 31 | } 32 | }, 33 | { 34 | "from": [ 0, 0, 0 ], 35 | "to": [ 16, 16, 16 ], 36 | "shade": false, 37 | "faces": { 38 | "down": { "texture": "#top_down", "cullface": "down" }, 39 | "up": { "texture": "#top_up", "cullface": "up" }, 40 | "north": { "texture": "#top_north", "cullface": "north" }, 41 | "south": { "texture": "#top_south", "cullface": "south" }, 42 | "west": { "texture": "#top_west", "cullface": "west" }, 43 | "east": { "texture": "#top_east", "cullface": "east" } 44 | } 45 | } 46 | ], 47 | "display": { 48 | "gui": { 49 | "rotation": [ 30, 225, 0 ], 50 | "translation": [ 0, 0, 0], 51 | "scale":[ 0.625, 0.625, 0.625 ] 52 | }, 53 | "ground": { 54 | "rotation": [ 0, 0, 0 ], 55 | "translation": [ 0, 3, 0], 56 | "scale":[ 0.25, 0.25, 0.25 ] 57 | }, 58 | "fixed": { 59 | "rotation": [ 0, 0, 0 ], 60 | "translation": [ 0, 0, 0], 61 | "scale":[ 0.5, 0.5, 0.5 ] 62 | }, 63 | "thirdperson_righthand": { 64 | "rotation": [ 75, 45, 0 ], 65 | "translation": [ 0, 2.5, 0], 66 | "scale": [ 0.375, 0.375, 0.375 ] 67 | }, 68 | "firstperson_righthand": { 69 | "rotation": [ 0, 45, 0 ], 70 | "translation": [ 0, 0, 0 ], 71 | "scale": [ 0.40, 0.40, 0.40 ] 72 | }, 73 | "firstperson_lefthand": { 74 | "rotation": [ 0, 225, 0 ], 75 | "translation": [ 0, 0, 0 ], 76 | "scale": [ 0.40, 0.40, 0.40 ] 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/block/jar.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench", 3 | "texture_size": [64, 32], 4 | "textures": { 5 | "0": "multiblocked:blocks/jar", 6 | "particle": "multiblocked:blocks/jar" 7 | }, 8 | "loader": "forge:multi-layer", 9 | "layers": { 10 | "cutout": { 11 | "textures": { 12 | "0": "multiblocked:blocks/jar" 13 | }, 14 | "elements": [ 15 | { 16 | "from": [5, 12, 5], 17 | "to": [11, 14, 11], 18 | "faces": { 19 | "north": {"uv": [0, 15, 1.5, 16], "texture": "#0"}, 20 | "east": {"uv": [4.5, 15, 6, 16], "texture": "#0"}, 21 | "south": {"uv": [3, 15, 4.5, 16], "texture": "#0"}, 22 | "west": {"uv": [1.5, 15, 3, 16], "texture": "#0"}, 23 | "up": {"uv": [3, 12, 4.5, 15], "texture": "#0"}, 24 | "down": {"uv": [1.5, 12, 3, 15], "texture": "#0"} 25 | } 26 | } 27 | ] 28 | }, 29 | "translucent": { 30 | "textures": { 31 | "0": "multiblocked:blocks/jar" 32 | }, 33 | "elements": [ 34 | { 35 | "from": [3, 0, 3], 36 | "to": [13, 12, 13], 37 | "faces": { 38 | "north": {"uv": [5, 5, 7.5, 11], "texture": "#0"}, 39 | "east": {"uv": [2.5, 5, 5, 11], "texture": "#0"}, 40 | "south": {"uv": [7.5, 5, 10, 11], "texture": "#0"}, 41 | "west": {"uv": [0, 5, 2.5, 11], "texture": "#0"}, 42 | "up": {"uv": [2.5, 0, 5, 5], "texture": "#0"}, 43 | "down": {"uv": [5, 0, 7.5, 5], "texture": "#0"} 44 | } 45 | } 46 | ] 47 | } 48 | }, 49 | "display": { 50 | "thirdperson_righthand": { 51 | "rotation": [75, 45, 0], 52 | "translation": [0, 2.5, 0], 53 | "scale": [0.375, 0.375, 0.375] 54 | }, 55 | "thirdperson_lefthand": { 56 | "rotation": [75, 45, 0], 57 | "translation": [0, 2.5, 0], 58 | "scale": [0.375, 0.375, 0.375] 59 | }, 60 | "firstperson_righthand": { 61 | "rotation": [0, 45, 0], 62 | "scale": [0.4, 0.4, 0.4] 63 | }, 64 | "firstperson_lefthand": { 65 | "rotation": [0, 225, 0], 66 | "scale": [0.4, 0.4, 0.4] 67 | }, 68 | "ground": { 69 | "translation": [0, 3, 0], 70 | "scale": [0.25, 0.25, 0.25] 71 | }, 72 | "gui": { 73 | "rotation": [30, 225, 0], 74 | "scale": [0.625, 0.625, 0.625] 75 | }, 76 | "fixed": { 77 | "scale": [0.5, 0.5, 0.5] 78 | } 79 | }, 80 | "groups": [ 81 | { 82 | "name": "group", 83 | "origin": [8, 8, 8], 84 | "color": 0, 85 | "children": [0, 1] 86 | } 87 | ] 88 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/block/part_tester.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench", 3 | "textures": { 4 | "particle": "multiblocked:blocks/blueprint_table", 5 | "table": "multiblocked:blocks/blueprint_table" 6 | }, 7 | "elements": [ 8 | { 9 | "from": [0, 0, 0], 10 | "to": [16, 16, 16], 11 | "faces": { 12 | "north": {"uv": [2.33333, 3, 7.66667, 8.33333], "texture": "#table", "cullface": "north"}, 13 | "east": {"uv": [2.33333, 3, 7.66667, 8.33333], "texture": "#table", "cullface": "east"}, 14 | "south": {"uv": [2.33333, 8.33333, 7.66667, 3], "texture": "#table", "cullface": "south"}, 15 | "west": {"uv": [2.33333, 3, 7.66667, 8.33333], "texture": "#table", "cullface": "west"}, 16 | "up": {"uv": [2.33333, 3, 7.66666, 8.33333], "texture": "#table", "cullface": "up"}, 17 | "down": {"uv": [2.33333, 3, 7.66666, 8.33333], "texture": "#table"} 18 | } 19 | } 20 | ], 21 | "display": { 22 | "gui": { 23 | "rotation": [ 30, 225, 0 ], 24 | "translation": [ 0, 0, 0], 25 | "scale":[ 0.625, 0.625, 0.625 ] 26 | }, 27 | "ground": { 28 | "rotation": [ 0, 0, 0 ], 29 | "translation": [ 0, 3, 0], 30 | "scale":[ 0.25, 0.25, 0.25 ] 31 | }, 32 | "fixed": { 33 | "rotation": [ 0, 0, 0 ], 34 | "translation": [ 0, 0, 0], 35 | "scale":[ 0.5, 0.5, 0.5 ] 36 | }, 37 | "thirdperson_righthand": { 38 | "rotation": [ 75, 45, 0 ], 39 | "translation": [ 0, 2.5, 0], 40 | "scale": [ 0.375, 0.375, 0.375 ] 41 | }, 42 | "firstperson_righthand": { 43 | "rotation": [ 0, 45, 0 ], 44 | "translation": [ 0, 0, 0 ], 45 | "scale": [ 0.40, 0.40, 0.40 ] 46 | }, 47 | "firstperson_lefthand": { 48 | "rotation": [ 0, 225, 0 ], 49 | "translation": [ 0, 0, 0 ], 50 | "scale": [ 0.40, 0.40, 0.40 ] 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/block/pedestal.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench", 3 | "texture_size": [32, 16], 4 | "textures": { 5 | "0": "multiblocked:blocks/pedestal", 6 | "particle": "multiblocked:blocks/pedestal" 7 | }, 8 | "elements": [ 9 | { 10 | "from": [2, 0, 2], 11 | "to": [14, 3, 14], 12 | "faces": { 13 | "north": {"uv": [0, 13, 6, 16], "texture": "#0"}, 14 | "east": {"uv": [0, 13, 6, 16], "texture": "#0"}, 15 | "south": {"uv": [0, 13, 6, 16], "texture": "#0"}, 16 | "west": {"uv": [0, 13, 6, 16], "texture": "#0"}, 17 | "up": {"uv": [6, 4, 12, 16], "texture": "#0"}, 18 | "down": {"uv": [6, 4, 12, 16], "texture": "#0"} 19 | } 20 | }, 21 | { 22 | "from": [4, 3, 4], 23 | "to": [12, 12, 12], 24 | "faces": { 25 | "north": {"uv": [1, 4, 5, 13], "texture": "#0"}, 26 | "east": {"uv": [1, 4, 5, 13], "texture": "#0"}, 27 | "south": {"uv": [1, 4, 5, 13], "texture": "#0"}, 28 | "west": {"uv": [1, 4, 5, 13], "texture": "#0"}, 29 | "up": {"uv": [7, 6, 11, 14], "texture": "#0"}, 30 | "down": {"uv": [7, 6, 11, 14], "texture": "#0"} 31 | } 32 | }, 33 | { 34 | "from": [2, 12, 2], 35 | "to": [14, 16, 14], 36 | "faces": { 37 | "north": {"uv": [0, 0, 6, 4], "texture": "#0"}, 38 | "east": {"uv": [0, 0, 6, 4], "texture": "#0"}, 39 | "south": {"uv": [0, 0, 6, 4], "texture": "#0"}, 40 | "west": {"uv": [0, 0, 6, 4], "texture": "#0"}, 41 | "up": {"uv": [6, 4, 12, 16], "texture": "#0"}, 42 | "down": {"uv": [6, 4, 12, 16], "texture": "#0"} 43 | } 44 | } 45 | ], 46 | "groups": [ 47 | { 48 | "name": "group", 49 | "origin": [8, 8, 8], 50 | "color": 0, 51 | "children": [0, 1, 2] 52 | } 53 | ], 54 | "display": { 55 | "gui": { 56 | "rotation": [ 30, 225, 0 ], 57 | "translation": [ 0, 0, 0], 58 | "scale":[ 0.625, 0.625, 0.625 ] 59 | }, 60 | "ground": { 61 | "rotation": [ 0, 0, 0 ], 62 | "translation": [ 0, 3, 0], 63 | "scale":[ 0.25, 0.25, 0.25 ] 64 | }, 65 | "fixed": { 66 | "rotation": [ 0, 0, 0 ], 67 | "translation": [ 0, 0, 0], 68 | "scale":[ 0.5, 0.5, 0.5 ] 69 | }, 70 | "thirdperson_righthand": { 71 | "rotation": [ 75, 45, 0 ], 72 | "translation": [ 0, 2.5, 0], 73 | "scale": [ 0.375, 0.375, 0.375 ] 74 | }, 75 | "firstperson_righthand": { 76 | "rotation": [ 0, 45, 0 ], 77 | "translation": [ 0, 0, 0 ], 78 | "scale": [ 0.40, 0.40, 0.40 ] 79 | }, 80 | "firstperson_lefthand": { 81 | "rotation": [ 0, 225, 0 ], 82 | "translation": [ 0, 0, 0 ], 83 | "scale": [ 0.40, 0.40, 0.40 ] 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/item/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "multiblocked:items/blueprint" 5 | }, 6 | "overrides": [ 7 | { 8 | "predicate": { 9 | "multiblocked:raw": 1 10 | }, 11 | "model": "multiblocked:item/blueprint_pattern" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/item/blueprint_pattern.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "multiblocked:items/blueprint_pattern" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/item/multiblock_builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "multiblocked:items/multiblock_builder" 5 | }, 6 | "overrides": [ 7 | { 8 | "predicate": { 9 | "multiblocked:raw": 1 10 | }, 11 | "model": "multiblocked:item/multiblock_builder_pattern" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/item/multiblock_builder_pattern.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "multiblocked:items/multiblock_builder_pattern" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/shaders/fbm.fsh: -------------------------------------------------------------------------------- 1 | #version 150 2 | // Author @patriciogv - 2015 3 | // http://patriciogonzalezvivo.com 4 | 5 | uniform vec2 iResolution; 6 | uniform float iTime; 7 | const vec3 b_color = vec3(.7, .1, .4); 8 | 9 | in vec2 texCoord; 10 | 11 | out vec4 fragColor; 12 | 13 | float random (in vec2 _st) { 14 | return fract(sin(dot(_st.xy, 15 | vec2(12.9898,78.233)))* 16 | 43758.5453123); 17 | } 18 | 19 | // Based on Morgan McGuire @morgan3d 20 | // https://www.shadertoy.com/view/4dS3Wd 21 | float noise (in vec2 _st) { 22 | vec2 i = floor(_st); 23 | vec2 f = fract(_st); 24 | 25 | // Four corners in 2D of a tile 26 | float a = random(i); 27 | float b = random(i + vec2(1.0, 0.0)); 28 | float c = random(i + vec2(0.0, 1.0)); 29 | float d = random(i + vec2(1.0, 1.0)); 30 | 31 | vec2 u = f * f * (3.0 - 2.0 * f); 32 | 33 | return mix(a, b, u.x) + 34 | (c - a)* u.y * (1.0 - u.x) + 35 | (d - b) * u.x * u.y; 36 | } 37 | 38 | #define NUM_OCTAVES 5 39 | 40 | float fbm ( in vec2 _st) { 41 | float v = 0.0; 42 | float a = 0.5; 43 | vec2 shift = vec2(100.0); 44 | // Rotate to reduce axial bias 45 | mat2 rot = mat2(cos(0.5), sin(0.5), 46 | -sin(0.5), cos(0.50)); 47 | for (int i = 0; i < NUM_OCTAVES; ++i) { 48 | v += a * noise(_st); 49 | _st = rot * _st * 2.0 + shift; 50 | a *= 0.5; 51 | } 52 | return v; 53 | } 54 | 55 | void mainImage(out vec4 fragColor, in vec2 fragCoord) { 56 | vec2 st = fragCoord.xy/iResolution.xy*3.; 57 | // st += st * abs(sin(iTime*0.1)*3.0); 58 | vec3 color = vec3(0.0); 59 | 60 | vec2 q = vec2(0.); 61 | q.x = fbm( st + 0.00*iTime); 62 | q.y = fbm( st + vec2(1.0)); 63 | 64 | vec2 r = vec2(0.); 65 | r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*iTime ); 66 | r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*iTime); 67 | 68 | float f = fbm(st+r); 69 | 70 | color = mix(vec3(0.6), 71 | vec3(0.315,0.600,0.530), 72 | clamp((f*f)*2.0,0.0,1.0)); 73 | 74 | color = mix(color, 75 | vec3(0.822,0.990,0.790), 76 | clamp(length(q),0.0,1.0)); 77 | 78 | color = mix(color, 79 | b_color, 80 | clamp(length(r.x),0.0,1.0)); 81 | 82 | fragColor = vec4((f*f*f+.6*f*f+.5*f)*color,1.); 83 | } 84 | 85 | void main() { 86 | // gl_FragColor.rgba = vec4(1.,0.,0.,1.); 87 | mainImage(fragColor, vec2(texCoord.x * iResolution.x, texCoord.y * iResolution.y)); 88 | } 89 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/blueprint_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/blueprint_table.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/casing/base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/casing/base.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/casing/create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/casing/create.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/gregtech_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/gregtech_base.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/gregtech_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/gregtech_front.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/jar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_energy_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_energy_in.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_energy_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_energy_out.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_entity.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_fluid_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_fluid_in.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_fluid_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_fluid_out.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_item_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_item_in.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_item_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_item_out.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/pedestal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/blocks/pedestal.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/fx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/fx/fx.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/laser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/fx/laser.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/laser_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/fx/laser_start.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/add.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/axis.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/bar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/blueprint_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/blueprint_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/blueprint_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/blueprint_table.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/boolean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/boolean.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/bordered_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/bordered_background.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/bordered_background_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/bordered_background_blue.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/button_common.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/button_common.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/button_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/button_view.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/button_wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/button_wood.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/component.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_biome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_biome.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_block.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_dimension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_dimension.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_pos_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_pos_y.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_predicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_predicate.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_rain.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_thunder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/condition_thunder.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/copy.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/ct_loader_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/ct_loader_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/custom_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/custom_gui.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/custom_gui_tab_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/custom_gui_tab_button.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/darkened_slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/darkened_slot.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/down.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/energy_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/energy_bar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/fluid_hatch_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/fluid_hatch_gui.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/io_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/io_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/item_bus_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/item_bus_gui.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/json_block_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/json_block_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/json_loader_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/json_loader_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/move_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/move_down.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/option.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/predicate_selector_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/predicate_selector_bar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/pretty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/pretty.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/pretty_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/pretty_active.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/progress_bar_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/progress_bar_arrow.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/progress_bar_fuel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/progress_bar_fuel.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/recipe_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/recipe_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/remove.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/repeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/repeat.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/save.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/structure_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/structure_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/switch_common.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/switch_common.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/tab_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/tab_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/tab_predicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/tab_predicate.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/tab_text_field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/tab_text_field.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/up.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/gui/wiki.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/blueprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/items/blueprint.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/blueprint_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/items/blueprint_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/multiblock_builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/items/multiblock_builder.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/multiblock_builder_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/items/multiblock_builder_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/void.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/assets/multiblocked/textures/void.png -------------------------------------------------------------------------------- /src/main/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Low-Drag-MC/Multiblocked/2b775355bfc03239bafe41db97e1da72d379463e/src/main/resources/icon.png -------------------------------------------------------------------------------- /src/main/resources/kubejs.plugins.txt: -------------------------------------------------------------------------------- 1 | com.lowdragmc.multiblocked.api.kubejs.MultiblockedJSPlugin -------------------------------------------------------------------------------- /src/main/resources/multiblocked.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "com.lowdragmc.multiblocked.core.mixins", 4 | "compatibilityLevel": "JAVA_8", 5 | "refmap": "multiblocked.refmap.json", 6 | "minVersion": "0.8", 7 | "client": [ 8 | "RenderChunkMixin", 9 | "TileEntityRendererDispatcherMixin" 10 | ], 11 | "mixins": [ 12 | "BlockMixin", 13 | "ChunkMixin", 14 | "NBTIngredientMixin", 15 | "RecipeManagerMixin", 16 | "ReloadMixin", 17 | "ServerChunkProviderMixin", 18 | "WorldMixin", 19 | "rubidium.BlockOcclusionCacheMixin", 20 | "rubidium.ChunkRenderRebuildTaskMixin" 21 | ] 22 | } -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Multiblocked Resources", 4 | "pack_format": 6 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /version.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | mod_version = "1.0.10.a" 3 | } 4 | --------------------------------------------------------------------------------