Skip to content

Commit c78ed0f

Browse files
committed
🤷
1 parent 72a85ab commit c78ed0f

File tree

11 files changed

+68
-63
lines changed

11 files changed

+68
-63
lines changed

‎build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id 'fabric-loom' version '0.10.64'
2+
id 'fabric-loom' version '0.12-SNAPSHOT'
33
id 'maven-publish'
44
id 'eclipse'
55
id 'idea'
66
id 'java'
7-
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
7+
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
88
}
99

1010
sourceCompatibility = JavaVersion.VERSION_16
@@ -37,8 +37,12 @@ dependencies {
3737
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
3838
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
3939
modImplementation "dev.emi:trinkets:${project.trinkets_version}"
40-
modImplementation "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${project.cardinal_components_version}"
41-
include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${project.cardinal_components_version}"
40+
41+
// modImplementation "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${project.cardinal_components_version}"
42+
// include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${project.cardinal_components_version}"
43+
44+
modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}"
45+
include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}"
4246

4347
[
4448
"com.teamwizardry.librarianlib:mosaic:${liblib_version}",

‎gradle.properties

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
org.gradle.jvmargs=-Xmx3G
22
org.gradle.daemon=false
33

4-
minecraft_version=1.17.1
5-
yarn_mappings=1.17.1+build.65
6-
loader_version=0.12.11
4+
minecraft_version=1.19.2
5+
yarn_mappings=1.19.2+build.28
6+
loader_version=0.14.17
77

8-
mod_version=2.0.0-alpha.3
8+
9+
mod_version=2.0.0-alpha.3-1.19.2
910
archivesBaseName=hooked
1011
release.curseforge.type=alpha
1112
release.modrinth.type=ALPHA
1213

13-
fabric_version=0.45.0+1.17
14-
fabric_kotlin_version=1.7.1+kotlin.1.6.10
15-
liblib_version=5.0.0-alpha.11
16-
trinkets_version=3.0.4
17-
cardinal_components_version=3.0.1
14+
15+
#Fabric api
16+
fabric_version=0.75.1+1.19.2
17+
fabric_kotlin_version=1.9.1+kotlin.1.8.10
18+
liblib_version=1.17-quilt-SNAPSHOT
19+
trinkets_version=3.4.0
20+
cardinal_components_version=5.0.2
1821

1922
mod.dependencies.fabricloader=>=0.11.6
20-
mod.dependencies.minecraft=1.17.x
21-
mod.dependencies.flk=>=1.7.1+kotlin.1.6.10
22-
mod.dependencies.trinkets=>=3.0.4
23+
mod.dependencies.minecraft=1.19.2
24+
mod.dependencies.flk=>=1.9.1+kotlin.1.8.10
25+
mod.dependencies.trinkets=>=3.4.0
2326

2427
mod.modmenu.hooked_name=Hooked

‎src/main/kotlin/dev/thecodewarrior/hooked/Hooked.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ import net.fabricmc.api.ModInitializer
2121
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
2222
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper
2323
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking
24+
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents
2425
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder
2526
import net.fabricmc.fabric.api.event.registry.RegistryAttribute
2627
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory
2728
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry
2829
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs
2930
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking
3031
import net.fabricmc.fabric.api.resource.ResourceManagerHelper
31-
import net.fabricmc.fabric.api.tag.TagFactory
3232
import net.minecraft.client.gui.screen.Screen
3333
import net.minecraft.entity.player.PlayerEntity
3434
import net.minecraft.network.PacketByteBuf
@@ -37,6 +37,7 @@ import net.minecraft.server.network.ServerPlayerEntity
3737
import net.minecraft.sound.SoundEvent
3838
import net.minecraft.stat.StatFormatter
3939
import net.minecraft.stat.Stats
40+
import net.minecraft.tag.TagKey
4041
import net.minecraft.util.Identifier
4142
import net.minecraft.util.registry.DefaultedRegistry
4243
import net.minecraft.util.registry.Registry
@@ -59,7 +60,9 @@ object Hooked {
5960
registerStats()
6061
registerSounds()
6162
registerNetworking()
62-
ServerHookProcessor.registerEvents()
63+
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register { player, _, _ ->
64+
player.hookData().syncStatus.forceFullSyncToClient = true
65+
}
6366
Rules // static initializer registers the gamerule
6467
Tags // static initializer registers tags
6568
}
@@ -189,8 +192,8 @@ object Hooked {
189192
}
190193

191194
object Tags {
192-
val SOLID_BLOCKS = TagFactory.BLOCK.create(Identifier("hooked:solid_blocks"))
193-
val IGNORE_BLOCKS = TagFactory.BLOCK.create(Identifier("hooked:ignore_blocks"))
195+
val SOLID_BLOCKS = TagKey.of(Registry.BLOCK_KEY, Identifier("hooked:solid_blocks"))
196+
val IGNORE_BLOCKS = TagKey.of(Registry.BLOCK_KEY, Identifier("hooked:ignore_blocks"))
194197
}
195198

196199
object Components : EntityComponentInitializer {

‎src/main/kotlin/dev/thecodewarrior/hooked/client/Keybinds.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ object Keybinds {
2020
var doubleJumpTimer = 0
2121

2222
fun tick(client: MinecraftClient) {
23-
val jumpDown = Client.minecraft.options.keyJump.isPressed
23+
val jumpDown = Client.minecraft.options.jumpKey.isPressed
2424
val jumpPressed = jumpDown && !jumpWasDown
2525
jumpWasDown = jumpDown
2626

2727
val player = Client.player ?: return
2828
val data = player.hookData()
2929

3030
if(data.type != HookType.NONE) {
31-
val sneakPressed = Client.minecraft.options.keySneak.isPressed
31+
val sneakPressed = Client.minecraft.options.sneakKey.isPressed
3232
if (FIRE.wasPressed()) {
3333
ClientHookProcessor.fireHook(player, data, player.eyePos, player.pitch, player.yaw, sneakPressed)
3434
while(FIRE.wasPressed()) { /* consume excess keypresses */ }

‎src/main/kotlin/dev/thecodewarrior/hooked/client/renderer/SimpleHookRenderer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ abstract class SimpleHookRenderer<C: HookPlayerController>(val type: HookType):
219219

220220
private fun loadModel(manager: ResourceManager): ReloadData {
221221
var model = try {
222-
manager.getResource(modelLocation).use {
223-
ObjReader.read(it.inputStream)
222+
manager.getResource(modelLocation).get().inputStream.use {
223+
ObjReader.read(it)
224224
}
225225
} catch (e: IOException) {
226226
Objs.create()

‎src/main/kotlin/dev/thecodewarrior/hooked/hook/HookPlayerController.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ abstract class HookPlayerController {
5656
request.withBlockMode(Raycaster.BlockMode.COLLISION)
5757
.withBlockOverride { state, _, _ ->
5858
when {
59-
Hooked.Tags.SOLID_BLOCKS.contains(state.block) -> VoxelShapes.fullCube()
60-
Hooked.Tags.IGNORE_BLOCKS.contains(state.block) -> VoxelShapes.empty()
59+
state.isIn(Hooked.Tags.SOLID_BLOCKS) -> VoxelShapes.fullCube()
60+
state.isIn(Hooked.Tags.IGNORE_BLOCKS) -> VoxelShapes.empty()
6161
else -> null
6262
}
6363
}

‎src/main/kotlin/dev/thecodewarrior/hooked/hook/ServerHookProcessor.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ object ServerHookProcessor: CommonHookProcessor() {
6363
}
6464
}
6565

66-
fun registerEvents() {
67-
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register { player, _, _ ->
68-
player.hookData().syncStatus.forceFullSyncToClient = true
69-
}
70-
}
66+
// fun registerEvents() {
67+
// ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register { player, _, _ ->
68+
// player.hookData().syncStatus.forceFullSyncToClient = true
69+
// }
70+
// }
7171

7272
fun fireHook(
7373
player: ServerPlayerEntity,

‎src/main/kotlin/dev/thecodewarrior/hooked/item/HookItem.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import dev.thecodewarrior.hooked.capability.IHookItem
55
import dev.thecodewarrior.hooked.hook.HookType
66
import net.minecraft.client.item.TooltipContext
77
import net.minecraft.item.ItemStack
8-
import net.minecraft.text.KeybindText
98
import net.minecraft.text.Text
10-
import net.minecraft.text.TranslatableText
9+
import net.minecraft.text.TranslatableTextContent
1110
import net.minecraft.util.Formatting
1211
import net.minecraft.world.World
1312

@@ -18,15 +17,15 @@ class HookItem(settings: Settings, override val hookType: HookType): TrinketItem
1817
tooltip: MutableList<Text>,
1918
context: TooltipContext
2019
) {
21-
tooltip.add(TranslatableText("$translationKey.tip"))
20+
tooltip.add(Text.translatable("$translationKey.tip"))
2221
if (hasShiftDown()) {
23-
val fireKeyName = KeybindText("key.hooked.fire").formatted(Formatting.BOLD)
22+
val fireKeyName = Text.keybind("key.hooked.fire").formatted(Formatting.BOLD)
2423
tooltip.addAll(hookType.controlLangKeys.map { key ->
25-
TranslatableText(key, fireKeyName).formatted(Formatting.GRAY)
24+
Text.translatable(key, fireKeyName).formatted(Formatting.GRAY)
2625
})
2726
} else {
2827
tooltip.add(
29-
TranslatableText("hooked.controller.universal.controls.collapsed").formatted(Formatting.GRAY)
28+
Text.translatable("hooked.controller.universal.controls.collapsed").formatted(Formatting.GRAY)
3029
)
3130
}
3231
super.appendTooltip(stack, world, tooltip, context)

‎src/main/kotlin/dev/thecodewarrior/hooked/util/ClientUtils.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ inline fun VertexConsumer.vertex(stack: MatrixStack, x: Number, y: Number, z: Nu
2525
val xf = x.toFloat()
2626
val yf = y.toFloat()
2727
val zf = z.toFloat()
28-
val matrix = mixinCast<IMatrix4f>(stack.peek().model)
28+
val matrix = mixinCast<IMatrix4f>(stack.peek().positionMatrix)
2929
return this.vertex(
3030
matrix.transformX(xf, yf, zf).toDouble(),
3131
matrix.transformY(xf, yf, zf).toDouble(),
@@ -37,7 +37,7 @@ fun VertexConsumer.vertex(stack: MatrixStack, v: Vec3d): VertexConsumer {
3737
val xf = v.x.toFloat()
3838
val yf = v.y.toFloat()
3939
val zf = v.z.toFloat()
40-
val matrix = mixinCast<IMatrix4f>(stack.peek().model)
40+
val matrix = mixinCast<IMatrix4f>(stack.peek().positionMatrix)
4141
return this.vertex(
4242
matrix.transformX(xf, yf, zf).toDouble(),
4343
matrix.transformY(xf, yf, zf).toDouble(),
@@ -50,7 +50,7 @@ inline fun VertexConsumer.normal(stack: MatrixStack, x: Number, y: Number, z: Nu
5050
val xf = x.toFloat()
5151
val yf = y.toFloat()
5252
val zf = z.toFloat()
53-
val matrix = mixinCast<IMatrix3f>(stack.peek().normal)
53+
val matrix = mixinCast<IMatrix3f>(stack.peek().normalMatrix)
5454
return this.normal(
5555
matrix.transformX(xf, yf, zf),
5656
matrix.transformY(xf, yf, zf),
@@ -63,7 +63,7 @@ fun VertexConsumer.normal(stack: MatrixStack, v: Vec3d): VertexConsumer {
6363
val xf = v.x.toFloat()
6464
val yf = v.y.toFloat()
6565
val zf = v.z.toFloat()
66-
val matrix = mixinCast<IMatrix3f>(stack.peek().normal)
66+
val matrix = mixinCast<IMatrix3f>(stack.peek().normalMatrix)
6767
return this.normal(
6868
matrix.transformX(xf, yf, zf),
6969
matrix.transformY(xf, yf, zf),

‎src/main/kotlin/dev/thecodewarrior/hooked/util/JumpHeightUtil.kt

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com.teamwizardry.librarianlib.core.util.vec
44
import net.minecraft.block.ShapeContext
55
import net.minecraft.entity.Entity
66
import net.minecraft.entity.player.PlayerEntity
7-
import net.minecraft.util.collection.ReusableStream
87
import net.minecraft.util.function.BooleanBiFunction
98
import net.minecraft.util.math.Box
109
import net.minecraft.util.math.Vec3d
@@ -28,23 +27,21 @@ object JumpHeightUtil {
2827
movement: Vec3d,
2928
maxHeight: Double
3029
): Vec3d {
31-
val shapeContext = ShapeContext.of(player)
3230
val voxelShape: VoxelShape = player.world.worldBorder.asVoxelShape()
33-
val stream = if (VoxelShapes.matchesAnywhere(
31+
val list: List<VoxelShape> = if (VoxelShapes.matchesAnywhere(
3432
voxelShape,
3533
VoxelShapes.cuboid(box.contract(1.0E-7)),
3634
BooleanBiFunction.AND
3735
)
38-
) Stream.empty() else Stream.of(voxelShape)
39-
val stream2: Stream<VoxelShape> = player.world.getEntityCollisions(player, box.stretch(movement), { true })
40-
val reusableStream: ReusableStream<VoxelShape> = ReusableStream(Stream.concat(stream2, stream))
36+
) emptyList() else listOf(voxelShape)
37+
val list2: List<VoxelShape> = player.world.getEntityCollisions(player, box.stretch(movement))
38+
val finalList: List<VoxelShape> = list + list2
4139
val horizontal = if (movement.lengthSquared() == 0.0) movement else Entity.adjustMovementForCollisions(
4240
player,
4341
movement,
4442
box,
4543
player.world,
46-
shapeContext,
47-
reusableStream
44+
finalList
4845
)
4946
val collidedX = movement.x != horizontal.x
5047
val collidedZ = movement.z != horizontal.z
@@ -54,25 +51,22 @@ object JumpHeightUtil {
5451
Vec3d(movement.x, maxHeight, movement.z),
5552
box,
5653
player.world,
57-
shapeContext,
58-
reusableStream
54+
finalList
5955
)
6056
val ceiling = Entity.adjustMovementForCollisions(
6157
player,
6258
Vec3d(0.0, maxHeight, 0.0),
6359
box.stretch(movement.x, 0.0, movement.z),
6460
player.world,
65-
shapeContext,
66-
reusableStream
61+
finalList
6762
)
6863
if (ceiling.y < maxHeight) {
6964
val ceilingHorizontal = Entity.adjustMovementForCollisions(
7065
player,
7166
Vec3d(movement.x, 0.0, movement.z),
7267
box.offset(ceiling),
7368
player.world,
74-
shapeContext,
75-
reusableStream
69+
finalList
7670
).add(ceiling)
7771
if (ceilingHorizontal.horizontalLengthSquared() > rising.horizontalLengthSquared()) {
7872
rising = ceilingHorizontal
@@ -85,8 +79,7 @@ object JumpHeightUtil {
8579
Vec3d(0.0, -rising.y + movement.y, 0.0),
8680
box.offset(rising),
8781
player.world,
88-
shapeContext,
89-
reusableStream
82+
finalList
9083
)
9184
)
9285
}

0 commit comments

Comments
 (0)