Skip to content

Commit

Permalink
Added Custom Module Page
Browse files Browse the repository at this point in the history
  • Loading branch information
TathanDev committed Nov 30, 2024
1 parent ae8ac26 commit 85284b1
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default defineConfig({
{
text: 'Documentation',
items: [
{ text: 'The Planet file', link: '/custom-planets' },
{ text: 'The Screen files', link: '/custom-screen' },
{ text: 'Custom Sky', link: '/custom-sky' }
{ text: 'The Planet file', link: '/docs/custom-planets' },
{ text: 'The Screen files', link: '/docs/custom-screen' },
{ text: 'Custom Sky', link: '/docs/custom-sky' }

]
},
Expand Down
67 changes: 67 additions & 0 deletions docs/custom-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Custom Modules

With Project Stellaris, you can add your own modules to the jet suit !

## Creation of the Module Class

First, you'll need to create the module class :

```java
public class TestModule extends Item implements SpaceSuitModule {

public TestModule(Properties properties) {
super(properties);
}

@Override
public MutableComponent displayName() {
return null;
}

@Override
public List<Item> requires() {
return List.of(ItemsRegistry.MODULE_FUEL.get());
}

@Override
public int renderStackedGui(GuiGraphics graphics, DeltaTracker deltaTracker, Player player, ItemStack stack, int y) {
return sizeOfTheGUI
}

@Override
public void renderToGui(GuiGraphics graphics, DeltaTracker deltaTracker, Player player, ItemStack stack) {
}

@Override
public void addToTooltips(ItemStack stack, TooltipContext context, List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
tooltipComponents.add(YourComponent)
}

}
```

## Methods


::: details **MutableComponent displayName()**
Need to return the name of the Module.
:::

::: details **void renderToGui()**
Allow you to render things on the player screen when the module is on the armor.
:::

::: details **void addToTooltips()**
Allow you to add tooltip to the Space Suit Chestplate.
:::


::: details **int renderStackedGui()**
Allow you to render things on the player screen. The height will change depending if others modules render things too. That is why you need to return the height of the thing you render
:::

::: details **List< Item > requires()**
Return a list of Modules that are needed for the module to be used.
:::


File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ hero:
actions:
- theme: brand
text: Custom Planets
link: /custom-planets
link: /docs/custom-planets
- theme: alt
text: Custom Screen
link: /custom-screen
link: /docs/custom-screen
- theme: brand
text: Wiki
link: /wiki/getting-started
Expand Down

0 comments on commit 85284b1

Please sign in to comment.