Skip to content

Commit

Permalink
refactor: minor tweak and set furniture customName to prevent geary r…
Browse files Browse the repository at this point in the history
…emoval
  • Loading branch information
Boy0000 committed Feb 7, 2024
1 parent 9c95fd7 commit 035c5a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=0.9
idofrontVersion=0.21.11
idofrontVersion=0.21.12
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object FurnitureHelpers {
}

//TODO Fix seat breaking below 0.0 offset and remove max() check here
fun spawnFurnitureSeat(furniture: ItemDisplay, yaw: Float, height: Double = 0.0, location: Location) =
fun spawnFurnitureSeat(furniture: ItemDisplay, location: Location, yaw: Float, height: Double = 0.0) =
location.toBlockCenterLocation().apply { y += max(0.0, height) }.spawn<ArmorStand> {
isVisible = false
isMarker = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.spawning.spawn
import com.mineinabyss.idofront.typealiases.BukkitEntity
import net.kyori.adventure.text.Component
import org.bukkit.entity.ItemDisplay

class AttemptSpawnFurnitureSystem : GearyListener() {
Expand Down Expand Up @@ -41,6 +42,7 @@ class AttemptSpawnFurnitureSystem : GearyListener() {

color?.let { target.entity.setPersisting<BlockyFurniture.Color>(it) }
target.entity.set<BukkitEntity>(this)
customName(Component.empty())
} ?: return
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class SetSeatOnFurnitureSystem : GearyListener() {
Bukkit.getScheduler().scheduleSyncDelayedTask(blocky.plugin, {
if (furniture.collisionHitbox.isNotEmpty()) {
FurnitureHelpers.collisionHitboxLocations(yaw, display.location, furniture.collisionHitbox)
.forEach { loc -> FurnitureHelpers.spawnFurnitureSeat(display, yaw - 180, seat.heightOffset, loc) }
} else FurnitureHelpers.spawnFurnitureSeat(display, yaw, seat.heightOffset, display.location)
.forEach { loc -> FurnitureHelpers.spawnFurnitureSeat(display, loc, yaw - 180, seat.heightOffset) }
} else FurnitureHelpers.spawnFurnitureSeat(display, display.location, yaw, seat.heightOffset)
}, 1L)
}
}

0 comments on commit 035c5a7

Please sign in to comment.