add clickable commands
This commit is contained in:
parent
dabef4a3fd
commit
73962c7ecd
16 changed files with 147 additions and 133 deletions
|
@ -878,7 +878,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
BlockPos pos = origin;
|
||||
int radius = SVars.spawnRadius;
|
||||
if(radius > 0) {
|
||||
pos = world.getTopSolidOrLiquidBlock(pos.add(
|
||||
pos = world.getHighestFreePos(pos.add(
|
||||
ExtMath.clampi(world.rand.excl(-radius, radius), -World.MAX_SIZE + 1, World.MAX_SIZE - 1), 0,
|
||||
ExtMath.clampi(world.rand.excl(-radius, radius), -World.MAX_SIZE + 1, World.MAX_SIZE - 1)));
|
||||
}
|
||||
|
@ -1162,7 +1162,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
newZ = ((double)pos.getZ()) + 0.5;
|
||||
}
|
||||
else {
|
||||
pos = world.getTopSolidOrLiquidBlock(new BlockPos(newX, 0, newZ));
|
||||
pos = world.getHighestFreePos(new BlockPos(newX, 0, newZ));
|
||||
newX = ((double)pos.getX()) + 0.5;
|
||||
newY = (double)pos.getY();
|
||||
newZ = ((double)pos.getZ()) + 0.5;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class BiomeTian extends GenBiome
|
|||
{
|
||||
int i = rand.chOffset();
|
||||
int j = rand.chOffset();
|
||||
this.spikeGen.generate(worldIn, rand, worldIn.getTopSolidOrLiquidBlock(pos.add(i, 0, j)));
|
||||
this.spikeGen.generate(worldIn, rand, worldIn.getHighestFreePos(pos.add(i, 0, j)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,28 +297,28 @@ public abstract class GenBiome implements IBiome {
|
|||
{
|
||||
int j = rand.chOffset();
|
||||
int k = rand.chOffset();
|
||||
this.sandGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(j, 0, k)));
|
||||
this.sandGen.generate(world, rand, world.getHighestFreePos(pos.add(j, 0, k)));
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < this.clayPerChunk; ++i1)
|
||||
{
|
||||
int l1 = rand.chOffset();
|
||||
int i6 = rand.chOffset();
|
||||
this.clayGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(l1, 0, i6)));
|
||||
this.clayGen.generate(world, rand, world.getHighestFreePos(pos.add(l1, 0, i6)));
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < this.sandPerChunk; ++j1)
|
||||
{
|
||||
int i2 = rand.chOffset();
|
||||
int j6 = rand.chOffset();
|
||||
this.gravelAsSandGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(i2, 0, j6)));
|
||||
this.gravelAsSandGen.generate(world, rand, world.getHighestFreePos(pos.add(i2, 0, j6)));
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < this.clayExtPerChunk; ++i1)
|
||||
{
|
||||
int l1 = rand.chOffset();
|
||||
int i6 = rand.chOffset();
|
||||
this.clayGenExt.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(l1, 0, i6)));
|
||||
this.clayGenExt.generate(world, rand, world.getHighestFreePos(pos.add(l1, 0, i6)));
|
||||
}
|
||||
|
||||
int k1 = this.treesPerChunk;
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
|||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.color.TextColor;
|
||||
import common.util.BlockPos;
|
||||
import common.util.CharValidator;
|
||||
import common.util.Vec3;
|
||||
|
@ -22,6 +23,10 @@ public abstract class Command implements Executable {
|
|||
private int parPos = 0;
|
||||
private boolean parReq = true;
|
||||
|
||||
public static String asCommand(TextColor color, String command, Object ... args) {
|
||||
return String.format(TextColor.DGRAY + "[" + TextColor.COMMAND + "%s" + TextColor.DGRAY + "]" + color, String.format(command, args));
|
||||
}
|
||||
|
||||
protected Command(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package server.command.commands;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.TextColor;
|
||||
import common.entity.Entity;
|
||||
import common.util.BlockPos;
|
||||
import server.command.Command;
|
||||
|
@ -21,7 +22,8 @@ public class CommandFind extends Command {
|
|||
for(Entity entity : entities) {
|
||||
if(entity.isEntityAlive()) {
|
||||
BlockPos pos = entity.getPosition();
|
||||
exec.log("%s bei %d, %d, %d in %s gefunden", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getNameString());
|
||||
exec.log("%s bei %d, %d, %d in %s gefunden %s", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getNameString(),
|
||||
asCommand(TextColor.RESET, "tp #%d", entity.getId()));
|
||||
done++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public abstract class Spawner {
|
|||
for(int n = 0; n < count; ++n) {
|
||||
boolean flag = false;
|
||||
for(int m = 0; !flag && m < 4; ++m) {
|
||||
BlockPos pos = world.getTopSolidOrLiquidBlock(new BlockPos(mx, 0, mz));
|
||||
BlockPos pos = world.getHighestFreePos(new BlockPos(mx, 0, mz));
|
||||
if(canSpawnAt(EntityWaterNPC.class.isAssignableFrom(entry.type), world, pos)) {
|
||||
EntityLiving entity;
|
||||
try {
|
||||
|
|
|
@ -2268,27 +2268,27 @@ public final class WorldServer extends AWorldServer {
|
|||
return false;
|
||||
}
|
||||
|
||||
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos) {
|
||||
public BlockPos getHighestFreePos(BlockPos pos) {
|
||||
ChunkServer chunk = this.getChunk(pos);
|
||||
int h = chunk.getTopSegment();
|
||||
if(h == Integer.MIN_VALUE)
|
||||
return new BlockPos(pos.getX(), 0, pos.getZ());
|
||||
BlockPos blockpos = new BlockPos(pos.getX(), h + 16, pos.getZ());
|
||||
BlockPos blockpos1;
|
||||
BlockPos free = new BlockPos(pos.getX(), h + 16, pos.getZ());
|
||||
BlockPos down;
|
||||
h = chunk.getBottomSegment();
|
||||
if(blockpos.getY() - h > 512)
|
||||
h = blockpos.getY() - 512;
|
||||
if(free.getY() - h > 512)
|
||||
h = free.getY() - 512;
|
||||
|
||||
for(; blockpos.getY() >= h; blockpos = blockpos1) {
|
||||
blockpos1 = blockpos.down();
|
||||
Material material = chunk.getBlock(blockpos1).getMaterial();
|
||||
for(; free.getY() >= h; free = down) {
|
||||
down = free.down();
|
||||
Material material = chunk.getBlock(down).getMaterial();
|
||||
|
||||
if(material.blocksMovement() && material != Material.LEAVES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return blockpos;
|
||||
return free;
|
||||
}
|
||||
|
||||
public void removePlayerEntityDangerously(Entity entityIn) {
|
||||
|
|
|
@ -327,7 +327,7 @@ public class StructureScattered
|
|||
|
||||
if (p_74935_2_.isVecInside(blockpos$mutableblockpos))
|
||||
{
|
||||
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.getSeaLevel());
|
||||
i += Math.max(worldIn.getHighestFreePos(blockpos$mutableblockpos).getY(), worldIn.getSeaLevel());
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1361,7 +1361,7 @@ public class StructureVillage
|
|||
|
||||
if (structureBoundingBoxIn.isVecInside(blockpos))
|
||||
{
|
||||
blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down();
|
||||
blockpos = worldIn.getHighestFreePos(blockpos).down();
|
||||
worldIn.setState(blockpos, iblockstate, 2);
|
||||
worldIn.setState(blockpos.down(), iblockstate1, 2);
|
||||
}
|
||||
|
@ -1581,7 +1581,7 @@ public class StructureVillage
|
|||
|
||||
if (p_74889_2_.isVecInside(blockpos$mutableblockpos))
|
||||
{
|
||||
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.getSeaLevel());
|
||||
i += Math.max(worldIn.getHighestFreePos(blockpos$mutableblockpos).getY(), worldIn.getSeaLevel());
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue