Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
uses: actions/checkout@v5
with:
repository: pylonmc/dokka
ref: pylon
ref: rebar

- name: Publish Dokka to Maven local
run: ./gradlew publishToMavenLocal -Pversion=2.1.0-pylon-SNAPSHOT
run: ./gradlew publishToMavenLocal -Pversion=2.1.0-rebar-SNAPSHOT

- name: Checkout
uses: actions/checkout@v5
Expand All @@ -47,12 +47,12 @@ jobs:
uses: actions/configure-pages@v5

- name: Build docs
run: ./gradlew :pylon-core:dokkaGenerate -PusePylonDokka=true
run: ./gradlew :rebar:dokkaGenerate -PuseRebarDokka=true

- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
path: 'pylon-core/build/dokka'
path: 'rebar/build/dokka'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/enws-missing-keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches: [ main ]
paths:
- "pylon-core/src/main/resources/lang/en.yml"
- "pylon-core/src/main/resources/lang/enws.yml"
- "rebar/src/main/resources/lang/en.yml"
- "rebar/src/main/resources/lang/enws.yml"
workflow_dispatch:

jobs:
Expand All @@ -18,11 +18,11 @@ jobs:

- name: Extract all keys from en.yml
run: |
yq eval '.. | select(. == "*") | (path | join("."))' pylon-core/src/main/resources/lang/en.yml | sort > en_keys.txt
yq eval '.. | select(. == "*") | (path | join("."))' rebar/src/main/resources/lang/en.yml | sort > en_keys.txt

- name: Extract all keys from enws.yml
run: |
yq eval '.. | select(. == "*") | (path | join("."))' pylon-core/src/main/resources/lang/enws.yml | sort > enws_keys.txt
yq eval '.. | select(. == "*") | (path | join("."))' rebar/src/main/resources/lang/enws.yml | sort > enws_keys.txt

- name: Compare keys
id: compare
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
branches:
- master
paths:
- 'pylon-core/**'
- 'rebar/**'
- 'test/**'
- 'build.gradle.kts'
pull_request:
branches: [ "*" ]
paths:
- 'pylon-core/**'
- 'rebar/**'
- 'test/**'
- 'build.gradle.kts'
workflow_call:
Expand Down Expand Up @@ -41,13 +41,13 @@ jobs:
uses: gradle/actions/[email protected]

- name: Build with Gradle Wrapper
run: ./gradlew :pylon-core:shadowJar -Pversion=${{ inputs.version || github.run_number }}
run: ./gradlew :rebar:shadowJar -Pversion=${{ inputs.version || github.run_number }}

- name: Upload the artifact
uses: actions/[email protected]
with:
name: pylon-core-${{ inputs.version || github.run_number }}
path: 'pylon-core/build/libs/pylon-core-${{ inputs.version || github.run_number }}.jar'
name: rebar-${{ inputs.version || github.run_number }}
path: 'rebar/build/libs/rebar-${{ inputs.version || github.run_number }}.jar'

dependency-submission:
needs: [ build ]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Download Pylon
- name: Download Rebar
uses: actions/[email protected]
with:
name: pylon-core-${{ github.ref_name }}
name: rebar-${{ github.ref_name }}

- name: Create Release
uses: marvinpinto/action-automatic-releases@latest
Expand All @@ -28,4 +28,4 @@ jobs:
prerelease: false
automatic_release_tag: ${{ github.ref_name }}
title: Release ${{ github.ref_name }}
files: pylon-core-*.jar
files: rebar-*.jar
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## What is Pylon?
Pylon is an upcoming Minecraft Java plugin that will hugely expand vanilla gameplay with new content, including electric machines, huge multiblocks, a fully-fledged fluid system, a complex smelting system, extensive automation options and much, an (actually good) research system, and much more. It is intended to supersede Slimefun.
## What is Rebar?
Rebar is an upcoming Minecraft Java plugin that will hugely expand vanilla gameplay with new content, including electric machines, huge multiblocks, a fully-fledged fluid system, a complex smelting system, extensive automation options and much, an (actually good) research system, and much more. It is intended to supersede Slimefun.

