ScriptEntity:

-Added getEntityId() function
-Moved getUniqueId() function

ScriptWorld:
-Added getPlayerByUUID(uuidstring) function
-Added several functions from World and WorldServer: isBlockFreezable,isBlockFreezableNaturally,canBlockFreeze,canBlockFreezeBody,canSnowAt,canSnowAtBody,getTopBlock,getHeightValue,getChunkHeightMapMinimum,getBlockMetadata,setBlockMetadataWithNotify,canBlockSeeTheSky,getFullBlockLightValue,getBlockLightValue,playSoundAtEntity,playSoundToNearExcept,getEntityByID,spawnEntityInWorld,getClosestPlayerToEntity,getClosestPlayer,getClosestVulnerablePlayerToEntity,getClosestVulnerablePlayer,countEntities,setTileEntity,removeTileEntity,isBlockFullCube,getSeed,setSpawnLocation,canLightningStrikeAt,isBlockHighHumidity

ScriptTileEntity:
Added a ScriptTileEntity class for MC Tile Entities, with nearly all its functions.

ScriptBlock:
-Added getTileEntity() and setTileEntity() functions using the new ScriptTileEntity class as a return value and parameter respectively.

API:
-Added playSoundAtEntity and playSoundToNearExcept functions.
-Added set/getMOTD() functions.
This commit is contained in:
Luis C.M committed 2022-05-03 23:09:21 -05:00
1 parent 80e3c075c7
commit bfd872a239
7 files changed
+332 -5

No files matched your search

@@ -0,0 +1,61 @@
package noppes.npcs.scripted;
import jdk.nashorn.internal.ir.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.ITileEntity;
public class ScriptTileEntity<T extends TileEntity> implements ITileEntity {
protected T tileEntity;
public ScriptTileEntity(T tileEntity) { this.tileEntity = tileEntity; }
public int getBlockMetadata(){
return tileEntity.getBlockMetadata();
}
public ScriptWorld getWorld(){
return (ScriptWorld) NpcAPI.Instance().getIWorld((WorldServer) tileEntity.getWorldObj());
}
public TileEntity getMCTileEntity() {
return this.tileEntity;
}
public void readFromNBT(INbt nbt){
this.tileEntity.readFromNBT(nbt.getMCNBT());
}
public double getDistanceFrom(double x, double y, double z){
return this.tileEntity.getDistanceFrom(x,y,z);
}
public ScriptBlock getBlockType(){
return new ScriptBlock(tileEntity.getWorldObj(), tileEntity.getBlockType(), new BlockPos(tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord));
}
public boolean isInvalid(){
return tileEntity.isInvalid();
}
public void invalidate(){
tileEntity.invalidate();
}
public void validate() {
tileEntity.validate();
}
public void updateContainingBlockInfo(){
tileEntity.updateContainingBlockInfo();
}
public INbt getNBT() {
NBTTagCompound compound = new NBTTagCompound();
this.tileEntity.writeToNBT(compound);
return NpcAPI.Instance().getINbt(compound);
}
}