Skip to content

Commit d22843f

Browse files
committed
Merge branch 'master' into allow-disabling-items
2 parents c644458 + f500194 commit d22843f

4 files changed

Lines changed: 7 additions & 22 deletions

File tree

pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core/block/BlockListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal object BlockListener : Listener {
5858
val relative = event.blockPlaced.position - event.blockAgainst.position
5959
val blockFace = BlockFace.entries.find { it.modX == relative.x && it.modY == relative.y && it.modZ == relative.z }
6060
?: BlockFace.SELF
61-
val pylonBlock = pylonItem.place(BlockCreateContext.PlayerPlace(player, item, event.blockPlaced, blockFace))
61+
val pylonBlock = pylonItem.place(BlockCreateContext.PlayerPlace(player, item, event))
6262

6363
if (pylonBlock == null) {
6464
event.isCancelled = true
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.github.pylonmc.pylon.core.block.context
22

33
import org.bukkit.block.Block
4-
import org.bukkit.block.BlockFace
54
import org.bukkit.entity.Player
5+
import org.bukkit.event.block.BlockPlaceEvent
66
import org.bukkit.inventory.ItemStack
77

88
interface BlockCreateContext {
@@ -12,9 +12,10 @@ interface BlockCreateContext {
1212
data class PlayerPlace(
1313
val player: Player,
1414
val item: ItemStack,
15-
override val block: Block,
16-
val clickedFace: BlockFace
17-
) : BlockCreateContext
15+
val event: BlockPlaceEvent
16+
) : BlockCreateContext {
17+
override val block = event.blockPlaced
18+
}
1819

1920
data class Default(override val block: Block) : BlockCreateContext
2021
}

pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core/util/ItemUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ inline fun <reified T> ItemStack?.isPylonAndIsNot(): Boolean {
5555
return pylonItem != null && pylonItem !is T
5656
}
5757

58+
@JvmName("recipeChoiceFromItem")
5859
fun ItemStack.asRecipeChoice(): RecipeChoice {
5960
return if (PylonItem.isPylonItem(this)) {
6061
RecipeChoice.ExactChoice(this)

pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core/util/PylonUtils.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@ package io.github.pylonmc.pylon.core.util
44

55
import io.github.pylonmc.pylon.core.addon.PylonAddon
66
import io.github.pylonmc.pylon.core.entity.display.transform.TransformUtil.yawToCardinalDirection
7-
import net.kyori.adventure.text.Component
8-
import org.bukkit.Color
9-
import org.bukkit.Location
107
import org.bukkit.NamespacedKey
118
import org.bukkit.block.BlockFace
129
import org.bukkit.entity.Player
13-
import org.bukkit.entity.TextDisplay
1410
import org.bukkit.util.Vector
15-
import org.joml.Matrix4f
1611
import org.joml.RoundingMode
1712
import org.joml.Vector3f
1813
import org.joml.Vector3i
@@ -58,16 +53,4 @@ fun rotateToPlayerFacing(player: Player, face: BlockFace, allowVertical: Boolean
5853
vector = vector.rotateAroundNonUnitAxis(rightVector, -yawToCardinalDirection(player.eyeLocation.pitch).toDouble())
5954
}
6055
return vectorToBlockFace(vector)
61-
}
62-
63-
fun spawnUnitSquareTextDisplay(location: Location, color: Color): TextDisplay {
64-
val display = location.world!!.spawn(location, TextDisplay::class.java)
65-
display.setTransformationMatrix( // https://github.com/TheCymaera/minecraft-hologram/blob/d67eb43308df61bdfe7283c6821312cca5f9dea9/src/main/java/com/heledron/hologram/utilities/rendering/textDisplays.kt#L15
66-
Matrix4f()
67-
.translate(-0.1f + .5f, -0.5f + .5f, 0f)
68-
.scale(8.0f, 4.0f, 1f)
69-
)
70-
display.text(Component.text(" "))
71-
display.backgroundColor = color
72-
return display
7356
}

0 commit comments

Comments
 (0)