Pylon uses an addon system, meaning anyone can add content to Pylon by writing an addon for it! It also comes with a number of really useful features, such as:
Rebar uses an addon system, meaning anyone can add content to Rebar by writing an addon for it! It also comes with a number of really useful features, such as:
- First-class translation support, meaning each player can select their own language.
- Extensive configuration options, including per-machine configuration.
- An intuitive and user-friendly guide to help players figure out the plugin.
Expand All @@ -13,7 +13,7 @@ Visit our website: https://pylonmc.github.io/
## Warning
PYLON IS CURRENTLY EXPERIMENTAL. ONLY RUN IT ON A TEST SERVER THAT YOU ARE WILLING TO DELETE. THE NEXT PYLON VERSION WILL PROBABLY NOT BE COMPATIBLE WITH THE PREVIOUS ONE. IF YOU INSTALL PYLON SOMEWHERE YOU SHOULDN'T AND END UP LOSING DATA, WE WILL POINT AND LAUGH AT YOU.

## Pylon in pictures
## Rebar in pictures
<img width="250" alt="using-smeltery" src="https://github.com/user-attachments/assets/b8a7ba3c-9103-46a5-ab43-f31de08dd492" />
<img width="250" alt="using-magic-altar" src="https://github.com/user-attachments/assets/fd1d4ed9-3f1e-491a-ac73-2be9bb172e53" />
<img width="250" alt="using-grindstone-turner" src="https://github.com/user-attachments/assets/ee947130-ce57-4af0-a5f9-b2eaf0480036" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement

class PylonDokkaPlugin : DokkaPlugin() {
class RebarDokkaPlugin : DokkaPlugin() {

val hideInternalApi by extending {
plugin<DokkaBase>().preMergeDocumentableTransformer providing ::HideInternalApiTransformer
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.github.pylonmc.dokka.PylonDokkaPlugin
io.github.pylonmc.dokka.RebarDokkaPlugin
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usePylonDokka=false
useRebarDokka=false
minecraft.version=1.21.11
2 changes: 1 addition & 1 deletion nms/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val minecraftVersion = property("minecraft.version").toString()

dependencies {
paperweight.paperDevBundle("$minecraftVersion-R0.1-SNAPSHOT")
compileOnly(project(":pylon-core"))
compileOnly(project(":rebar"))
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@file:Suppress("UnstableApiUsage")

package io.github.pylonmc.pylon.core.i18n.packet
package io.github.pylonmc.rebar.i18n.packet

import io.github.pylonmc.pylon.core.PylonCore
import io.github.pylonmc.pylon.core.i18n.PlayerTranslationHandler
import io.github.pylonmc.pylon.core.item.PylonItem
import io.github.pylonmc.pylon.core.util.editData
import io.github.pylonmc.rebar.Rebar
import io.github.pylonmc.rebar.i18n.PlayerTranslationHandler
import io.github.pylonmc.rebar.item.RebarItem
import io.github.pylonmc.rebar.util.editData
import io.netty.channel.ChannelDuplexHandler
import io.netty.channel.ChannelHandlerContext
import io.netty.channel.ChannelPromise
Expand Down Expand Up @@ -201,7 +201,7 @@ class PlayerPacketHandler(private val player: ServerPlayer, private val handler:
} catch (e: Throwable) {
// Log the error nicely instead of kicking the player off
// and causing two days of headache. True story.
PylonCore.logger.log(
Rebar.logger.log(
Level.SEVERE,
"An error occurred while handling item translations",
e
Expand All @@ -213,15 +213,15 @@ class PlayerPacketHandler(private val player: ServerPlayer, private val handler:
private fun reset(stack: ItemStack): ItemStack {
if (stack.isEmpty) return stack
val bukkitStack = CraftItemStack.asCraftMirror(stack)
val item = PylonItem.fromStack(bukkitStack) ?: return stack
val item = RebarItem.fromStack(bukkitStack) ?: return stack
val prototype = item.schema.getItemStack()
prototype.copyDataFrom(bukkitStack) { it != DataComponentTypes.ITEM_NAME && it != DataComponentTypes.LORE }
prototype.amount = bukkitStack.amount
val translatedPrototype = prototype.clone()
try {
handler.handleItem(translatedPrototype)
} catch (e: Throwable) {
PylonCore.logger.log(
Rebar.logger.log(
Level.SEVERE,
"An error occurred while handling item translations",
e
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.pylonmc.pylon.core.nms
package io.github.pylonmc.rebar.nms

import com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent
import com.github.shynixn.mccoroutine.bukkit.asyncDispatcher
import com.github.shynixn.mccoroutine.bukkit.launch
import io.github.pylonmc.pylon.core.PylonCore
import io.github.pylonmc.pylon.core.i18n.PlayerTranslationHandler
import io.github.pylonmc.pylon.core.i18n.packet.PlayerPacketHandler
import io.github.pylonmc.pylon.core.nms.recipe.HandlerRecipeBookClick
import io.github.pylonmc.rebar.Rebar
import io.github.pylonmc.rebar.i18n.PlayerTranslationHandler
import io.github.pylonmc.rebar.i18n.packet.PlayerPacketHandler
import io.github.pylonmc.rebar.nms.recipe.HandlerRecipeBookClick
import io.papermc.paper.adventure.PaperAdventure
import net.kyori.adventure.text.Component
import net.minecraft.core.registries.Registries
Expand Down Expand Up @@ -112,7 +112,7 @@ object NmsAccessorImpl : NmsAccessor {
))
.orElse(null) ?: return

val postPlaceAction = HandlerRecipeBookClick(serverPlayer).handlePylonItemPlacement(
val postPlaceAction = HandlerRecipeBookClick(serverPlayer).handleRebarItemPlacement(
menu,
event.isMakeAll,
recipeHolder,
Expand All @@ -124,7 +124,7 @@ object NmsAccessorImpl : NmsAccessor {
event.isCancelled = true
if (postPlaceAction != PostPlaceAction.PLACE_GHOST_RECIPE || displayRecipes.isEmpty()) return

PylonCore.javaPlugin.launch(PylonCore.asyncDispatcher) {
Rebar.javaPlugin.launch(Rebar.asyncDispatcher) {
val max = displayRecipes.size
for (i in 0..<max) {
serverPlayer.connection.send(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.pylonmc.pylon.core.nms.recipe
package io.github.pylonmc.rebar.nms.recipe

import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
Expand All @@ -14,9 +14,9 @@ class HandlerRecipeBookClick(val player: ServerPlayer) {

/**
* Mimics AbstractCraftingMenu#handlePlacement, but instead we are using our own
* PylonServerPlaceRecipe#placeRecipe to handle the crafting, in order to handle pylon items
* RebarServerPlaceRecipe#placeRecipe to handle the crafting, in order to handle Rebar items
*/
fun handlePylonItemPlacement(
fun handleRebarItemPlacement(
menu: AbstractCraftingMenu,
useMaxItems: Boolean,
recipe: RecipeHolder<*>?,
Expand All @@ -30,7 +30,7 @@ class HandlerRecipeBookClick(val player: ServerPlayer) {
var postPlaceAction: RecipeBookMenu.PostPlaceAction
try {
val inputGridSlots = menu.inputGridSlots
postPlaceAction = PylonServerPlaceRecipe.placeRecipe(
postPlaceAction = RebarServerPlaceRecipe.placeRecipe(
menu,
player,
inputGridSlots,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.pylonmc.pylon.core.nms.recipe
package io.github.pylonmc.rebar.nms.recipe

import io.github.pylonmc.pylon.core.item.PylonItem
import io.github.pylonmc.pylon.core.nms.recipe.util.StackedItemContentsWrapper
import io.github.pylonmc.pylon.core.nms.recipe.util.accountStackPylon
import io.github.pylonmc.rebar.item.RebarItem
import io.github.pylonmc.rebar.nms.recipe.util.StackedItemContentsWrapper
import io.github.pylonmc.rebar.nms.recipe.util.accountStackRebar
import io.papermc.paper.inventory.recipe.ItemOrExact
import net.minecraft.recipebook.PlaceRecipeHelper
import net.minecraft.recipebook.ServerPlaceRecipe
Expand All @@ -21,12 +21,12 @@ import java.lang.invoke.MethodType
import kotlin.math.min

/**
* Handling pylon item placing and accounting, delegates most of the stuff to
* Handling Rebar item placing and accounting, delegates most of the stuff to
* nms's ServerPlaceRecipe class, tries to match the method signatures and implements
* ServerPlaceRecipe#CraftingMenuAccess as we don't need an anonymous object as we are
* only going to change that specific case
*/
class PylonServerPlaceRecipe private constructor(
class RebarServerPlaceRecipe private constructor(
private val menu: AbstractCraftingMenu,
private val player: ServerPlayer,
private val inputGridSlots: MutableList<Slot>
Expand All @@ -52,7 +52,7 @@ class PylonServerPlaceRecipe private constructor(

override fun fillCraftSlotsStackedContents(stackedItemContents: StackedItemContents) {
for (stack in menu.craftSlots.contents) {
stackedItemContents.accountStackPylon(stack)
stackedItemContents.accountStackRebar(stack)
}
}

Expand Down Expand Up @@ -165,7 +165,7 @@ class PylonServerPlaceRecipe private constructor(
}

/**
* Behave like normal, however skip pylon items from material matches
* Behave like normal, however skip Rebar items from material matches
*/
fun findSlotMatchingCraftingIngredient(items: List<ItemStack>, item: ItemOrExact, stack: ItemStack): Int {
for (i in items.indices) {
Expand All @@ -176,7 +176,7 @@ class PylonServerPlaceRecipe private constructor(

if (item is ItemOrExact.Item) {
if (!Inventory.isUsableForCrafting(itemStack)) continue
if (PylonItem.isPylonItem(itemStack.bukkitStack)) continue // skip our pylon items
if (RebarItem.isRebarItem(itemStack.bukkitStack)) continue // skip our Rebar items
}

if (stack.isEmpty || ItemStack.isSameItemSameComponents(stack, itemStack)) {
Expand Down Expand Up @@ -208,9 +208,9 @@ class PylonServerPlaceRecipe private constructor(
Void.TYPE,
ServerPlaceRecipe.CraftingMenuAccess::class.java,
Inventory::class.java,
Boolean::class.javaPrimitiveType, // boolean
Integer::class.javaPrimitiveType, // int
Integer::class.javaPrimitiveType, // int
Boolean::class.javaPrimitiveType,
Integer::class.javaPrimitiveType,
Integer::class.javaPrimitiveType,
List::class.java,
List::class.java
)
Expand All @@ -225,7 +225,7 @@ class PylonServerPlaceRecipe private constructor(
recipe: RecipeHolder<CraftingRecipe>,
useMaxItems: Boolean
): RecipeBookMenu.PostPlaceAction {
val serverPlaceRecipe = PylonServerPlaceRecipe(
val serverPlaceRecipe = RebarServerPlaceRecipe(
menu,
player,
inputGridSlots
Expand All @@ -249,7 +249,7 @@ class PylonServerPlaceRecipe private constructor(
stackedItemContents.initializeExtras(recipe.value(), null)

for (itemStack in player.inventory) {
stackedItemContents.accountStackPylon(itemStack)
stackedItemContents.accountStackRebar(itemStack)
}

serverPlaceRecipe.fillCraftSlotsStackedContents(stackedItemContents)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.pylonmc.pylon.core.nms.recipe.util
package io.github.pylonmc.rebar.nms.recipe.util

import io.github.pylonmc.pylon.core.item.PylonItem
import io.github.pylonmc.pylon.core.nms.recipe.util.StackedItemContentsWrapper.rawGetter
import io.github.pylonmc.rebar.item.RebarItem
import io.github.pylonmc.rebar.nms.recipe.util.StackedItemContentsWrapper.rawGetter
import io.papermc.paper.inventory.recipe.ItemOrExact
import net.minecraft.world.entity.player.StackedContents
import net.minecraft.world.entity.player.StackedItemContents
Expand All @@ -27,20 +27,20 @@ fun StackedItemContents.getRaw(): StackedContents<ItemOrExact> = rawGetter.invok

/**
*
* Behaves like the StackedItemContents#accountStack, however for pylon items we instead
* Behaves like the StackedItemContents#accountStack, however for Rebar items we instead
* account them as ItemOrExact#Exact when added to the StackedContents that handles crafting,
* so that only exact picks, and not material pick, will show up as valid
*
* @param stack stack to add
* @param maxStackSize max stack size of the itemstack, by default obtained with DataComponents#MAX_STACK_SIZE
*/
fun StackedItemContents.accountStackPylon(stack: ItemStack, maxStackSize: Int = stack.maxStackSize) {
fun StackedItemContents.accountStackRebar(stack: ItemStack, maxStackSize: Int = stack.maxStackSize) {
if (stack.isEmpty) return

val min = min(maxStackSize, stack.count)

// Determine if this is a Pylon item
if (PylonItem.isPylonItem(stack.bukkitStack)) {
// Determine if this is a Rebar item
if (RebarItem.isRebarItem(stack.bukkitStack)) {
val r = ItemOrExact.Exact(stack.copy())
this.getRaw().account(r, min)
return
Expand Down
Loading
Loading