Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 52 additions & 52 deletions docs/en/archived/baguette-of-wisdom.md
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are archived docs and cannot be accessed from the site, id just not bother with this file at all

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are still accessible, just no link from other pages to them.
https://pylonmc.github.io/archived/baguette-of-wisdom/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are expressly archived from before the rename, I dont think it makes sense to change them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was intentionally not changed, I would just leave it as is

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/en/creating-addons/tutorial-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ The second thing we need is an actual item. We'll use [ItemStackBuilder] for thi

[ItemStackBuilder] contains several different methods to help you create [ItemStack]s. For example, you can use `.set(<component>, <value>)` to set some of the item's values, like enchantments, whether the item is unbreakable, and so on.

**Whenever you're creating a Rebar item, make sure you use `ItemStackBuilder.rebarItem(<material>, <key>)`.** There are others ways to create [ItemStack]s, but **do not** use these to create Rebar items.
**Whenever you're creating a Rebar item, make sure you use `ItemStackBuilder.rebar(<material>, <key>)`.** There are others ways to create [ItemStack]s, but **do not** use these to create Rebar items.

??? question "Why use `ItemStackBuilder.rebarItem`, and not any of the other ways to create an [ItemStack]?"
Under the hood, Rebar stores item keys in [PersistentDataContainer]s, or PDCs. When you call `ItemStackBuilder.rebarItem` and supply a key, that key is written to the item's PDC automatically. If you supply your own item stack, its PDC won't contain the item's key, and Rebar won't be able to differentiate that item with a regular Minecraft item.
??? question "Why use `ItemStackBuilder.rebar`, and not any of the other ways to create an [ItemStack]?"
Under the hood, Rebar stores item keys in [PersistentDataContainer]s, or PDCs. When you call `ItemStackBuilder.rebar` and supply a key, that key is written to the item's PDC automatically. If you supply your own item stack, its PDC won't contain the item's key, and Rebar won't be able to differentiate that item with a regular Minecraft item.

[ItemStackBuilder] also sets the name and lore of the item to the default translation keys (which will be explained later in this tutorial).

Expand All @@ -42,7 +42,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguette = ItemStackBuilder.rebarItem(Material.BREAD, baguetteKey)
public static final ItemStack baguette = ItemStackBuilder.rebar(Material.BREAD, baguetteKey)
.set(DataComponentTypes.FOOD, FoodProperties.food().nutrition(6))
.build();

Expand All @@ -61,7 +61,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguette = ItemStackBuilder.rebarItem(Material.BREAD, baguetteKey)
public static final ItemStack baguette = ItemStackBuilder.rebar(Material.BREAD, baguetteKey)
.set(DataComponentTypes.FOOD, FoodProperties.food().nutrition(6))
.build();

Expand All @@ -84,7 +84,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguette = ItemStackBuilder.rebarItem(Material.BREAD, baguetteKey)
public static final ItemStack baguette = ItemStackBuilder.rebar(Material.BREAD, baguetteKey)
.set(DataComponentTypes.FOOD, FoodProperties.food().nutrition(6))
.build();

Expand All @@ -95,7 +95,7 @@ public final class ExampleAddonItems {
// ...

RebarItem.register(RebarItem.class, baguette);
BasePages.FOOD.addItem(baguetteKey);
PylonPages.FOOD.addItem(baguetteKey);
}
}
```
Expand Down Expand Up @@ -296,7 +296,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguette = ItemStackBuilder.rebarItem(Material.BREAD, baguetteKey)
public static final ItemStack baguette = ItemStackBuilder.rebar(Material.BREAD, baguetteKey)
.set(DataComponentTypes.FOOD, FoodProperties.food().nutrition(6))
.build();

Expand All @@ -307,7 +307,7 @@ public final class ExampleAddonItems {
// ...

RebarItem.register(RebarItem.class, baguette);
BasePages.FOOD.addItem(baguetteKey);
PylonPages.FOOD.addItem(baguetteKey);
}
}
```
Expand Down
16 changes: 8 additions & 8 deletions docs/en/creating-addons/tutorial-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguetteFlamethrower = ItemStackBuilder.rebarItem(Material.BREAD, baguetteFlamethrowerKey)
public static final ItemStack baguetteFlamethrower = ItemStackBuilder.rebar(Material.BREAD, baguetteFlamethrowerKey)
.build();

