Skip to content

Commit

Permalink
Fix crash on setInLove. (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Jul 22, 2020
1 parent df1cd0b commit 9455d03
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.entity.passive;

import io.izzel.arclight.common.bridge.entity.passive.AnimalEntityBridge;
import io.izzel.arclight.common.mixin.core.entity.AgeableEntityMixin;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
Expand All @@ -12,7 +13,6 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.izzel.arclight.common.mixin.core.entity.AgeableEntityMixin;

@Mixin(AnimalEntity.class)
public abstract class AnimalEntityMixin extends AgeableEntityMixin implements AnimalEntityBridge {
Expand All @@ -34,7 +34,9 @@ public boolean attackEntityFrom(DamageSource source, float amount) {

@Inject(method = "setInLove(Lnet/minecraft/entity/player/PlayerEntity;)V", at = @At("HEAD"))
private void arclight$setBreedItem(PlayerEntity player, CallbackInfo ci) {
this.breedItem = player.inventory.getCurrentItem();
if (player != null) {
this.breedItem = player.inventory.getCurrentItem();
}
}

@Override
Expand Down

0 comments on commit 9455d03

Please sign in to comment.