Added ScriptBlock and ScriptNbt support to scripting API

This commit is contained in:
luisc committed 2021-10-12 03:23:56 -05:00
1 parent 6752f8baec
commit 699182f4c0
9 files changed
+339 -4

No files matched your search

@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import noppes.npcs.NoppesUtilServer;
@@ -57,11 +58,11 @@ public class ScriptWorld implements IWorld{
* @param z World position z
* @return The block at the given position. Returns null if there isn't a block
*/
public ScriptItemStack getBlock(int x, int y, int z){
public IBlock getBlock(int x, int y, int z){
Block block = world.getBlock(x, y, z);
if(block == null || block.isAir(world, x, y, z))
return null;
return new ScriptItemStack(new ItemStack(block, 1, world.getBlockMetadata(x, y, z)));
return new ScriptBlock(world, block, new BlockPos(x,y,z));
}
/**
@@ -345,7 +346,11 @@ public class ScriptWorld implements IWorld{
public ScriptScoreboard getScoreboard(){
return new ScriptScoreboard();
}
public BlockPos getMCBlockPos(int x, int y, int z){
return new BlockPos(x,y,z);
}
/**
* @since 1.7.10c
* Expert use only