// ...
Expand All @@ -31,7 +31,7 @@ public final class ExampleAddonItems {
// ...

RebarItem.register(RebarItem.class, baguette);
BasePages.FOOD.addItem(baguetteKey);
PylonPages.FOOD.addItem(baguetteKey);
}
}
```
Expand Down Expand Up @@ -76,7 +76,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(40);
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(40);
}
}
Expand All @@ -160,7 +160,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(burnTimeTicks);
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(burnTimeTicks);
}
}
Expand All @@ -203,7 +203,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack baguetteFlamethrower = ItemStackBuilder.rebarItem(Material.BREAD, baguetteFlamethrowerKey)
public static final ItemStack baguetteFlamethrower = ItemStackBuilder.rebar(Material.BREAD, baguetteFlamethrowerKey)
.build();

// ...
Expand All @@ -213,7 +213,7 @@ public final class ExampleAddonItems {
// ...

RebarItem.register(RebarItem.class, baguette);
BasePages.FOOD.addItem(baguetteKey);
PylonPages.FOOD.addItem(baguetteKey);
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/en/creating-addons/tutorial-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(burnTimeTicks);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ public class BaguetteFlamethrower extends RebarItem implements RebarItemEntityIn
}

@Override
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event) {
public void onUsedToRightClickEntity(@NotNull PlayerInteractEntityEvent event, @NotNull EventPriority priority) {
event.getRightClicked().setFireTicks(burnTimeTicks);
}

Expand Down
22 changes: 11 additions & 11 deletions docs/en/creating-addons/tutorial-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public final class ExampleAddonItems {

// ...

public static final ItemStack countingBaguette = ItemStackBuilder.pylonItem(Material.BREAD, countingBaguetteKey)
public static final ItemStack countingBaguette = ItemStackBuilder.rebar(Material.BREAD, countingBaguetteKey)
.build();

// ...
Expand All @@ -62,16 +62,16 @@ public final class ExampleAddonItems {

// ...

PylonItem.register(CountingBaguette.class, countingBaguette);
BasePages.FOOD.addItem(countingBaguette);
RebarItem.register(CountingBaguette.class, countingBaguette);
PylonPages.FOOD.addItem(countingBaguette);
}
}
```

<span></span>

