mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 13:36:00 +00:00
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:
1 parent
6fe16d1929
commit
a4361b8420
21 files changed
+468
-13
No files matched your search
@@ -139,7 +139,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
public boolean updateClient = false;
|
||||
public boolean updateAI = false;
|
||||
|
||||
public boolean projectilesKeepTerrain = false;
|
||||
|
||||
public FlyingMoveHelper flyMoveHelper = new FlyingMoveHelper(this);
|
||||
public PathNavigate flyNavigator = new PathNavigateFlying(this, worldObj);
|
||||
|
||||
@@ -956,6 +957,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
totalTicksAlive = compound.getLong("TotalTicksAlive");
|
||||
|
||||
linkedName = compound.getString("LinkedNpcName");
|
||||
|
||||
projectilesKeepTerrain = compound.getBoolean("ProjectilesKeepTerrain");
|
||||
|
||||
if(!isRemote())
|
||||
LinkedNpcController.Instance.loadNpcData(this);
|
||||
|
||||
@@ -987,6 +991,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
compound.setLong("TotalTicksAlive", totalTicksAlive);
|
||||
compound.setInteger("ModRev", npcVersion);
|
||||
compound.setString("LinkedNpcName", linkedName);
|
||||
compound.setBoolean("ProjectilesKeepTerrain", projectilesKeepTerrain);
|
||||
}
|
||||
|
||||
public void updateHitbox() {
|
||||
|
||||
@@ -77,6 +77,7 @@ public class EntityProjectile extends EntityThrowable {
|
||||
public boolean accelerate = false;
|
||||
public boolean explosive = false;
|
||||
public boolean explosiveDamage = true;
|
||||
public boolean destroyTerrain = true;
|
||||
public int explosiveRadius = 0;
|
||||
public EnumPotionType effect = EnumPotionType.None;
|
||||
public int duration = 5;
|
||||
@@ -138,6 +139,7 @@ public class EntityProjectile extends EntityThrowable {
|
||||
if (isNPC) {
|
||||
this.npc = (EntityNPCInterface) this.thrower;
|
||||
this.getStatProperties(this.npc.stats);
|
||||
this.destroyTerrain = !this.npc.projectilesKeepTerrain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +564,7 @@ public class EntityProjectile extends EntityThrowable {
|
||||
|
||||
if (explosive){
|
||||
if (this.explosiveRadius != 0 || this.effect == EnumPotionType.None){
|
||||
boolean terraindamage = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") && explosiveDamage;
|
||||
boolean terraindamage = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") && explosiveDamage && destroyTerrain;
|
||||
Explosion explosion = new Explosion(worldObj, this, posX, posY, posZ, explosiveRadius);
|
||||
explosion.isFlaming = this.effect == EnumPotionType.Fire;
|
||||
explosion.isSmoking = terraindamage;
|
||||
|
||||
Reference in new issue
Block a user