Skip to content

Commit

Permalink
Adds access to game mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
blackd committed Dec 26, 2022
1 parent 9fbb870 commit 2c93625
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook ?: throw AssertionError("unreachable")

fun gameMode() = mc().interactionManager?.currentGameMode

@Suppress("FunctionName")
fun ClientPlayerEntity.`(sendCommandMessage)`(msg: String) = sendChatMessage(msg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import net.minecraft.client.network.ClientPlayerInteractionManager
import net.minecraft.client.sound.SoundInstance
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.sound.SoundEvent
import net.minecraft.world.GameMode

typealias MinecraftClient = MinecraftClient
typealias IntegratedServer = IntegratedServer
Expand All @@ -63,6 +64,8 @@ typealias PlayerEntity = PlayerEntity

typealias SoundEvent = SoundEvent

typealias GameType = GameMode

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = Registry.BLOCK_ENTITY_TYPE.ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook ?: throw AssertionError("unreachable")

fun gameMode() = mc().interactionManager?.currentGameMode

@Suppress("FunctionName")
fun ClientPlayerEntity.`(sendCommandMessage)`(msg: String) = sendChatMessage(msg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.client.sound.SoundInstance
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.screen.ScreenHandlerFactory
import net.minecraft.sound.SoundEvent
import net.minecraft.world.GameMode

typealias MinecraftClient = MinecraftClient
typealias IntegratedServer = IntegratedServer
Expand Down Expand Up @@ -66,6 +67,8 @@ typealias ScreenHandlerFactory = ScreenHandlerFactory

typealias SoundEvent = SoundEvent

typealias GameType = GameMode

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = Registry.BLOCK_ENTITY_TYPE.ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook ?: throw AssertionError("unreachable")

fun gameMode() = mc().interactionManager?.currentGameMode

@Suppress("FunctionName")
fun ClientPlayerEntity.`(sendCommandMessage)`(msg: String) = this.networkHandler.sendCommand(msg.replaceFirst("/","")) // sendCommand(msg.replaceFirst("/",""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import net.minecraft.client.sound.SoundInstance
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.screen.ScreenHandlerFactory
import net.minecraft.sound.SoundEvent
import net.minecraft.world.GameMode

typealias MinecraftClient = MinecraftClient
typealias IntegratedServer = IntegratedServer
Expand Down Expand Up @@ -68,6 +69,8 @@ typealias ScreenHandlerFactory = ScreenHandlerFactory

typealias SoundEvent = SoundEvent

typealias GameType = GameMode

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = Registries.BLOCK_ENTITY_TYPE.ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook ?: throw AssertionError("unreachable")

fun gameMode() = mc().interactionManager?.currentGameMode

@Suppress("FunctionName")
fun ClientPlayerEntity.`(sendCommandMessage)`(msg: String) = sendCommand(msg.replaceFirst("/",""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.client.sound.SoundInstance
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.screen.ScreenHandlerFactory
import net.minecraft.sound.SoundEvent
import net.minecraft.world.GameMode

typealias MinecraftClient = MinecraftClient
typealias IntegratedServer = IntegratedServer
Expand Down Expand Up @@ -66,6 +67,8 @@ typealias ScreenHandlerFactory = ScreenHandlerFactory

typealias SoundEvent = SoundEvent

typealias GameType = GameMode

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = Registry.BLOCK_ENTITY_TYPE.ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook

fun gameMode() = mc().playerController?.currentGameType

@Suppress("FunctionName")
fun ClientPlayerEntity.`(sendCommandMessage)`(msg: String) = sendChatMessage(msg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.util.Util
import net.minecraft.util.registry.DefaultedRegistry
import net.minecraft.util.registry.Registry
import net.minecraftforge.registries.ForgeRegistries
import net.minecraft.world.GameType

typealias MinecraftClient = Minecraft
typealias IntegratedServer = IntegratedServer
Expand All @@ -64,6 +65,8 @@ typealias PlayerEntity = ClientPlayerEntity

typealias SoundEvent = SoundEvent

typealias GameType = GameType

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = ForgeRegistries.TILE_ENTITIES.keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook

fun gameMode() = mc().gameMode?.playerMode

@Suppress("FunctionName")
fun LocalPlayer.`(sendCommandMessage)`(msg: String) = chat(msg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.player.Player
import net.minecraftforge.registries.ForgeRegistries
import net.minecraft.world.level.GameType

typealias MinecraftClient = Minecraft
typealias IntegratedServer = IntegratedServer
Expand All @@ -64,6 +65,8 @@ typealias PlayerEntity = Player

typealias SoundEvent = SoundEvent

typealias GameType = GameType

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = ForgeRegistries.BLOCK_ENTITIES.keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook

fun gameMode() = mc().gameMode?.playerMode

@Suppress("FunctionName")
fun LocalPlayer.`(sendCommandMessage)`(msg: String) = this.connection.sendCommand(msg.replaceFirst("/", ""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.player.Player
import net.minecraftforge.registries.ForgeRegistries
import net.minecraft.world.level.GameType

typealias MinecraftClient = Minecraft
typealias IntegratedServer = IntegratedServer
Expand Down Expand Up @@ -68,6 +69,8 @@ typealias PlayerEntity = Player

typealias SoundEvent = SoundEvent

typealias GameType = GameType

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = ForgeRegistries.BLOCK_ENTITY_TYPES.keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ object Vanilla {

fun recipeBook() = player().recipeBook

fun gameMode() = mc().gameMode?.playerMode

@Suppress("FunctionName")
fun LocalPlayer.`(sendCommandMessage)`(msg: String) = m_242614_(msg.replaceFirst("/", ""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.player.Player
import net.minecraftforge.registries.ForgeRegistries
import net.minecraft.world.level.GameType

typealias MinecraftClient = Minecraft
typealias IntegratedServer = IntegratedServer
Expand All @@ -64,6 +65,8 @@ typealias PlayerEntity = Player

typealias SoundEvent = SoundEvent

typealias GameType = GameType

@Suppress("ObjectPropertyName", "HasPlatformType")
inline val `(REGISTRIES-BLOCK_ENTITY_TYPES-IDS)`
get() = ForgeRegistries.BLOCK_ENTITY_TYPES.keys
Expand Down

0 comments on commit 2c93625

Please sign in to comment.