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.9.4 (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitch215 committed Dec 6, 2023
2 parents fd696c5 + 164553e commit e6c3f69
Show file tree
Hide file tree
Showing 43 changed files with 4,391 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.gamercoder215.mobchip.ai.behavior;

import me.gamercoder215.mobchip.ai.memories.EntityMemory;
import me.gamercoder215.mobchip.ai.schedule.Updatable;

/**
* Represents Behavior for a Breeze
*/
public interface BreezeBehavior extends CreatureBehavior, Updatable {

/**
* Performs a Breeze Long Jump.
* <p>This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.</p>
*/
void longJump();

/**
* Performs a Breeze Shooting Attack.
* <p>This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.</p>
*/
void shoot();

/**
* Performs a Breeze Slide.
* <p>This behavior requires {@link EntityMemory#ATTACK_TARGET} to be present in the brain.</p>
*/
void slide();

}
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,41 @@ public final class EntityMemory<T> implements Memory<T> {
*/
public static final EntityMemory<Boolean> SNIFFER_HAPPY = new EntityMemory<>(Boolean.class, "sniffer_happy");

/**
* A Breeze's Jump Cooldown.
*/
public static final EntityMemory<Unit> BREEZE_JUMP_COOLDOWN = new EntityMemory<>(Unit.class, "breeze_jump_cooldown");

/**
* A Breeze's Shooting Duration.
*/
public static final EntityMemory<Unit> BREEZE_SHOOT = new EntityMemory<>(Unit.class, "breeze_shoot");

/**
* A Breeze's Charging duration for its Shooting.
*/
public static final EntityMemory<Unit> BREEZE_SHOOT_CHARGING = new EntityMemory<>(Unit.class, "breeze_shoot_charging");

/**
* A Breeze's Recovery duration after Shooting.
*/
public static final EntityMemory<Unit> BREEZE_SHOOT_RECOVERING = new EntityMemory<>(Unit.class, "breeze_shoot_recovering");

/**
* A Breeze's Shooting Cooldown.
*/
public static final EntityMemory<Unit> BREEZE_SHOOT_COOLDOWN = new EntityMemory<>(Unit.class, "breeze_shoot_cooldown");

/**
* The duration of a Breeze's Inhaling before Jumping.
*/
public static final EntityMemory<Unit> BREEZE_JUMP_INHALING = new EntityMemory<>(Unit.class, "breeze_jump_inhaling");

/**
* The location of where a Breeze should jump.
*/
public static final EntityMemory<Location> BREEZE_JUMP_TARGET = new EntityMemory<>(Location.class, "breeze_jump_target");

private final Class<T> bukkit;

private final String key;
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
}

val pGroup = "me.gamercoder215"
val pVersion = "1.9.3-SNAPSHOT"
val pVersion = "1.9.4-SNAPSHOT"
val pAuthor = "GamerCoder215"

val github = "$pAuthor/MobChip"
Expand Down
2 changes: 2 additions & 0 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
"1_19_R3",
"1_20_R1",
"1_20_R2",
"1_20_R3"
).forEach {
api(project(":mobchip-$it"))
}
Expand All @@ -50,6 +51,7 @@ tasks {
"1_19_R3",
"1_20_R1",
"1_20_R2",
"1_20_R3"
).forEach { dependsOn(":mobchip-$it:jar") }
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
org.bukkit.World w = Bukkit.getWorld(DimensionManager.a(l.getDimensionManager()).getKey());
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition) {
BlockPosition p = (BlockPosition) nmsValue;
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof EntityHuman) {
EntityHuman p = (EntityHuman) nmsValue;
value = Bukkit.getPlayer(p.getUniqueID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
World w = Bukkit.getWorld(DimensionManager.a(l.getDimensionManager()).getKey());
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition) {
BlockPosition p = (BlockPosition) nmsValue;
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof EntityHuman) {
EntityHuman p = (EntityHuman) nmsValue;
value = Bukkit.getPlayer(p.getUniqueID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
World w = o.isPresent() ? o.get().a(l.getDimensionManager()).getWorld() : Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition) {
BlockPosition p = (BlockPosition) nmsValue;
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) nmsValue;
value = Bukkit.getPlayer(p.getUniqueID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,10 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
World w = ((CraftServer) Bukkit.getServer()).getHandle().getServer().f.b(IRegistry.L).a(l.getDimensionManager()).getWorld();
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition) {
BlockPosition p = (BlockPosition) nmsValue;
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) nmsValue;
value = Bukkit.getPlayer(p.getUniqueID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
World w = ((CraftServer) Bukkit.getServer()).getHandle().getServer().customRegistry.b(IRegistry.L).a(l.getDimensionManager()).getWorld();
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition) {
BlockPosition p = (BlockPosition) nmsValue;
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) nmsValue;
value = Bukkit.getPlayer(p.getUniqueID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
World w = ((CraftServer) Bukkit.getServer()).getHandle().getServer().l.d(IRegistry.Q).a(l.getDimensionManager()).getWorld();
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPosition p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,9 @@ public static Object fromNMS(Mob m, String key, Object nmsValue) {
if (w == null) w = Bukkit.getWorlds().get(0);
value = new Location(w, pos.getX(), pos.getY(), pos.getZ());
}
else if (nmsValue instanceof BlockPos p) {
value = new Location(m.getWorld(), p.getX(), p.getY(), p.getZ());
}
else if (nmsValue instanceof List<?> li) {
switch (key) {
case "secondary_job_site", "interactable_doors" -> {
Expand Down
35 changes: 35 additions & 0 deletions nms/1_20_R3/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import io.github.patrick.gradle.remapper.RemapTask

plugins {
id("io.github.patrick.remapper") version "1.4.0"
}

val mcVersion = "1.20.3"

dependencies {
api(project(":mobchip-base"))
api(project(":mobchip-abstraction"))
api(project(":mobchip-1_14_R1"))

compileOnly("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang")
testImplementation("org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang")
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks {
assemble {
dependsOn("remap")
}

remap {
dependsOn("shadowJar")

version.set(mcVersion)
action.set(RemapTask.Action.MOJANG_TO_SPIGOT)
archiveName.set("${project.name}-${project.version}.jar")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package me.gamercoder215.mobchip.abstraction.v1_20_R3;

import me.gamercoder215.mobchip.ai.attribute.Attribute;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_20_R3.util.CraftNamespacedKey;
import org.jetbrains.annotations.NotNull;

final class Attribute1_20_R3 extends RangedAttribute implements Attribute {

private final NamespacedKey key;
private final double defaultV;
private final double min;
private final double max;

public Attribute1_20_R3(RangedAttribute a) {
super(a.getDescriptionId(), a.getDefaultValue(), a.getMinValue(), a.getMaxValue());
this.key = BuiltInRegistries.ATTRIBUTE.getKey(a) == null ? NamespacedKey.minecraft(a.getDescriptionId()) : CraftNamespacedKey.fromMinecraft(BuiltInRegistries.ATTRIBUTE.getKey(a));
this.defaultV = a.getDefaultValue();
this.min = a.getMinValue();
this.max = a.getMaxValue();
}

public Attribute1_20_R3(NamespacedKey key, double defaultV, double min, double max, boolean clientSide) {
super("attribute.name." + key.getKey().toLowerCase(), defaultV, min, max);
this.key = key;
this.min = min;
this.defaultV = defaultV;
this.max = max;
this.setSyncable(clientSide);
}

public double getMinValue() {
return this.min;
}

public double getDefaultValue() {
return this.defaultV;
}

public double getMaxValue() {
return this.max;
}

@Override
public boolean isClientSide() {
return isClientSyncable();
}

@NotNull
@Override
public NamespacedKey getKey() {
return this.key;
}
}
Loading

0 comments on commit e6c3f69

Please sign in to comment.