Added various things to the API and other small changes

This adds some useful functions to the api and a few other changes.
I had been creating a custom build of this mod while working on stuff because I couldn't figure out how to do certain things without changing the mod. So this is a collection api features that I think everyone would find useful.

Api additions:
-purchase counting, and disabling trades for the trader role. (if a trade is disabled the gui still says insufficient funds, maybe allow a custom message to appear) added get the traders currency items and sell items.
-if an npc's projectile does explosive damage, you can disable it destroying blocks even if mob griefing is on
-int arrays as stored data for entities
-entity.playSound(...)
-get set if npcs can drown
-player read and unread dialog
-player set faction points
-extra player.sendMessage functions to add custom colors/bold/underline
-player clear inventory
-get set if a follower npc is following a player or waiting
-a bunch of stuff to script faction
-is an item food and how many food points?
-get scoreboard team by it's name
-get and create factions from the script world
-world.rayCastBlockPos is used for getting what block a player is looking at.
-world.getNearestAir is meant to get the block of air above or around the result of world.rayCastBlockPos, or at least that's how I've been using it.

Changes:
-in NoppesUtilServer I feel like if an npc is cloned it's ticksExisted or age should bee zero
-follower npcs should have the canDespawn field automatically set to false...? maybe make it an option
This commit is contained in:
1whohears committed 2022-05-24 03:06:16 -05:00
1 parent 6fe16d1929
commit a4361b8420
21 files changed
+468 -13

No files matched your search

@@ -1,5 +1,8 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -42,13 +45,27 @@ public interface IWorld {
* @param item The block to be set
*/
public void setBlock(int x, int y, int z, ScriptItemStack item);
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @param block The block to be set
*/
public void setBlock(int x, int y, int z, Block block);
/**
* @param x World position x
* @param y World position y
* @param z World position z
*/
public void removeBlock(int x, int y, int z);
public Vec3 rayCastBlockPos(Vec3 pos, Vec3 look, int maxDistance);
public Vec3 getNearestAir(Vec3 pos, int maxHeight);
public boolean canSeeSky(int x, int y, int z);
/**
* @param name The name of the player to be returned
@@ -180,6 +197,8 @@ public interface IWorld {
public void explode(double x, double y, double z, float range, boolean fire, boolean grief);
public ScriptPlayer[] getAllServerPlayers();
public String[] getPlayerNames();
/**
* @since 1.7.10c
@@ -199,7 +218,20 @@ public interface IWorld {
* @return Returns the entity which was spawned
*/
public ScriptEntity spawnClone(int x, int y, int z, int tab, String name);
public boolean spawnEntity(Entity e);
/**
* Create a new default faction
* @param name The name of the new faction. If the name already exists an '_' will be added at the end
* @return The faction object which was created
*/
public ScriptFaction createFaction(String name);
public ScriptFaction getFactionFromName(String name);
public ScriptFaction getFactionFromId(int id);
public ScriptScoreboard getScoreboard();
BlockPos getMCBlockPos(int x, int y, int z);