Skip to content

Commit

Permalink
Merge branch '1.20.2' into 1.20.4
Browse files Browse the repository at this point in the history
* 1.20.2:
  Fixed looting and cooldown reset
  • Loading branch information
Faboslav committed Jan 31, 2024
2 parents 299d32e + 8bea946 commit 672b9d5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import net.minecraft.entity.ai.brain.Brain;
import net.minecraft.entity.ai.brain.MemoryModuleState;
import net.minecraft.entity.ai.brain.MemoryModuleType;
import net.minecraft.entity.ai.brain.task.MultiTickTask;
import net.minecraft.entity.ai.brain.task.Task;
import net.minecraft.entity.ai.control.FlightMoveControl;
import net.minecraft.entity.ai.pathing.BirdNavigation;
import net.minecraft.entity.ai.pathing.EntityNavigation;
Expand Down Expand Up @@ -48,10 +50,7 @@
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.GlobalPos;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.*;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.*;
import net.minecraft.world.event.GameEvent;
Expand All @@ -62,6 +61,7 @@
@SuppressWarnings({"rawtypes", "unchecked"})
public final class GlareEntity extends TameableEntity implements Flutterer, AnimatedEntity
{
private static final Vec3i ITEM_PICKUP_RANGE_EXPANDER = new Vec3i(1, 1, 1);
public static final Predicate<ItemEntity> PICKABLE_FOOD_FILTER;
private static final int GRUMPY_BITMASK = 2;
private static final float MOVEMENT_SPEED = 0.1F;
Expand Down Expand Up @@ -192,6 +192,12 @@ protected void mobTick() {
GlareBrain.updateActivities(this);
this.getWorld().getProfiler().pop();

for (var runningTask : this.getBrain().getRunningTasks()) {
if (runningTask.getStatus() == MultiTickTask.Status.RUNNING) {
FriendsAndFoes.getLogger().info(runningTask.toString());
}
}

super.mobTick();
}

Expand All @@ -216,6 +222,16 @@ public void travel(Vec3d movementInput) {
this.updateLimbs(false);
}

@Override
protected Vec3i getItemPickUpRangeExpander() {
return ITEM_PICKUP_RANGE_EXPANDER;
}

@Override
public boolean canGather(ItemStack itemStack) {
return itemStack.isEmpty() == false && itemStack.getItem() == Items.GLOW_BERRIES && super.canGather(itemStack);
}

@Override
public boolean canPickUpLoot() {
return !this.isItemPickupCoolingDown() && !this.isHoldingItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ public static void updateActivities(GlareEntity glare) {

public static void updateMemories(GlareEntity glare) {
if (
glare.isBaby()
(
glare.isBaby()
|| (glare.isBaby() == false && glare.isTamed() == false)
)
&& glare.getBrain().isMemoryInState(FriendsAndFoesMemoryModuleTypes.GLARE_DARK_SPOT_LOCATING_COOLDOWN.get(), MemoryModuleState.VALUE_ABSENT)
) {
GlareBrain.setDarkSpotLocatingCooldown(glare);
Expand Down

0 comments on commit 672b9d5

Please sign in to comment.