Skip to content

Commit

Permalink
update: update to 1.20.4 (#45)
Browse files Browse the repository at this point in the history
* update: update to 1.20.4

* fix: newItem is no longer nullable
  • Loading branch information
ChechuDEV authored Jun 3, 2024
1 parent 36c85b5 commit 47374ea
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import java.io.BufferedReader
import java.nio.file.Paths

val javaVersion = 17
val minecraftVersion = "1.19.4"
val minecraftVersion = "1.20.4"

fun runCommand(command: Array<String>) = Runtime
.getRuntime()
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/de/danielmaile/mpp/block/BlockBreakingService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket
import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action
import net.minecraft.world.effect.MobEffect
import net.minecraft.world.effect.MobEffectInstance
import net.minecraft.world.effect.MobEffects
import org.bukkit.Bukkit
import org.bukkit.GameMode
import org.bukkit.Material
Expand All @@ -48,7 +48,7 @@ import org.bukkit.inventory.meta.Damageable
import org.bukkit.potion.PotionEffectType
import kotlin.random.Random

private val MINING_FATIGUE = MobEffectInstance(MobEffect.byId(4)!!, Integer.MAX_VALUE, 255, false, false, false)
private val MINING_FATIGUE = MobEffectInstance(MobEffects.DIG_SLOWDOWN, Integer.MAX_VALUE, 255, false, false, false)

object BlockBreakingService {
private val damagedBlocks: HashMap<Player, DamagedBlock> = HashMap()
Expand Down Expand Up @@ -150,7 +150,7 @@ object BlockBreakingService {
// the player might actually have mining fatigue.
// in this case, it is important to copy the hasIcon value to prevent it from disappearing.
val effectInstance = MobEffectInstance(
MobEffect.byId(4)!!,
MobEffects.DIG_SLOWDOWN,
Int.MAX_VALUE,
255,
effect.isAmbient,
Expand All @@ -171,7 +171,7 @@ object BlockBreakingService {
val packet = if (effect != null) {
// if the player actually has mining fatigue, send the correct effect again
val effectInstance = MobEffectInstance(
MobEffect.byId(4)!!,
MobEffects.DIG_SLOWDOWN,
effect.duration,
effect.amplifier,
effect.isAmbient,
Expand All @@ -181,7 +181,7 @@ object BlockBreakingService {
ClientboundUpdateMobEffectPacket(this.entityId, effectInstance)
} else {
// remove the effect
ClientboundRemoveMobEffectPacket(this.entityId, MobEffect.byId(4)!!)
ClientboundRemoveMobEffectPacket(this.entityId, MobEffects.DIG_SLOWDOWN)
}

PacketHandler.sendPacket(this, packet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import net.minecraft.world.item.PickaxeItem
import net.minecraft.world.item.ShovelItem
import net.minecraft.world.level.block.state.BlockState
import org.bukkit.block.Block
import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack
import org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack
import org.bukkit.enchantments.Enchantment
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ArmorListener : Listener {
// This method is planned for subsequent updates
@EventHandler
fun playerEquipArmor(event: PlayerArmorChangeEvent) {
val armorPiece = event.newItem ?: return
val armorPiece = event.newItem
val armorPieceItem = ItemRegistry.getItemFromItemstack(armorPiece) ?: return

if (armorPieceItem is Armors) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/de/danielmaile/mpp/packet/PacketHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import io.netty.channel.ChannelHandlerContext
import io.netty.channel.ChannelPromise
import net.minecraft.network.protocol.Packet
import org.bukkit.Bukkit
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/de/danielmaile/mpp/util/PlayerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.bukkit.FluidCollisionMode
import org.bukkit.attribute.Attribute
import org.bukkit.block.Block
import org.bukkit.block.BlockFace
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer
import org.bukkit.entity.Player
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
Expand Down

0 comments on commit 47374ea

Please sign in to comment.