Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Update to v1.8.0 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerCoder authored Feb 13, 2023
2 parents 3bb36c6 + cf3b8da commit da816c5
Show file tree
Hide file tree
Showing 269 changed files with 1,527 additions and 1,277 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
java-version: '16'
cache: 'maven'
- name: Build Project
run: mvn clean package -DskipTests -Dmaven.javadoc.skip=true -pl "base,abstraction,1_13_R1,1_13_R2,1_14_R1,1_15_R1,1_16_R1,1_16_R2,1_16_R3,1_17_R1,bukkit"
run: mvn clean package -DskipTests -Dmaven.javadoc.skip=true -pl "base,abstraction,nms/1_13_R1,nms/1_13_R2,nms/1_14_R1,nms/1_15_R1,nms/1_16_R1,nms/1_16_R2,nms/1_16_R3,nms/1_17_R1,bukkit"

build-8_11:
needs: setup
Expand All @@ -58,7 +58,7 @@ jobs:
java-version: ${{ matrix.java-version }}
cache: 'maven'
- name: Build Project
run: mvn clean package -DskipTests -Dmaven.javadoc.skip=true -pl "base,abstraction,1_13_R1,1_13_R2,1_14_R1,1_15_R1,1_16_R1,1_16_R2,1_16_R3,bukkit"
run: mvn clean package -DskipTests -Dmaven.javadoc.skip=true -pl "base,abstraction,nms/1_13_R1,nms/1_13_R2,nms/1_14_R1,nms/1_15_R1,nms/1_16_R1,nms/1_16_R2,nms/1_16_R3,bukkit"


build:
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
build.sh
.idea/

bukkit/target
*/target
/target
**/target/
target/

logs/*.log
*/logs/*.log
**/logs/*.log
2 changes: 1 addition & 1 deletion abstraction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>me.gamercoder215</groupId>
<artifactId>mobchip-parent</artifactId>
<version>1.7.2-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>mobchip-abstraction</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ default void addPathfinders(Collection<? extends WrappedPathfinder> c, boolean t

MemoryStatus getMemoryStatus(Mob mob, Memory<?> m);

EnderCrystal getNearestCrystal(EnderDragon d);

default void updateActivities(Creature c) {}

default BehaviorResult hearNoteblock(Creature c, Location loc) {
Expand Down
2 changes: 1 addition & 1 deletion base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>me.gamercoder215</groupId>
<artifactId>mobchip-parent</artifactId>
<version>1.7.2-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>

<artifactId>mobchip-base</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions base/src/main/java/me/gamercoder215/mobchip/DragonBrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import me.gamercoder215.mobchip.ai.enderdragon.CustomPhase;
import me.gamercoder215.mobchip.ai.enderdragon.DragonPhase;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderDragon;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Represents a special EntityBrain for Ender Dragons.
Expand All @@ -16,6 +19,13 @@ public interface DragonBrain extends EntityBrain {
*/
void setCustomPhase(@NotNull CustomPhase phase) throws IllegalArgumentException;

/**
* Fetches the nearest ender crystal that is currently healing this Ender Dragon.
* @return EnderCrystal healing this EnderDragon, may be null
*/
@Nullable
EnderCrystal getNearestCrystal();

