Skip to content

Commit

Permalink
Remove NBTStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 10, 2024
1 parent 34a4a92 commit 80a6a0b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 401 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public float getCost(BlockSource source, PathPoint point) {
return 2F;
if (isLiquidOrInLiquid(source.getWorld().getBlockAt(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()))) {
if (in == Material.LAVA)
return 3F;
return 4F;
return 2F;
}
return 0F; // TODO: add light level-specific costs?
Expand Down Expand Up @@ -102,23 +102,23 @@ public void run() {
if (next.getY() > prev.getY()) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.3));
if (sneakingForScaffolding) {
npc.data().set(NPC.Metadata.SNEAKING, sneakingForScaffolding = false);
npc.setSneaking(sneakingForScaffolding = false);
}
} else if (isScaffolding(in) || isScaffolding(next.getType())) {
if (loc.distance(next.getLocation().add(0.5, 1, 0.5)) < 0.4) {
npc.data().set(NPC.Metadata.SNEAKING, sneakingForScaffolding = true);
npc.setSneaking(sneakingForScaffolding = true);
}
} else if (next.getY() < prev.getY()) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(-0.2));
}
} else if (sneakingForScaffolding) {
npc.data().set(NPC.Metadata.SNEAKING, sneakingForScaffolding = false);
npc.setSneaking(sneakingForScaffolding = false);
}
}
});
npc.getNavigator().getLocalParameters().addSingleUseCallback(cancelReason -> {
npc.data().set("running-ladder", false);
npc.data().set(NPC.Metadata.SNEAKING, false);
npc.setSneaking(false);
});
added = true;
}
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/net/citizensnpcs/api/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ public interface NPC extends Agent, Cloneable {
*/
public void setProtected(boolean isProtected);

public void setSneaking(boolean sneaking);

/**
* Set the NPC to use Minecraft AI where possible. Note that the NPC may not always behave exactly like a Minecraft
* mob would because of additional Citizens APIs.
Expand Down Expand Up @@ -554,11 +556,6 @@ public enum Metadata {
* Whether to suppress sounds.
*/
SILENT("silent-sounds", Boolean.class),
/**
* Whether to sneak.
*/
@Deprecated
SNEAKING("citizens-sneaking", Boolean.class),
/**
* The initial no damage ticks on spawn, defaults to 20. Integer
*/
Expand Down
Loading

0 comments on commit 80a6a0b

Please sign in to comment.