diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 index 1a5add5f..3190c926 100644 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 @@ -1,2 +1,2 @@ -// 1.20.1 2023-10-17T21:36:16.1265363 Languages: en_us -30f8301afe214a9b79f7ec8c1d188b4103bb79b0 assets/armourandtoolsmod/lang/en_us.json +// 1.20.1 2023-10-18T21:49:31.0374931 Languages: en_us +dc4899b51a9ba3f1a123c05cc3c66fffe779b4b6 assets/armourandtoolsmod/lang/en_us.json diff --git a/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json b/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json index 848dfe57..32e942b5 100644 --- a/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json +++ b/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json @@ -167,5 +167,6 @@ "item.minecraft.potion.effect.worthy_potion": "Worthy Potion", "item.minecraft.splash_potion.effect.worthy_potion": "Worthy Potion", "key.categories.armourandtoolsmod": "Armour and Item Mod", - "key.get_mjolnir": "Get Mjölnir" + "key.get_mjolnir": "Get Mjölnir", + "key.strike_lightning": "Strike Lightning" } \ No newline at end of file diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt index 960e2a3a..d2ae365b 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt @@ -63,7 +63,6 @@ class ArmourAndToolsMod { // register click event FORGE_BUS.addListener(ClientEvents::rightClickBlock) FORGE_BUS.addListener(ClientEvents::rightClickEmpty) - FORGE_BUS.addListener(ClientEvents::onEntityInteract) // register key input event bus.addListener(ClientEvents::onKeyRegister) FORGE_BUS.addListener(ClientEvents::onKeyInput) diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/ClientEvents.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/ClientEvents.kt index e71f6869..4e82044f 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/ClientEvents.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/ClientEvents.kt @@ -165,23 +165,12 @@ object ClientEvents { val effects = player.activeEffectsMap if (effects.contains(MobEffectsInit.WORTHY_EFFECT.get())) { - val lightningbolt = EntityType.LIGHTNING_BOLT.create(player.level()) - if (lightningbolt != null) {} - } - } - } - } - - fun onEntityInteract(event: PlayerInteractEvent.EntityInteract) { - if (event.entity is ServerPlayer) { - val player = event.entity as ServerPlayer - val effects = player.activeEffectsMap - - if (effects.contains(MobEffectsInit.WORTHY_EFFECT.get())) { - if (event.target is LivingEntity) { val lightningbolt = EntityType.LIGHTNING_BOLT.create(player.level()) if (lightningbolt != null) { - fireLightningBolt(event, lightningbolt) + lightningbolt.moveTo(Vec3.atBottomCenterOf(player.blockPosition())) + lightningbolt.cause = if (player is ServerPlayer) player else null + player.level().addFreshEntity(lightningbolt) + player.playSound(SoundEvents.LIGHTNING_BOLT_THUNDER, 1.0f, 1.0f) } } } diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/renderer/mjolnir/MjolnirItemRendererISTER.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/renderer/mjolnir/MjolnirItemRendererISTER.kt index 98583d8b..ff1d7067 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/renderer/mjolnir/MjolnirItemRendererISTER.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/client/renderer/mjolnir/MjolnirItemRendererISTER.kt @@ -91,7 +91,8 @@ class MjolnirItemRendererISTER : ArmourAndToolsModBlockEntityWithoutLevelRendere } fun getModelResourceLocation(): ModelResourceLocation { - return ModelResourceLocation(ArmourAndToolsMod.getModIdAndName("mjolnir"), "inventory") + return ModelResourceLocation( + ArmourAndToolsMod.getModIdAndName("aqumarine_trident"), "inventory") } fun getTextureLocation(): ResourceLocation { diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/ArmourToolsModTridentEntity.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/ArmourToolsModTridentEntity.kt index e7c06512..cfc09099 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/ArmourToolsModTridentEntity.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/ArmourToolsModTridentEntity.kt @@ -18,7 +18,6 @@ */ package io.github.realyusufismail.armourandtoolsmod.common.entity -import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.network.protocol.Packet @@ -48,6 +47,7 @@ abstract class ArmourToolsModTridentEntity : AbstractArrow { var tridentItem: ItemStack? = null private var dealtDamage = false var returningTicks = 0 + var allowToTriggerThunderWithoutEnchantment = false constructor(type: EntityType, world: Level) : super(type, world) @@ -152,16 +152,33 @@ abstract class ArmourToolsModTridentEntity : AbstractArrow { deltaMovement = deltaMovement.multiply(-0.01, -0.1, -0.01) var f1 = 1.0f - if (level() is ServerLevel && level().isThundering && isChanneling()) { - val blockpos = entity.blockPosition() - if (level().canSeeSky(blockpos)) { - val lightningbolt = EntityType.LIGHTNING_BOLT.create(level()) - if (lightningbolt != null) { - lightningbolt.moveTo(Vec3.atBottomCenterOf(blockpos)) - lightningbolt.cause = if (shooter is ServerPlayer) shooter else null - level().addFreshEntity(lightningbolt) - soundEvent = SoundEvents.TRIDENT_THUNDER - f1 = 5.0f + + if (!allowToTriggerThunderWithoutEnchantment) { + if (level() is ServerLevel && level().isThundering && isChanneling()) { + val blockpos = entity.blockPosition() + if (level().canSeeSky(blockpos)) { + val lightningbolt = EntityType.LIGHTNING_BOLT.create(level()) + if (lightningbolt != null) { + lightningbolt.moveTo(Vec3.atBottomCenterOf(blockpos)) + lightningbolt.cause = if (shooter is ServerPlayer) shooter else null + level().addFreshEntity(lightningbolt) + soundEvent = SoundEvents.TRIDENT_THUNDER + f1 = 5.0f + } + } + } + } else { + if (level() is ServerLevel) { + val blockpos = entity.blockPosition() + if (level().canSeeSky(blockpos)) { + val lightningbolt = EntityType.LIGHTNING_BOLT.create(level()) + if (lightningbolt != null) { + lightningbolt.moveTo(Vec3.atBottomCenterOf(blockpos)) + lightningbolt.cause = if (shooter is ServerPlayer) shooter else null + level().addFreshEntity(lightningbolt) + soundEvent = SoundEvents.LIGHTNING_BOLT_THUNDER + f1 = 5.0f + } } } } diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/MjolnirEntity.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/MjolnirEntity.kt index 716cc35b..2bafc3d9 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/MjolnirEntity.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/common/entity/MjolnirEntity.kt @@ -29,7 +29,8 @@ open class MjolnirEntity : ArmourToolsModTridentEntity { constructor(type: EntityType, world: Level) : super(type, world) { this.tridentItem = ItemStack(ItemInit.MJOLNIR.get()) - this.entityData.define(ID_LOYALTY, 1.toByte()) + this.entityData.set(ID_LOYALTY, 1.toByte()) + this.allowToTriggerThunderWithoutEnchantment = true } constructor( @@ -37,7 +38,8 @@ open class MjolnirEntity : ArmourToolsModTridentEntity { thrower: LivingEntity, stack: ItemStack ) : super(EntityTypeInit.MJOLNIR_THROWN_TRIDENT.get(), level, thrower, stack) { - this.entityData.define(ID_LOYALTY, 1.toByte()) + this.entityData.set(ID_LOYALTY, 1.toByte()) + this.allowToTriggerThunderWithoutEnchantment = true } override fun getBaseDamage(): Double { diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/util/KeyBinding.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/util/KeyBinding.kt index 6d7615db..4dd4d1d5 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/util/KeyBinding.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/util/KeyBinding.kt @@ -41,6 +41,6 @@ object KeyBinding { KEY_STRIKE_LIGHTNING, KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM, - GLFW.GLFW_KEY_L, + GLFW.GLFW_KEY_Z, KEY_CATEGORY_ARMOUR_AND_TOOLS_MOD) }