Used interfaces in implementations instead of the real classes for most scripted classes.

This commit is contained in:
Luis C.M committed 2022-05-11 22:08:31 -05:00
1 parent 6896cec417
commit cf33b90b26
63 files changed
+466 -551

No files matched your search

@@ -9,9 +9,6 @@ import net.minecraft.entity.EntityCreature;
import noppes.npcs.scripted.ScriptFaction;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.ITimers;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.roles.*;
public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
@@ -167,7 +164,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* @param item The item you want to shoot
* @param accuracy Accuracy of the shot (0-100)
*/
void shootItem(ScriptLivingBase target, ScriptItemStack item, int accuracy);
void shootItem(IEntityLivingBase target, IItemStack item, int accuracy);
/**
* @param message The message the npc will say
@@ -177,7 +174,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @param message The message the npc will say
*/
void say(ScriptPlayer player, String message);
void say(IPlayer player, String message);
/**
* Kill the npc, doesnt't despawn it
@@ -211,7 +208,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @param item Item to be held in the right hand
*/
void setRightItem(ScriptItemStack item);
void setRightItem(IItemStack item);
/**
* @return The item held in the left hand
@@ -221,7 +218,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @param item Item to be held in the left hand
*/
void setLeftItem(ScriptItemStack item);
void setLeftItem(IItemStack item);
/**
* @return Returns the projectile the npc uses
@@ -231,7 +228,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @param item Item to be used as projectile
*/
void setProjectileItem(ScriptItemStack item);
void setProjectileItem(IItemStack item);
/**
*
@@ -288,7 +285,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* @param slot The armor slot to set. 0:head, 1:body, 2:legs, 3:boots
* @param item Item to be set as armor
*/
void setArmor(int slot, ScriptItemStack item);
void setArmor(int slot, IItemStack item);
/**
*
@@ -302,7 +299,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* @param slot The slot from the NPC's drop list to change
* @param item The item the drop list slot will be changed to
*/
void setLootItem(int slot, ScriptItemStack item);
void setLootItem(int slot, IItemStack item);
/**
*
@@ -488,7 +485,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* @param player The player this NPC becomes visible/invisible to
* @param visible True if you want the NPC to be invisible to the player, false otherwise
*/
void setVisibleTo(ScriptPlayer player, boolean visible);
void setVisibleTo(IPlayer player, boolean visible);
/**
*
@@ -497,7 +494,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* If setVisibleTo(player,visible) was not called to make this NPC invisible to the player at any point
* in the NPC's life, this function will return true regardless of the value of isVisible().
*/
boolean isVisibleTo(ScriptPlayer player);
boolean isVisibleTo(IPlayer player);
/**
* @param type The visibility type of the name, 0:visible, 1:invisible, 2:when-attacking
@@ -621,7 +618,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* @param player The player to give the item to
* @param item The item given to the player
*/
void giveItem(ScriptPlayer player, ScriptItemStack item);
void giveItem(IPlayer player, IItemStack item);
/**
@@ -8,10 +8,9 @@ package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.Entity;
import noppes.npcs.scripted.ScriptParticle;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IEntity<T extends Entity> {
@@ -129,14 +128,14 @@ public interface IEntity<T extends Entity> {
* @param range The search range for entities around this entity
* @return Array of entities within range
*/
ScriptEntity[] getSurroundingEntities(int range);
IEntity[] getSurroundingEntities(int range);
/**
* @param range The search range for entities around this entity
* @param type The EntityType you want to find
* @return Array of entities within range
*/
ScriptEntity[] getSurroundingEntities(int range, int type);
IEntity[] getSurroundingEntities(int range, int type);
/**
* @return Whether the entity is alive or not
@@ -249,27 +248,27 @@ public interface IEntity<T extends Entity> {
/**
* @param item Item to be dropped
*/
void dropItem(ScriptItemStack item);
void dropItem(IItemStack item);
/**
* @return Return the rider
*/
ScriptEntity getRider();
IEntity getRider();
/**
* @param entity The entity to ride this entity
*/
void setRider(ScriptEntity entity);
void setRider(IEntity entity);
/**
* @return Return the entity, this entity is riding
*/
ScriptEntity getMount();
IEntity getMount();
/**
* @param entity The entity this entity will mount
*/
void setMount(ScriptEntity entity);
void setMount(IEntity entity);
/**
* @see noppes.npcs.scripted.constants.EntityType
@@ -1,11 +1,8 @@
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.wrapper.ScriptDamageSource;
import noppes.npcs.scripted.ScriptDamageSource;
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
/**
@@ -20,7 +17,7 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
void hurt(float damage);
void hurt(float damage, ScriptEntity source);
void hurt(float damage, IEntity source);
void hurt(float damage, ScriptDamageSource damageSource);
@@ -36,12 +33,12 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
/**
* @param living Entity which this entity will attack
*/
void setAttackTarget(ScriptLivingBase living);
void setAttackTarget(IEntityLivingBase living);
/**
* @return The entity which this entity is attacking
*/
ScriptLivingBase getAttackTarget();
IEntityLivingBase getAttackTarget();
int getType();
@@ -51,7 +48,7 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @param entity Entity to check
* @return Whether or not this entity can see the given entity
*/
boolean canSeeEntity(ScriptEntity entity);
boolean canSeeEntity(IEntity entity);
/**
* Expert use only
@@ -97,7 +94,7 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @since 1.7.10c
* @param item The item to be set
*/
void setHeldItem(ScriptItemStack item);
void setHeldItem(IItemStack item);
/**
* Note not all Living Entities support this
@@ -112,5 +109,5 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head
* @param item Item to be set
*/
void setArmor(int slot, ScriptItemStack item);
void setArmor(int slot, IItemStack item);
}
@@ -4,13 +4,11 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import noppes.npcs.scripted.ScriptBlock;
import noppes.npcs.scripted.entity.ScriptDBCPlayer;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.item.ScriptItemStack;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
@@ -103,7 +101,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param item The item to be checked
* @return How many of this item the player has
*/
int inventoryItemCount(ScriptItemStack item);
int inventoryItemCount(IItemStack item);
/**
* @since 1.7.10d
@@ -116,7 +114,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param amount How many will be removed
* @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given
*/
boolean removeItem(ScriptItemStack item, int amount);
boolean removeItem(IItemStack item, int amount);
/**
* @since 1.7.10c
@@ -133,7 +131,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param amount The amount of the item to be added
* @return Returns whether or not it gave the item succesfully
*/
boolean giveItem(ScriptItemStack item, int amount);
boolean giveItem(IItemStack item, int amount);
/**
* @since 1.7.10c
@@ -157,7 +155,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
/**
* @param item The item to be removed from the players inventory
*/
void removeAllItems(ScriptItemStack item);
void removeAllItems(IItemStack item);
void setRotation(float rotationYaw, float rotationPitch);
@@ -169,11 +167,11 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
void mountEntity(Entity ridingEntity);
ScriptEntity dropOneItem(boolean dropStack);
IEntity dropOneItem(boolean dropStack);
boolean canHarvestBlock(ScriptBlock block);
boolean interactWith(ScriptEntity entity);
boolean interactWith(IEntity entity);
/**
* @param achievement The achievement id. For a complete list see http://minecraft.gamepedia.com/Achievements