Files
CustomNPC-Plus/src/main/java/noppes/npcs/scripted/interfaces/IWorld.java
T

376 lines
11 KiB
Java
Raw Normal View History

package noppes.npcs.scripted.interfaces;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import noppes.npcs.scripted.ScriptScoreboard;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IWorld {
/**
* @return The worlds time
*/
long getTime();
/**
* @return The total world time
*/
long getTotalTime();
2022-05-03 23:09:21 -05:00
boolean areAllPlayersAsleep();
/**
* @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
*/
public IBlock getBlock(int x, int y, int z);
2022-05-27 15:31:02 -05:00
/**
* @param pos
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock(IPos pos);
/**
*
* @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);
boolean isBlockFreezable(int x, int y, int z);
2022-05-03 23:09:21 -05:00
boolean isBlockFreezableNaturally(int x, int y, int z);
2022-05-03 23:09:21 -05:00
boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater);
2022-05-03 23:09:21 -05:00
boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater);
2022-05-03 23:09:21 -05:00
boolean canSnowAt(int x, int y, int z, boolean checkLight);
2022-05-03 23:09:21 -05:00
boolean canSnowAtBody(int x, int y, int z, boolean checkLight);
2022-05-03 23:09:21 -05:00
/**
* @return The Y-value of the world at this x & z value based on the height map of the world.
*/
int getHeightValue(int x, int z);
2022-05-03 23:09:21 -05:00
/**
* @return The minimum Y-value of the world at this x & z value based on the height map of the world.
*/
int getChunkHeightMapMinimum(int x, int z);
2022-05-03 23:09:21 -05:00
/**
* @return The metadata of the block at this position.
*/
int getBlockMetadata(int x, int y, int z);
2022-05-03 23:09:21 -05:00
boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag);
2022-05-03 23:09:21 -05:00
boolean canBlockSeeTheSky(int x, int y, int z);
2022-05-03 23:09:21 -05:00
int getFullBlockLightValue(int x, int y, int z);
2022-05-03 23:09:21 -05:00
int getBlockLightValue(int x, int y, int z);
2022-05-03 23:09:21 -05:00
void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
2022-05-03 23:09:21 -05:00
void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
2022-05-03 23:09:21 -05:00
IEntity getEntityByID(int id);
2022-05-03 23:09:21 -05:00
boolean spawnEntityInWorld(IEntity entity);
2022-05-03 23:09:21 -05:00
IPlayer getClosestPlayerToEntity(IEntity entity, double range);
2022-05-03 23:09:21 -05:00
IPlayer getClosestPlayer(double x, double y, double z, double range);
2022-05-03 23:09:21 -05:00
IPlayer getClosestVulnerablePlayerToEntity(IEntity entity, double range);
2022-05-03 23:09:21 -05:00
IPlayer getClosestVulnerablePlayer(double x, double y, double z, double range);
2022-05-03 23:09:21 -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.
*/
int countEntities(IEntity entity);
2022-05-03 23:09:21 -05:00
2022-06-12 01:26:23 -05:00
IEntity[] getLoadedEntities();
/**
* Sets the block's tile entity at the given position.
*/
void setTileEntity(int x, int y, int z, ITileEntity tileEntity);
2022-05-03 23:09:21 -05:00
/**
* Removes the block's tile entity at the given position.
*/
void removeTileEntity(int x, int y, int z);
2022-05-03 23:09:21 -05:00
/**
*
* @return True if the block at this position is of cubic shape. (Not a stair, slab, etc.)
*/
boolean isBlockFullCube(int x, int y, int z);
2022-05-03 23:09:21 -05:00
long getSeed();
2022-05-03 23:09:21 -05:00
void setSpawnLocation(int x, int y, int z);
2022-05-03 23:09:21 -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);
/**
* @param x World position x
* @param y World position y
* @param z World position z
* @return Text from signs
* @since 1.7.10d
*/
String getSignText(int x, int y, int z);
/**
* @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
*/
public void setBlock(int x, int y, int z, IBlock 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);
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
*/
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);
/**
* @param name The name of the player to be returned
* @return The Player with name. Null is returned when the player isnt found
*/
IPlayer getPlayer(String name);
IPlayer getPlayerByUUID(String uuid);
/**
* @param time The world time to be set
*/
void setTime(long time);
/**
* @return Whether or not its daytime
*/
boolean isDay();
/**
* @return Whether or not its currently raining
*/
boolean isRaining();
/**
* @param bo Set if it's raining
*/
void setRaining(boolean bo);
/**
* @param x The x position
* @param y The y position
* @param z The z position
*/
void thunderStrike(double x, double y, double z);
/**
* 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
*/
void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count);
/**
* @param id The items name
* @param damage The damage value
* @param size The number of items in the item
* @return Returns the item
*/
IItemStack createItem(String id, int damage, int size);
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
* @return Returns IEntityParticle object
*/
@Deprecated
IParticle createEntityParticle(String directory);
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
Object getTempData(String key);
/**
* 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
*/
void setTempData(String key, Object value);
/**
* @param key The key thats going to be tested against the temp data
* @return Whether or not temp data containes the key
*/
boolean hasTempData(String key);
/**
* @param key The key for the temp data to be removed
*/
void removeTempData(String key);
/**
* Removes all tempdata
*/
void clearTempData();
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
Object getStoredData(String key);
/**
* 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
*/
void setStoredData(String key, Object value);
/**
* @param key The key of the data to be checked
* @return Returns whether or not the stored data contains the key
*/
boolean hasStoredData(String key);
/**
* @param key The key of the data to be removed
*/
void removeStoredData(String key);
/**
* Remove all stored data
*/
void clearStoredData();
/**
* @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
*/
void explode(double x, double y, double z, float range, boolean fire, boolean grief);
IPlayer[] getAllServerPlayers();
public String[] getPlayerNames();
/**
* @since 1.7.10c
* @param x Position x
* @param z Position z
* @return Returns the name of the biome
*/
String getBiomeName(int x, int z);
/**
* 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
2022-07-06 01:29:43 -07:00
* @param ignoreProtection Whether the spawning of this clone skips protection checks.
* @return Returns the entity which was spawned
*/
2022-07-06 01:29:43 -07:00
IEntity spawnClone(int x, int y, int z, int tab, String name, boolean ignoreProtection);
IEntity spawnClone(int x, int y, int z, int tab, String name);
ScriptScoreboard getScoreboard();
/**
*
* @return An obfuscated MC BlockPos object.
*/
BlockPos getMCBlockPos(int x, int y, int z);
/**
* @since 1.7.10c
* Expert use only
* @return Returns minecraft world object
*/
WorldServer getMCWorld();
/**
*
* @return The ID of this world's dimension. 0 for overworld, 1 for End, -1 for Nether, etc.
*/
int getDimensionID();
}