Merge remote-tracking branch 'origin/master'

# Conflicts:
#	gradle.properties
This commit is contained in:
Auxilor 2023-06-18 13:25:39 +02:00
commit 802d291ae2
9 changed files with 80 additions and 3 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @WillFP

View File

@ -0,0 +1,6 @@
group = "com.willfp"
version = rootProject.version
dependencies {
compileOnly("org.spigotmc:spigot:1.20-R0.1-SNAPSHOT")
}

View File

@ -0,0 +1,26 @@
package com.willfp.ecoenchants.proxy.v1_20_R1
import com.willfp.ecoenchants.enchants.EcoEnchant
import com.willfp.ecoenchants.enchants.EcoEnchants
import com.willfp.ecoenchants.vanilla.VanillaEnchantmentData
import net.minecraft.world.item.enchantment.Enchantment
import org.bukkit.craftbukkit.v1_20_R1.enchantments.CraftEnchantment
class EcoCraftEnchantment(
target: Enchantment,
private val data: VanillaEnchantmentData
) : CraftEnchantment(target) {
override fun getMaxLevel(): Int = data.maxLevel ?: super.getMaxLevel()
override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean {
if (other is EcoEnchant) {
return other.conflictsWith(this)
}
return data.conflicts?.contains(other.key) ?: super.conflictsWith(other)
}
fun register() {
EcoEnchants.register(this)
}
}

View File

@ -0,0 +1,26 @@
package com.willfp.ecoenchants.proxy.v1_20_R1
import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy
import com.willfp.ecoenchants.vanilla.VanillaEnchantmentData
import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
import org.bukkit.NamespacedKey
import org.bukkit.enchantments.Enchantment
class EcoCraftEnchantmentManager : EcoCraftEnchantmentManagerProxy {
override fun registerNewCraftEnchantment(
enchantment: Enchantment,
data: VanillaEnchantmentData
) {
for (enchant in BuiltInRegistries.g) {
val key = org.bukkit.craftbukkit.v1_20_R1.util.CraftNamespacedKey.fromMinecraft(
BuiltInRegistries.g.b(enchant)
)
if (key.key != enchantment.key.key) {
continue
}
EcoCraftEnchantment(enchant, data).register()
}
}
}

View File

@ -0,0 +1,11 @@
package com.willfp.ecoenchants.proxy.v1_20_R1
import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer
import org.bukkit.entity.Player
class OpenInventory : OpenInventoryProxy {
override fun getOpenInventory(player: Player): Any {
return (player as CraftPlayer).handle.bR
}
}

View File

@ -80,6 +80,10 @@ class EnchantmentReplenish(
} }
if (data.age != data.maximumAge) { if (data.age != data.maximumAge) {
if (enchant.config.getBool("prevent-not-fully-grown")) {
return
}
event.isDropItems = false event.isDropItems = false
event.expToDrop = 0 event.expToDrop = 0
} }

View File

@ -15,3 +15,5 @@ enchantable: true
conditions: [ ] conditions: [ ]
consume-seeds: true # If seeds should be consumed in replanting consume-seeds: true # If seeds should be consumed in replanting
prevent-not-fully-grown: false # If the enchantment should prevent replanting not fully grown crops

View File

@ -1,5 +1,5 @@
#libreforge-updater #libreforge-updater
#Mon Jun 05 16:27:00 BST 2023 #Sat Jun 10 13:32:20 BST 2023
kotlin.code.style=official kotlin.code.style=official
libreforge-version=4.18.0 libreforge-version=4.19.0
version=10.18.1 version=10.19.0

View File

@ -19,3 +19,4 @@ include(":eco-core:core-nms:v1_18_R2")
include(":eco-core:core-nms:v1_19_R1") include(":eco-core:core-nms:v1_19_R1")
include(":eco-core:core-nms:v1_19_R2") include(":eco-core:core-nms:v1_19_R2")
include(":eco-core:core-nms:v1_19_R3") include(":eco-core:core-nms:v1_19_R3")
include(":eco-core:core-nms:v1_20_R1")