├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ └── 1.12-auto-publish-release.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── api └── java │ └── team │ └── chisel │ └── ctm │ └── api │ └── IFacade.java ├── main ├── java │ └── com │ │ └── cleanroommc │ │ └── multiblocked │ │ ├── CommonProxy.java │ │ ├── Listeners.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 │ │ ├── crafttweaker │ │ │ ├── CTHelper.java │ │ │ ├── CTParticleUtils.java │ │ │ ├── CTRegistry.java │ │ │ ├── brackethandler │ │ │ │ ├── CapabilityBracketHandler.java │ │ │ │ ├── ControllerBracketHandler.java │ │ │ │ ├── DefinitionBracketHandler.java │ │ │ │ ├── MultiblockedBracketHandler.java │ │ │ │ ├── PartBracketHandler.java │ │ │ │ └── RecipeMapBracketHandler.java │ │ │ ├── expanders │ │ │ │ ├── ExpandComponent.java │ │ │ │ ├── ExpandComponentDefinition.java │ │ │ │ ├── ExpandIRenderer.java │ │ │ │ ├── ExpandParticle.java │ │ │ │ ├── ExpandPredicate.java │ │ │ │ ├── ExpandRecipe.java │ │ │ │ ├── ExpandRecipeBuilder.java │ │ │ │ └── ExpandRecipeContent.java │ │ │ ├── functions │ │ │ │ ├── IApplyContentModifier.java │ │ │ │ ├── ICalcRecipeDuration.java │ │ │ │ ├── IDrops.java │ │ │ │ ├── IDynamicPattern.java │ │ │ │ ├── IDynamicRenderer.java │ │ │ │ ├── IGetOutputRedstoneSignal.java │ │ │ │ ├── ILeftClick.java │ │ │ │ ├── INeighborChanged.java │ │ │ │ ├── IPartAddedToMulti.java │ │ │ │ ├── IPartRemovedFromMulti.java │ │ │ │ ├── IPredicateFunction.java │ │ │ │ ├── IReadInitialData.java │ │ │ │ ├── IReceiveCustomData.java │ │ │ │ ├── IRecipeFinish.java │ │ │ │ ├── IRightClick.java │ │ │ │ ├── ISetupRecipe.java │ │ │ │ ├── IShouldCheckPattern.java │ │ │ │ ├── IStatusChanged.java │ │ │ │ ├── IStructureFormed.java │ │ │ │ ├── IStructureInvalid.java │ │ │ │ ├── IUpdateFormed.java │ │ │ │ ├── IUpdateTick.java │ │ │ │ └── IWriteInitialData.java │ │ │ └── interfaces │ │ │ │ ├── ICTComponent.java │ │ │ │ ├── ICTController.java │ │ │ │ ├── ICTLaserParticle.java │ │ │ │ ├── ICTPart.java │ │ │ │ ├── ICTParticle.java │ │ │ │ └── ICTTextureParticle.java │ │ ├── definition │ │ │ ├── ComponentDefinition.java │ │ │ ├── ControllerDefinition.java │ │ │ ├── PartDefinition.java │ │ │ └── StatusProperties.java │ │ ├── gui │ │ │ ├── factory │ │ │ │ ├── TileEntityUIFactory.java │ │ │ │ └── UIFactory.java │ │ │ ├── ingredient │ │ │ │ ├── IGhostIngredientTarget.java │ │ │ │ ├── IIngredientSlot.java │ │ │ │ └── IRecipeTransferHandlerWidget.java │ │ │ ├── modular │ │ │ │ ├── IUIHolder.java │ │ │ │ ├── ModularUI.java │ │ │ │ ├── ModularUIContainer.java │ │ │ │ ├── ModularUIGuiContainer.java │ │ │ │ ├── ModularUIGuiHandler.java │ │ │ │ └── WidgetUIAccess.java │ │ │ ├── texture │ │ │ │ ├── ColorBorderTexture.java │ │ │ │ ├── ColorRectTexture.java │ │ │ │ ├── GuiTextureGroup.java │ │ │ │ ├── IGuiTexture.java │ │ │ │ ├── ItemStackTexture.java │ │ │ │ ├── ProgressTexture.java │ │ │ │ ├── ResourceBorderTexture.java │ │ │ │ ├── ResourceTexture.java │ │ │ │ ├── ShaderTexture.java │ │ │ │ └── TextTexture.java │ │ │ ├── util │ │ │ │ ├── ClickData.java │ │ │ │ ├── DrawerHelper.java │ │ │ │ ├── FileNode.java │ │ │ │ ├── ModularUIBuilder.java │ │ │ │ ├── PerTickIntCounter.java │ │ │ │ ├── TextFormattingUtil.java │ │ │ │ └── TreeNode.java │ │ │ └── widget │ │ │ │ ├── Widget.java │ │ │ │ ├── WidgetGroup.java │ │ │ │ └── imp │ │ │ │ ├── BlockSelectorWidget.java │ │ │ │ ├── ButtonWidget.java │ │ │ │ ├── DialogWidget.java │ │ │ │ ├── DraggableScrollableWidgetGroup.java │ │ │ │ ├── DraggableWidgetGroup.java │ │ │ │ ├── FluidStackSelectorWidget.java │ │ │ │ ├── GuiUtils.java │ │ │ │ ├── ImageWidget.java │ │ │ │ ├── ItemStackSelectorWidget.java │ │ │ │ ├── LabelWidget.java │ │ │ │ ├── PhantomFluidWidget.java │ │ │ │ ├── PhantomSlotWidget.java │ │ │ │ ├── SceneWidget.java │ │ │ │ ├── SearchComponentWidget.java │ │ │ │ ├── SelectableWidgetGroup.java │ │ │ │ ├── SelectorWidget.java │ │ │ │ ├── SlotWidget.java │ │ │ │ ├── SwitchWidget.java │ │ │ │ ├── TankWidget.java │ │ │ │ ├── TextBoxWidget.java │ │ │ │ ├── TextFieldWidget.java │ │ │ │ ├── TreeListWidget.java │ │ │ │ ├── blueprint_table │ │ │ │ ├── BlueprintTableWidget.java │ │ │ │ ├── ControllerBuilderWidget.java │ │ │ │ ├── PartBuilderWidget.java │ │ │ │ ├── RecipeMapBuilderWidget.java │ │ │ │ ├── RendererBuilderWidget.java │ │ │ │ ├── TemplateBuilderWidget.java │ │ │ │ ├── components │ │ │ │ │ ├── ComponentWidget.java │ │ │ │ │ ├── ControllerWidget.java │ │ │ │ │ └── PartWidget.java │ │ │ │ └── dialogs │ │ │ │ │ ├── IParticleWidget.java │ │ │ │ │ ├── IRendererWidget.java │ │ │ │ │ ├── IShaderWidget.java │ │ │ │ │ ├── IShapeWidget.java │ │ │ │ │ ├── ISoundWidget.java │ │ │ │ │ ├── JsonBlockPatternWidget.java │ │ │ │ │ ├── RecipeMapWidget.java │ │ │ │ │ └── ResourceTextureWidget.java │ │ │ │ ├── controller │ │ │ │ ├── IOPageWidget.java │ │ │ │ ├── PageWidget.java │ │ │ │ ├── RecipePage.java │ │ │ │ └── structure │ │ │ │ │ ├── PatternWidget.java │ │ │ │ │ └── StructurePageWidget.java │ │ │ │ ├── recipe │ │ │ │ ├── ContentWidget.java │ │ │ │ ├── FuelWidget.java │ │ │ │ ├── ProgressWidget.java │ │ │ │ └── RecipeWidget.java │ │ │ │ ├── tab │ │ │ │ ├── TabButton.java │ │ │ │ └── TabContainer.java │ │ │ │ └── tester │ │ │ │ ├── ControllerScriptWidget.java │ │ │ │ ├── PartScriptWidget.java │ │ │ │ └── ZSScriptWidget.java │ │ ├── item │ │ │ ├── ItemBlueprint.java │ │ │ └── ItemMultiblockBuilder.java │ │ ├── json │ │ │ ├── BlockTypeAdapterFactory.java │ │ │ ├── FluidStackTypeAdapter.java │ │ │ ├── IBlockStateTypeAdapterFactory.java │ │ │ ├── IRendererTypeAdapterFactory.java │ │ │ ├── ItemStackTypeAdapter.java │ │ │ ├── RecipeMapTypeAdapter.java │ │ │ ├── RecipeTypeAdapter.java │ │ │ └── SimplePredicateFactory.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 │ │ │ │ ├── PredicateMetaTileEntity.java │ │ │ │ ├── PredicateStates.java │ │ │ │ └── SimplePredicate.java │ │ │ └── util │ │ │ │ ├── BlockInfo.java │ │ │ │ ├── PatternMatchContext.java │ │ │ │ └── RelativeDirection.java │ │ ├── recipe │ │ │ ├── Content.java │ │ │ ├── ContentModifier.java │ │ │ ├── EntityIngredient.java │ │ │ ├── ItemsIngredient.java │ │ │ ├── Recipe.java │ │ │ ├── RecipeBuilder.java │ │ │ ├── RecipeCondition.java │ │ │ ├── RecipeLogic.java │ │ │ └── RecipeMap.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 │ │ │ ├── IDynamicComponentTile.java │ │ │ └── part │ │ │ ├── PartHatchTileEntity.java │ │ │ ├── PartTileEntity.java │ │ │ └── PartTileTesterEntity.java │ │ ├── client │ │ ├── ClientProxy.java │ │ ├── MultiblockedResourceLoader.java │ │ ├── model │ │ │ ├── IModelSupplier.java │ │ │ ├── ModelFactory.java │ │ │ ├── SimpleStateMapper.java │ │ │ ├── bakedpipeline │ │ │ │ └── VertexBuilder.java │ │ │ └── custommodel │ │ │ │ ├── CustomBakedModel.java │ │ │ │ └── MetadataSectionEmissive.java │ │ ├── particle │ │ │ ├── AbstractParticle.java │ │ │ ├── CommonParticle.java │ │ │ ├── CustomParticleDigging.java │ │ │ ├── IParticle.java │ │ │ ├── IParticleHandler.java │ │ │ ├── LaserBeamParticle.java │ │ │ ├── MCParticleHandler.java │ │ │ ├── ParticleManager.java │ │ │ └── ShaderTextureParticle.java │ │ ├── renderer │ │ │ ├── BlueprintRegionRenderer.java │ │ │ ├── ComponentRenderer.java │ │ │ ├── ComponentTESR.java │ │ │ ├── ICustomItemRenderer.java │ │ │ ├── ICustomRenderer.java │ │ │ ├── IRenderer.java │ │ │ ├── MultiblockPreviewRenderer.java │ │ │ ├── fx │ │ │ │ └── LaserBeamRenderer.java │ │ │ ├── impl │ │ │ │ ├── B3DRenderer.java │ │ │ │ ├── BlockStateRenderer.java │ │ │ │ ├── CycleBlockStateRenderer.java │ │ │ │ ├── GTRenderer.java │ │ │ │ ├── GeoComponentRenderer.java │ │ │ │ ├── IModelRenderer.java │ │ │ │ ├── OBJRenderer.java │ │ │ │ ├── ParticleRenderer.java │ │ │ │ └── TextureParticleRenderer.java │ │ │ └── scene │ │ │ │ ├── FBOWorldSceneRenderer.java │ │ │ │ ├── ISceneRenderHook.java │ │ │ │ ├── ImmediateWorldSceneRenderer.java │ │ │ │ └── WorldSceneRenderer.java │ │ ├── shader │ │ │ ├── Shaders.java │ │ │ ├── management │ │ │ │ ├── Shader.java │ │ │ │ ├── ShaderManager.java │ │ │ │ └── ShaderProgram.java │ │ │ └── uniform │ │ │ │ ├── IUniformCallback.java │ │ │ │ ├── UniformCache.java │ │ │ │ └── UniformEntry.java │ │ └── util │ │ │ ├── EntityCamera.java │ │ │ ├── FacadeBlockAccess.java │ │ │ ├── FacadeBlockWorld.java │ │ │ ├── RenderBufferUtils.java │ │ │ ├── RenderUtils.java │ │ │ └── TrackedDummyWorld.java │ │ ├── command │ │ ├── CommandClient.java │ │ ├── CommandMbdNbt.java │ │ ├── CommandMbdTps.java │ │ └── CommandMbdTree.java │ │ ├── common │ │ ├── capability │ │ │ ├── AspectThaumcraftCapability.java │ │ │ ├── AuraMultiblockCapability.java │ │ │ ├── EMCProjectECapability.java │ │ │ ├── EmberEmbersCapability.java │ │ │ ├── EnergyGTCECapability.java │ │ │ ├── EntityMultiblockCapability.java │ │ │ ├── FEMultiblockCapability.java │ │ │ ├── FluidMultiblockCapability.java │ │ │ ├── GPExtraUtilities2Capability.java │ │ │ ├── GasMekanismCapability.java │ │ │ ├── HeatMekanismCapability.java │ │ │ ├── HotAirProdigyCapability.java │ │ │ ├── ImpetusThaumicAugmentationCapability.java │ │ │ ├── ItemDurabilityMultiblockCapability.java │ │ │ ├── ItemMultiblockCapability.java │ │ │ ├── LEMultiblockCapability.java │ │ │ ├── LPBloodMagicCapability.java │ │ │ ├── LaserMekanismCapability.java │ │ │ ├── ManaBotaniaCapability.java │ │ │ ├── MystMechPowerCapability.java │ │ │ ├── ParticleQMDCapability.java │ │ │ ├── PneumaticPressureCapability.java │ │ │ ├── StarlightAstralCapability.java │ │ │ ├── trait │ │ │ │ ├── EMCPlayerCapabilityTrait.java │ │ │ │ ├── EnergyCapabilityTrait.java │ │ │ │ ├── EntityCapabilityTrait.java │ │ │ │ ├── FECapabilityTrait.java │ │ │ │ ├── FluidCapabilityTrait.java │ │ │ │ ├── FuelProgressTrait.java │ │ │ │ ├── GPPlayerCapabilityTrait.java │ │ │ │ ├── ImpetusCapabilityTrait.java │ │ │ │ ├── ItemCapabilityTrait.java │ │ │ │ ├── LPPlayerCapabilityTrait.java │ │ │ │ ├── LaserCapabilityTrait.java │ │ │ │ ├── ManaCapabilityTrait.java │ │ │ │ ├── PneumaticMachineTrait.java │ │ │ │ ├── RecipeProgressTrait.java │ │ │ │ └── StarlightCapabilityTrait.java │ │ │ └── widget │ │ │ │ ├── AspectStackWidget.java │ │ │ │ ├── EntityContentWidget.java │ │ │ │ ├── FluidContentWidget.java │ │ │ │ ├── GasStackWidget.java │ │ │ │ ├── ItemsContentWidget.java │ │ │ │ ├── NumberContentWidget.java │ │ │ │ ├── ParticleStackWidget.java │ │ │ │ ├── StarlightWidget.java │ │ │ │ └── TieredNumberContentWidget.java │ │ └── recipe │ │ │ ├── conditions │ │ │ ├── BiomeCondition.java │ │ │ ├── BlockCondition.java │ │ │ ├── DimensionCondition.java │ │ │ ├── PositionYCondition.java │ │ │ ├── PredicateCondition.java │ │ │ ├── RainingCondition.java │ │ │ └── ThunderCondition.java │ │ │ └── content │ │ │ ├── AspectStack.java │ │ │ └── Starlight.java │ │ ├── core │ │ ├── ASMTransformer.java │ │ ├── MultiblockedLoadingPlugin.java │ │ ├── asm │ │ │ ├── BlockVisitor.java │ │ │ ├── CCLBlockRendererDispatcherVisitor.java │ │ │ ├── DynamicTileEntityGenerator.java │ │ │ ├── JEIRecipesGuiVisitor.java │ │ │ ├── MEKPacketHandlerVisitor.java │ │ │ ├── hooks │ │ │ │ ├── BlockHooks.java │ │ │ │ ├── CCLHooks.java │ │ │ │ ├── JEIHooks.java │ │ │ │ └── MEKHooks.java │ │ │ └── util │ │ │ │ ├── ObfMapping.java │ │ │ │ └── TargetClassVisitor.java │ │ └── mixins │ │ │ ├── BlockModelRendererMixin.java │ │ │ ├── BlockRendererDispatcherMixin.java │ │ │ ├── ChunkMixin.java │ │ │ ├── EntityRendererMixin.java │ │ │ ├── FMLOutboundTargetMixin.java │ │ │ ├── ForgeBlockModelRendererMixin.java │ │ │ ├── MinecraftMixin.java │ │ │ ├── NBTTagCompoundMapExposer.java │ │ │ ├── RenderChunkMixin.java │ │ │ ├── RenderItemMixin.java │ │ │ ├── TileEntityMixin.java │ │ │ ├── TileEntityRendererDispatcherMixin.java │ │ │ └── WorldMixin.java │ │ ├── integration │ │ ├── InfoProviders.java │ │ └── provider │ │ │ └── RecipeProgressInfoProvider.java │ │ ├── jei │ │ ├── IJeiIngredientAdapter.java │ │ ├── JEIModularUIGuiContainer.java │ │ ├── JeiPlugin.java │ │ ├── ModularWrapper.java │ │ ├── MultiblockInfoRecipeFocusShower.java │ │ ├── ingredient │ │ │ ├── AbstractIngredient.java │ │ │ └── AspectListIngredient.java │ │ ├── multipage │ │ │ ├── MultiblockInfoCategory.java │ │ │ └── MultiblockInfoWrapper.java │ │ └── recipeppage │ │ │ ├── FuelWrapper.java │ │ │ ├── RecipeMapCategory.java │ │ │ ├── RecipeMapFuelCategory.java │ │ │ └── RecipeWrapper.java │ │ ├── network │ │ ├── IPacket.java │ │ ├── MultiblockedNetworking.java │ │ ├── c2s │ │ │ └── CPacketUIClientAction.java │ │ └── s2c │ │ │ ├── SPacketCommand.java │ │ │ ├── SPacketRemoveDisabledRendering.java │ │ │ ├── SPacketUIOpen.java │ │ │ └── SPacketUIWidgetUpdate.java │ │ ├── persistence │ │ ├── IAsyncThreadUpdate.java │ │ └── MultiblockWorldSavedData.java │ │ └── util │ │ ├── BlockPosFace.java │ │ ├── CycleItemStackHandler.java │ │ ├── FileUtility.java │ │ ├── ISearch.java │ │ ├── ItemStackKey.java │ │ ├── JsonUtil.java │ │ ├── LocalizationUtils.java │ │ ├── Position.java │ │ ├── PositionedRect.java │ │ ├── Quat.java │ │ ├── RayTraceUtils.java │ │ ├── ResourceUtils.java │ │ ├── SearchEngine.java │ │ ├── ShapeUtils.java │ │ ├── Size.java │ │ ├── Vector3.java │ │ └── world │ │ ├── DummyChunkProvider.java │ │ ├── DummySaveHandler.java │ │ └── DummyWorld.java └── resources │ ├── assets │ └── multiblocked │ │ ├── animations │ │ └── botarium.animation.json │ │ ├── definition │ │ └── part │ │ │ ├── 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 │ │ ├── demo │ │ └── particle.zs │ │ ├── geo │ │ └── botarium.geo.json │ │ ├── lang │ │ ├── en_us.lang │ │ └── zh_cn.lang │ │ ├── models │ │ ├── block │ │ │ ├── blueprint_table.json │ │ │ ├── blueprint_table_controller.json │ │ │ ├── blueprint_table_formed.json │ │ │ ├── controller_tester.json │ │ │ ├── cube_2_layer.json │ │ │ ├── emitter.json │ │ │ └── part_tester.json │ │ ├── item │ │ │ ├── blueprint.json │ │ │ ├── blueprint_pattern.json │ │ │ ├── multiblock_builder.json │ │ │ └── multiblock_builder_pattern.json │ │ ├── obj │ │ │ ├── energy_core_model.mtl │ │ │ └── energy_core_model.obj │ │ └── test_model.json │ │ ├── shaders │ │ ├── fbm.frag │ │ ├── image.frag │ │ ├── image.vert │ │ └── start.frag │ │ └── textures │ │ ├── blocks │ │ ├── blueprint_table.png │ │ ├── casing │ │ │ ├── base.png │ │ │ └── lv.png │ │ ├── gregtech_base.png │ │ ├── gregtech_front.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 │ │ ├── botarium.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 │ │ ├── test │ │ ├── d.png │ │ ├── e.png │ │ ├── n.png │ │ ├── n_layer2.png │ │ ├── s.png │ │ ├── s_layer2.png │ │ ├── s_layer2.png.mcmeta │ │ ├── u.png │ │ └── w.png │ │ └── void.png │ ├── mcmod.info │ ├── mixins.multiblocked.json │ ├── multiblocked_at.cfg │ └── pack.mcmeta └── test └── java ├── JsonBlockPatternTest.java └── com └── cleanroommc └── multiblocked └── api └── json └── FluidStackTypeAdapterTest.java /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: If you sure there is no previous issue for your problem, filling the blanks 4 | here. 5 | title: "[Bug report]" 6 | labels: '' 7 | assignees: '' 8 | 9 | --- 10 | 11 | ## Versions 12 | #### Multiblocked version: 13 | 14 | 15 | 16 | #### Forge version: 17 | 18 | 19 | 20 | #### Singleplayer or Multiplayer: 21 | 22 | 23 | 24 | #### Installed mods: 25 | 27 | 28 | 29 | ## Link to full crash-report or log 30 | 32 | 33 | 34 | 35 | ## Description of the problem 36 | #### How to reproduce: 37 | 38 | 39 | 1. 40 | 2. 41 | 3. etc... 42 | 43 | 44 | #### Expected result: 45 | 46 | 47 | 48 | #### Actual result: 49 | 50 | 51 | 52 | #### Pictures: 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/1.12-auto-publish-release.yml: -------------------------------------------------------------------------------- 1 | name: 1.12 Auto Build Release Publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | paths: 8 | - 'gradle.properties' 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | with: 16 | submodules: true 17 | 18 | - uses: actions/setup-java@v3 19 | with: 20 | java-version: '8' 21 | distribution: 'adopt' 22 | 23 | - name: Validate Gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | 26 | - name: Grant execute permission for gradlew 27 | run: chmod +x gradlew 28 | 29 | - name: Run the Gradle package task 30 | uses: gradle/gradle-build-action@v2 31 | with: 32 | arguments: build 33 | 34 | - name: Get file name 35 | id: var 36 | run: | 37 | MESSAGE=$(ls build/libs/* | grep sources.jar -v) 38 | echo file_path=$MESSAGE >> $GITHUB_OUTPUT 39 | 40 | - name: Upload to CurseForge 41 | uses: itsmeow/curseforge-upload@v3 42 | with: 43 | token: ${{ secrets.CURSEFORGE_TOKEN }} 44 | project_id: 604054 45 | game_endpoint: minecraft 46 | file_path: ${{ steps.var.outputs.file_path }} 47 | changelog: See recent commits [here](https://github.com/CleanroomMC/Multiblocked/commits/${{ github.sha }}). This is only marked as a beta release so CurseForge shows it on the front page. 48 | changelog_type: markdown 49 | # 1.12.2, Java 8 50 | game_versions: "Minecraft 1.12:1.12.2,Java 8,Forge" 51 | release_type: beta 52 | relations: mixin-booter:requiredDependency,geckolib:optionalDependency,jei:optionalDependency 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | production 11 | out 12 | logs 13 | *.ipr 14 | *.iws 15 | *.iml 16 | .idea 17 | 18 | # gradle 19 | build 20 | .gradle 21 | 22 | # other 23 | eclipse 24 | run 25 | .vscode 26 | 27 | logs/ 28 | test 29 | -------------------------------------------------------------------------------- /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 | 5 | # Mod Information 6 | mod_version = 0.8.10 7 | maven_group = com.cleanroommc 8 | archives_base_name = multiblocked 9 | 10 | # Boilerplate Options 11 | use_mixins = true 12 | use_coremod = true 13 | use_assetmover = false 14 | 15 | # Coremod Arguments 16 | coremod_plugin_class_name = com.cleanroommc.multiblocked.core.MultiblockedLoadingPlugin 17 | 18 | #systemProp.http.proxyHost=127.0.0.1 19 | #systemProp.http.proxyPort=1081 20 | #systemProp.https.proxyHost=127.0.0.1 21 | #systemProp.https.proxyPort=1081 22 | #systemProp.socks.proxyHost=127.0.0.1 23 | #systemProp.socks.proxyPort=1081 24 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | // RetroFuturaGradle 5 | name = 'GTNH Maven' 6 | url = 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' 7 | allowInsecureProtocol = true 8 | mavenContent { 9 | includeGroup 'com.gtnewhorizons' 10 | includeGroup 'com.gtnewhorizons.retrofuturagradle' 11 | } 12 | } 13 | gradlePluginPortal() 14 | mavenCentral() 15 | mavenLocal() 16 | } 17 | } 18 | 19 | plugins { 20 | // Automatic toolchain provisioning 21 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' 22 | } 23 | 24 | rootProject.name = 'Multiblocked' -------------------------------------------------------------------------------- /src/api/java/team/chisel/ctm/api/IFacade.java: -------------------------------------------------------------------------------- 1 | package team.chisel.ctm.api; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.util.EnumFacing; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.IBlockAccess; 9 | 10 | public interface IFacade { 11 | /** @deprecated */ 12 | @Nonnull 13 | @Deprecated 14 | IBlockState getFacade(@Nonnull IBlockAccess var1, @Nonnull BlockPos var2, @Nullable EnumFacing var3); 15 | 16 | @Nonnull 17 | default IBlockState getFacade(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, @Nonnull BlockPos connection) { 18 | return this.getFacade(world, pos, side); 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/MbdConfig.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked; 2 | 3 | import net.minecraftforge.common.config.Config; 4 | import net.minecraftforge.fml.common.Loader; 5 | 6 | @Config(modid = Multiblocked.MODID) 7 | public final class MbdConfig { 8 | 9 | public static NaturesAura naturesAura = Loader.isModLoaded(Multiblocked.MODID_NA) ? new NaturesAura() : null; 10 | 11 | @Config.Comment({"location of the mbd scripts and resources.", "Default: {.../config}/multiblocked"}) 12 | @Config.RequiresMcRestart 13 | public static String location = "multiblocked"; 14 | 15 | @Config.Comment({"If true, built-in parts (Item Input Bus, Item Output Bus, etc.) are enabled.", "Default: true"}) 16 | @Config.RequiresMcRestart 17 | public static boolean enableBuiltInComponents = true; 18 | 19 | @Config.Comment("Blacklist of tile entity capability proxy") 20 | public static String[] capabilityProxyBlacklist = new String[] { 21 | "de.ellpeck.actuallyadditions.common.tile.TileEntityPhantomEnergyface", 22 | "de.ellpeck.actuallyadditions.common.tile.TileEntityPhantomItemface", 23 | "de.ellpeck.actuallyadditions.common.tile.TileEntityPhantomLiquiface", 24 | "com.supermartijn642.entangled.EntangledBlockEntity", 25 | "com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController" 26 | }; 27 | 28 | public static class NaturesAura { 29 | @Config.Comment({"set the radius of aura value consumption.", "Default: 20"}) 30 | public int radius = 20; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/block/ItemComponent.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.block; 2 | 3 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 4 | import net.minecraft.client.util.ITooltipFlag; 5 | import net.minecraft.item.ItemBlock; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.world.World; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nonnull; 12 | import javax.annotation.Nullable; 13 | import java.util.List; 14 | 15 | public class ItemComponent extends ItemBlock { 16 | 17 | public ItemComponent(BlockComponent block) { 18 | super(block); 19 | setHasSubtypes(true); 20 | setRegistryName(block.getRegistryName()); 21 | if (block.definition != null) { 22 | setMaxStackSize(block.definition.properties.stackSize); 23 | } 24 | } 25 | 26 | public ComponentDefinition getDefinition() { 27 | return ((BlockComponent)block).definition; 28 | } 29 | 30 | @Nullable 31 | @Override 32 | public String getCreatorModId(@Nonnull ItemStack itemStack) { 33 | return getDefinition().location.getNamespace(); 34 | } 35 | 36 | @Override 37 | @SideOnly(Side.CLIENT) 38 | public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { 39 | super.addInformation(stack, worldIn, tooltip, flagIn); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/capability/IInnerCapabilityProvider.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.capability; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | import net.minecraftforge.common.capabilities.Capability; 5 | import net.minecraftforge.common.capabilities.ICapabilityProvider; 6 | 7 | import javax.annotation.Nonnull; 8 | import javax.annotation.Nullable; 9 | import java.util.Collections; 10 | import java.util.Set; 11 | 12 | public interface IInnerCapabilityProvider extends ICapabilityProvider { 13 | 14 | /** 15 | * inner capability used for recipe logic handling. 16 | */ 17 | @Nullable 18 | default T getInnerCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { 19 | return getCapability(capability, facing); 20 | } 21 | 22 | 23 | /** 24 | * inner capability used for recipe logic handling with slotName. 25 | */ 26 | default T getInnerCapability(@Nonnull Capability capability, @Nullable EnumFacing facing, @Nullable String slotName) { 27 | return getInnerCapability(capability, facing); 28 | } 29 | 30 | /** 31 | * additional slot names 32 | */ 33 | default Set getSlotNames() { 34 | return Collections.emptySet(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/capability/IO.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.capability; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import stanhebben.zenscript.annotations.*; 5 | 6 | /** 7 | * The capability can be input or output or both 8 | */ 9 | @ZenClass("mods.multiblocked.capability.IO") 10 | @ZenRegister 11 | public enum IO { 12 | @ZenProperty IN, 13 | @ZenProperty OUT, 14 | @ZenProperty BOTH; 15 | 16 | public static IO[] VALUES = IO.values(); 17 | 18 | @ZenOperator(OperatorType.EQUALS) 19 | public boolean equals(IO io) { 20 | return this == io; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/capability/proxy/CapCapabilityProxy.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.capability.proxy; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.MultiblockCapability; 4 | import net.minecraft.tileentity.TileEntity; 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, TileEntity 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 | @Override 26 | public boolean equals(Object obj) { 27 | return obj instanceof CapCapabilityProxy && Objects.equals(getCapability(null), ((CapCapabilityProxy) obj).getCapability(null)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/capability/trait/InterfaceUser.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.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/cleanroommc/multiblocked/api/crafttweaker/CTRegistry.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker; 2 | 3 | 4 | import com.cleanroommc.multiblocked.api.capability.MultiblockCapability; 5 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 6 | import com.cleanroommc.multiblocked.api.recipe.RecipeMap; 7 | import com.cleanroommc.multiblocked.api.registry.MbdCapabilities; 8 | import com.cleanroommc.multiblocked.api.registry.MbdComponents; 9 | import crafttweaker.annotations.ZenRegister; 10 | import net.minecraft.util.ResourceLocation; 11 | import stanhebben.zenscript.annotations.ZenClass; 12 | import stanhebben.zenscript.annotations.ZenMethod; 13 | 14 | @ZenClass("mods.multiblocked.MBDRegistry") 15 | @ZenRegister 16 | public class CTRegistry { 17 | 18 | @ZenMethod 19 | public static ComponentDefinition getDefinition(String name) { 20 | return MbdComponents.DEFINITION_REGISTRY.get(new ResourceLocation(name)); 21 | } 22 | 23 | @ZenMethod 24 | public static RecipeMap getRecipeMap(String name) { 25 | return RecipeMap.RECIPE_MAP_REGISTRY.get(name); 26 | } 27 | 28 | @ZenMethod 29 | public static MultiblockCapability getCapability(String name) { 30 | return MbdCapabilities.get(name); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/CapabilityBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.MultiblockCapability; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.CTRegistry; 5 | import crafttweaker.CraftTweakerAPI; 6 | import crafttweaker.annotations.BracketHandler; 7 | import crafttweaker.annotations.ZenRegister; 8 | 9 | @BracketHandler 10 | @ZenRegister 11 | public class CapabilityBracketHandler extends MultiblockedBracketHandler { 12 | public CapabilityBracketHandler() { 13 | super(CraftTweakerAPI.getJavaMethod(CapabilityBracketHandler.class, "get", String.class), "cap", MultiblockCapability.class); 14 | } 15 | 16 | public static MultiblockCapability get(String member) { 17 | return CTRegistry.getCapability(member); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/ControllerBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.CTRegistry; 4 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 5 | import com.cleanroommc.multiblocked.api.definition.ControllerDefinition; 6 | import crafttweaker.CraftTweakerAPI; 7 | import crafttweaker.annotations.BracketHandler; 8 | import crafttweaker.annotations.ZenRegister; 9 | 10 | @BracketHandler 11 | @ZenRegister 12 | public class ControllerBracketHandler extends MultiblockedBracketHandler { 13 | 14 | public ControllerBracketHandler() { 15 | super(CraftTweakerAPI.getJavaMethod(ControllerBracketHandler.class, "get", String.class), "controller", ControllerDefinition.class); 16 | } 17 | 18 | public static ControllerDefinition get(String member) { 19 | ComponentDefinition definition = CTRegistry.getDefinition(member); 20 | return definition instanceof ControllerDefinition ? ((ControllerDefinition) definition) : null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/DefinitionBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.CTRegistry; 4 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 5 | import crafttweaker.CraftTweakerAPI; 6 | import crafttweaker.annotations.BracketHandler; 7 | import crafttweaker.annotations.ZenRegister; 8 | 9 | @BracketHandler 10 | @ZenRegister 11 | public class DefinitionBracketHandler extends MultiblockedBracketHandler { 12 | 13 | public DefinitionBracketHandler() { 14 | super(CraftTweakerAPI.getJavaMethod(DefinitionBracketHandler.class, "get", String.class), "definition", ComponentDefinition.class); 15 | } 16 | 17 | public static ComponentDefinition get(String member) { 18 | return CTRegistry.getDefinition(member); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/MultiblockedBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import crafttweaker.zenscript.IBracketHandler; 4 | import stanhebben.zenscript.compiler.IEnvironmentGlobal; 5 | import stanhebben.zenscript.expression.ExpressionCallStatic; 6 | import stanhebben.zenscript.expression.ExpressionString; 7 | import stanhebben.zenscript.parser.Token; 8 | import stanhebben.zenscript.symbols.IZenSymbol; 9 | import stanhebben.zenscript.type.natives.IJavaMethod; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @author youyihj 15 | */ 16 | public abstract class MultiblockedBracketHandler implements IBracketHandler { 17 | protected final IJavaMethod method; 18 | protected final String key; 19 | protected final Class returnedClass; 20 | 21 | protected MultiblockedBracketHandler(IJavaMethod method, String key, Class returnedClass) { 22 | this.method = method; 23 | this.key = key; 24 | this.returnedClass = returnedClass; 25 | } 26 | 27 | @Override 28 | public IZenSymbol resolve(IEnvironmentGlobal environment, List tokens) { 29 | if ((tokens.size() < 5)) return null; 30 | if (!tokens.get(0).getValue().equalsIgnoreCase("mbd")) return null; 31 | if (!tokens.get(1).getValue().equals(":")) return null; 32 | if (!tokens.get(2).getValue().equals(key)) return null; 33 | if (!tokens.get(3).getValue().equals(":")) return null; 34 | StringBuilder nameBuilder = new StringBuilder(); 35 | for (int i = 4; i < tokens.size(); i++) { 36 | nameBuilder.append(tokens.get(i).getValue()); 37 | } 38 | return position -> new ExpressionCallStatic(position, environment, method, new ExpressionString(position, nameBuilder.toString())); 39 | } 40 | 41 | @Override 42 | public Class getReturnedClass() { 43 | return returnedClass; 44 | } 45 | 46 | @Override 47 | public String getRegexMatchingString() { 48 | return "mbd:" + key + ":.*"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/PartBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.CTRegistry; 4 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 5 | import com.cleanroommc.multiblocked.api.definition.PartDefinition; 6 | import crafttweaker.CraftTweakerAPI; 7 | import crafttweaker.annotations.BracketHandler; 8 | import crafttweaker.annotations.ZenRegister; 9 | 10 | /** 11 | * @author youyihj 12 | */ 13 | @ZenRegister 14 | @BracketHandler 15 | public class PartBracketHandler extends MultiblockedBracketHandler { 16 | public PartBracketHandler() { 17 | super(CraftTweakerAPI.getJavaMethod(PartBracketHandler.class, "get", String.class), "part", PartDefinition.class); 18 | } 19 | 20 | public static PartDefinition get(String member) { 21 | ComponentDefinition definition = CTRegistry.getDefinition(member); 22 | return definition instanceof PartDefinition ? ((PartDefinition) definition) : null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/brackethandler/RecipeMapBracketHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.brackethandler; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.CTRegistry; 4 | import com.cleanroommc.multiblocked.api.recipe.RecipeMap; 5 | import crafttweaker.CraftTweakerAPI; 6 | import crafttweaker.annotations.BracketHandler; 7 | import crafttweaker.annotations.ZenRegister; 8 | 9 | @BracketHandler 10 | @ZenRegister 11 | public class RecipeMapBracketHandler extends MultiblockedBracketHandler { 12 | public RecipeMapBracketHandler() { 13 | super(CraftTweakerAPI.getJavaMethod(RecipeMapBracketHandler.class, "get", String.class), "recipe_map", RecipeMap.class); 14 | } 15 | 16 | public static RecipeMap get(String member) { 17 | return CTRegistry.getRecipeMap(member); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/expanders/ExpandComponent.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.expanders; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTPart; 6 | import crafttweaker.annotations.ZenRegister; 7 | import stanhebben.zenscript.annotations.ZenCaster; 8 | import stanhebben.zenscript.annotations.ZenExpansion; 9 | 10 | @ZenRegister 11 | @ZenExpansion("mods.multiblocked.tile.Component") 12 | public class ExpandComponent { 13 | 14 | @ZenCaster 15 | public static ICTController asController(ICTComponent component) { 16 | return component instanceof ICTController ? (ICTController) component : null; 17 | } 18 | 19 | @ZenCaster 20 | public static ICTPart asPart(ICTComponent component) { 21 | return component instanceof ICTPart ? (ICTPart) component : null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/expanders/ExpandComponentDefinition.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.expanders; 2 | 3 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 4 | import com.cleanroommc.multiblocked.api.definition.ControllerDefinition; 5 | import com.cleanroommc.multiblocked.api.definition.PartDefinition; 6 | import crafttweaker.annotations.ZenRegister; 7 | import stanhebben.zenscript.annotations.ZenCaster; 8 | import stanhebben.zenscript.annotations.ZenExpansion; 9 | 10 | @ZenRegister 11 | @ZenExpansion("mods.multiblocked.definition.ComponentDefinition") 12 | public class ExpandComponentDefinition { 13 | 14 | @ZenCaster 15 | public static ControllerDefinition asController(ComponentDefinition definition) { 16 | return definition instanceof ControllerDefinition ? (ControllerDefinition) definition : null; 17 | } 18 | 19 | @ZenCaster 20 | public static PartDefinition asPart(ComponentDefinition definition) { 21 | return definition instanceof PartDefinition ? (PartDefinition) definition : null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/expanders/ExpandParticle.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.expanders; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTLaserParticle; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTParticle; 5 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTTextureParticle; 6 | import crafttweaker.annotations.ZenRegister; 7 | import stanhebben.zenscript.annotations.ZenCaster; 8 | import stanhebben.zenscript.annotations.ZenExpansion; 9 | 10 | @ZenRegister 11 | @ZenExpansion("mods.multiblocked.client.Particle") 12 | public class ExpandParticle { 13 | 14 | @ZenCaster 15 | public static ICTTextureParticle asTexture(ICTParticle particle) { 16 | return particle instanceof ICTTextureParticle ? (ICTTextureParticle) particle : null; 17 | } 18 | 19 | @ZenCaster 20 | public static ICTLaserParticle asLaser(ICTParticle particle) { 21 | return particle instanceof ICTLaserParticle ? (ICTLaserParticle) particle : null; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IApplyContentModifier.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.capability.IO; 5 | import com.cleanroommc.multiblocked.api.capability.MultiblockCapability; 6 | import com.cleanroommc.multiblocked.api.recipe.Content; 7 | import com.cleanroommc.multiblocked.api.recipe.ContentModifier; 8 | import com.cleanroommc.multiblocked.api.recipe.Recipe; 9 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 10 | import crafttweaker.annotations.ZenRegister; 11 | import net.minecraftforge.fml.common.Optional; 12 | import stanhebben.zenscript.annotations.ZenClass; 13 | 14 | import javax.annotation.Nullable; 15 | 16 | /** 17 | * @author youyihj 18 | */ 19 | @FunctionalInterface 20 | @ZenClass("mods.multiblocked.functions.IApplyContentModifier") 21 | @ZenRegister 22 | public interface IApplyContentModifier { 23 | @Optional.Method(modid = Multiblocked.MODID_CT) 24 | @Nullable 25 | ContentModifier apply(RecipeLogic logic, Recipe recipe, Content content, MultiblockCapability capability, IO io, boolean isTickIO); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/ICalcRecipeDuration.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.recipe.Recipe; 5 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 6 | import crafttweaker.annotations.ZenRegister; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenRegister 12 | @ZenClass("mods.multiblocked.functions.ICalcRecipeDuration") 13 | public interface ICalcRecipeDuration { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | int apply(RecipeLogic logic, Recipe recipe, int oldDuration); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IDrops.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 4 | import crafttweaker.annotations.ZenRegister; 5 | import crafttweaker.api.item.IItemStack; 6 | import crafttweaker.api.player.IPlayer; 7 | import com.cleanroommc.multiblocked.Multiblocked; 8 | import net.minecraftforge.fml.common.Optional; 9 | import stanhebben.zenscript.annotations.ZenClass; 10 | 11 | @FunctionalInterface 12 | @ZenClass("mods.multiblocked.functions.IDrops") 13 | @ZenRegister 14 | public interface IDrops { 15 | @Optional.Method(modid = Multiblocked.MODID_CT) 16 | IItemStack[] apply(ICTComponent componentTileEntity, IPlayer player); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IDynamicPattern.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import crafttweaker.annotations.ZenRegister; 6 | import com.cleanroommc.multiblocked.api.pattern.BlockPattern; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IDynamicPattern") 12 | @ZenRegister 13 | public interface IDynamicPattern { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | BlockPattern apply(ICTController controllerTileEntity); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IDynamicRenderer.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import com.cleanroommc.multiblocked.client.renderer.IRenderer; 6 | import crafttweaker.annotations.ZenRegister; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IDynamicRenderer") 12 | @ZenRegister 13 | public interface IDynamicRenderer { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | IRenderer apply(ICTComponent componentTileEntity); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IGetOutputRedstoneSignal.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 4 | import crafttweaker.annotations.ZenRegister; 5 | import crafttweaker.api.world.IFacing; 6 | import com.cleanroommc.multiblocked.Multiblocked; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IGetOutputRedstoneSignal") 12 | @ZenRegister 13 | public interface IGetOutputRedstoneSignal { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | int apply(ICTComponent componentTileEntity, IFacing facing); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/ILeftClick.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 4 | import crafttweaker.annotations.ZenRegister; 5 | import crafttweaker.api.player.IPlayer; 6 | import com.cleanroommc.multiblocked.Multiblocked; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.ILeftClick") 12 | @ZenRegister 13 | public interface ILeftClick { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | void apply(ICTComponent componentTileEntity, IPlayer player); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/INeighborChanged.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.INeighborChanged") 11 | @ZenRegister 12 | public interface INeighborChanged { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | void apply(ICTComponent componentTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IPartAddedToMulti.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTPart; 6 | import crafttweaker.annotations.ZenRegister; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IPartAddedToMulti") 12 | @ZenRegister 13 | public interface IPartAddedToMulti { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | void apply(ICTPart partTileEntity, ICTController controllerTileEntity); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IPartRemovedFromMulti.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTPart; 6 | import crafttweaker.annotations.ZenRegister; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IPartRemovedFromMulti") 12 | @ZenRegister 13 | public interface IPartRemovedFromMulti { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | void apply(ICTPart partTileEntity, ICTController controllerTileEntity); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IPredicateFunction.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.api.recipe.Recipe; 4 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 5 | import crafttweaker.annotations.ZenRegister; 6 | import stanhebben.zenscript.annotations.ZenClass; 7 | 8 | @FunctionalInterface 9 | @ZenClass("mods.multiblocked.functions.IPredicateFunction") 10 | @ZenRegister 11 | public interface IPredicateFunction { 12 | 13 | boolean test(RecipeLogic recipeLogic, Recipe recipe); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IReadInitialData.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import crafttweaker.api.data.IData; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IReadInitialData") 12 | @ZenRegister 13 | public interface IReadInitialData { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | void apply(ICTComponent componentTileEntity, IData data); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IReceiveCustomData.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import crafttweaker.api.data.IData; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IReceiveCustomData") 12 | @ZenRegister 13 | public interface IReceiveCustomData { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | void apply(ICTComponent componentTileEntity, int id, IData data); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IRecipeFinish.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import com.cleanroommc.multiblocked.api.recipe.Recipe; 5 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 6 | import stanhebben.zenscript.annotations.ZenClass; 7 | 8 | @FunctionalInterface 9 | @ZenClass("mods.multiblocked.functions.IRecipeFinish") 10 | @ZenRegister 11 | public interface IRecipeFinish { 12 | /** 13 | * @return true - block the original logic 14 | */ 15 | boolean apply(RecipeLogic recipeLogic, Recipe recipe); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IRightClick.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 4 | import crafttweaker.annotations.ZenRegister; 5 | import crafttweaker.api.player.IPlayer; 6 | import crafttweaker.api.world.IFacing; 7 | import com.cleanroommc.multiblocked.Multiblocked; 8 | import net.minecraftforge.fml.common.Optional; 9 | import stanhebben.zenscript.annotations.ZenClass; 10 | 11 | @FunctionalInterface 12 | @ZenClass("mods.multiblocked.functions.IRightClick") 13 | @ZenRegister 14 | public interface IRightClick { 15 | @Optional.Method(modid = Multiblocked.MODID_CT) 16 | boolean apply(ICTComponent componentTileEntity, IPlayer player, IFacing facing, float hitX, float hitY, float hitZ); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/ISetupRecipe.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import com.cleanroommc.multiblocked.api.recipe.Recipe; 5 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 6 | import stanhebben.zenscript.annotations.ZenClass; 7 | 8 | @FunctionalInterface 9 | @ZenClass("mods.multiblocked.functions.ISetupRecipe") 10 | @ZenRegister 11 | public interface ISetupRecipe { 12 | /** 13 | * @return true - block the original logic 14 | */ 15 | boolean apply(RecipeLogic recipeLogic, Recipe recipe); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IShouldCheckPattern.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IShouldCheckPattern") 11 | @ZenRegister 12 | public interface IShouldCheckPattern { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | boolean apply(ICTController controllerTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IStatusChanged.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IStatusChanged") 11 | @ZenRegister 12 | public interface IStatusChanged { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | String apply(ICTComponent componentTileEntity, String newStatus); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IStructureFormed.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IStructureFormed") 11 | @ZenRegister 12 | public interface IStructureFormed { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | void apply(ICTController controllerTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IStructureInvalid.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IStructureInvalid") 11 | @ZenRegister 12 | public interface IStructureInvalid { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | void apply(ICTController controllerTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IUpdateFormed.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTController; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IUpdateFormed") 11 | @ZenRegister 12 | public interface IUpdateFormed { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | void apply(ICTController controllerTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IUpdateTick.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraftforge.fml.common.Optional; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | 9 | @FunctionalInterface 10 | @ZenClass("mods.multiblocked.functions.IUpdateTick") 11 | @ZenRegister 12 | public interface IUpdateTick { 13 | @Optional.Method(modid = Multiblocked.MODID_CT) 14 | void apply(ICTComponent componentTileEntity); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/functions/IWriteInitialData.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.functions; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.crafttweaker.interfaces.ICTComponent; 5 | import crafttweaker.annotations.ZenRegister; 6 | import crafttweaker.api.data.IData; 7 | import net.minecraftforge.fml.common.Optional; 8 | import stanhebben.zenscript.annotations.ZenClass; 9 | 10 | @FunctionalInterface 11 | @ZenClass("mods.multiblocked.functions.IWriteInitialData") 12 | @ZenRegister 13 | public interface IWriteInitialData { 14 | @Optional.Method(modid = Multiblocked.MODID_CT) 15 | IData apply(ICTComponent componentTileEntity); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/interfaces/ICTController.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.interfaces; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.ICapabilityProxyHolder; 4 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 5 | import com.cleanroommc.multiblocked.api.tile.ControllerTileEntity; 6 | import crafttweaker.annotations.ZenRegister; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | import stanhebben.zenscript.annotations.ZenGetter; 9 | import stanhebben.zenscript.annotations.ZenMethod; 10 | 11 | @ZenClass("mods.multiblocked.tile.Controller") 12 | @ZenRegister 13 | public interface ICTController extends ICTComponent, ICapabilityProxyHolder { 14 | 15 | ControllerTileEntity getInner(); 16 | 17 | @ZenMethod 18 | default boolean checkPattern() { 19 | return getInner().checkPattern(); 20 | } 21 | 22 | @ZenMethod 23 | default boolean shouldCheckPattern() { 24 | return getInner().shouldCheckPattern(); 25 | } 26 | 27 | @ZenGetter 28 | default RecipeLogic recipeLogic() { 29 | return getInner().getRecipeLogic(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/interfaces/ICTLaserParticle.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.interfaces; 2 | 3 | import com.cleanroommc.multiblocked.client.particle.LaserBeamParticle; 4 | import com.cleanroommc.multiblocked.util.Vector3; 5 | import crafttweaker.annotations.ZenRegister; 6 | import net.minecraft.util.ResourceLocation; 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | import stanhebben.zenscript.annotations.ZenClass; 10 | import stanhebben.zenscript.annotations.ZenMethod; 11 | 12 | @ZenRegister 13 | @ZenClass("mods.multiblocked.client.LaserParticle") 14 | public interface ICTLaserParticle extends ICTParticle{ 15 | 16 | @SideOnly(Side.CLIENT) 17 | LaserBeamParticle getInner(); 18 | 19 | @ZenMethod 20 | default void setBody(String location) { 21 | getInner().setBody(new ResourceLocation(location)); 22 | } 23 | 24 | @ZenMethod 25 | default void setHead(String location) { 26 | getInner().setHead(new ResourceLocation(location)); 27 | } 28 | 29 | @ZenMethod 30 | default void setStartPos(double x, double y, double z) { 31 | getInner().setStartPos(new Vector3(x, y, z)); 32 | } 33 | 34 | @ZenMethod 35 | default void setEndPos(double x, double y, double z) { 36 | getInner().setEndPos(new Vector3(x, y, z)); 37 | } 38 | 39 | @ZenMethod 40 | void setBeamHeight(float beamHeight); 41 | 42 | @ZenMethod 43 | void setHeadWidth(float headWidth); 44 | 45 | @ZenMethod 46 | void setAlpha(float alpha); 47 | 48 | @ZenMethod 49 | void setEmit(float emit); 50 | 51 | @ZenMethod 52 | void setVerticalMode(boolean verticalMode); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/crafttweaker/interfaces/ICTPart.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.crafttweaker.interfaces; 2 | 3 | import com.cleanroommc.multiblocked.api.tile.part.PartTileEntity; 4 | import crafttweaker.annotations.ZenRegister; 5 | import stanhebben.zenscript.annotations.ZenClass; 6 | import stanhebben.zenscript.annotations.ZenGetter; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @ZenClass("mods.multiblocked.tile.Part") 12 | @ZenRegister 13 | public interface ICTPart extends ICTComponent { 14 | 15 | PartTileEntity getInner(); 16 | 17 | @ZenGetter 18 | default List controllers() { 19 | return new ArrayList<>(getInner().getControllers()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/definition/PartDefinition.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.definition; 2 | 3 | import com.cleanroommc.multiblocked.api.crafttweaker.functions.IPartAddedToMulti; 4 | import com.google.gson.JsonObject; 5 | import crafttweaker.annotations.ZenRegister; 6 | import com.cleanroommc.multiblocked.api.crafttweaker.functions.IPartRemovedFromMulti; 7 | import com.cleanroommc.multiblocked.api.tile.part.PartTileEntity; 8 | import net.minecraft.util.JsonUtils; 9 | import net.minecraft.util.ResourceLocation; 10 | import stanhebben.zenscript.annotations.ZenClass; 11 | import stanhebben.zenscript.annotations.ZenProperty; 12 | 13 | /** 14 | * Definition of a part. 15 | */ 16 | @ZenClass("mods.multiblocked.definition.PartDefinition") 17 | @ZenRegister 18 | public class PartDefinition extends ComponentDefinition { 19 | 20 | @ZenProperty 21 | public boolean canShared = true; 22 | @ZenProperty 23 | public transient IPartAddedToMulti partAddedToMulti; 24 | @ZenProperty 25 | public transient IPartRemovedFromMulti partRemovedFromMulti; 26 | 27 | // used for Gson 28 | public PartDefinition() { 29 | super(null, PartTileEntity.PartSimpleTileEntity.class); 30 | } 31 | 32 | public PartDefinition(ResourceLocation location, Class> clazz) { 33 | super(location, clazz); 34 | } 35 | 36 | public PartDefinition(ResourceLocation location) { 37 | super(location, PartTileEntity.PartSimpleTileEntity.class); 38 | } 39 | 40 | @Override 41 | public void fromJson(JsonObject json) { 42 | super.fromJson(json); 43 | canShared = JsonUtils.getBoolean(json, "canShared", canShared); 44 | } 45 | 46 | @Override 47 | public JsonObject toJson(JsonObject json) { 48 | json = super.toJson(json); 49 | json.addProperty("canShared", canShared); 50 | return json; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/factory/TileEntityUIFactory.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.factory; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.modular.IUIHolder; 4 | import com.cleanroommc.multiblocked.api.gui.modular.ModularUI; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.network.PacketBuffer; 8 | import net.minecraft.tileentity.TileEntity; 9 | 10 | public class TileEntityUIFactory extends UIFactory{ 11 | public static final TileEntityUIFactory INSTANCE = new TileEntityUIFactory(); 12 | 13 | private TileEntityUIFactory() { 14 | super(); 15 | } 16 | 17 | @Override 18 | protected ModularUI createUITemplate(TileEntity holder, EntityPlayer entityPlayer) { 19 | if (holder instanceof IUIHolder) { 20 | return ((IUIHolder) holder).createUI(entityPlayer); 21 | } 22 | return null; 23 | } 24 | 25 | @Override 26 | protected TileEntity readHolderFromSyncData(PacketBuffer syncData) { 27 | return Minecraft.getMinecraft().world.getTileEntity(syncData.readBlockPos()); 28 | } 29 | 30 | @Override 31 | protected void writeHolderToSyncData(PacketBuffer syncData, TileEntity holder) { 32 | syncData.writeBlockPos(holder.getPos()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/ingredient/IGhostIngredientTarget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.ingredient; 2 | 3 | import mezz.jei.api.gui.IGhostIngredientHandler.Target; 4 | import net.minecraftforge.fml.common.Optional; 5 | 6 | import java.util.List; 7 | 8 | public interface IGhostIngredientTarget { 9 | 10 | @Optional.Method(modid = "jei") 11 | List> getPhantomTargets(Object ingredient); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/ingredient/IIngredientSlot.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.ingredient; 2 | 3 | public interface IIngredientSlot { 4 | 5 | Object getIngredientOverMouse(int mouseX, int mouseY); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/ingredient/IRecipeTransferHandlerWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.ingredient; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.modular.ModularUIContainer; 4 | import mezz.jei.api.gui.IRecipeLayout; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | 7 | public interface IRecipeTransferHandlerWidget { 8 | 9 | String transferRecipe(ModularUIContainer container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/modular/IUIHolder.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.modular; 2 | 3 | 4 | import net.minecraft.entity.player.EntityPlayer; 5 | 6 | public interface IUIHolder { 7 | IUIHolder EMPTY = new IUIHolder() { 8 | @Override 9 | public ModularUI createUI(EntityPlayer entityPlayer) { 10 | return null; 11 | } 12 | 13 | @Override 14 | public boolean isInvalid() { 15 | return false; 16 | } 17 | 18 | @Override 19 | public boolean isRemote() { 20 | return false; 21 | } 22 | 23 | @Override 24 | public void markAsDirty() { 25 | 26 | } 27 | }; 28 | 29 | ModularUI createUI(EntityPlayer entityPlayer); 30 | 31 | boolean isInvalid(); 32 | 33 | boolean isRemote(); 34 | 35 | void markAsDirty(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/modular/WidgetUIAccess.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.modular; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.widget.Widget; 4 | import com.cleanroommc.multiblocked.api.gui.widget.imp.SlotWidget; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.network.PacketBuffer; 7 | 8 | import java.util.function.Consumer; 9 | 10 | public interface WidgetUIAccess { 11 | 12 | void notifySizeChange(); 13 | 14 | void notifyWidgetChange(); 15 | 16 | boolean attemptMergeStack(ItemStack itemStack, boolean fromContainer, boolean simulate); 17 | 18 | void sendSlotUpdate(SlotWidget slot); 19 | 20 | void sendHeldItemUpdate(); 21 | 22 | void writeClientAction(Widget widget, int id, Consumer payloadWriter); 23 | 24 | void writeUpdateInfo(Widget widget, int id, Consumer payloadWriter); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/texture/ColorBorderTexture.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.texture; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.util.DrawerHelper; 4 | 5 | import java.awt.Color; 6 | 7 | public class ColorBorderTexture implements IGuiTexture{ 8 | public int color; 9 | public int border; 10 | 11 | public ColorBorderTexture(int border, int color) { 12 | this.color = color; 13 | this.border = border; 14 | } 15 | 16 | public ColorBorderTexture(int border, Color color) { 17 | this.color = color.getRGB(); 18 | this.border = border; 19 | } 20 | 21 | public ColorBorderTexture setBorder(int border) { 22 | this.border = border; 23 | return this; 24 | } 25 | 26 | 27 | 28 | public void setColor(int color) { 29 | this.color = color; 30 | } 31 | 32 | public int getColor() { 33 | return color; 34 | } 35 | 36 | @Override 37 | public void draw(int mouseX, int mouseY, double x, double y, int width, int height) { 38 | DrawerHelper.drawBorder((int)x, (int)y, width, height, color, border); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/texture/ColorRectTexture.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.texture; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.util.DrawerHelper; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import org.lwjgl.opengl.GL11; 6 | 7 | import java.awt.Color; 8 | 9 | public class ColorRectTexture implements IGuiTexture{ 10 | public int color; 11 | 12 | public ColorRectTexture(int color) { 13 | this.color = color; 14 | } 15 | 16 | public ColorRectTexture(Color color) { 17 | this.color = color.getRGB(); 18 | } 19 | 20 | public void setColor(int color) { 21 | this.color = color; 22 | } 23 | 24 | public int getColor() { 25 | return color; 26 | } 27 | 28 | @Override 29 | public void draw(int mouseX, int mouseY, double x, double y, int width, int height) { 30 | DrawerHelper.drawSolidRect((int) x, (int) y, width, height, color); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/texture/GuiTextureGroup.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.texture; 2 | 3 | public class GuiTextureGroup implements IGuiTexture{ 4 | public IGuiTexture[] textures; 5 | 6 | public GuiTextureGroup(IGuiTexture... textures) { 7 | this.textures = textures; 8 | } 9 | 10 | public GuiTextureGroup setTextures(IGuiTexture[] textures) { 11 | this.textures = textures; 12 | return this; 13 | } 14 | 15 | @Override 16 | public void draw(double x, double y, int width, int height) { 17 | for (IGuiTexture texture : textures) { 18 | texture.draw(x, y, width, height); 19 | } 20 | } 21 | 22 | @Override 23 | public void updateTick() { 24 | for (IGuiTexture texture : textures) { 25 | texture.updateTick(); 26 | } 27 | } 28 | 29 | @Override 30 | public void drawSubArea(double x, double y, int width, int height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { 31 | for (IGuiTexture texture : textures) { 32 | texture.drawSubArea(x, y, width, height, drawnU, drawnV, drawnWidth, drawnHeight); 33 | } 34 | } 35 | 36 | @Override 37 | public void draw(int mouseX, int mouseY, double x, double y, int width, int height) { 38 | for (IGuiTexture texture : textures) { 39 | texture.draw(mouseX, mouseY, x, y, width, height); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/texture/IGuiTexture.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.texture; 2 | 3 | import mezz.jei.api.gui.IDrawable; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraftforge.fml.common.Optional; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | public interface IGuiTexture { 12 | 13 | @Deprecated 14 | default void draw(double x, double y, int width, int height) { 15 | draw(0, 0, x, y, width, height); 16 | } 17 | 18 | void draw(int mouseX, int mouseY, double x, double y, int width, int height); 19 | 20 | default void updateTick() { } 21 | 22 | IGuiTexture EMPTY = (mouseX, mouseY, x, y, width, height) -> {}; 23 | 24 | default void drawSubArea(double x, double y, int width, int height, double drawnU, double drawnV, double drawnWidth, double drawnHeight) { 25 | draw(x, y, width, height); 26 | } 27 | 28 | 29 | @SideOnly(Side.CLIENT) 30 | @Optional.Method(modid = "jei") 31 | default IDrawable toDrawable(final int width, final int height) { 32 | return new IDrawable() { 33 | @Override 34 | public int getWidth() { 35 | return width; 36 | } 37 | 38 | @Override 39 | public int getHeight() { 40 | return height; 41 | } 42 | 43 | @Override 44 | public void draw(@Nonnull Minecraft minecraft, int x, int y) { 45 | IGuiTexture.this.draw(0, 0, x, y, width, height); 46 | } 47 | }; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/texture/ItemStackTexture.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.texture; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.RenderHelper; 6 | import net.minecraft.client.renderer.RenderItem; 7 | import net.minecraft.item.Item; 8 | import net.minecraft.item.ItemStack; 9 | 10 | public class ItemStackTexture implements IGuiTexture{ 11 | private final ItemStack[] itemStack; 12 | private int index = 0; 13 | private int ticks = 0; 14 | 15 | public ItemStackTexture(ItemStack... itemStacks) { 16 | this.itemStack = itemStacks; 17 | } 18 | 19 | public ItemStackTexture(Item... items) { 20 | this.itemStack = new ItemStack[items.length]; 21 | for(int i = 0; i < items.length; i++) { 22 | itemStack[i] = new ItemStack(items[i]); 23 | } 24 | } 25 | 26 | @Override 27 | public void updateTick() { 28 | if(itemStack.length > 1 && ++ticks % 20 == 0) 29 | if(++index == itemStack.length) 30 | index = 0; 31 | } 32 | 33 | @Override 34 | public void draw(int mouseX, int mouseY, double x, double y, int width, int height) { 35 | if (itemStack.length == 0) return; 36 | RenderHelper.disableStandardItemLighting(); 37 | GlStateManager.disableDepth(); 38 | RenderHelper.enableGUIStandardItemLighting(); 39 | GlStateManager.pushMatrix(); 40 | GlStateManager.enableDepth(); 41 | GlStateManager.scale(width / 16f, height / 16f, 0.0001); 42 | GlStateManager.translate(x * 16 / width, y * 16 / height, 0); 43 | RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); 44 | itemRender.renderItemAndEffectIntoGUI(itemStack[index], 0, 0); 45 | GlStateManager.enableAlpha(); 46 | GlStateManager.popMatrix(); 47 | RenderHelper.disableStandardItemLighting(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/util/ClickData.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.util; 2 | 3 | import net.minecraft.network.PacketBuffer; 4 | import net.minecraftforge.fml.relauncher.Side; 5 | import net.minecraftforge.fml.relauncher.SideOnly; 6 | import org.lwjgl.input.Keyboard; 7 | import org.lwjgl.input.Mouse; 8 | 9 | public class ClickData { 10 | public final int button; 11 | public final boolean isShiftClick; 12 | public final boolean isCtrlClick; 13 | public final boolean isRemote; 14 | 15 | private ClickData(int button, boolean isShiftClick, boolean isCtrlClick, boolean isRemote) { 16 | this.button = button; 17 | this.isShiftClick = isShiftClick; 18 | this.isCtrlClick = isCtrlClick; 19 | this.isRemote = isRemote; 20 | } 21 | 22 | @SideOnly(Side.CLIENT) 23 | public ClickData() { 24 | this.button = Mouse.getEventButton(); 25 | this.isShiftClick = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); 26 | this.isCtrlClick = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); 27 | this.isRemote = true; 28 | } 29 | 30 | @SideOnly(Side.CLIENT) 31 | public void writeToBuf(PacketBuffer buf) { 32 | buf.writeVarInt(button); 33 | buf.writeBoolean(isShiftClick); 34 | buf.writeBoolean(isCtrlClick); 35 | } 36 | 37 | public static ClickData readFromBuf(PacketBuffer buf) { 38 | int button = buf.readVarInt(); 39 | boolean shiftClick = buf.readBoolean(); 40 | boolean ctrlClick = buf.readBoolean(); 41 | return new ClickData(button, shiftClick, ctrlClick, false); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/util/FileNode.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.util; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | public class FileNode extends TreeNode { 9 | 10 | public FileNode(File dir){ 11 | this(0, dir); 12 | } 13 | 14 | private FileNode(int dimension, File key) { 15 | super(dimension, key); 16 | } 17 | 18 | @Override 19 | public boolean isLeaf() { 20 | return getKey().isFile(); 21 | } 22 | 23 | @Override 24 | public File getContent() { 25 | return isLeaf() ? getKey() : null; 26 | } 27 | 28 | @Override 29 | public List> getChildren() { 30 | if (children == null && !isLeaf()) { 31 | children = new ArrayList<>(); 32 | Arrays.stream(key.listFiles()).sorted((a, b)->{ 33 | if (a.isFile() && b.isFile()) { 34 | return a.compareTo(b); 35 | } else if (a.isDirectory() && b.isDirectory()) { 36 | return a.compareTo(b); 37 | } else if(a.isDirectory()) { 38 | return -1; 39 | } 40 | return 1; 41 | }).forEach(file -> children.add(new FileNode(dimension + 1, file).setValid(valid))); 42 | } 43 | return super.getChildren(); 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return getKey().getName(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/util/PerTickIntCounter.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.util; 2 | 3 | import net.minecraft.world.World; 4 | 5 | public class PerTickIntCounter { 6 | 7 | private final int defaultValue; 8 | 9 | private long lastUpdatedWorldTime; 10 | 11 | private int currentValue; 12 | 13 | public PerTickIntCounter(int defaultValue) { 14 | this.defaultValue = defaultValue; 15 | this.currentValue = defaultValue; 16 | } 17 | 18 | private void checkValueState(World world) { 19 | long currentWorldTime = world.getTotalWorldTime(); 20 | if (currentWorldTime != lastUpdatedWorldTime) { 21 | this.lastUpdatedWorldTime = currentWorldTime; 22 | this.currentValue = defaultValue; 23 | } 24 | } 25 | 26 | public int get(World world) { 27 | checkValueState(world); 28 | return currentValue; 29 | } 30 | 31 | public void increment(World world, int value) { 32 | checkValueState(world); 33 | this.currentValue += value; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/widget/imp/ImageWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.widget.imp; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.texture.IGuiTexture; 4 | import com.cleanroommc.multiblocked.util.Position; 5 | import com.cleanroommc.multiblocked.util.Size; 6 | import com.cleanroommc.multiblocked.api.gui.util.DrawerHelper; 7 | import com.cleanroommc.multiblocked.api.gui.widget.Widget; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | public class ImageWidget extends Widget { 12 | 13 | protected IGuiTexture area; 14 | 15 | private int border; 16 | private int borderColor; 17 | 18 | public ImageWidget(int xPosition, int yPosition, int width, int height) { 19 | super(xPosition, yPosition, width, height); 20 | } 21 | 22 | public ImageWidget(int xPosition, int yPosition, int width, int height, IGuiTexture area) { 23 | this(xPosition, yPosition, width, height); 24 | this.area = area; 25 | } 26 | 27 | public ImageWidget setImage(IGuiTexture area) { 28 | this.area = area; 29 | return this; 30 | } 31 | 32 | public IGuiTexture getImage() { 33 | return area; 34 | } 35 | 36 | public ImageWidget setBorder(int border, int color) { 37 | this.border = border; 38 | this.borderColor = color; 39 | return this; 40 | } 41 | 42 | @Override 43 | public void updateScreen() { 44 | if (area != null) { 45 | area.updateTick(); 46 | } 47 | } 48 | 49 | @Override 50 | @SideOnly(Side.CLIENT) 51 | public void drawInBackground(int mouseX, int mouseY, float partialTicks) { 52 | if (area == null) return; 53 | Position position = getPosition(); 54 | Size size = getSize(); 55 | area.draw(mouseX, mouseY, position.x, position.y, size.width, size.height); 56 | if (border > 0) { 57 | DrawerHelper.drawBorder(position.x, position.y, size.width, size.height, borderColor, border); 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/widget/imp/blueprint_table/components/PartWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.widget.imp.blueprint_table.components; 2 | 3 | import com.cleanroommc.multiblocked.api.definition.PartDefinition; 4 | import com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup; 5 | import com.cleanroommc.multiblocked.api.gui.widget.imp.GuiUtils; 6 | import com.cleanroommc.multiblocked.api.pattern.JsonBlockPattern; 7 | import com.google.gson.JsonObject; 8 | 9 | import java.util.function.Consumer; 10 | 11 | public class PartWidget extends ComponentWidget{ 12 | protected JsonBlockPattern pattern; 13 | 14 | public PartWidget(WidgetGroup group, PartDefinition definition, Consumer onSave) { 15 | super(group, definition, onSave); 16 | int x = 47; 17 | S1.addWidget(GuiUtils.createBoolSwitch(x + 100, 150, "canShared", "multiblocked.gui.widget.part.shared", definition.canShared, r -> definition.canShared = r)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/widget/imp/controller/PageWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.widget.imp.controller; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.texture.IGuiTexture; 4 | import com.cleanroommc.multiblocked.api.gui.texture.ResourceTexture; 5 | import com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup; 6 | import com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabButton; 7 | import com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabContainer; 8 | 9 | public abstract class PageWidget extends WidgetGroup { 10 | protected final ResourceTexture page; 11 | protected final IGuiTexture background; 12 | 13 | public PageWidget(ResourceTexture page, TabContainer tabContainer) { 14 | super(20, 0, 176, 256); 15 | this.page = page; 16 | this.background = page.getSubTexture(0, 0, 176 / 256.0, 1); 17 | tabContainer.addTab(new TabButton(0, tabContainer.containerGroup.widgets.size() * 20, 20, 20) 18 | .setTexture(page.getSubTexture(176 / 256.0, 216 / 256.0, 20 / 256.0, 20 / 256.0), 19 | page.getSubTexture(176 / 256.0, 236 / 256.0, 20 / 256.0, 20 / 256.0)), 20 | this); 21 | } 22 | 23 | @Override 24 | public void drawInBackground(int mouseX, int mouseY, float partialTicks) { 25 | int x = getPosition().x; 26 | int y = getPosition().y; 27 | int width = getSize().width; 28 | int height = getSize().height; 29 | background.draw(mouseX, mouseY, x, y, width, height); 30 | super.drawInBackground(mouseX, mouseY, partialTicks); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/widget/imp/controller/structure/StructurePageWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.widget.imp.controller.structure; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.definition.ControllerDefinition; 5 | import com.cleanroommc.multiblocked.api.gui.texture.ResourceTexture; 6 | import com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup; 7 | import com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabButton; 8 | import com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabContainer; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | public class StructurePageWidget extends WidgetGroup { 13 | 14 | public StructurePageWidget(ControllerDefinition controllerDefinition, TabContainer tabContainer) { 15 | super(20, 0, 176, 256); 16 | ResourceTexture page = new ResourceTexture("multiblocked:textures/gui/structure_page.png"); 17 | tabContainer.addTab(new TabButton(0, tabContainer.widgets.size() * 10, 20, 20) 18 | .setTexture(page.getSubTexture(202 / 256.0, 0 / 256.0, 20 / 256.0, 20 / 256.0), 19 | page.getSubTexture(202 / 256.0, 20 / 256.0, 20 / 256.0, 20 / 256.0)), 20 | this); 21 | setClientSideWidget(); 22 | if (Multiblocked.isClient()) { 23 | addWidget(getPatternWidget(controllerDefinition)); 24 | } 25 | } 26 | 27 | @SideOnly(Side.CLIENT) 28 | public WidgetGroup getPatternWidget(ControllerDefinition controllerDefinition) { 29 | if (Multiblocked.isClient()) { 30 | return PatternWidget.getPatternWidget(controllerDefinition); 31 | } 32 | return null; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/gui/widget/imp/tab/TabButton.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.gui.widget.imp.tab; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.texture.IGuiTexture; 4 | import com.cleanroommc.multiblocked.api.gui.util.ClickData; 5 | import com.cleanroommc.multiblocked.api.gui.widget.imp.SwitchWidget; 6 | 7 | public class TabButton extends SwitchWidget { 8 | protected TabContainer container; 9 | 10 | public TabButton(int xPosition, int yPosition, int width, int height) { 11 | super(xPosition, yPosition, width, height, null); 12 | this.setOnPressCallback(this::onPressed); 13 | } 14 | 15 | @Override 16 | public TabButton setTexture(IGuiTexture baseTexture, IGuiTexture pressedTexture) { 17 | super.setTexture(baseTexture, pressedTexture); 18 | return this; 19 | } 20 | 21 | @Override 22 | public TabButton setBaseTexture(IGuiTexture... baseTexture) { 23 | return (TabButton) super.setBaseTexture(baseTexture); 24 | } 25 | 26 | @Override 27 | public TabButton setPressedTexture(IGuiTexture... pressedTexture) { 28 | return (TabButton) super.setPressedTexture(pressedTexture); 29 | } 30 | 31 | @Override 32 | public TabButton setHoverTexture(IGuiTexture... hoverTexture) { 33 | return (TabButton) super.setHoverTexture(hoverTexture); 34 | } 35 | 36 | @Override 37 | public TabButton setHoverBorderTexture(int border, int color) { 38 | return (TabButton) super.setHoverBorderTexture(border, color); 39 | } 40 | 41 | @Override 42 | public TabButton setHoverTooltip(String tooltipText) { 43 | return (TabButton) super.setHoverTooltip(tooltipText); 44 | } 45 | 46 | public void setContainer(TabContainer container) { 47 | this.container = container; 48 | } 49 | 50 | public void onPressed(ClickData clickData, boolean isPressed) { 51 | this.isPressed = true; 52 | if (container != null) { 53 | container.switchTag(container.tabs.get(this)); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/json/BlockTypeAdapterFactory.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.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 net.minecraft.block.Block; 13 | 14 | public class BlockTypeAdapterFactory implements TypeAdapterFactory { 15 | public static final BlockTypeAdapterFactory INSTANCE = new BlockTypeAdapterFactory(); 16 | 17 | @SuppressWarnings("unchecked") 18 | @Override 19 | public TypeAdapter create(Gson gson, TypeToken type) { 20 | if (!Block.class.isAssignableFrom(type.getRawType())) return null; 21 | return (TypeAdapter) new BlockTypeAdapter(gson); 22 | } 23 | 24 | private static final class BlockTypeAdapter extends TypeAdapter { 25 | 26 | private final Gson gson; 27 | 28 | private BlockTypeAdapter(final Gson gson) { 29 | this.gson = gson; 30 | } 31 | 32 | @Override 33 | public void write(final JsonWriter out, final Block value) { 34 | if (value == null || value.getRegistryName() == null) { 35 | gson.toJson(JsonNull.INSTANCE, out); 36 | return; 37 | } 38 | final JsonObject jsonObject = new JsonObject(); 39 | jsonObject.addProperty("id", value.getRegistryName().toString()); 40 | gson.toJson(jsonObject, out); 41 | } 42 | 43 | @Override 44 | public Block read(final JsonReader in) { 45 | final JsonElement jsonElement = gson.fromJson(in, JsonElement.class); 46 | if (jsonElement.isJsonNull()) return null; 47 | return Block.getBlockFromName(jsonElement.getAsJsonObject().get("id").getAsString()); 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/json/FluidStackTypeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.json; 2 | 3 | import com.google.gson.JsonDeserializationContext; 4 | import com.google.gson.JsonDeserializer; 5 | import com.google.gson.JsonElement; 6 | import com.google.gson.JsonParseException; 7 | import com.google.gson.JsonPrimitive; 8 | import com.google.gson.JsonSerializationContext; 9 | import com.google.gson.JsonSerializer; 10 | import net.minecraft.nbt.JsonToNBT; 11 | import net.minecraft.nbt.NBTException; 12 | import net.minecraft.nbt.NBTTagCompound; 13 | import net.minecraftforge.fluids.FluidStack; 14 | 15 | import java.lang.reflect.Type; 16 | 17 | public class FluidStackTypeAdapter implements JsonDeserializer, JsonSerializer { 18 | 19 | public static final FluidStackTypeAdapter INSTANCE = new FluidStackTypeAdapter(); 20 | 21 | private FluidStackTypeAdapter() { } 22 | 23 | @Override 24 | public FluidStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { 25 | try { 26 | return FluidStack.loadFluidStackFromNBT(JsonToNBT.getTagFromJson(json.getAsString())); 27 | } catch (NBTException e) { 28 | return null; 29 | } 30 | } 31 | 32 | @Override 33 | public JsonElement serialize(FluidStack src, Type typeOfSrc, JsonSerializationContext context) { 34 | return new JsonPrimitive(src.writeToNBT(new NBTTagCompound()).toString()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/json/ItemStackTypeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.json; 2 | 3 | import com.google.gson.JsonDeserializationContext; 4 | import com.google.gson.JsonDeserializer; 5 | import com.google.gson.JsonElement; 6 | import com.google.gson.JsonParseException; 7 | import com.google.gson.JsonPrimitive; 8 | import com.google.gson.JsonSerializationContext; 9 | import com.google.gson.JsonSerializer; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.nbt.JsonToNBT; 12 | import net.minecraft.nbt.NBTException; 13 | 14 | import java.lang.reflect.Type; 15 | 16 | public class ItemStackTypeAdapter implements JsonDeserializer, JsonSerializer { 17 | 18 | public static final ItemStackTypeAdapter INSTANCE = new ItemStackTypeAdapter(); 19 | 20 | private ItemStackTypeAdapter() { } 21 | 22 | @Override 23 | public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { 24 | try { 25 | return new ItemStack(JsonToNBT.getTagFromJson(json.getAsString())); 26 | } catch (NBTException e) { 27 | return null; 28 | } 29 | } 30 | 31 | @Override 32 | public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) { 33 | return new JsonPrimitive(src.serializeNBT().toString()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/pattern/Predicates.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.pattern; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.MultiblockCapability; 4 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 5 | import com.cleanroommc.multiblocked.api.definition.ControllerDefinition; 6 | import com.cleanroommc.multiblocked.api.pattern.predicates.PredicateAnyCapability; 7 | import com.cleanroommc.multiblocked.api.pattern.predicates.PredicateBlocks; 8 | import com.cleanroommc.multiblocked.api.pattern.predicates.PredicateComponent; 9 | import com.cleanroommc.multiblocked.api.pattern.predicates.PredicateStates; 10 | import com.cleanroommc.multiblocked.api.pattern.predicates.SimplePredicate; 11 | import net.minecraft.block.Block; 12 | import net.minecraft.block.state.IBlockState; 13 | 14 | public class Predicates { 15 | 16 | public static TraceabilityPredicate states(IBlockState... allowedStates) { 17 | return new TraceabilityPredicate(new PredicateStates(allowedStates)); 18 | } 19 | 20 | public static TraceabilityPredicate blocks(Block... blocks) { 21 | return new TraceabilityPredicate(new PredicateBlocks(blocks)); 22 | } 23 | 24 | /** 25 | * Use it when you require that a position must have a specific capability. 26 | */ 27 | public static TraceabilityPredicate anyCapability(MultiblockCapability capability) { 28 | return new TraceabilityPredicate(new PredicateAnyCapability(capability)); 29 | } 30 | 31 | public static TraceabilityPredicate component(ComponentDefinition definition) { 32 | TraceabilityPredicate predicate = new TraceabilityPredicate(new PredicateComponent(definition)); 33 | return definition instanceof ControllerDefinition ? predicate.setCenter() : predicate; 34 | } 35 | 36 | public static TraceabilityPredicate any() { 37 | return new TraceabilityPredicate(SimplePredicate.ANY); 38 | } 39 | 40 | public static TraceabilityPredicate air() { 41 | return new TraceabilityPredicate(SimplePredicate.AIR); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/pattern/error/PatternStringError.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.pattern.error; 2 | 3 | import net.minecraft.client.resources.I18n; 4 | 5 | public class PatternStringError extends PatternError{ 6 | public final String translateKey; 7 | 8 | public PatternStringError(String translateKey) { 9 | this.translateKey = translateKey; 10 | } 11 | 12 | @Override 13 | public String getErrorInfo() { 14 | return I18n.format(translateKey); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/pattern/error/SinglePredicateError.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.pattern.error; 2 | 3 | import com.cleanroommc.multiblocked.api.pattern.predicates.SimplePredicate; 4 | import net.minecraft.client.resources.I18n; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | public class SinglePredicateError extends PatternError { 13 | public final SimplePredicate predicate; 14 | public final int type; 15 | 16 | public SinglePredicateError(SimplePredicate predicate, int type) { 17 | this.predicate = predicate; 18 | this.type = type; 19 | } 20 | 21 | @Override 22 | public List> getCandidates() { 23 | return Collections.singletonList(predicate.getCandidates()); 24 | } 25 | 26 | @SideOnly(Side.CLIENT) 27 | @Override 28 | public String getErrorInfo() { 29 | int number = -1; 30 | if (type == 0) { 31 | number = predicate.maxCount; 32 | } 33 | if (type == 1) { 34 | number = predicate.minCount; 35 | } 36 | return I18n.format("multiblocked.pattern.error.limited." + type, 37 | number); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/pattern/predicates/PredicateCustomAny.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.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/cleanroommc/multiblocked/api/pattern/util/PatternMatchContext.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.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/cleanroommc/multiblocked/api/pattern/util/RelativeDirection.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.pattern.util; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import net.minecraft.util.EnumFacing; 5 | import stanhebben.zenscript.annotations.ZenClass; 6 | import stanhebben.zenscript.annotations.ZenProperty; 7 | 8 | import java.util.function.Function; 9 | 10 | /** 11 | * Relative direction when facing horizontally 12 | */ 13 | @ZenClass("mods.multiblocked.pattern.RelativeDirection") 14 | @ZenRegister 15 | public enum RelativeDirection { 16 | @ZenProperty 17 | UP(f -> EnumFacing.UP, EnumFacing.Axis.Y), 18 | @ZenProperty 19 | DOWN(f -> EnumFacing.DOWN, EnumFacing.Axis.Y), 20 | @ZenProperty 21 | LEFT(EnumFacing::rotateYCCW, EnumFacing.Axis.X), 22 | @ZenProperty 23 | RIGHT(EnumFacing::rotateY, EnumFacing.Axis.X), 24 | @ZenProperty 25 | FRONT(Function.identity(), EnumFacing.Axis.Z), 26 | @ZenProperty 27 | BACK(EnumFacing::getOpposite, EnumFacing.Axis.Z); 28 | 29 | final Function actualFacing; 30 | public final EnumFacing.Axis axis; 31 | 32 | RelativeDirection(Function actualFacing, EnumFacing.Axis axis) { 33 | this.actualFacing = actualFacing; 34 | this.axis = axis; 35 | } 36 | 37 | public EnumFacing getActualFacing(EnumFacing facing) { 38 | return actualFacing.apply(facing); 39 | } 40 | 41 | public boolean isSameAxis(RelativeDirection dir) { 42 | return this.axis == dir.axis; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/recipe/Content.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.recipe; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import stanhebben.zenscript.annotations.ZenClass; 5 | import stanhebben.zenscript.annotations.ZenProperty; 6 | 7 | @ZenRegister 8 | @ZenClass("mods.multiblocked.recipe.Content") 9 | public class Content { 10 | public transient Object content; 11 | @ZenProperty 12 | public float chance; 13 | @ZenProperty 14 | public String slotName; 15 | 16 | public Content(Object content, float chance, String slotName) { 17 | this.content = content; 18 | this.chance = chance; 19 | this.slotName = slotName; 20 | } 21 | 22 | public Object getContent() { 23 | return content; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/recipe/ContentModifier.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.recipe; 2 | 3 | import crafttweaker.annotations.ZenRegister; 4 | import net.minecraft.util.math.MathHelper; 5 | import stanhebben.zenscript.annotations.ZenClass; 6 | import stanhebben.zenscript.annotations.ZenConstructor; 7 | import stanhebben.zenscript.annotations.ZenProperty; 8 | 9 | @ZenClass("mods.multiblocked.recipe.ContentModifier") 10 | @ZenRegister 11 | public class ContentModifier { 12 | @ZenProperty 13 | public final double value; 14 | @ZenProperty 15 | public final boolean affectChance; 16 | @ZenProperty 17 | public final Operation operation; 18 | 19 | @ZenConstructor 20 | public ContentModifier(double value, boolean affectChance, Operation operation) { 21 | this.value = value; 22 | this.affectChance = affectChance; 23 | this.operation = operation; 24 | } 25 | 26 | public double apply(double target) { 27 | if (affectChance) return target; 28 | return operation == Operation.ADDITION ? target + value : target * value; 29 | } 30 | 31 | public float applyToChance(float chance) { 32 | if (!affectChance) return chance; 33 | return MathHelper.clamp((float) (operation == Operation.ADDITION ? chance + value : chance * value), 0.0f, 1.0f); 34 | } 35 | 36 | @ZenClass("mods.multiblocked.recipe.ContentModifierOperation") 37 | @ZenRegister 38 | public enum Operation { 39 | @ZenProperty 40 | ADDITION, 41 | @ZenProperty 42 | MULTIPLICATION 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/registry/MbdItems.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.registry; 2 | 3 | import com.cleanroommc.multiblocked.api.item.ItemBlueprint; 4 | import com.cleanroommc.multiblocked.api.item.ItemMultiblockBuilder; 5 | import net.minecraft.client.renderer.block.model.ModelResourceLocation; 6 | import net.minecraft.item.Item; 7 | import net.minecraftforge.client.model.ModelLoader; 8 | import net.minecraftforge.registries.IForgeRegistry; 9 | 10 | public class MbdItems { 11 | public static ItemBlueprint BLUEPRINT = new ItemBlueprint(); 12 | public static ItemMultiblockBuilder BUILDER = new ItemMultiblockBuilder(); 13 | 14 | public static void registerItems(IForgeRegistry registry) { 15 | registry.register(BLUEPRINT); 16 | registry.register(BUILDER); 17 | } 18 | 19 | @SuppressWarnings("ConstantConditions") 20 | public static void registerModels() { 21 | ModelLoader.setCustomModelResourceLocation(BLUEPRINT, 0, new ModelResourceLocation(BLUEPRINT.getRegistryName(), "inventory")); 22 | ModelLoader.setCustomModelResourceLocation(BLUEPRINT, 1, new ModelResourceLocation(BLUEPRINT.getRegistryName() + "_pattern", "inventory")); 23 | ModelLoader.setCustomModelResourceLocation(BUILDER, 0, new ModelResourceLocation(BUILDER.getRegistryName(), "inventory")); 24 | ModelLoader.setCustomModelResourceLocation(BUILDER, 1, new ModelResourceLocation(BUILDER.getRegistryName() + "_pattern", "inventory")); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/registry/MbdRecipeConditions.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.registry; 2 | 3 | import com.cleanroommc.multiblocked.api.recipe.RecipeCondition; 4 | import com.cleanroommc.multiblocked.common.recipe.conditions.*; 5 | import com.google.common.collect.Maps; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * @author KilaBash 11 | * @date 2022/05/27 12 | * @implNote RecipeConditions 13 | */ 14 | public class MbdRecipeConditions { 15 | public static final Map RECIPE_CONDITIONS_REGISTRY = Maps.newHashMap(); 16 | 17 | public static void registerCondition(RecipeCondition condition) { 18 | RECIPE_CONDITIONS_REGISTRY.put(condition.getType().toLowerCase(), condition); 19 | } 20 | 21 | public static RecipeCondition getCondition(String type) { 22 | return RECIPE_CONDITIONS_REGISTRY.get(type.toLowerCase()); 23 | } 24 | 25 | public static void registerConditions() { 26 | registerCondition(DimensionCondition.INSTANCE); 27 | registerCondition(ThunderCondition.INSTANCE); 28 | registerCondition(RainingCondition.INSTANCE); 29 | registerCondition(PositionYCondition.INSTANCE); 30 | registerCondition(BiomeCondition.INSTANCE); 31 | registerCondition(BlockCondition.INSTANCE); 32 | registerCondition(PredicateCondition.INSTANCE); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/registry/MbdRenderers.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.registry; 2 | 3 | 4 | import com.cleanroommc.multiblocked.Multiblocked; 5 | import com.cleanroommc.multiblocked.client.renderer.ICustomRenderer; 6 | import com.cleanroommc.multiblocked.client.renderer.impl.B3DRenderer; 7 | import com.cleanroommc.multiblocked.client.renderer.impl.BlockStateRenderer; 8 | import com.cleanroommc.multiblocked.client.renderer.impl.GTRenderer; 9 | import com.cleanroommc.multiblocked.client.renderer.impl.GeoComponentRenderer; 10 | import com.cleanroommc.multiblocked.client.renderer.impl.IModelRenderer; 11 | import com.cleanroommc.multiblocked.client.renderer.impl.OBJRenderer; 12 | import com.cleanroommc.multiblocked.client.renderer.impl.TextureParticleRenderer; 13 | import com.google.common.collect.Maps; 14 | import net.minecraftforge.fml.common.Loader; 15 | 16 | import java.util.Map; 17 | 18 | public class MbdRenderers { 19 | public static final Map RENDERER_REGISTRY = Maps.newHashMap(); 20 | 21 | public static void registerRenderer(ICustomRenderer renderer) { 22 | RENDERER_REGISTRY.put(renderer.getType().toLowerCase(), renderer); 23 | } 24 | 25 | public static ICustomRenderer getRenderer(String type) { 26 | return RENDERER_REGISTRY.get(type.toLowerCase()); 27 | } 28 | 29 | public static void registerRenderers() { 30 | registerRenderer(IModelRenderer.INSTANCE); 31 | registerRenderer(BlockStateRenderer.INSTANCE); 32 | registerRenderer(B3DRenderer.INSTANCE); 33 | registerRenderer(OBJRenderer.INSTANCE); 34 | registerRenderer(TextureParticleRenderer.INSTANCE); 35 | registerRenderer(GTRenderer.INSTANCE); 36 | if (Loader.isModLoaded(Multiblocked.MODID_GEO)) { 37 | registerRenderer(GeoComponentRenderer.INSTANCE); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/sound/ComponentSound.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.sound; 2 | 3 | import com.cleanroommc.multiblocked.api.tile.ComponentTileEntity; 4 | import net.minecraft.client.audio.MovingSound; 5 | import net.minecraft.util.SoundCategory; 6 | import net.minecraft.util.SoundEvent; 7 | import net.minecraft.world.World; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nullable; 12 | 13 | /** 14 | * @author KilaBash 15 | * @date 2022/8/16 16 | * @implNote ComponentSound 17 | */ 18 | @SideOnly(Side.CLIENT) 19 | public class ComponentSound extends MovingSound { 20 | @Nullable 21 | public final ComponentTileEntity component; 22 | public final SoundState soundState; 23 | 24 | protected ComponentSound(SoundEvent soundEvent, SoundState soundState, @Nullable ComponentTileEntity component) { 25 | super(soundEvent, SoundCategory.BLOCKS); 26 | this.component = component; 27 | this.soundState = soundState; 28 | this.repeat = soundState.loop; 29 | this.repeatDelay = soundState.delay; 30 | this.volume = soundState.volume; 31 | this.pitch = soundState.pitch; 32 | if (component == null) { 33 | this.attenuationType = AttenuationType.NONE; 34 | return; 35 | } 36 | this.xPosF = component.getPos().getX() + 0.5f; 37 | this.yPosF = component.getPos().getY() + 0.5f; 38 | this.zPosF = component.getPos().getZ() + 0.5f; 39 | } 40 | 41 | @Override 42 | public void update() { 43 | if (component != null) { 44 | World level = component.getWorld(); 45 | if (!component.getStatus().equals(soundState.status) || component.isInvalid() || level.getTileEntity(component.getPos()) != component) { 46 | stopSound(); 47 | } 48 | } 49 | } 50 | 51 | public void stopSound() { 52 | donePlaying = true; 53 | repeat = false; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/tile/DummyComponentTileEntity.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.tile; 2 | 3 | import com.cleanroommc.multiblocked.api.definition.ComponentDefinition; 4 | 5 | public class DummyComponentTileEntity extends ComponentTileEntity { 6 | public boolean isFormed; 7 | 8 | @Override 9 | public boolean isFormed() { 10 | return isFormed; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/api/tile/IDynamicComponentTile.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.tile; 2 | 3 | import com.cleanroommc.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/cleanroommc/multiblocked/api/tile/part/PartHatchTileEntity.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.tile.part; 2 | 3 | /** 4 | * A TileEntity that defies all hatch machines. 5 | * 6 | * I/O part of the multiblock. 7 | */ 8 | public class PartHatchTileEntity extends PartTileEntity { 9 | 10 | @Override 11 | public boolean isFormed() { 12 | return false; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/MultiblockedResourceLoader.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client; 2 | 3 | import com.cleanroommc.multiblocked.MbdConfig; 4 | import com.google.gson.JsonObject; 5 | import net.minecraft.client.resources.FolderResourcePack; 6 | import net.minecraft.client.resources.data.IMetadataSection; 7 | import net.minecraft.client.resources.data.MetadataSerializer; 8 | import net.minecraftforge.fml.common.Loader; 9 | 10 | import java.io.File; 11 | 12 | public class MultiblockedResourceLoader extends FolderResourcePack { 13 | 14 | public static final MultiblockedResourceLoader INSTANCE = new MultiblockedResourceLoader(); 15 | 16 | private MultiblockedResourceLoader() { 17 | super(new File(Loader.instance().getConfigDir(), MbdConfig.location)); 18 | resourcePackFile.mkdir(); 19 | new File(resourcePackFile, "assets").mkdir(); 20 | } 21 | 22 | @Override 23 | public String getPackName() { 24 | return "MultiblockedInternalResources"; 25 | } 26 | 27 | @Override 28 | public T getPackMetadata(MetadataSerializer metadataSerializer, String metadataSectionName) { 29 | JsonObject metadata = new JsonObject(); 30 | JsonObject packObj = new JsonObject(); 31 | metadata.add("pack", packObj); 32 | packObj.addProperty("description", "Includes assets provided by the user for Multiblocked."); 33 | packObj.addProperty("pack_format", 2); 34 | return metadataSerializer.parseMetadataSection(metadataSectionName, metadata); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/model/IModelSupplier.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.model; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | 6 | public interface IModelSupplier { 7 | 8 | @SideOnly(Side.CLIENT) 9 | void onModelRegister(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/model/SimpleStateMapper.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.model; 2 | 3 | import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; 4 | import net.minecraft.block.Block; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.client.renderer.block.model.ModelResourceLocation; 7 | import net.minecraft.client.renderer.block.statemap.IStateMapper; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nonnull; 12 | import java.util.Map; 13 | 14 | @SideOnly(Side.CLIENT) 15 | public class SimpleStateMapper implements IStateMapper { 16 | 17 | private final ModelResourceLocation mrl; 18 | 19 | public SimpleStateMapper(ModelResourceLocation mrl) { 20 | this.mrl = mrl; 21 | } 22 | 23 | @Override 24 | @Nonnull 25 | public Map putStateModelLocations(Block block) { 26 | Map map = new Object2ObjectOpenHashMap<>(block.getBlockState().getValidStates().size()); 27 | for (IBlockState state : block.getBlockState().getValidStates()) { 28 | map.put(state, mrl); 29 | } 30 | return map; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/particle/CustomParticleDigging.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.particle; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.client.particle.ParticleDigging; 5 | import net.minecraft.world.World; 6 | 7 | public class CustomParticleDigging extends ParticleDigging { 8 | 9 | public CustomParticleDigging(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) { 10 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/particle/IParticle.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.particle; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.world.World; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | public interface IParticle { 10 | 11 | default IParticleHandler getGLHandler() { 12 | return IParticleHandler.DEFAULT_FX_HANDLER; 13 | } 14 | 15 | World getWorld(); 16 | 17 | void setWorld(World world); 18 | 19 | double getX(); 20 | 21 | double getY(); 22 | 23 | double getZ(); 24 | 25 | void setPosition(double x, double y, double z); 26 | 27 | default void setX(double x) { 28 | setPosition(x, getY(), getZ()); 29 | } 30 | 31 | default void setY(double y){ 32 | setPosition(getX(), y, getZ()); 33 | } 34 | 35 | default void setZ(double z){ 36 | setPosition(getX(), getY(), z); 37 | } 38 | 39 | boolean isBackLayer(); 40 | 41 | boolean isAddBlend(); 42 | 43 | void setBackLayer(boolean isBackLayer); 44 | 45 | void setAddBlend(boolean isBackLayer); 46 | 47 | void kill(); 48 | 49 | boolean isAlive(); 50 | 51 | void onUpdate(); 52 | 53 | boolean shouldRendered(Entity entityIn, float partialTicks); 54 | 55 | @SideOnly(Side.CLIENT) 56 | void renderParticle(BufferBuilder buffer, float partialTicks); 57 | 58 | default void addParticle() { 59 | ParticleManager.INSTANCE.addEffect(this); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/particle/IParticleHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.particle; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | import net.minecraftforge.fml.relauncher.Side; 5 | import net.minecraftforge.fml.relauncher.SideOnly; 6 | 7 | public interface IParticleHandler { 8 | /** 9 | * Run any pre render gl code here. 10 | * You can also start drawing quads. 11 | */ 12 | @SideOnly(Side.CLIENT) 13 | void preDraw(BufferBuilder buffer); 14 | 15 | /** 16 | * Run any post render gl code here. 17 | * This is where you would draw if you started drawing in preDraw 18 | */ 19 | @SideOnly(Side.CLIENT) 20 | void postDraw(BufferBuilder buffer); 21 | 22 | IParticleHandler DEFAULT_FX_HANDLER = new IParticleHandler() { 23 | @Override 24 | public void preDraw(BufferBuilder buffer) { 25 | 26 | } 27 | 28 | @Override 29 | public void postDraw(BufferBuilder buffer) { 30 | } 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/renderer/ComponentTESR.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.renderer; 2 | 3 | import com.cleanroommc.multiblocked.api.tile.ComponentTileEntity; 4 | import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; 5 | import net.minecraftforge.fml.relauncher.Side; 6 | import net.minecraftforge.fml.relauncher.SideOnly; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | @SideOnly(Side.CLIENT) 11 | public class ComponentTESR extends TileEntitySpecialRenderer { 12 | 13 | public ComponentTESR() { 14 | super(); 15 | } 16 | 17 | @Override 18 | public void render(@Nonnull ComponentTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { 19 | IRenderer renderer = te.getRenderer(); 20 | if (renderer != null && !renderer.isRaw()) { 21 | te.getRenderer().renderTESR(te, x, y, z, partialTicks, destroyStage, alpha); 22 | } 23 | } 24 | 25 | @Override 26 | public boolean isGlobalRenderer(@Nonnull ComponentTileEntity te) { 27 | IRenderer renderer = te.getRenderer(); 28 | if (renderer != null) { 29 | return te.getRenderer().isGlobalRenderer(te); 30 | } 31 | return false; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/renderer/ICustomItemRenderer.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.renderer; 2 | 3 | import com.cleanroommc.multiblocked.client.model.ModelFactory; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.client.renderer.block.model.BakedQuad; 6 | import net.minecraft.client.renderer.block.model.IBakedModel; 7 | import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; 8 | import net.minecraft.client.renderer.block.model.ItemOverrideList; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.util.EnumFacing; 11 | import net.minecraftforge.common.model.TRSRTransformation; 12 | import org.apache.commons.lang3.tuple.Pair; 13 | 14 | import javax.annotation.Nonnull; 15 | import javax.annotation.Nullable; 16 | import javax.vecmath.Matrix4f; 17 | import java.util.Collections; 18 | import java.util.List; 19 | 20 | public interface ICustomItemRenderer extends IBakedModel { 21 | 22 | void renderItem(ItemStack stack); 23 | 24 | @Override 25 | @Nonnull 26 | default Pair handlePerspective(@Nonnull TransformType cameraTransformType) { 27 | TRSRTransformation transformation = ModelFactory.getBlockTransform(cameraTransformType); 28 | return transformation == null ? IBakedModel.super.handlePerspective(cameraTransformType) : Pair.of(this, transformation.getMatrix()); 29 | } 30 | 31 | @Override 32 | @Nonnull 33 | default List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { 34 | return Collections.emptyList(); 35 | } 36 | 37 | @Override 38 | default boolean isBuiltInRenderer() { 39 | return true; 40 | } 41 | 42 | @Override 43 | @Nonnull 44 | default ItemOverrideList getOverrides() { 45 | return ItemOverrideList.NONE; 46 | } 47 | 48 | @Override 49 | default boolean isAmbientOcclusion() { 50 | return true; 51 | } 52 | 53 | @Override 54 | default boolean isGui3d() { 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/renderer/scene/ISceneRenderHook.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.renderer.scene; 2 | 3 | import net.minecraft.util.BlockRenderLayer; 4 | 5 | /** 6 | * Scene Render State hooks. 7 | * This is where you decide whether or not this group of pos should be rendered. What other requirements do you have for rendering. 8 | */ 9 | public interface ISceneRenderHook { 10 | void apply(boolean isTESR, int pass, BlockRenderLayer layer); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/shader/Shaders.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.shader; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.client.shader.management.Shader; 5 | import net.minecraft.util.ResourceLocation; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | import java.io.IOException; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | @SideOnly(Side.CLIENT) 14 | public class Shaders { 15 | 16 | public static Shader IMAGE_F; 17 | public static Shader IMAGE_V; 18 | public static Shader FBM; 19 | 20 | public static void init() { 21 | IMAGE_F = load(Shader.ShaderType.FRAGMENT, new ResourceLocation(Multiblocked.MODID, "image")); 22 | IMAGE_V = load(Shader.ShaderType.VERTEX, new ResourceLocation(Multiblocked.MODID, "image")); 23 | FBM = load(Shader.ShaderType.FRAGMENT, new ResourceLocation(Multiblocked.MODID, "fbm")); 24 | } 25 | 26 | public static Map CACHE = new HashMap<>(); 27 | 28 | public static void reload() { 29 | for (Shader shader : CACHE.values()) { 30 | if (shader != null) { 31 | shader.deleteShader(); 32 | } 33 | } 34 | CACHE.clear(); 35 | init(); 36 | } 37 | 38 | public static Shader load(Shader.ShaderType shaderType, ResourceLocation resourceLocation) { 39 | return CACHE.computeIfAbsent(new ResourceLocation(resourceLocation.getNamespace(), "shaders/" + resourceLocation.getPath() + shaderType.shaderExtension), key -> { 40 | try { 41 | return Shader.loadShader(shaderType, key); 42 | } catch (IOException e) { 43 | Multiblocked.LOGGER.error("load shader {} resource {} failed", shaderType, resourceLocation); 44 | return null; 45 | } 46 | }); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/shader/uniform/IUniformCallback.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.shader.uniform; 2 | 3 | @FunctionalInterface 4 | public interface IUniformCallback { 5 | 6 | void apply(UniformCache cache); 7 | 8 | default IUniformCallback with(IUniformCallback callback) { 9 | return cache -> { 10 | apply(cache); 11 | callback.apply(cache); 12 | }; 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/client/util/EntityCamera.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.client.util; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | import net.minecraft.util.math.MathHelper; 6 | import net.minecraft.world.World; 7 | 8 | public class EntityCamera extends Entity { 9 | 10 | public EntityCamera(World worldIn) { 11 | super(worldIn); 12 | this.height = 0; 13 | this.width = 0; 14 | } 15 | 16 | public void setPositionAndRotation(double x, double y, double z, float yaw, float pitch) { 17 | this.posX = MathHelper.clamp(x, -3.0E7D, 3.0E7D); 18 | this.posY = y; 19 | this.posZ = MathHelper.clamp(z, -3.0E7D, 3.0E7D); 20 | this.prevPosX = this.posX; 21 | this.prevPosY = this.posY; 22 | this.prevPosZ = this.posZ; 23 | pitch = MathHelper.clamp(pitch, -90.0F, 90.0F); 24 | this.rotationYaw = yaw; 25 | this.rotationPitch = pitch; 26 | this.prevRotationYaw = this.rotationYaw; 27 | this.prevRotationPitch = this.rotationPitch; 28 | double d0 = this.prevRotationYaw - yaw; 29 | 30 | if (d0 < -180.0D) 31 | { 32 | this.prevRotationYaw += 360.0F; 33 | } 34 | 35 | if (d0 >= 180.0D) 36 | { 37 | this.prevRotationYaw -= 360.0F; 38 | } 39 | 40 | this.setPosition(this.posX, this.posY, this.posZ); 41 | this.setRotation(yaw, pitch); 42 | } 43 | 44 | @Override 45 | protected void entityInit() { 46 | 47 | } 48 | 49 | @Override 50 | protected void readEntityFromNBT(NBTTagCompound compound) { 51 | 52 | } 53 | 54 | @Override 55 | protected void writeEntityToNBT(NBTTagCompound compound) { 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/command/CommandClient.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.command; 2 | 3 | import com.cleanroommc.multiblocked.network.MultiblockedNetworking; 4 | import com.cleanroommc.multiblocked.network.s2c.SPacketCommand; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.ICommandSender; 7 | import net.minecraft.entity.player.EntityPlayerMP; 8 | import net.minecraft.server.MinecraftServer; 9 | 10 | import javax.annotation.Nonnull; 11 | 12 | public class CommandClient extends CommandBase { 13 | 14 | public final String cmd; 15 | 16 | public CommandClient (String cmd) { 17 | this.cmd = cmd; 18 | } 19 | 20 | @Override 21 | @Nonnull 22 | public String getName() { 23 | return cmd; 24 | } 25 | 26 | @Override 27 | @Nonnull 28 | public String getUsage(@Nonnull ICommandSender sender) { 29 | return "multiblocked "; 30 | } 31 | 32 | 33 | @Override 34 | public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) { 35 | if (sender instanceof EntityPlayerMP) { 36 | MultiblockedNetworking.sendToPlayer(new SPacketCommand(cmd), (EntityPlayerMP) sender); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/command/CommandMbdTree.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.command; 2 | 3 | import net.minecraft.command.ICommandSender; 4 | import net.minecraftforge.server.command.CommandTreeBase; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | public class CommandMbdTree extends CommandTreeBase { 11 | public CommandMbdTree() { 12 | this.addSubcommand(new CommandClient("reload_shaders")); 13 | this.addSubcommand(new CommandMbdTps()); 14 | this.addSubcommand(new CommandMbdNbt()); 15 | } 16 | 17 | @Nonnull 18 | public String getName() { 19 | return "multiblocked"; 20 | } 21 | 22 | @Nonnull 23 | public List getAliases() { 24 | return Collections.singletonList("mbd"); 25 | } 26 | 27 | @Nonnull 28 | public String getUsage(@Nonnull ICommandSender sender) { 29 | return "multiblocked.command.usage"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/trait/EMCPlayerCapabilityTrait.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.trait; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.trait.PlayerCapabilityTrait; 4 | import com.cleanroommc.multiblocked.common.capability.EMCProjectECapability; 5 | import moze_intel.projecte.api.ProjectEAPI; 6 | import moze_intel.projecte.api.capabilities.IKnowledgeProvider; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | 10 | public class EMCPlayerCapabilityTrait extends PlayerCapabilityTrait { 11 | 12 | public EMCPlayerCapabilityTrait() { 13 | super(EMCProjectECapability.CAP); 14 | } 15 | 16 | public IKnowledgeProvider getCapability() { 17 | EntityPlayer player = getPlayer(); 18 | return player == null ? null : player.getCapability(ProjectEAPI.KNOWLEDGE_CAPABILITY, null); 19 | } 20 | 21 | public long updateEMC(long emc, boolean simulate) { 22 | EntityPlayer player = getPlayer(); 23 | if (player instanceof EntityPlayerMP) { 24 | IKnowledgeProvider emcCap = getCapability(); 25 | if (emcCap != null) { 26 | long stored = emcCap.getEmc(); 27 | long emcL = Math.max(0, stored + emc); 28 | if (!simulate) { 29 | emcCap.setEmc(emcL); 30 | emcCap.sync((EntityPlayerMP) player); // send to client 31 | } 32 | return Math.abs(emcL - (stored + emc)); 33 | } 34 | } 35 | return Math.abs(emc); 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/trait/EntityCapabilityTrait.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.trait; 2 | 3 | 4 | import com.cleanroommc.multiblocked.api.capability.trait.CapabilityTrait; 5 | import com.cleanroommc.multiblocked.common.capability.EntityMultiblockCapability; 6 | 7 | /** 8 | * @author KilaBash 9 | * @date 2022/8/3 10 | * @implNote EntityCapabilityTrait 11 | */ 12 | public class EntityCapabilityTrait extends CapabilityTrait { 13 | 14 | public EntityCapabilityTrait() { 15 | super(EntityMultiblockCapability.CAP); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/trait/FuelProgressTrait.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.trait; 2 | 3 | 4 | import com.cleanroommc.multiblocked.api.capability.trait.ProgressCapabilityTrait; 5 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 6 | import com.cleanroommc.multiblocked.api.tile.ControllerTileEntity; 7 | import com.cleanroommc.multiblocked.util.LocalizationUtils; 8 | 9 | /** 10 | * @author KilaBash 11 | * @date 2022/11/15 12 | * @implNote RecipeProgressTrait 13 | */ 14 | public class FuelProgressTrait extends ProgressCapabilityTrait { 15 | 16 | public FuelProgressTrait() { 17 | super(null); 18 | } 19 | 20 | @Override 21 | protected String dynamicHoverTips(double progress) { 22 | return LocalizationUtils.format("multiblocked.top.fuel_progress", ((int)(progress * 100)) + "%"); 23 | } 24 | 25 | @Override 26 | protected double getProgress() { 27 | if (component instanceof ControllerTileEntity) { 28 | ControllerTileEntity controller = (ControllerTileEntity) component; 29 | RecipeLogic recipeLogic = controller.getRecipeLogic(); 30 | return recipeLogic == null ? 0 : Math.min(recipeLogic.fuelTime, recipeLogic.fuelMaxTime) * 1d / Math.max(1, recipeLogic.fuelMaxTime); 31 | } 32 | return 0; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/trait/LPPlayerCapabilityTrait.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.trait; 2 | 3 | import WayofTime.bloodmagic.core.data.SoulNetwork; 4 | import WayofTime.bloodmagic.util.helper.NetworkHelper; 5 | import com.cleanroommc.multiblocked.api.capability.trait.PlayerCapabilityTrait; 6 | import com.cleanroommc.multiblocked.common.capability.LPBloodMagicCapability; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | 10 | public class LPPlayerCapabilityTrait extends PlayerCapabilityTrait { 11 | 12 | public LPPlayerCapabilityTrait() { 13 | super(LPBloodMagicCapability.CAP); 14 | } 15 | 16 | public SoulNetwork getCapability() { 17 | EntityPlayer player = getPlayer(); 18 | return player == null ? null : NetworkHelper.getSoulNetwork(player); 19 | } 20 | 21 | public int updateLP(int inputLp, boolean simulate) { 22 | EntityPlayer player = getPlayer(); 23 | if (player instanceof EntityPlayerMP) { 24 | SoulNetwork soulNetwork = getCapability(); 25 | if (soulNetwork != null) { 26 | int stored = soulNetwork.getCurrentEssence(); 27 | int lp = Math.max(0, stored + inputLp); 28 | if (!simulate) { 29 | soulNetwork.setCurrentEssence(lp); // auto sync 30 | } 31 | return Math.abs(lp - (stored + inputLp)); 32 | } 33 | } 34 | return Math.abs(inputLp); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/trait/RecipeProgressTrait.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.trait; 2 | 3 | import com.cleanroommc.multiblocked.api.capability.trait.ProgressCapabilityTrait; 4 | import com.cleanroommc.multiblocked.api.recipe.RecipeLogic; 5 | import com.cleanroommc.multiblocked.api.tile.ControllerTileEntity; 6 | import com.cleanroommc.multiblocked.util.LocalizationUtils; 7 | 8 | /** 9 | * @author KilaBash 10 | * @date 2022/11/15 11 | * @implNote RecipeProgressTrait 12 | */ 13 | public class RecipeProgressTrait extends ProgressCapabilityTrait { 14 | 15 | public RecipeProgressTrait() { 16 | super(null); 17 | } 18 | 19 | @Override 20 | protected String dynamicHoverTips(double progress) { 21 | return LocalizationUtils.format("multiblocked.top.recipe_progress", ((int)(progress * 100)) + "%"); 22 | } 23 | 24 | @Override 25 | protected double getProgress() { 26 | if (component instanceof ControllerTileEntity) { 27 | RecipeLogic recipeLogic = ((ControllerTileEntity)component).getRecipeLogic(); 28 | return recipeLogic == null ? 0 : (recipeLogic.progress * 1. / recipeLogic.duration); 29 | } 30 | return 0; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/capability/widget/TieredNumberContentWidget.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.capability.widget; 2 | 3 | import java.util.function.Function; 4 | 5 | public class TieredNumberContentWidget extends NumberContentWidget { 6 | 7 | private Function tierFunction; 8 | 9 | public TieredNumberContentWidget() { 10 | 11 | } 12 | 13 | @Override 14 | protected void onContentUpdate() { 15 | isDecimal = content instanceof Float || content instanceof Double; 16 | this.setHoverTooltip(content + " " + unit + tierFunction.apply(content.longValue())); 17 | } 18 | 19 | public TieredNumberContentWidget setTierFunction(Function function) { 20 | this.tierFunction = function; 21 | return this; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/recipe/content/AspectStack.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.recipe.content; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import crafttweaker.annotations.ModOnly; 5 | import crafttweaker.annotations.ZenRegister; 6 | import stanhebben.zenscript.annotations.OperatorType; 7 | import stanhebben.zenscript.annotations.ZenClass; 8 | import stanhebben.zenscript.annotations.ZenConstructor; 9 | import stanhebben.zenscript.annotations.ZenMethod; 10 | import stanhebben.zenscript.annotations.ZenOperator; 11 | import stanhebben.zenscript.annotations.ZenProperty; 12 | import thaumcraft.api.aspects.Aspect; 13 | import thaumcraft.api.aspects.AspectList; 14 | 15 | @ZenClass("mods.thaumcraft.AspectStack") 16 | @ZenRegister 17 | @ModOnly(value = Multiblocked.MODID_TC6) 18 | public class AspectStack { 19 | public final Aspect aspect; 20 | @ZenProperty 21 | public int amount; 22 | 23 | public AspectStack(Aspect aspect, int amount) { 24 | this.aspect = aspect; 25 | this.amount = amount; 26 | } 27 | 28 | @ZenConstructor 29 | public AspectStack(String aspect, int amount) { 30 | this.aspect = Aspect.getAspect(aspect); 31 | this.amount = amount; 32 | } 33 | 34 | @ZenMethod 35 | public String getAspectName() { 36 | return aspect.getName(); 37 | } 38 | 39 | @ZenMethod 40 | public AspectStack copy() { 41 | return new AspectStack(aspect, amount); 42 | } 43 | 44 | public AspectList toAspectList() { 45 | AspectList list = new AspectList(); 46 | list.add(aspect, amount); 47 | return list; 48 | } 49 | 50 | @ZenOperator(OperatorType.MUL) 51 | public AspectStack multi(int other) { 52 | return new AspectStack(aspect, amount * other); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/common/recipe/content/Starlight.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.common.recipe.content; 2 | 3 | import hellfirepvp.astralsorcery.common.constellation.IConstellation; 4 | 5 | /** 6 | * @author youyihj 7 | */ 8 | public class Starlight { 9 | private int value; 10 | private IConstellation constellation; 11 | 12 | public Starlight(int value, IConstellation constellation) { 13 | this.value = value; 14 | this.constellation = constellation; 15 | } 16 | 17 | public int getValue() { 18 | return value; 19 | } 20 | 21 | public void setValue(int value) { 22 | this.value = value; 23 | } 24 | 25 | public IConstellation getConstellation() { 26 | return constellation; 27 | } 28 | 29 | public void setConstellation(IConstellation constellation) { 30 | this.constellation = constellation; 31 | } 32 | 33 | public Starlight copy() { 34 | return new Starlight(value, constellation); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/MultiblockedLoadingPlugin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; 5 | import zone.rong.mixinbooter.IEarlyMixinLoader; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public class MultiblockedLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader { 11 | 12 | @Override 13 | public String[] getASMTransformerClass() { 14 | return new String[]{"com.cleanroommc.multiblocked.core.ASMTransformer"}; 15 | } 16 | 17 | @Override 18 | public String getModContainerClass() { 19 | return null; 20 | } 21 | 22 | @Override 23 | public String getSetupClass() { 24 | return null; 25 | } 26 | 27 | @Override 28 | public void injectData(Map data) { } 29 | 30 | @Override 31 | public String getAccessTransformerClass() { 32 | return null; 33 | } 34 | 35 | @Override 36 | public List getMixinConfigs() { 37 | return ImmutableList.of("mixins.multiblocked.json"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/asm/JEIRecipesGuiVisitor.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.asm; 2 | 3 | import com.cleanroommc.multiblocked.core.asm.util.ObfMapping; 4 | import org.objectweb.asm.Label; 5 | import org.objectweb.asm.MethodVisitor; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | public class JEIRecipesGuiVisitor extends MethodVisitor implements Opcodes { 9 | public static final String TARGET_CLASS_NAME = "mezz/jei/gui/recipes/RecipesGui"; 10 | public static final ObfMapping TARGET_METHOD = new ObfMapping( 11 | TARGET_CLASS_NAME, 12 | "func_146274_d", 13 | "()V"); 14 | private static final ObfMapping METHOD_HOOKS = new ObfMapping("com/cleanroommc/multiblocked/core/asm/hooks/JEIHooks", 15 | "handleMouseInput", 16 | "(Lmezz/jei/gui/recipes/RecipesGui;)Z"); 17 | 18 | 19 | public JEIRecipesGuiVisitor(MethodVisitor mv) { 20 | super(Opcodes.ASM5, mv); 21 | } 22 | 23 | @Override 24 | public void visitCode() { 25 | Label label = new Label(); 26 | mv.visitVarInsn(ALOAD, 0); 27 | METHOD_HOOKS.visitMethodInsn(this, INVOKESTATIC); 28 | mv.visitJumpInsn(IFEQ, label); 29 | mv.visitInsn(RETURN); 30 | mv.visitLabel(label); 31 | super.visitCode(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/asm/hooks/BlockHooks.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.asm.hooks; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.util.math.BlockPos; 5 | import net.minecraft.world.IBlockAccess; 6 | 7 | public class BlockHooks { 8 | 9 | public static Boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos) { 10 | if (MultiblockWorldSavedData.isModelDisabled(pos)) { 11 | return false; 12 | } 13 | return null; 14 | } 15 | 16 | public static Boolean isFullCube(IBlockAccess world, BlockPos pos) { 17 | if (MultiblockWorldSavedData.isModelDisabled(pos)) { 18 | return false; 19 | } 20 | return null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/asm/hooks/CCLHooks.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.asm.hooks; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.IBlockAccess; 9 | 10 | public class CCLHooks { 11 | public static boolean renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { 12 | return MultiblockWorldSavedData.isModelDisabled(pos); 13 | } 14 | 15 | public static boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn) { 16 | return MultiblockWorldSavedData.isModelDisabled(pos); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/asm/hooks/MEKHooks.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.asm.hooks; 2 | 3 | import com.cleanroommc.multiblocked.util.world.DummyWorld; 4 | import net.minecraft.tileentity.TileEntity; 5 | 6 | public class MEKHooks { 7 | 8 | public static boolean sendUpdatePacket(TileEntity tile) { 9 | return tile.getWorld() instanceof DummyWorld || tile.getWorld() == null; 10 | } 11 | 12 | public static boolean sendToDimension(int dimensionId) { 13 | return dimensionId == Integer.MAX_VALUE - 1024; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/BlockModelRendererMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.client.renderer.BlockModelRenderer; 6 | import net.minecraft.util.EnumFacing; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.IBlockAccess; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(BlockModelRenderer.class) 14 | public class BlockModelRendererMixin { 15 | 16 | @Redirect(method = "renderModelFlat", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z")) 17 | private boolean injectRenderModelFlat(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing facing) { 18 | if (MultiblockWorldSavedData.isModelDisabled(pos.offset(facing))) { 19 | return true; 20 | } 21 | return blockState.shouldSideBeRendered(blockAccess, pos, facing); 22 | } 23 | 24 | @Redirect(method = "renderModelSmooth", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z")) 25 | private boolean injectRenderModelSmooth(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing facing) { 26 | if (MultiblockWorldSavedData.isModelDisabled(pos.offset(facing))) { 27 | return true; 28 | } 29 | return blockState.shouldSideBeRendered(blockAccess, pos, facing); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/ChunkMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import com.cleanroommc.multiblocked.api.pattern.MultiblockState; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.util.math.ChunkPos; 8 | import net.minecraft.world.World; 9 | import net.minecraft.world.chunk.Chunk; 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(Chunk.class) 19 | public class ChunkMixin { 20 | 21 | @Shadow @Final public int x; 22 | @Shadow @Final public int z; 23 | @Shadow @Final private World world; 24 | 25 | // We want to be as quick as possible here 26 | @Inject(method = "setBlockState", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/World;captureBlockSnapshots:Z", remap = false)) 27 | private void onAddingBlock(BlockPos pos, IBlockState state, CallbackInfoReturnable cir) { 28 | if (this.world.getMinecraftServer() == null) return; 29 | this.world.getMinecraftServer().addScheduledTask(() -> { 30 | for (MultiblockState structure : MultiblockWorldSavedData.getOrCreate(this.world).getControllerInChunk(new ChunkPos(x, z))) { 31 | if (structure.isPosInCache(pos)) { 32 | structure.onBlockStateChanged(pos); 33 | } 34 | } 35 | }); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/FMLOutboundTargetMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import io.netty.channel.ChannelHandlerContext; 4 | import net.minecraftforge.fml.common.FMLCommonHandler; 5 | import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher; 6 | import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; 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.CallbackInfoReturnable; 11 | 12 | import java.util.Collections; 13 | import java.util.List; 14 | 15 | /** 16 | * @author youyihj 17 | */ 18 | @Mixin(remap = false, targets = { 19 | "net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$5", 20 | "net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$6", 21 | "net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$7", 22 | }) 23 | public class FMLOutboundTargetMixin { 24 | @Inject(method = "selectNetworks", at = @At("HEAD"), cancellable = true) 25 | public void selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet, CallbackInfoReturnable> cir) { 26 | if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) { 27 | cir.setReturnValue(Collections.emptyList()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/ForgeBlockModelRendererMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.util.EnumFacing; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.world.IBlockAccess; 8 | import net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(ForgeBlockModelRenderer.class) 14 | public class ForgeBlockModelRendererMixin { 15 | 16 | @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z")) 17 | private static boolean injectRender(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing facing) { 18 | if (MultiblockWorldSavedData.isModelDisabled(pos.offset(facing))) { 19 | return true; 20 | } 21 | return blockState.shouldSideBeRendered(blockAccess, pos, facing); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/MinecraftMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.client.MultiblockedResourceLoader; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.resources.IResourcePack; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | import java.util.List; 14 | 15 | @Mixin(Minecraft.class) 16 | public class MinecraftMixin { 17 | 18 | @Shadow @Final private List defaultResourcePacks; 19 | 20 | @Inject(method = "refreshResources", at = @At(value = "HEAD")) 21 | private void addInternalResourcePack(CallbackInfo ci) { 22 | if (defaultResourcePacks.isEmpty() || !defaultResourcePacks.contains(MultiblockedResourceLoader.INSTANCE)) { 23 | defaultResourcePacks.add(MultiblockedResourceLoader.INSTANCE); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/NBTTagCompoundMapExposer.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import net.minecraft.nbt.NBTBase; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | import java.util.Map; 9 | 10 | @Mixin(NBTTagCompound.class) 11 | public interface NBTTagCompoundMapExposer { 12 | 13 | @Accessor 14 | Map getTagMap(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/RenderChunkMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.client.renderer.BlockRendererDispatcher; 6 | import net.minecraft.client.renderer.BufferBuilder; 7 | import net.minecraft.client.renderer.chunk.RenderChunk; 8 | import net.minecraft.util.math.BlockPos; 9 | import net.minecraft.world.IBlockAccess; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | 14 | @Mixin(RenderChunk.class) 15 | public class RenderChunkMixin { 16 | 17 | @Redirect(method = "rebuildChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/BlockRendererDispatcher;renderBlock(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/BufferBuilder;)Z")) 18 | private boolean injectRenderModelFlat(BlockRendererDispatcher blockRendererDispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn) { 19 | MultiblockWorldSavedData.isBuildingChunk.set(true); 20 | if (MultiblockWorldSavedData.isModelDisabled(pos)) { 21 | MultiblockWorldSavedData.isBuildingChunk.set(false); 22 | return false; 23 | } 24 | boolean result = blockRendererDispatcher.renderBlock(state, pos, blockAccess, bufferBuilderIn); 25 | MultiblockWorldSavedData.isBuildingChunk.set(false); 26 | return result; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/RenderItemMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.client.renderer.ICustomItemRenderer; 4 | import net.minecraft.client.renderer.GlStateManager; 5 | import net.minecraft.client.renderer.RenderItem; 6 | import net.minecraft.client.renderer.block.model.IBakedModel; 7 | import net.minecraft.item.ItemStack; 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.CallbackInfo; 12 | 13 | @Mixin(RenderItem.class) 14 | public class RenderItemMixin { 15 | 16 | @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At(value = "HEAD"), cancellable = true) 17 | private void injectRenderBlockDamage(ItemStack stack, IBakedModel model, CallbackInfo ci) { 18 | if (!stack.isEmpty() && model instanceof ICustomItemRenderer) { 19 | ICustomItemRenderer renderer = (ICustomItemRenderer) model; 20 | GlStateManager.pushMatrix(); 21 | GlStateManager.translate(-0.5F, -0.5F, -0.5F); 22 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 23 | GlStateManager.enableRescaleNormal(); 24 | renderer.renderItem(stack); 25 | GlStateManager.popMatrix(); 26 | ci.cancel(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/core/mixins/TileEntityRendererDispatcherMixin.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.core.mixins; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import com.cleanroommc.multiblocked.api.tile.ComponentTileEntity; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; 7 | import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; 8 | import net.minecraft.tileentity.TileEntity; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Shadow; 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(TileEntityRendererDispatcher.class) 16 | public class TileEntityRendererDispatcherMixin { 17 | @Shadow public static TileEntityRendererDispatcher instance; 18 | 19 | @Inject(method = "getRenderer(Lnet/minecraft/tileentity/TileEntity;)Lnet/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer;", at = @At(value = "HEAD"), cancellable = true) 20 | private void injectGetRenderer(TileEntity tileEntityIn, CallbackInfoReturnable> cir) { 21 | if (tileEntityIn != null) { 22 | if (tileEntityIn.getWorld() == Minecraft.getMinecraft().world && MultiblockWorldSavedData.modelDisabled.contains(tileEntityIn.getPos())) { 23 | cir.setReturnValue(null); 24 | } else if (tileEntityIn instanceof ComponentTileEntity && !((ComponentTileEntity) tileEntityIn).hasTESRRenderer()) { 25 | cir.setReturnValue(null); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/integration/InfoProviders.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.integration; 2 | 3 | import com.cleanroommc.multiblocked.integration.provider.RecipeProgressInfoProvider; 4 | import mcjty.theoneprobe.TheOneProbe; 5 | import mcjty.theoneprobe.api.ITheOneProbe; 6 | 7 | public class InfoProviders { 8 | 9 | public static void registerTOP() { 10 | ITheOneProbe theOneProbe = TheOneProbe.theOneProbeImp; 11 | theOneProbe.registerProvider(new RecipeProgressInfoProvider()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/jei/IJeiIngredientAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.jei; 2 | 3 | import mezz.jei.api.recipe.IIngredientType; 4 | import net.minecraftforge.fml.common.Optional; 5 | 6 | import java.util.function.Function; 7 | import java.util.stream.Stream; 8 | 9 | /** 10 | * @author youyihj 11 | */ 12 | public interface IJeiIngredientAdapter extends Function> { 13 | Class getInternalIngredientType(); 14 | 15 | @Optional.Method(modid = "jei") 16 | IIngredientType getJeiIngredientType(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/jei/ModularWrapper.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.jei; 2 | 3 | import com.cleanroommc.multiblocked.Multiblocked; 4 | import com.cleanroommc.multiblocked.api.gui.modular.IUIHolder; 5 | import com.cleanroommc.multiblocked.api.gui.modular.ModularUI; 6 | import com.cleanroommc.multiblocked.api.gui.texture.IGuiTexture; 7 | import com.cleanroommc.multiblocked.api.gui.util.ModularUIBuilder; 8 | import com.cleanroommc.multiblocked.api.gui.widget.Widget; 9 | import mezz.jei.api.recipe.IRecipeWrapper; 10 | import mezz.jei.gui.recipes.RecipeLayout; 11 | import net.minecraft.client.Minecraft; 12 | 13 | import javax.annotation.Nonnull; 14 | import java.io.IOException; 15 | 16 | public abstract class ModularWrapper implements IRecipeWrapper { 17 | protected final Widget widget; 18 | protected final JEIModularUIGuiContainer guiContainer; 19 | 20 | public ModularWrapper(Widget widget, int width, int height) { 21 | ModularUI gui = new ModularUIBuilder(IGuiTexture.EMPTY, width, height) 22 | .widget(widget) 23 | .build(IUIHolder.EMPTY, Minecraft.getMinecraft().player); 24 | gui.initWidgets(); 25 | this.widget = widget; 26 | guiContainer = new JEIModularUIGuiContainer(gui); 27 | } 28 | 29 | public Widget getWidget() { 30 | return widget; 31 | } 32 | 33 | public void setRecipeLayout(RecipeLayout layout) { 34 | guiContainer.setRecipeLayout(layout); 35 | } 36 | 37 | @Override 38 | public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { 39 | guiContainer.drawInfo(minecraft, mouseX, mouseY); 40 | } 41 | 42 | public void handleMouseInput() { 43 | try { 44 | guiContainer.handleMouseInput(); 45 | } catch (IOException e) { 46 | Multiblocked.LOGGER.error(e); 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/jei/ingredient/AbstractIngredient.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.jei.ingredient; 2 | 3 | import mezz.jei.api.ingredients.IIngredientHelper; 4 | import mezz.jei.api.ingredients.IIngredientRenderer; 5 | import mezz.jei.api.ingredients.IModIngredientRegistration; 6 | import mezz.jei.api.recipe.IIngredientType; 7 | 8 | import java.util.Collection; 9 | 10 | public abstract class AbstractIngredient implements IIngredientType, IIngredientHelper, IIngredientRenderer { 11 | 12 | public void registerIngredients(IModIngredientRegistration registry) { 13 | registry.register(this, getAllIngredients(), this, this); 14 | } 15 | 16 | public abstract Collection getAllIngredients(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/jei/multipage/MultiblockInfoWrapper.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.jei.multipage; 2 | 3 | import com.cleanroommc.multiblocked.api.definition.ControllerDefinition; 4 | import com.cleanroommc.multiblocked.api.gui.widget.imp.controller.structure.PatternWidget; 5 | import com.cleanroommc.multiblocked.jei.ModularWrapper; 6 | import mezz.jei.api.ingredients.IIngredients; 7 | import mezz.jei.api.ingredients.VanillaTypes; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | public class MultiblockInfoWrapper extends ModularWrapper { 12 | public final ControllerDefinition definition; 13 | 14 | public MultiblockInfoWrapper(ControllerDefinition definition) { 15 | super(PatternWidget.getPatternWidget(definition), 176, 220); 16 | this.definition = definition; 17 | } 18 | 19 | @Override 20 | public void getIngredients(@Nonnull IIngredients ingredients) { 21 | ingredients.setInputs(VanillaTypes.ITEM, ((PatternWidget)widget).allItemStackInputs); 22 | ingredients.setOutput(VanillaTypes.ITEM, definition.getStackForm()); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/network/IPacket.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.network; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraft.client.network.NetHandlerPlayClient; 5 | import net.minecraft.network.NetHandlerPlayServer; 6 | import net.minecraft.network.PacketBuffer; 7 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | public interface IPacket extends IMessage { 12 | 13 | void encode(PacketBuffer buf); 14 | 15 | void decode(PacketBuffer buf); 16 | 17 | @Override 18 | default void fromBytes(ByteBuf buf){ 19 | decode(new PacketBuffer(buf)); 20 | } 21 | 22 | @Override 23 | default void toBytes(ByteBuf buf) { 24 | encode(new PacketBuffer(buf)); 25 | } 26 | 27 | @SideOnly(Side.CLIENT) 28 | default IPacket executeClient(NetHandlerPlayClient handler) { 29 | return null; 30 | } 31 | 32 | default IPacket executeServer(NetHandlerPlayServer handler) { 33 | return null; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/network/s2c/SPacketRemoveDisabledRendering.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.network.s2c; 2 | 3 | import com.cleanroommc.multiblocked.persistence.MultiblockWorldSavedData; 4 | import com.cleanroommc.multiblocked.network.IPacket; 5 | import net.minecraft.client.network.NetHandlerPlayClient; 6 | import net.minecraft.network.PacketBuffer; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 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(PacketBuffer buf) { 23 | buf.writeVarLong(controllerPos.toLong()); 24 | } 25 | 26 | @Override 27 | public void decode(PacketBuffer buf) { 28 | this.controllerPos = BlockPos.fromLong(buf.readVarLong()); 29 | } 30 | 31 | @SideOnly(Side.CLIENT) 32 | @Override 33 | public IPacket executeClient(NetHandlerPlayClient handler) { 34 | MultiblockWorldSavedData.removeDisableModel(controllerPos); 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/network/s2c/SPacketUIOpen.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.network.s2c; 2 | 3 | import com.cleanroommc.multiblocked.api.gui.factory.UIFactory; 4 | import com.cleanroommc.multiblocked.network.IPacket; 5 | import io.netty.buffer.ByteBuf; 6 | import io.netty.buffer.Unpooled; 7 | import net.minecraft.client.network.NetHandlerPlayClient; 8 | import net.minecraft.network.PacketBuffer; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | public class SPacketUIOpen implements IPacket { 13 | private int uiFactoryId; 14 | private PacketBuffer serializedHolder; 15 | private int windowId; 16 | 17 | public SPacketUIOpen() { 18 | } 19 | 20 | public SPacketUIOpen(int uiFactoryId, PacketBuffer serializedHolder, int windowId) { 21 | this.uiFactoryId = uiFactoryId; 22 | this.serializedHolder = serializedHolder; 23 | this.windowId = windowId; 24 | } 25 | 26 | @Override 27 | public void encode(PacketBuffer buf) { 28 | buf.writeVarInt(serializedHolder.readableBytes()); 29 | buf.writeBytes(serializedHolder); 30 | 31 | buf.writeVarInt(uiFactoryId); 32 | buf.writeVarInt(windowId); 33 | } 34 | 35 | @Override 36 | public void decode(PacketBuffer buf) { 37 | ByteBuf directSliceBuffer = buf.readBytes(buf.readVarInt()); 38 | ByteBuf copiedDataBuffer = Unpooled.copiedBuffer(directSliceBuffer); 39 | directSliceBuffer.release(); 40 | this.serializedHolder = new PacketBuffer(copiedDataBuffer); 41 | 42 | this.uiFactoryId = buf.readVarInt(); 43 | this.windowId = buf.readVarInt(); 44 | } 45 | 46 | @SideOnly(Side.CLIENT) 47 | @Override 48 | public IPacket executeClient(NetHandlerPlayClient handler) { 49 | UIFactory uiFactory = UIFactory.FACTORIES.get(uiFactoryId); 50 | if (uiFactory != null) { 51 | uiFactory.initClientUI(serializedHolder, windowId); 52 | } 53 | return null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/persistence/IAsyncThreadUpdate.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.persistence; 2 | 3 | 4 | public interface IAsyncThreadUpdate { 5 | void asyncThreadLogic(long periodID); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/BlockPosFace.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | import net.minecraft.util.math.BlockPos; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | public class BlockPosFace { 9 | public final EnumFacing facing; 10 | public final BlockPos pos; 11 | 12 | public BlockPosFace(BlockPos pos, EnumFacing facing) { 13 | this.pos = pos; 14 | this.facing = facing; 15 | } 16 | 17 | @Override 18 | public boolean equals(@Nullable Object bp) { 19 | if (bp instanceof BlockPosFace) { 20 | return pos.equals(((BlockPosFace) bp).pos) && ((BlockPosFace) bp).facing == facing; 21 | } 22 | return super.equals(bp); 23 | } 24 | 25 | @Override 26 | public int hashCode() { 27 | return pos.hashCode() + facing.hashCode(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/CycleItemStackHandler.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraftforge.items.IItemHandler; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.util.List; 9 | 10 | public class CycleItemStackHandler implements IItemHandler { 11 | private List> stacks; 12 | 13 | 14 | public CycleItemStackHandler(List> stacks) { 15 | updateStacks(stacks); 16 | } 17 | 18 | public void updateStacks(List> stacks) { 19 | this.stacks = stacks; 20 | } 21 | 22 | @Override 23 | public int getSlots() { 24 | return stacks.size(); 25 | } 26 | 27 | @Nonnull 28 | @Override 29 | public ItemStack getStackInSlot(int i) { 30 | List stackList = stacks.get(i); 31 | return stackList == null || stackList.isEmpty() ? ItemStack.EMPTY : stackList.get(Math.abs((int)(System.currentTimeMillis() / 1000) % stackList.size())); 32 | } 33 | 34 | @Nonnull 35 | @Override 36 | public ItemStack insertItem(int i, @Nonnull ItemStack itemStack, boolean b) { 37 | return itemStack; 38 | } 39 | 40 | @Nonnull 41 | @Override 42 | public ItemStack extractItem(int i, int i1, boolean b) { 43 | return ItemStack.EMPTY; 44 | } 45 | 46 | @Override 47 | public int getSlotLimit(int i) { 48 | return 64; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/ISearch.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | import java.util.function.Consumer; 4 | 5 | public interface ISearch { 6 | default boolean isManualInterrupt() {return false;} 7 | void search(String word, Consumer find); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/Position.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | import com.google.common.base.MoreObjects; 4 | 5 | import java.util.Objects; 6 | 7 | public class Position { 8 | 9 | public static final Position ORIGIN = new Position(0, 0); 10 | 11 | public final int x; 12 | public final int y; 13 | 14 | public Position(int x, int y) { 15 | this.x = x; 16 | this.y = y; 17 | } 18 | 19 | public Position add(Position other) { 20 | return new Position(x + other.x, y + other.y); 21 | } 22 | 23 | public Position subtract(Position other) { 24 | return new Position(x - other.x, y - other.y); 25 | } 26 | 27 | public Position add(Size size) { 28 | return new Position(x + size.width, y + size.height); 29 | } 30 | 31 | public int getX() { 32 | return x; 33 | } 34 | 35 | public int getY() { 36 | return y; 37 | } 38 | 39 | @Override 40 | public boolean equals(Object o) { 41 | if (this == o) return true; 42 | if (!(o instanceof Position)) return false; 43 | Position position = (Position) o; 44 | return x == position.x && 45 | y == position.y; 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return Objects.hash(x, y); 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return MoreObjects.toStringHelper(this) 56 | .add("x", x) 57 | .add("y", y) 58 | .toString(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/SearchEngine.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.function.Consumer; 5 | 6 | public class SearchEngine { 7 | private final ISearch search; 8 | private final Consumer result; 9 | private Thread thread; 10 | 11 | public SearchEngine(@Nonnull ISearch search, @Nonnull Consumer result){ 12 | this.search = search; 13 | this.result = result; 14 | } 15 | 16 | public void searchWord(String word) { 17 | dispose(); 18 | thread = new Thread(()-> search.search(word, result)); 19 | thread.start(); 20 | } 21 | 22 | public boolean isSearching() { 23 | return thread != null && thread.isAlive(); 24 | } 25 | 26 | public void dispose() { 27 | if (isSearching()) { 28 | if (search.isManualInterrupt()) { 29 | thread.interrupt(); 30 | } else { 31 | thread.stop(); 32 | } 33 | } 34 | thread = null; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/Size.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util; 2 | 3 | import com.google.common.base.MoreObjects; 4 | 5 | import java.util.Objects; 6 | 7 | public class Size { 8 | 9 | public static final Size ZERO = new Size(0, 0); 10 | 11 | public final int width; 12 | public final int height; 13 | 14 | public Size(int width, int height) { 15 | this.width = width; 16 | this.height = height; 17 | } 18 | 19 | public int getWidth() { 20 | return width; 21 | } 22 | 23 | public int getHeight() { 24 | return height; 25 | } 26 | 27 | @Override 28 | public boolean equals(Object o) { 29 | if (this == o) return true; 30 | if (!(o instanceof Size)) return false; 31 | Size size = (Size) o; 32 | return width == size.width && 33 | height == size.height; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | return Objects.hash(width, height); 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return MoreObjects.toStringHelper(this) 44 | .add("width", width) 45 | .add("height", height) 46 | .toString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/cleanroommc/multiblocked/util/world/DummyChunkProvider.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.util.world; 2 | 3 | import io.netty.util.collection.LongObjectHashMap; 4 | import io.netty.util.collection.LongObjectMap; 5 | import net.minecraft.util.math.ChunkPos; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.chunk.Chunk; 8 | import net.minecraft.world.chunk.IChunkProvider; 9 | 10 | import javax.annotation.Nonnull; 11 | import javax.annotation.Nullable; 12 | 13 | public class DummyChunkProvider implements IChunkProvider { 14 | 15 | private final World world; 16 | private final LongObjectMap loadedChunks = new LongObjectHashMap<>(); 17 | 18 | public DummyChunkProvider(World world) { 19 | this.world = world; 20 | } 21 | 22 | @Nullable 23 | @Override 24 | public Chunk getLoadedChunk(int x, int z) { 25 | return loadedChunks.get(ChunkPos.asLong(x, z)); 26 | } 27 | 28 | @Nonnull 29 | @Override 30 | public Chunk provideChunk(int x, int z) { 31 | long chunkKey = ChunkPos.asLong(x, z); 32 | if (loadedChunks.containsKey(chunkKey)) 33 | return loadedChunks.get(chunkKey); 34 | Chunk chunk = new Chunk(world, x, z); 35 | loadedChunks.put(chunkKey, chunk); 36 | return chunk; 37 | } 38 | 39 | @Override 40 | public boolean tick() { 41 | for (Chunk chunk : loadedChunks.values()) { 42 | chunk.onTick(false); 43 | } 44 | return loadedChunks.size() > 0; 45 | } 46 | 47 | @Nonnull 48 | @Override 49 | public String makeString() { 50 | return "Dummy"; 51 | } 52 | 53 | @Override 54 | public boolean isChunkGeneratedAt(int x, int z) { 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /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 | "x": 30, 20 | "y": 98, 21 | "width": 120, 22 | "height": 9, 23 | "texture": "multiblocked:textures/gui/energy_bar.png", 24 | "capacity": 100000, 25 | "maxReceive": 5000, 26 | "maxExtract": 5000 27 | } 28 | }, 29 | "allowRotate": true, 30 | "showInJei": true, 31 | "baseRenderer": { 32 | "baseTexture": "multiblocked:blocks/casing/base", 33 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_in", 34 | "formedAsController": true, 35 | "type": "gregtech" 36 | }, 37 | "properties": { 38 | "isOpaque": true, 39 | "destroyTime": 5.0, 40 | "explosionResistance": 6.0, 41 | "harvestLevel": 1, 42 | "lightEmissive": 0, 43 | "speedFactor": 1.0, 44 | "jumpFactor": 1.0, 45 | "friction": 0.6, 46 | "hasCollision": true, 47 | "tabGroup": "multiblocked.all", 48 | "stackSize": 64 49 | } 50 | } -------------------------------------------------------------------------------- /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 | "x": 28, 27 | "y": 106, 28 | "width": 120, 29 | "height": 9, 30 | "texture": "multiblocked:textures/gui/energy_bar.png", 31 | "capacity": 100000, 32 | "maxReceive": 5000, 33 | "maxExtract": 5000 34 | } 35 | }, 36 | "allowRotate": true, 37 | "showInJei": true, 38 | "baseRenderer": { 39 | "baseTexture": "multiblocked:blocks/casing/base", 40 | "frontTexture": "multiblocked:blocks/overlay/overlay_energy_out", 41 | "formedAsController": true, 42 | "type": "gregtech" 43 | }, 44 | "properties": { 45 | "isOpaque": true, 46 | "destroyTime": 5.0, 47 | "explosionResistance": 6.0, 48 | "harvestLevel": 1, 49 | "lightEmissive": 0, 50 | "speedFactor": 1.0, 51 | "jumpFactor": 1.0, 52 | "friction": 0.6, 53 | "hasCollision": true, 54 | "tabGroup": "multiblocked.all", 55 | "stackSize": 64 56 | } 57 | } -------------------------------------------------------------------------------- /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 | "x": 88, 19 | "y": 62, 20 | "autoIO": true 21 | }, 22 | { 23 | "cIO": 0, 24 | "gIO": 2, 25 | "x": 70, 26 | "y": 80, 27 | "autoIO": true 28 | }, 29 | { 30 | "cIO": 0, 31 | "gIO": 2, 32 | "x": 88, 33 | "y": 80, 34 | "autoIO": true 35 | } 36 | ] 37 | }, 38 | "allowRotate": true, 39 | "showInJei": true, 40 | "baseRenderer": { 41 | "baseTexture": "multiblocked:blocks/casing/base", 42 | "frontTexture": "multiblocked:blocks/overlay/overlay_item_in", 43 | "formedAsController": true, 44 | "type": "gregtech" 45 | }, 46 | "isOpaqueCube": true 47 | } -------------------------------------------------------------------------------- /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 | "x": 88, 19 | "y": 62, 20 | "autoIO": true 21 | }, 22 | { 23 | "cIO": 1, 24 | "gIO": 2, 25 | "x": 70, 26 | "y": 80, 27 | "autoIO": true 28 | }, 29 | { 30 | "cIO": 1, 31 | "gIO": 2, 32 | "x": 88, 33 | "y": 80, 34 | "autoIO": true 35 | } 36 | ] 37 | }, 38 | "allowRotate": true, 39 | "showInJei": true, 40 | "baseRenderer": { 41 | "baseTexture": "multiblocked:blocks/casing/base", 42 | "frontTexture": "multiblocked:blocks/overlay/overlay_item_out", 43 | "formedAsController": true, 44 | "type": "gregtech" 45 | }, 46 | "isOpaqueCube": true 47 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/demo/particle.zs: -------------------------------------------------------------------------------- 1 | import mods.multiblocked.MBDParticle; 2 | 3 | import crafttweaker.world.IWorld; 4 | import crafttweaker.util.IRandom; 5 | 6 | val world = MBDParticle.getWorld(); 7 | val rand = world.random; 8 | 9 | for i in 0 to 20 { 10 | val particle = MBDParticle.texture(world, 0.5, 2, 0.5); 11 | particle.setMotion( 12 | (rand.nextFloat() * 2 - 1) * 0.1, 13 | (rand.nextFloat() * 2 - 1) * 0.1, 14 | (rand.nextFloat() * 2 - 1) * 0.1); 15 | particle.setBackLayer(true); 16 | particle.setMotionless(true); 17 | particle.setAddBlend(true); 18 | val alpha = rand.nextInt(100) + 100; 19 | particle.setColor(alpha, 0x5f, 0xff, 0xff); 20 | particle.setScale(1); 21 | particle.setTexturesCount(2); 22 | particle.setTexturesIndex(1, 1); 23 | particle.setLightingMap(15, 15); 24 | particle.setLife(40); 25 | particle.setTexture("multiblocked:textures/fx/fx.png"); 26 | particle.create(); 27 | } 28 | 29 | val particle = MBDParticle.texture(world, 0.5, 2, 0.5, true); 30 | particle.setTexture("multiblocked:start"); 31 | particle.setBackLayer(true); 32 | particle.setScale(16); 33 | particle.setLightingMap(15, 15); 34 | particle.setImmortal(); 35 | particle.create(); 36 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | } 48 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/item/blueprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "multiblocked:items/blueprint" 5 | } 6 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/models/obj/energy_core_model.mtl: -------------------------------------------------------------------------------- 1 | newmtl texture 2 | # Ns 96.078431 3 | Ka 0.000000 0.000000 0.000000 4 | Kd 0.640000 0.640000 0.640000 5 | # Ks 0.500000 0.500000 0.500000 6 | # Ni 1.000000 7 | d 1.000000 8 | # illum 2 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/models/test_model.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/block", 3 | "textures": { 4 | "bot_down": "multiblocked:test/d", 5 | "bot_up": "multiblocked:test/u", 6 | "bot_north": "multiblocked:test/n", 7 | "bot_south": "multiblocked:test/s", 8 | "bot_west": "multiblocked:test/w", 9 | "bot_east": "multiblocked:test/e", 10 | 11 | "top_down": "multiblocked:void", 12 | "top_up": "multiblocked:void", 13 | "top_north": "multiblocked:test/n_layer2", 14 | "top_south": "multiblocked:test/s_layer2", 15 | "top_west": "multiblocked:void", 16 | "top_east": "multiblocked:void", 17 | 18 | "particle": "multiblocked:test/u" 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 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/shaders/image.frag: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D colourTexture; 4 | 5 | void main(void){ 6 | 7 | gl_FragColor = texture2D(colourTexture, gl_TexCoord[0].xy).rgba; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/shaders/image.vert: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | attribute vec2 position; 4 | 5 | void main(void){ 6 | gl_Position = vec4(position, 0.0, 1.0); 7 | gl_TexCoord[0].xy = position * 0.5 + 0.5; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/blueprint_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/blueprint_table.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/casing/base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/casing/base.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/casing/lv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/casing/lv.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/gregtech_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/gregtech_base.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/gregtech_front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/gregtech_front.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_energy_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/blocks/overlay/overlay_item_out.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/botarium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/botarium.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/fx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/fx/fx.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/laser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/fx/laser.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/fx/laser_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/fx/laser_start.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/add.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/axis.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/bar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/blueprint_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/blueprint_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/blueprint_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/blueprint_table.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/boolean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/boolean.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/bordered_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/button_common.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/button_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/button_view.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/button_wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/button_wood.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/component.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_biome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/condition_biome.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/condition_block.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_dimension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/condition_predicate.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/condition_rain.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/condition_thunder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/condition_thunder.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/copy.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/ct_loader_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/darkened_slot.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/down.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/energy_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/move_down.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/option.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/predicate_selector_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/predicate_selector_bar.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/pretty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/pretty.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/pretty_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/recipe_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/remove.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/repeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/repeat.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/save.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/structure_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/structure_page.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/switch_common.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/switch_common.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/tab_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/tab_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/tab_predicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/tab_text_field.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/up.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/gui/wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/gui/wiki.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/blueprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/items/blueprint.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/blueprint_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/items/blueprint_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/items/multiblock_builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/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/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/items/multiblock_builder_pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/d.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/e.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/n.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/n_layer2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/n_layer2.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/s.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/s_layer2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/s_layer2.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/s_layer2.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "multiblocked": { 3 | "emissive": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/u.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/test/w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/test/w.png -------------------------------------------------------------------------------- /src/main/resources/assets/multiblocked/textures/void.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanroomMC/Multiblocked/b0fbb83d36b8ff6163f887de63ede1e0f5c757e7/src/main/resources/assets/multiblocked/textures/void.png -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "multiblocked", 4 | "name": "Multiblock'd", 5 | "description": "An extremely flexible, vanilla-esque multiblock mod that also incorporates aspects of MultiblockTweaker and Modular Machinery.", 6 | "version": "${version}", 7 | "mcversion": "${mcversion}", 8 | "url": "https://github.com/CleanroomMC/Multiblocked", 9 | "updateUrl": "https://github.com/CleanroomMC/Multiblocked", 10 | "authorList": ["KilaBash", "Rongmario"], 11 | "credits": "youyihj an insane man who made many compatibilities. thanks for model providers (yor42, 琥珀酸, Zaglo). debug and communication CleanroomMC Team", 12 | "logoFile": "", 13 | "screenshots": [], 14 | "dependencies": [ 15 | "mixinbooter" 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/main/resources/mixins.multiblocked.json: -------------------------------------------------------------------------------- 1 | { 2 | "package": "com.cleanroommc.multiblocked.core.mixins", 3 | "refmap": "mixins.multiblocked.refmap.json", 4 | "target": "@env(DEFAULT)", 5 | "minVersion": "0.8", 6 | "compatibilityLevel": "JAVA_8", 7 | "mixins": [ 8 | "ChunkMixin", 9 | "FMLOutboundTargetMixin", 10 | "NBTTagCompoundMapExposer", 11 | "TileEntityMixin", 12 | "WorldMixin" 13 | ], 14 | "client": [ 15 | "BlockModelRendererMixin", 16 | "BlockRendererDispatcherMixin", 17 | "EntityRendererMixin", 18 | "ForgeBlockModelRendererMixin", 19 | "MinecraftMixin", 20 | "RenderChunkMixin", 21 | "RenderItemMixin", 22 | "TileEntityRendererDispatcherMixin" 23 | ] 24 | } -------------------------------------------------------------------------------- /src/main/resources/multiblocked_at.cfg: -------------------------------------------------------------------------------- 1 | public net.minecraft.client.renderer.entity.RenderManager field_78725_b # renderPosX 2 | public net.minecraft.client.renderer.entity.RenderManager field_78726_c # renderPosY 3 | public net.minecraft.client.renderer.entity.RenderManager field_78723_d # renderPosZ 4 | 5 | #GuiContainer 6 | protected net.minecraft.client.gui.inventory.GuiContainer field_147006_u #hoveredSlot 7 | protected net.minecraft.client.gui.inventory.GuiContainer field_147005_v #clickedSlot 8 | protected net.minecraft.client.gui.inventory.GuiContainer field_147004_w #isRightMouseClick 9 | protected net.minecraft.client.gui.inventory.GuiContainer field_147012_x #draggedStack 10 | protected net.minecraft.client.gui.inventory.GuiContainer field_146996_I #dragSplittingRemnant 11 | protected net.minecraft.client.gui.inventory.GuiContainer func_146982_a(Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V #drawItemStack 12 | protected net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V #drawSlot 13 | protected net.minecraft.client.gui.inventory.GuiContainer field_146991_C #returningStack 14 | protected net.minecraft.client.gui.inventory.GuiContainer field_146990_B #returningStackTime 15 | protected net.minecraft.client.gui.inventory.GuiContainer field_146989_A #returnStackDestSlot 16 | protected net.minecraft.client.gui.inventory.GuiContainer field_147010_z #touchUpY 17 | protected net.minecraft.client.gui.inventory.GuiContainer field_147011_y #touchUpX 18 | 19 | #Ingredient 20 | public net.minecraft.item.crafting.Ingredient field_193371_b # matchingStacks 21 | 22 | #EnumDyeColor 23 | public net.minecraft.item.EnumDyeColor field_193351_w # colorValue 24 | 25 | #CreativeTabs 26 | public net.minecraft.creativetab.CreativeTabs field_78034_o # tabLabel -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Multiblocked", 4 | "pack_format": 3 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/java/JsonBlockPatternTest.java: -------------------------------------------------------------------------------- 1 | import com.cleanroommc.multiblocked.api.capability.IO; 2 | import com.cleanroommc.multiblocked.api.pattern.JsonBlockPattern; 3 | import com.cleanroommc.multiblocked.api.pattern.util.RelativeDirection; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.math.BlockPos; 6 | 7 | import java.lang.reflect.Array; 8 | import java.util.Arrays; 9 | 10 | class JsonBlockPatternTest { 11 | 12 | public static > T[] getEnumArray(Class enumClass) { 13 | return (T[]) Array.newInstance(enumClass, 10) ; 14 | } 15 | 16 | public static void main(String[] args) { 17 | System.out.println(String.format("%.1f", 0.001)); 18 | IO[] ios = getEnumArray(IO.class); 19 | JsonBlockPattern pattern = new JsonBlockPattern(); 20 | pattern.pattern = new String[][] { 21 | {"TXX", " E "}, 22 | {"C#A", "QPW"}, 23 | {"BYD", " "} 24 | }; 25 | print(pattern); 26 | 27 | BlockPos pos = pattern.getActualPosOffset(2, 0,1, EnumFacing.NORTH); 28 | System.out.println(pos); 29 | System.out.println(); 30 | 31 | 32 | pattern.changeDir(RelativeDirection.DOWN, RelativeDirection.BACK, RelativeDirection.RIGHT); 33 | print(pattern); 34 | 35 | System.out.println(Arrays.toString(pattern.getActualPatternOffset(pos, EnumFacing.NORTH))); 36 | System.out.println(); 37 | 38 | pattern.changeDir(RelativeDirection.LEFT, RelativeDirection.UP, RelativeDirection.FRONT); 39 | print(pattern); 40 | 41 | System.out.println(Arrays.toString(pattern.getActualPatternOffset(pos, EnumFacing.NORTH))); 42 | System.out.println(); 43 | 44 | } 45 | 46 | private static void print(JsonBlockPattern pattern) { 47 | for (int i = 0; i < pattern.pattern.length; i++) { 48 | for (int j = 0; j < pattern.pattern[0].length; j++) { 49 | System.out.print("\""+pattern.pattern[i][j] + "\" "); 50 | } 51 | System.out.println(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/test/java/com/cleanroommc/multiblocked/api/json/FluidStackTypeAdapterTest.java: -------------------------------------------------------------------------------- 1 | package com.cleanroommc.multiblocked.api.json; 2 | 3 | 4 | import com.google.gson.Gson; 5 | import com.google.gson.GsonBuilder; 6 | import com.google.gson.JsonObject; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | 9 | class FluidStackTypeAdapterTest { 10 | 11 | public static void main(String[] args) { 12 | deserialize(); 13 | } 14 | 15 | static void deserialize() { 16 | NBTTagCompound tag = new NBTTagCompound(); 17 | tag.setString("s","213"); 18 | tag.setInteger("sdf",1213); 19 | tag.setTag("dd", new NBTTagCompound()); 20 | Gson gson = new GsonBuilder().create(); 21 | gson.fromJson(tag.toString(), JsonObject.class); 22 | System.out.println(); 23 | } 24 | 25 | static void serialize() { 26 | } 27 | } --------------------------------------------------------------------------------