You are browsing as a guest. Sign up (or log in) to start making projects!

Minecraft Challenge Mod

  • 4 Devlogs
  • 13 Total hours

Minecraft Challenge Mod with several mods for example shared damage among all players, randomizer and more.

Ship #1 Changes requested

I made a Minecraft Challenges Mod with Fabric. You have multiple challegnes such as shared damage among your friends, ice track udner you and more. Additionally you can add a randomizer to your challenge which makes it that every block drop is different from the original one. Try it out with /challenges

  • 4 devlogs
  • 13h
Try project → See source code →
Open comments for this post

2h 47m 2s logged

I finished the Mod! There were a few bugs left, where whe nyou would rejoin, the randomizer wouldnt work but i could fix it pretty easily.

I finished the Mod! There were a few bugs left, where whe nyou would rejoin, the randomizer wouldnt work but i could fix it pretty easily.

Replying to @timon

0
2
Open comments for this post

2h 34m 12s logged

I added two new challenges. one is pretty simple. Every time you jump you get a random item dropped to you. mixin into jumpFromGround, grab a random item from the registry and spawn it. (might also have been easier with just giving it to the player but it works for now. i will go into testing later if one has bugs)

the second one is the ice trail. you can sneak to toggle it on and off and a 3x3 platform of ice spawns under you wherever you walk. The ice will only replace air blocks and not existing blocks / blockentities.
getting the sneak toggle to work was annoying as to mixin into a sneak method didnt work because i couldnt find the right class. ended up using client.options.keyShift.isDown in a client tick event.

I added two new challenges. one is pretty simple. Every time you jump you get a random item dropped to you. mixin into jumpFromGround, grab a random item from the registry and spawn it. (might also have been easier with just giving it to the player but it works for now. i will go into testing later if one has bugs)

the second one is the ice trail. you can sneak to toggle it on and off and a 3x3 platform of ice spawns under you wherever you walk. The ice will only replace air blocks and not existing blocks / blockentities.
getting the sneak toggle to work was annoying as to mixin into a sneak method didnt work because i couldnt find the right class. ended up using client.options.keyShift.isDown in a client tick event.

Replying to @timon

0
3
Open comments for this post

2h 53m 16s logged

The first challegne “shared life” is done.
The core mechanic is when a player takes damage, everyone else gets the same amount. sounds simple, but it took me quiet a bit to get that right. the method i needed to use is called hurtServer in 26.x, not hurt like every tutorial says (cause of old yarn mappings like alr said in last devlog).

@Inject(method = [“hurtServer”], at = [At(“TAIL”)])
private fun onHurtServer(level: ServerLevel, source: DamageSource, amount: Float, cir: CallbackInfoReturnable) {
if (!cir.returnValue) return
if (ChallengeState.activeChallenge !is SharedLifeChallenge) return
val entity = this as? ServerPlayer ?: return
if (source.directEntity == null && source.entity == null) return
SharedLifeChallenge.onPlayerHurt(entity, amount)
}

the directEntity == null check is to prevent an infinite loop. When we deal damage to the other players, that would trigger the mixin again. Generic damage (the kind I use to pass the damage to other players) has no entity source so we can filter it out that way.

The first challegne “shared life” is done.
The core mechanic is when a player takes damage, everyone else gets the same amount. sounds simple, but it took me quiet a bit to get that right. the method i needed to use is called hurtServer in 26.x, not hurt like every tutorial says (cause of old yarn mappings like alr said in last devlog).

@Inject(method = [“hurtServer”], at = [At(“TAIL”)])
private fun onHurtServer(level: ServerLevel, source: DamageSource, amount: Float, cir: CallbackInfoReturnable) {
if (!cir.returnValue) return
if (ChallengeState.activeChallenge !is SharedLifeChallenge) return
val entity = this as? ServerPlayer ?: return
if (source.directEntity == null && source.entity == null) return
SharedLifeChallenge.onPlayerHurt(entity, amount)
}

the directEntity == null check is to prevent an infinite loop. When we deal damage to the other players, that would trigger the mixin again. Generic damage (the kind I use to pass the damage to other players) has no entity source so we can filter it out that way.

Replying to @timon

0
2
Open comments for this post

5h 7m 51s logged

I have been building a challenges mod for minecraft 26.x and the idea is pretty simple. You type /challenges, a menu opens, you pick a challenge and it changes the gameplay. First challenge I am working on is shared life, where damage shared with every player.
Getting it running was honestly kind of a pain. 26.x doesnt need yarn mappings anymore since mojang ships unobfuscated now. Which sounds great until you realize nearly every of the classes isnt the same as yarn mappings and nothing matches the (now outdated) tutorials. For example: hurt() is now hurtServer(), GuiGraphics is GuiGraphicsExtractor.
I used AI to help look stuff up which sped things up a lot but even that was not always right.
I am finished with the Menu and I started with the challenge code.

I have been building a challenges mod for minecraft 26.x and the idea is pretty simple. You type /challenges, a menu opens, you pick a challenge and it changes the gameplay. First challenge I am working on is shared life, where damage shared with every player.
Getting it running was honestly kind of a pain. 26.x doesnt need yarn mappings anymore since mojang ships unobfuscated now. Which sounds great until you realize nearly every of the classes isnt the same as yarn mappings and nothing matches the (now outdated) tutorials. For example: hurt() is now hurtServer(), GuiGraphics is GuiGraphicsExtractor.
I used AI to help look stuff up which sped things up a lot but even that was not always right.
I am finished with the Menu and I started with the challenge code.

Replying to @timon

0
2

Followers

Loading…