Skip to content

Commit

Permalink
1.18.2 port sync
Browse files Browse the repository at this point in the history
  • Loading branch information
HollowHorizon committed Feb 6, 2024
1 parent 34bf689 commit bfe527f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dev.ftb.mods.ftbteams.data.Team
import dev.ftb.mods.ftbteams.event.TeamEvent
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TranslatableComponent
import net.minecraft.server.level.ServerPlayer
import net.minecraft.stats.Stats
import net.minecraftforge.event.TickEvent.ServerTickEvent
Expand Down Expand Up @@ -65,9 +66,9 @@ object StoryHandler {
it.value.isEnded
} catch (exception: Exception) {
team.onlineMembers.forEach { player ->
player.sendSystemMessage(Component.translatable("hollowengine.executing_error", it.key))
player.sendSystemMessage("${exception.message}".mcText)
player.sendSystemMessage("hollowengine.check_logs".mcTranslate)
player.sendMessage(TranslatableComponent("hollowengine.executing_error", it.key), player.uuid)
player.sendMessage("${exception.message}".mcText, player.uuid)
player.sendMessage("hollowengine.check_logs".mcTranslate, player.uuid)
}

StoryLogger.LOGGER.error("(HollowEngine) Error while executing event \"${it.key}\"", exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ fun runScript(server: MinecraftServer, team: Team, file: File, isCommand: Boolea
returnValue is ResultValue.Error -> {
val error = returnValue.error
team.onlineMembers.forEach {
it.sendSystemMessage(Component.translatable("hollowengine.executing_error", file.toReadablePath()))
it.sendSystemMessage("${error.message}".mcText)
it.sendSystemMessage("hollowengine.check_logs".mcTranslate)
it.sendMessage(TranslatableComponent("hollowengine.executing_error", file.toReadablePath()), it.uuid)
it.sendMessage("${error.message}".mcText, it.uuid)
it.sendMessage("hollowengine.check_logs".mcTranslate, it.uuid)
}

StoryLogger.LOGGER.error("(HollowEngine) Error while executing event \"${file.toReadablePath()}\"", error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dev.ftb.mods.ftbteams.data.Team
import net.minecraft.core.BlockPos
import net.minecraft.nbt.ListTag
import net.minecraft.nbt.StringTag
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.TextComponent
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.util.Mth
Expand Down Expand Up @@ -51,7 +51,6 @@ import ru.hollowhorizon.hollowengine.common.scripting.story.nodes.util.Animation
import ru.hollowhorizon.hollowengine.common.scripting.story.nodes.util.NpcContainer
import ru.hollowhorizon.hollowengine.common.scripting.story.nodes.util.TeamHelper
import ru.hollowhorizon.hollowengine.common.scripting.story.nodes.util.TeleportContainer
import ru.hollowhorizon.hollowengine.common.util.getStructure
import ru.hollowhorizon.hollowengine.cutscenes.replay.Replay
import ru.hollowhorizon.hollowengine.cutscenes.replay.ReplayPlayer
import java.util.function.Function
Expand Down Expand Up @@ -174,20 +173,6 @@ interface IContextBuilder {
Vec3(pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble())
}

fun NPCProperty.moveToStructure(structureName: () -> String, offset: () -> BlockPos = { BlockPos.ZERO }) =
+NpcMoveToBlockNode(this) {
val npc = this@moveToStructure()
val level = npc.level as ServerLevel
val structure = level.getStructure(structureName(), npc.blockPosition()).pos
val offsetPos = offset()

Vec3(
structure.x.toDouble() + offsetPos.x,
structure.y.toDouble() + offsetPos.y,
structure.z.toDouble() + offsetPos.z
)
}

fun ProgressManager.addMessage(message: () -> String) = +SimpleNode {
val list = this.manager.team.extraData.getList("hollowengine_progress_tasks", 8)
list += StringTag.valueOf(message())
Expand Down Expand Up @@ -219,7 +204,7 @@ interface IContextBuilder {
infix fun NPCProperty.lookAtPos(target: () -> Vec3) = +NpcLookToBlockNode(this, target)

fun NPCProperty.lookAtEntityType(entity: () -> String) {
val entityType = ForgeRegistries.ENTITY_TYPES.getValue(entity().rl)!!
val entityType = ForgeRegistries.ENTITIES.getValue(entity().rl)!!

lookAtEntity {
val npc = this()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ fun IContextBuilder.playSound(sound: SoundContainer.() -> Unit) = +SimpleNode {
SoundSource.MASTER,
container.pos ?: it.position(),
container.volume,
container.pitch,
it.random.nextLong()
container.pitch
)
)
}
Expand Down

0 comments on commit bfe527f

Please sign in to comment.