Skip to content

Commit

Permalink
fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Slexom committed Mar 28, 2021
1 parent 5439fed commit acf7775
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package slexom.vf.animal_feeding_trough.mixin;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.goal.GoalSelector;
import net.minecraft.entity.ai.goal.TemptGoal;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.PathAwareEntity;
Expand All @@ -11,9 +10,7 @@
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -22,16 +19,16 @@
import java.util.Arrays;
import java.util.stream.Collectors;

@Mixin(MobEntity.class)
public class AnimalEntityMixin {
@Mixin(AnimalEntity.class)
public class AnimalEntityMixin extends MobEntity {
private static final ItemStack[] FORBIDDEN_ITEMS = Arrays.stream(new Item[]{Items.CARROT_ON_A_STICK, Items.WARPED_FUNGUS_ON_A_STICK}).map(ItemStack::new).toArray(ItemStack[]::new);

@Shadow
@Final
protected GoalSelector goalSelector;
protected AnimalEntityMixin(EntityType<? extends MobEntity> entityType, World world) {
super(entityType, world);
}

@Inject(method = "<init>", at = @At("TAIL"))
private void ASFAddSelfFeedingGoal(EntityType<? extends MobEntity> entityType, World world, CallbackInfo ci) {
private void AFTAddSelfFeedingGoal(EntityType<? extends MobEntity> entityType, World world, CallbackInfo ci) {
if (world != null && !world.isClient) {
((GoalSelectorAccessor) this.goalSelector)
.getGoals()
Expand Down

0 comments on commit acf7775

Please sign in to comment.