```java title="CountingBaguette.java"
public class CountingBaguette extends PylonItem {
public class CountingBaguette extends RebarItem {
public CountingBaguette(@NotNull ItemStack stack) {
super(stack);
}
Expand All @@ -90,13 +90,13 @@ item:

First, we need to detect when the player right clicks:
```java title="CountingBaguette.java" hl_lines="1 6-10"
public class CountingBaguette extends PylonItem implements PylonInteractor {
public class CountingBaguette extends RebarItem implements RebarInteractor {
public CountingBaguette(@NotNull ItemStack stack) {
super(stack);
}

@Override
public void onUsedToRightClick(@NotNull PlayerInteractEvent event) {
public void onUsedToClick(@NotNull PlayerInteractEvent event, @NotNull EventPriority priority) {
// TODO send stored value to player
// TODO increment stored value
}
Expand All @@ -111,15 +111,15 @@ To store a piece of data in a persistent data container, we need two other thing
For convenience, Pylon supplies a range of types in the [PylonSerializers] file. This includes all the default types provided by Paper, but also some extra types (like UUID, Vector, BlockPosition, ItemStack, and more).

```java title="CountingBaguette.java" hl_lines="2 10-12"
public class CountingBaguette extends PylonItem implements PylonInteractor {
public class CountingBaguette extends RebarItem implements RebarInteractor {
public static final NamespacedKey COUNT_KEY = new NamespacedKey(MyAddon.getInstance(), "count");

public CountingBaguette(@NotNull ItemStack stack) {
super(stack);
}

@Override
public void onUsedToRightClick(@NotNull PlayerInteractEvent event) {
public void onUsedToClick(@NotNull PlayerInteractEvent event, @NotNull EventPriority priority) {
int count = getStack().getPersistentDataContainer().get(COUNT_KEY, PylonSerializers.INTEGER);
event.getPlayer().sendMessage(String.valueOf(count));
getStack().editPersistentDataContainer(pdc -> pdc.set(COUNT_KEY, PylonSerializers.INTEGER, count + 1));
Expand All @@ -133,11 +133,11 @@ You may have noticed that we have not set a starting value for the count yet. In

```java title="CountingBaguette.java" hl_lines="3"
NamespacedKey countingBaguetteKey = new NamespacedKey(this, "counting_baguette");
ItemStack countingBaguette = ItemStackBuilder.pylonItem(Material.BREAD, countingBaguetteKey)
ItemStack countingBaguette = ItemStackBuilder.rebar(Material.BREAD, countingBaguetteKey)
.editPdc(pdc -> pdc.set(CountingBaguette.COUNT_KEY, PylonSerializers.INTEGER, 0))
.build();
PylonItem.register(CountingBaguette.class, countingBaguette);
BasePages.FOOD.addItem(countingBaguette);
RebarItem.register(CountingBaguette.class, countingBaguette);
PylonPages.FOOD.addItem(countingBaguette);
```

And that's it! The data we stored will persist as long as the item exists.
Expand Down
14 changes: 7 additions & 7 deletions docs/en/documentation/contributing/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Getting started

Pylon Core is written in [Kotlin](https://kotlinlang.org/), a language similar to Java, but with more modern features and concise syntax. If you know Java, you'll be able to pick up Kotlin very quickly.
Rebar is written in [Kotlin](https://kotlinlang.org/), a language similar to Java, but with more modern features and concise syntax. If you know Java, you'll be able to pick up Kotlin very quickly.

Pylon Base is written in Java.
Pylon is written in Java.

## How to get started

1. Clone the `pylon` repository: `git clone https://github.com/pylonmc/pylon` (or use a GUI like Github Desktop)
2. If you're using IntelliJ, it'll set everything up automatically. If not, run `./gradlew`. This will clone the `pylon-core` and `pylon-base` repositories.
3. If you want to submit your changes to the Pylon project, **delete the `pylon-core` or `pylon-base` directory (depending on which one you want to contribute to), fork the pylon-core or pylon-base repository, and clone your fork into the same directory.** Otherwise, you won't be able to open a pull request with your changes (unless you're a Pylon developer and have access to the Pylon repositories).
2. If you're using IntelliJ, it'll set everything up automatically. If not, run `./gradlew`. This will clone the `rebar` and `pylon` repositories.
3. If you want to submit your changes to the Pylon project, **delete the `rebar` or `pylon` directory (depending on which one you want to contribute to), fork the rebar or pylon repository, and clone your fork into the same directory.** Otherwise, you won't be able to open a pull request with your changes (unless you're a Pylon developer and have access to the Pylon repositories).

See the [Pylon Master Project](master-project.md) page for more information about the master repository.

## Submitting your contributions

We generally welcome contributions for both Core and Base, but it's best check with the Pylon team before making any major changes, because we might already have something planned out that won't fit well with your changes. Hop on our Discord server and have a chat with us if you're interested in doing anything major, or have any questions about contributing :)
We generally welcome contributions for both Rebar and Pylon, but it's best check with the Pylon team before making any major changes, because we might already have something planned out that won't fit well with your changes. Hop on our Discord server and have a chat with us if you're interested in doing anything major, or have any questions about contributing :)

Once you're done with your changes, open a pull request and give some information about what you did and why you did it.

## Tests

Pylon Core has a set of integration tests. Tests should only be added for critical functionality such as block storage and recipes.
Rebar has a set of integration tests. Tests should only be added for critical functionality such as block storage and recipes.

## Custom Dokka

Expand All @@ -29,7 +29,7 @@ Pylon uses a custom version of Dokka to generate Javadocs. This is because the d
1. Clone the `pylonmc/dokka` repository: `git clone https://github.com/pylonmc/dokka`
2. Checkout the `pylon` branch: `git checkout pylon`
3. In the root directory, execute `./gradlew publishToMavenLocal -Pversion=2.1.0-pylon-SNAPSHOT`. Note that as Dokka is a very large project, the first build will take a long time. On Seggan's decent-ish laptop, the first run took about 10 minutes. Subsequent builds will be much faster as long s you don't delete the build cache.
4. Now, in the Pylon master project, execute `./gradlew :pylon-core:pylon-core:dokkaGenerate -PusePylonDokka=true`. The generated output will be under `pylon/pylon-core/pylon-core/build/dokka`.
4. Now, in the Pylon master project, execute `./gradlew :rebar:rebar:dokkaGenerate -PusePylonDokka=true`. The generated output will be under `pylon/rebar/rebar/build/dokka`.
Comment thread
Seggan marked this conversation as resolved.

## I'm stuck, what next?

Expand Down
27 changes: 14 additions & 13 deletions docs/en/documentation/contributing/master-project.md
Comment thread
lijinhong11 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# The Pylon Master Project
# The Parallel Dev Repo Project

Pylon has a master repository that contains both `pylon-core` and `pylon-base`. This allows you to run base using your very own home-baked version of core, which allows you to test new features much more easily. This is what the 'How to get started' section used. We recommend you make changes to both Base and Core using the master repository, and the rest of this guide will assume you're using it.
PylonMC has a repositry called: `parallel-dev-repo`. This allows you to run base using your very own home-baked version of core, which allows you to test new features much more easily. This is what the 'How to get started' section used. We recommend you make changes to both Pylon and Rebar using the repository, and the rest of this guide will assume you're using it.

## Project structure
The master project is structured as such:
The project is structured as such:
```
pylon/
pylon-base/
pylon-core/
dokka-plugin/
nms/
pylon-core/
test/
src/
rebar/
dokka-plugin/
nms/
rebar/
test/
```
`pylon-base` contains the Base addon for Pylon. `pylon-core` has four subprojects: `dokka-plugin`, `nms`, `pylon-core`, and `test`. `dokka-plugin` contains a custom Dokka plugin we use to help with formatting Javadocs. `nms` contains all the Pylon Core code that touches server internals. It is in a separate subproject to effectively isolate potentially unstable code from the rest of the project. `pylon-core` contains the main Pylon Core code, and `test` contains the integration tests for Pylon Core.

`pylon` is the base addon for Rebar. `rebar` has four subprojects: `dokka-plugin`, `nms`, `rebar`, and `test`. `dokka-plugin` contains a custom Dokka plugin we use to help with formatting Javadocs. `nms` contains all the Rebar code that touches server internals. It is in a separate subproject to effectively isolate potentially unstable code from the rest of the project. `rebar` contains the main Rebar code, and `test` contains the integration tests for Rebar.

## Tasks
The Pylon master project contains a few tasks that are useful for development:

| Task | Alias | Description |
|------------------------------|---------------------|------------------------------------------------------------------------------------------------------------|
| `runServer` | `runSnapshotServer` | Runs a Minecraft server with the current version of Pylon Base and Pylon Core |
| `:pylon-base:runServer` | `runStableServer` | Runs a Minecraft server with the latest stable version of Pylon Core and the current version of Pylon Base |
| `:pylon-core:test:runServer` | `runLiveTests` | Executes the integration tests for Pylon Core |
| `runServer` | `runSnapshotServer` | Runs a Minecraft server with the current version of Rebar and Pylon |
| `:pylon:runServer` | `runStableServer` | Runs a Minecraft server with the latest stable version of Rebar and the current version of Pylon |
| `:rebar:test:runServer` | `runLiveTests` | Executes the integration tests for Rebar |

!!! danger
If you are launching the tasks using the aliases from IntelliJ and attach the debugger, you will notice that it will not work. I have no idea why this happens. In order to successfully attach the debugger, you need to run the actual tasks, not the aliases. For example, instead of running `runSnapshotServer`, run `runServer`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Adding a custom block requires 3 things:

- A block class
- A `NamespacedKey` that identifies your block
- A corresponding `PylonItem` (Not strictly needed, but recommended so players can place your block)
- A corresponding `RebarItem` (Not strictly needed, but recommended so players can place your block)


## Block classes
Expand Down