/**
* Fetches the current DragonPhase of the Ender Dragon.
* @return Current DragonPhase of the Ender Dragon.
Expand Down
4 changes: 3 additions & 1 deletion base/src/main/java/me/gamercoder215/mobchip/EntityBrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import me.gamercoder215.mobchip.ai.controller.EntityController;
import me.gamercoder215.mobchip.ai.memories.Memory;
import me.gamercoder215.mobchip.ai.memories.MemoryStatus;
import me.gamercoder215.mobchip.ai.memories.Unit;
import me.gamercoder215.mobchip.ai.navigation.EntityNavigation;
import me.gamercoder215.mobchip.ai.schedule.EntityScheduleManager;
import me.gamercoder215.mobchip.ai.sensing.EntitySenses;
Expand Down Expand Up @@ -132,7 +133,8 @@ default void setMemories(@NotNull Map<Memory, ?> map, long expire) {
<T> T getMemory(@NotNull Memory<T> memory);

/**
* Get the expiration date of this Memory.
* <p>Get the expiration date of this Memory.</p>
* <p>For memories with a {@link Unit} type, this value should be read instead of using {@link #getMemory(Memory)}.</p>
* @param memory Memory to fetch
* @return Found expiration date, or 0 if no expiration or not found
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.gamercoder215.mobchip;

import me.gamercoder215.mobchip.ai.gossip.EntityGossipContainer;
import org.bukkit.entity.Villager;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -15,4 +16,7 @@ public interface VillagerBrain extends EntityBrain {
@NotNull
EntityGossipContainer getGossipContainer();

@Override
Villager getEntity();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.gamercoder215.mobchip.ai.goal;

import org.bukkit.entity.AbstractHorse;
import org.jetbrains.annotations.NotNull;

/**
* <p>Represents a Pathfinder for a Horse-like Mob to randomly stand.</p>
* <strong>Only Available in 1.19.3+ Versions</strong>
*/
public final class PathfinderRandomStand extends Pathfinder {

/**
* Constructs a PathfinderRandomStand.
* @param m AbstractHorse to use
*/
public PathfinderRandomStand(@NotNull AbstractHorse m) {
super(m);
}

@Override
public @NotNull PathfinderFlag[] getFlags() {
return new PathfinderFlag[0];
}

@Override
public String getInternalName() {
return "RandomStandGoal";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,6 @@ public final class EntityMemory<T> implements Memory<T> {
* The player that this Mob likes.
*/
public static final EntityMemory<Player> LIKED_PLAYER = new EntityMemory<>(Player.class, "liked_player");
/**
* Whether this Warden is sniffing.
*/
public static final EntityMemory<Boolean> IS_SNIFFING = new EntityMemory<>(Boolean.class, "is_sniffing");
/**
* Whether this Warden is emerging.
*/
public static final EntityMemory<Boolean> IS_EMERGING = new EntityMemory<>(Boolean.class, "is_emerging");
/**
* This Warden's Roaring Target.
*/
Expand All @@ -319,6 +311,62 @@ public final class EntityMemory<T> implements Memory<T> {
*/
public static final EntityMemory<Location> DISTURBANCE_LOCATION = new EntityMemory<>(Location.class, "disturbance_location");

/**
* <p>Whether this Warden is sniffing.</p>
* <p>An expiry value of {@code 0} means it is not sniffing, and any other value is how many ticks left it has to completely sniff.</p>
*/
public static final EntityMemory<Unit> IS_SNIFFING = new EntityMemory<>(Unit.class, "is_sniffing");
/**
* <p>Whether this Warden is emerging.</p>
* <p>An expiry value of {@code 0} means it is not emerging, and any other value is how many ticks left it has to completely emerge.</p>
*/
public static final EntityMemory<Unit> IS_EMERGING = new EntityMemory<>(Unit.class, "is_emerging");

/**
* Represents the delay for the next roar sound.
*/
public static final EntityMemory<Unit> ROAR_SOUND_DELAY = new EntityMemory<>(Unit.class, "roar_sound_delay");

/**
* Represents the cooldown until this Warden can dig again.
*/
public static final EntityMemory<Unit> DIG_COOLDOWN = new EntityMemory<>(Unit.class, "dig_cooldown");

/**
* Represents the cooldown until this Warden can roar again.
*/
public static final EntityMemory<Unit> ROAR_SOUND_COOLDOWN = new EntityMemory<>(Unit.class, "roar_sound_cooldown");

/**
* Represents the cooldown until this Warden can sniff again.
*/
public static final EntityMemory<Unit> SNIFF_COOLDOWN = new EntityMemory<>(Unit.class, "sniff_cooldown");

/**
* Represents the cooldown until this Warden can locate another disturbance.
*/
public static final EntityMemory<Unit> TOUCH_COOLDOWN = new EntityMemory<>(Unit.class, "touch_cooldown");

/**
* Represents the cooldown until this Warden can receive another vibration.
*/
public static final EntityMemory<Unit> VIBRATION_COOLDOWN = new EntityMemory<>(Unit.class, "vibration_cooldown");

/**
* Represents the cooldown until this Warden can perform its sonic boom attack.
*/
public static final EntityMemory<Unit> SONIC_BOOM_COOLDOWN = new EntityMemory<>(Unit.class, "sonic_boom_cooldown");

/**
* Represents the cooldown until this Warden can play its sonic boom sound.
*/
public static final EntityMemory<Unit> SONIC_BOOM_SOUND_COOLDOWN = new EntityMemory<>(Unit.class, "sonic_boom_sound_cooldown");

/**
* Represents the delay for when this Warden can play its sonic boom sound.
*/
public static final EntityMemory<Unit> SONIC_BOOM_SOUND_DELAY = new EntityMemory<>(Unit.class, "sonic_boom_sound_delay");

private final Class<T> bukkit;

private final String key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
* A Memory being absent means that a value is not stored in the brain. For example, {@link EntityMemory#NOT_ADMIRING} would have no value present.
* </p>
* <p>
* A Memory being registered means that the memory is present in the Minecraft Registry. All native memories, such as the ones listed in this class, are all
* A Memory being registered means that the memory is present in the Minecraft Registry, and is supported by the mob type. All native memories, such as the ones listed in this class, are all
* registered in the Minecraft Registry by default, but can be unregistered at any time. However, custom memories are not registered in the Minecraft Registry, and thus, would not be able to be present in the brain.
*
* Additionally, not all mobs support the same memory, making them unregistered when applicable. Passive Mobs do not have {@link EntityMemory#ANGRY_AT} registered in their Brain, and Wardens are the only ones with {@link EntityMemory#DISTURBANCE_LOCATION} registered.
* </p>
*/
public enum MemoryStatus {
Expand All @@ -32,7 +34,8 @@ public enum MemoryStatus {
*/
ABSENT,
/**
* Represents a Memory that is registered within the Minecraft Registry. In usual cases with Vanilla Memories, they are all registered.
* <p>Represents a Memory that is registered within the Minecraft Registry. In usual cases with Vanilla Memories, they are all registered.</p>
* <p>If the Mob Type does not support the memory type (e.g. Passive Mobs don't have {@link EntityMemory#ANGRY_AT} registered), it will still return this enum.</p>
*/
REGISTERED

Expand Down
26 changes: 26 additions & 0 deletions base/src/main/java/me/gamercoder215/mobchip/ai/memories/Unit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.gamercoder215.mobchip.ai.memories;

import me.gamercoder215.mobchip.EntityBrain;

/**
* <p>Represents a Memory Unit.</p>
* <p>For some memories that require active cooldowns, such as {@link EntityMemory#IS_SNIFFING}, the cooldown is read instead of the actual memory value.</p>
*
* Example:
* <pre>{@code
* public void setMemories(Warden w) {
* EntityBrain brain = BukkitBrain.getBrain(w);
*
* brain.setMemory(EntityMemory.IS_SNIFFING, Unit.INSTANCE, 500); // Sniffing for 500 ticks
* }
* }</pre>
*
* @see EntityBrain#getExpiration(Memory)
*/
public enum Unit {

/**
* The only Unit Instance.
*/
INSTANCE
}
2 changes: 1 addition & 1 deletion bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>me.gamercoder215</groupId>
<artifactId>mobchip-parent</artifactId>
<version>1.7.2-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
</parent>
<artifactId>mobchip-bukkit</artifactId>
<name>MobChip-Bukkit</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.gamercoder215.mobchip.bukkit;

import me.gamercoder215.mobchip.DragonBrain;
import me.gamercoder215.mobchip.EntityBody;
import me.gamercoder215.mobchip.EntityBrain;
import me.gamercoder215.mobchip.abstraction.ChipUtil;
Expand Down Expand Up @@ -50,10 +51,20 @@ public class BukkitBrain implements EntityBrain {
public static EntityBrain getBrain(@Nullable Mob m) {
if (m == null) return null;
if (m instanceof Villager) return new BukkitVillagerBrain((Villager) m);
if (m instanceof EnderDragon) return new BukkitDragonBrain((EnderDragon) m);
return new BukkitBrain(m);
}

/**
* Gets the DragonBrain of this EnderDragon.
* @param d EnderDragon to get
* @return DragonBrain
*/
@Nullable
public static DragonBrain getBrain(@Nullable EnderDragon d) {
if (d == null) return null;
return new BukkitDragonBrain(d);
}

/**
* Registers a Sensor.
* @param sensor Sensor to Register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.gamercoder215.mobchip.ai.enderdragon.CustomPhase;
import me.gamercoder215.mobchip.DragonBrain;
import me.gamercoder215.mobchip.ai.enderdragon.DragonPhase;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderDragon;
import org.jetbrains.annotations.NotNull;

Expand All @@ -20,6 +21,11 @@ public void setCustomPhase(@NotNull CustomPhase phase) throws IllegalArgumentExc
w.setCustomPhase(m, phase);
}

@Override
public EnderCrystal getNearestCrystal() {
return w.getNearestCrystal(m);
}

@Override
public @NotNull DragonPhase getCurrentPhase() {
return w.getCurrentPhase(m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ class BukkitVillagerBrain extends BukkitBrain implements VillagerBrain {
public EntityGossipContainer getGossipContainer() {
return w.getGossipContainer(v);
}

@Override
public Villager getEntity() {
return v;
}
}
3 changes: 2 additions & 1 deletion 1_13_R1/pom.xml → nms/1_13_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<parent>
<groupId>me.gamercoder215</groupId>
<artifactId>mobchip-parent</artifactId>
<version>1.7.2-SNAPSHOT</version>
<version>1.8.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>mobchip-1_13_R1</artifactId>
Expand Down
Loading

0 comments on commit da816c5

Please sign in to comment.