Fix addEatEffect hook
This commit is contained in:
parent
0424dd1944
commit
cfd6b101d8
@ -29,6 +29,7 @@ import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.food.FoodProperties
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.ProjectileWeaponItem
|
||||
@ -1521,14 +1522,14 @@ class MatteryPlayer(val ply: Player) {
|
||||
* hooked into LivingEntity through coremod script
|
||||
*/
|
||||
@JvmStatic
|
||||
fun addEatEffectHook(iterator: Iterator<com.mojang.datafixers.util.Pair<MobEffectInstance, Float>>, entity: LivingEntity): Iterator<com.mojang.datafixers.util.Pair<MobEffectInstance, Float>> {
|
||||
fun addEatEffectHook(iterator: Iterator<FoodProperties.PossibleEffect>, entity: LivingEntity): Iterator<FoodProperties.PossibleEffect> {
|
||||
if (entity !is Player) {
|
||||
return iterator
|
||||
}
|
||||
|
||||
if (entity.matteryPlayer.isAndroid) {
|
||||
return iterator.filter {
|
||||
it.first.effect != MobEffects.HUNGER
|
||||
it.effect().effect != MobEffects.HUNGER
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,7 +576,7 @@ function backtrack(instructions, from, opcode, skipAmount) {
|
||||
|
||||
function initializeCoreMod() {
|
||||
return {
|
||||
'LivingEntity#addEatEffect patch for androids': method('net.minecraft.world.entity.LivingEntity.m_21063_(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/LivingEntity;)V', function(node) {
|
||||
'LivingEntity#addEatEffect patch for androids': method('net.minecraft.world.entity.LivingEntity.addEatEffect(Lnet/minecraft/world/food/FoodProperties;)V', function(node) {
|
||||
for (var i = 0; i < node.instructions.size(); i++) {
|
||||
var instr = node.instructions.get(i)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user