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.3 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitch215 committed Oct 7, 2023
2 parents 05e937b + cb11472 commit 3540675
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.gamercoder215.mobchip.ai.behavior;

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

/**
* Represents Entity Behaviors for a Camel
*/
public interface CamelBehavior extends CreatureBehavior, Updatable {

/**
* Makes this Camel sit.
* <p>This behavior does not require any memories.</p>
* @param minimalPoseTicks The minimum amount of ticks this camel should sit for
*/
void sit(int minimalPoseTicks);

}
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.2-SNAPSHOT"
val pVersion = "1.9.3-SNAPSHOT"
val pAuthor = "GamerCoder215"

val github = "$pAuthor/MobChip"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ public EntityBehavior getBehaviors() {
constr = allay.getDeclaredConstructor(entityClass);
break;
}
case "camel": {
Class<? extends CamelBehavior> camel = Class.forName(BUKKIT_PACKAGE + "BukkitCamelBehavior")
.asSubclass(CamelBehavior.class);
constr = camel.getDeclaredConstructor(entityClass);
break;
}
}

constr.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,10 @@ public static <T> T getObject(PathfinderGoal o, String name, Class<T> cast) {

public static BlockPosition toNMS(Location l) { return new BlockPosition(l.getX(), l.getY(), l.getZ()); }

public static List<ItemStack> fromNMS(RecipeItemStack in) { return Arrays.stream(in.c).map(CraftItemStack::asBukkitCopy).collect(Collectors.toList()); }
public static List<ItemStack> fromNMS(RecipeItemStack in) {
in.buildChoices();
return Arrays.stream(in.c).map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
}

public static Sound fromNMS(SoundEffect s) { return CraftSound.getBukkit(s); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import net.minecraft.world.entity.animal.*;
import net.minecraft.world.entity.animal.allay.AllayAi;
import net.minecraft.world.entity.animal.axolotl.AxolotlAi;
import net.minecraft.world.entity.animal.camel.CamelAi;
import net.minecraft.world.entity.animal.frog.FrogAi;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
import net.minecraft.world.entity.boss.enderdragon.phases.*;
Expand Down Expand Up @@ -1628,6 +1629,7 @@ public void updateActivities(Creature c) {
else if (c instanceof Axolotl) AxolotlAi.updateActivity((net.minecraft.world.entity.animal.axolotl.Axolotl) nms);
else if (c instanceof Frog) FrogAi.updateActivity((net.minecraft.world.entity.animal.frog.Frog) nms);
else if (c instanceof org.bukkit.entity.Warden) WardenAi.updateActivity((Warden) nms);
else if (c instanceof Camel) CamelAi.updateActivity((net.minecraft.world.entity.animal.camel.Camel) nms);
}

public static MemoryModuleType<?> toNMS(Memory<?> mem) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.gamercoder215.mobchip.bukkit;

import me.gamercoder215.mobchip.ai.behavior.CamelBehavior;
import org.bukkit.entity.Camel;

class BukkitCamelBehavior extends BukkitUpdatableCreatureBehavior implements CamelBehavior {

final Camel m;

public BukkitCamelBehavior(Camel m) {
super(m);
this.m = m;
}

@Override
public void sit(int minimalPoseTicks) {
wrapper.runBehavior(m, "CamelAi$RandomSitting", "net.minecraft.world.entity.animal.camel", minimalPoseTicks);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import net.minecraft.world.entity.animal.*;
import net.minecraft.world.entity.animal.allay.AllayAi;
import net.minecraft.world.entity.animal.axolotl.AxolotlAi;
import net.minecraft.world.entity.animal.camel.CamelAi;
import net.minecraft.world.entity.animal.frog.FrogAi;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
import net.minecraft.world.entity.boss.enderdragon.phases.*;
Expand Down Expand Up @@ -1628,6 +1629,7 @@ public void updateActivities(Creature c) {
else if (c instanceof Axolotl) AxolotlAi.updateActivity((net.minecraft.world.entity.animal.axolotl.Axolotl) nms);
else if (c instanceof Frog) FrogAi.updateActivity((net.minecraft.world.entity.animal.frog.Frog) nms);
else if (c instanceof org.bukkit.entity.Warden) WardenAi.updateActivity((Warden) nms);
else if (c instanceof Camel) CamelAi.updateActivity((net.minecraft.world.entity.animal.camel.Camel) nms);
}

public static MemoryModuleType<?> toNMS(Memory<?> mem) {
Expand Down

0 comments on commit 3540675

Please sign in to comment.