2021-10-18 06:33:39 -05:00
package noppes.npcs.scripted.interfaces ;
2021-09-30 21:44:30 -05:00
2021-10-12 03:23:56 -05:00
import net.minecraft.util.math.BlockPos ;
2021-10-19 16:59:09 -05:00
import net.minecraft.world.WorldServer ;
2022-05-27 11:28:01 -05:00
import noppes.npcs.scripted.ScriptScoreboard ;
2022-05-11 16:43:14 -05:00
import noppes.npcs.scripted.interfaces.entity.IEntity ;
2022-05-11 22:08:31 -05:00
import noppes.npcs.scripted.interfaces.entity.IPlayer ;
2022-05-11 16:43:14 -05:00
import noppes.npcs.scripted.interfaces.item.IItemStack ;
2021-09-30 21:44:30 -05:00
public interface IWorld {
/**
* @return The worlds time
*/
2022-05-11 16:31:14 -05:00
long getTime ();
2021-09-30 21:44:30 -05:00
/**
* @return The total world time
*/
2022-05-11 16:31:14 -05:00
long getTotalTime ();
2021-09-30 21:44:30 -05:00
2022-05-03 23:09:21 -05:00
boolean areAllPlayersAsleep ();
2021-09-30 21:44:30 -05:00
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @return The block at the given position. Returns null if there isn't a block
*/
2021-10-12 03:23:56 -05:00
public IBlock getBlock ( int x , int y , int z );
2022-05-27 15:31:02 -05:00
2022-05-26 02:10:25 -05:00
/**
* @param pos
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock ( IPos pos );
2021-09-30 21:44:30 -05:00
2022-05-17 18:02:09 -05:00
/**
*
* @return The top-most block in the world as an IBlock object.
*/
2022-05-03 23:09:21 -05:00
IBlock getTopBlock ( int x , int z );
2022-05-11 16:31:14 -05:00
boolean isBlockFreezable ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean isBlockFreezableNaturally ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canBlockFreeze ( int x , int y , int z , boolean adjacentToWater );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canBlockFreezeBody ( int x , int y , int z , boolean adjacentToWater );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canSnowAt ( int x , int y , int z , boolean checkLight );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canSnowAtBody ( int x , int y , int z , boolean checkLight );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
* @return The Y-value of the world at this x & z value based on the height map of the world.
*/
2022-05-11 16:31:14 -05:00
int getHeightValue ( int x , int z );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
* @return The minimum Y-value of the world at this x & z value based on the height map of the world.
*/
2022-05-11 16:31:14 -05:00
int getChunkHeightMapMinimum ( int x , int z );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
* @return The metadata of the block at this position.
*/
2022-05-11 16:31:14 -05:00
int getBlockMetadata ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean setBlockMetadataWithNotify ( int x , int y , int z , int metadata , int flag );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canBlockSeeTheSky ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
int getFullBlockLightValue ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
int getBlockLightValue ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
void playSoundAtEntity ( IEntity entity , String sound , float volume , float pitch );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
void playSoundToNearExcept ( IPlayer player , String sound , float volume , float pitch );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
IEntity getEntityByID ( int id );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
boolean spawnEntityInWorld ( IEntity entity );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
IPlayer getClosestPlayerToEntity ( IEntity entity , double range );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
IPlayer getClosestPlayer ( double x , double y , double z , double range );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
IPlayer getClosestVulnerablePlayerToEntity ( IEntity entity , double range );
2022-05-03 23:09:21 -05:00
2022-05-11 22:08:31 -05:00
IPlayer getClosestVulnerablePlayer ( double x , double y , double z , double range );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
*
* @param entity The entity whose type will be used as a parameter
* @return The amount of entities of the given type in the world.
*/
2022-05-11 22:08:31 -05:00
int countEntities ( IEntity entity );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
* Sets the block's tile entity at the given position.
*/
2022-05-11 22:08:31 -05:00
void setTileEntity ( int x , int y , int z , ITileEntity tileEntity );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
* Removes the block's tile entity at the given position.
*/
2022-05-11 16:31:14 -05:00
void removeTileEntity ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-17 18:02:09 -05:00
/**
*
* @return True if the block at this position is of cubic shape. (Not a stair, slab, etc.)
*/
2022-05-11 16:31:14 -05:00
boolean isBlockFullCube ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
long getSeed ();
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
void setSpawnLocation ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
2022-05-11 16:31:14 -05:00
boolean canLightningStrikeAt ( int x , int y , int z );
2022-05-03 23:09:21 -05:00
boolean isBlockHighHumidity ( int x , int y , int z );
2021-09-30 21:44:30 -05:00
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @return Text from signs
* @since 1.7.10d
*/
2022-05-11 16:31:14 -05:00
String getSignText ( int x , int y , int z );
2021-09-30 21:44:30 -05:00
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @param item The block to be set
*/
2022-05-27 15:31:02 -05:00
public void setBlock ( int x , int y , int z , IItemStack item );
2022-05-26 20:55:11 -05:00
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @param block The block to be set
*/
2022-05-26 02:10:25 -05:00
public void setBlock ( int x , int y , int z , IBlock block );
2021-09-30 21:44:30 -05:00
/**
* @param x World position x
* @param y World position y
* @param z World position z
*/
public void removeBlock ( int x , int y , int z );
2022-05-27 15:31:02 -05:00
2022-05-26 20:55:11 -05:00
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
2022-05-27 15:31:02 -05:00
* @param startPos
2022-05-26 20:55:11 -05:00
* @param lookVector should be a normalized direction vector
2022-05-27 15:31:02 -05:00
* @param maxDistance
2022-05-26 20:55:11 -05:00
* @return the first detected block but null if maxDistance is reached
*/
2022-05-26 20:44:44 -05:00
public IBlock rayCastBlock ( double [] startPos , double [] lookVector , int maxDistance );
2022-05-27 15:31:02 -05:00
2022-05-26 20:55:11 -05:00
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
2022-05-27 15:31:02 -05:00
* @param startPos
2022-05-26 20:55:11 -05:00
* @param lookVector will normalize x, y, z to get a direction vector
2022-05-27 15:31:02 -05:00
* @param maxDistance
2022-05-26 20:55:11 -05:00
* @return the first detected block but null if maxDistance is reached
*/
2022-05-26 20:44:44 -05:00
public IBlock rayCastBlock ( IPos startPos , IPos lookVector , int maxDistance );
2022-05-27 15:31:02 -05:00
2022-05-26 20:55:11 -05:00
/**
* @param startPos
* @param maxHeight
2022-05-27 15:31:02 -05:00
* @return the position of the closest block of air to startPos
2022-05-26 20:55:11 -05:00
*/
public IPos getNearestAir ( IPos startPos , int maxHeight );
2022-05-27 15:31:02 -05:00
2022-05-26 20:55:11 -05:00
/**
* @param x
* @param y
* @param z
* @return can the block at this position see the sky or are there no blocks above this one
*/
2022-05-24 03:06:16 -05:00
public boolean canSeeSky ( int x , int y , int z );
2022-05-27 15:31:02 -05:00
2022-05-26 20:55:11 -05:00
/**
* @param pos
* @return can the block at this position see the sky or are there no blocks above this one
*/
public boolean canSeeSky ( IPos pos );
2021-09-30 21:44:30 -05:00
/**
* @param name The name of the player to be returned
* @return The Player with name. Null is returned when the player isnt found
*/
2022-05-11 22:08:31 -05:00
IPlayer getPlayer ( String name );
2021-09-30 21:44:30 -05:00
2022-05-11 22:08:31 -05:00
IPlayer getPlayerByUUID ( String uuid );
2021-09-30 21:44:30 -05:00
/**
* @param time The world time to be set
*/
2022-05-11 16:31:14 -05:00
void setTime ( long time );
2021-09-30 21:44:30 -05:00
/**
* @return Whether or not its daytime
*/
2022-05-11 16:31:14 -05:00
boolean isDay ();
2021-09-30 21:44:30 -05:00
/**
* @return Whether or not its currently raining
*/
2022-05-11 16:31:14 -05:00
boolean isRaining ();
2021-09-30 21:44:30 -05:00
/**
* @param bo Set if it's raining
*/
2022-05-11 16:31:14 -05:00
void setRaining ( boolean bo );
2021-09-30 21:44:30 -05:00
/**
* @param x The x position
* @param y The y position
* @param z The z position
*/
2022-05-11 16:31:14 -05:00
void thunderStrike ( double x , double y , double z );
2021-09-30 21:44:30 -05:00
/**
* Sends a packet from the server to the client everytime its called. Probably should not use this too much.
* @param particle Particle name. Particle name list: http://minecraft.gamepedia.com/Particles
* @param x The x position
* @param y The y position
* @param z The z position
* @param dx Usually used for the x motion
* @param dy Usually used for the y motion
* @param dz Usually used for the z motion
* @param speed Speed of the particles, usually between 0 and 1
* @param count Particle count
*/
2022-05-11 16:31:14 -05:00
void spawnParticle ( String particle , double x , double y , double z , double dx , double dy , double dz , double speed , int count );
2021-09-30 21:44:30 -05:00
/**
* @param id The items name
* @param damage The damage value
* @param size The number of items in the item
* @return Returns the item
*/
2022-05-11 16:31:14 -05:00
IItemStack createItem ( String id , int damage , int size );
2021-09-30 21:44:30 -05:00
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
2022-05-11 22:08:31 -05:00
* @return Returns IEntityParticle object
2021-09-30 21:44:30 -05:00
*/
2022-05-17 18:02:09 -05:00
@Deprecated
2022-05-11 22:08:31 -05:00
IParticle createEntityParticle ( String directory );
2021-09-30 21:44:30 -05:00
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
2022-05-11 16:31:14 -05:00
Object getTempData ( String key );
2021-09-30 21:44:30 -05:00
/**
* Tempdata gets cleared when the server restarts. All worlds share the same temp data.
* @param key The key for the data stored
* @param value The data stored
*/
2022-05-11 16:31:14 -05:00
void setTempData ( String key , Object value );
2021-09-30 21:44:30 -05:00
/**
* @param key The key thats going to be tested against the temp data
* @return Whether or not temp data containes the key
*/
2022-05-11 16:31:14 -05:00
boolean hasTempData ( String key );
2021-09-30 21:44:30 -05:00
/**
* @param key The key for the temp data to be removed
*/
2022-05-11 16:31:14 -05:00
void removeTempData ( String key );
2021-09-30 21:44:30 -05:00
/**
* Removes all tempdata
*/
2022-05-11 16:31:14 -05:00
void clearTempData ();
2021-09-30 21:44:30 -05:00
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
2022-05-11 16:31:14 -05:00
Object getStoredData ( String key );
2021-09-30 21:44:30 -05:00
/**
* Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved
* @param key The key for the data stored
* @param value The data stored. This data can be either a Number or a String. Other data is not stored
*/
2022-05-11 16:31:14 -05:00
void setStoredData ( String key , Object value );
2021-09-30 21:44:30 -05:00
/**
* @param key The key of the data to be checked
* @return Returns whether or not the stored data contains the key
*/
2022-05-11 16:31:14 -05:00
boolean hasStoredData ( String key );
2021-09-30 21:44:30 -05:00
/**
* @param key The key of the data to be removed
*/
2022-05-11 16:31:14 -05:00
void removeStoredData ( String key );
2021-09-30 21:44:30 -05:00
/**
* Remove all stored data
*/
2022-05-11 16:31:14 -05:00
void clearStoredData ();
2021-09-30 21:44:30 -05:00
/**
* @param x Position x
* @param y Position y
* @param z Position z
* @param range Range of the explosion
* @param fire Whether or not the explosion does fire damage
* @param grief Whether or not the explosion does damage to blocks
*/
2022-05-11 16:31:14 -05:00
void explode ( double x , double y , double z , float range , boolean fire , boolean grief );
2021-09-30 21:44:30 -05:00
2022-05-11 22:08:31 -05:00
IPlayer [] getAllServerPlayers ();
2021-09-30 21:44:30 -05:00
2022-05-24 03:06:16 -05:00
public String [] getPlayerNames ();
2021-09-30 21:44:30 -05:00
/**
* @since 1.7.10c
* @param x Position x
* @param z Position z
* @return Returns the name of the biome
*/
2022-05-11 16:31:14 -05:00
String getBiomeName ( int x , int z );
2021-09-30 21:44:30 -05:00
/**
* Lets you spawn a server side cloned entity
* @param x The x position the clone will be spawned at
* @param y The y position the clone will be spawned at
* @param z The z position the clone will be spawned at
* @param tab The tab in which the clone is
* @param name Name of the cloned entity
* @return Returns the entity which was spawned
*/
2022-05-11 22:08:31 -05:00
IEntity spawnClone ( int x , int y , int z , int tab , String name );
2021-09-30 21:44:30 -05:00
2022-05-11 16:31:14 -05:00
ScriptScoreboard getScoreboard ();
2021-09-30 21:44:30 -05:00
2022-05-17 18:02:09 -05:00
/**
*
* @return An obfuscated MC BlockPos object.
*/
2021-10-12 03:23:56 -05:00
BlockPos getMCBlockPos ( int x , int y , int z );
2021-09-30 21:44:30 -05:00
/**
* @since 1.7.10c
* Expert use only
* @return Returns minecraft world object
*/
2022-05-11 16:31:14 -05:00
WorldServer getMCWorld ();
2021-11-22 01:10:27 -06:00
2022-05-17 18:02:09 -05:00
/**
*
* @return The ID of this world's dimension. 0 for overworld, 1 for End, -1 for Nether, etc.
*/
2022-05-11 16:31:14 -05:00
int getDimensionID ();
2021-09-30 21:44:30 -05:00
}