1
0
Fork 0

misc updates, remove mipmapping

This commit is contained in:
Sen 2025-09-01 16:03:50 +02:00
parent 88a6cbe826
commit 1ce918c0af
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
377 changed files with 2910 additions and 3223 deletions

View file

@ -81,7 +81,7 @@ import common.packet.SPacketSkin;
import common.packet.SPacketTimeUpdate;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.EncryptUtil;
import common.util.ExtMath;
import common.util.Pair;
@ -91,7 +91,7 @@ import common.util.Color;
import common.util.Triplet;
import common.util.Util;
import common.util.Var;
import common.util.WorldPos;
import common.util.GlobalPos;
import common.vars.Vars;
import common.world.World;
import server.clipboard.ReorderRegistry;
@ -957,10 +957,10 @@ public final class Server implements IThreadListener, Executor {
return Thread.currentThread() == this.thread;
}
public Position getRandomSpawnPosition(WorldPos origin) {
public Position getRandomSpawnPosition(GlobalPos origin) {
WorldServer world = this.getWorld(origin.getDimension());
world = world == null ? this.space : world;
BlockPos pos = origin;
LocalPos pos = origin;
int radius = SVars.spawnRadius;
if(radius > 0) {
pos = world.getHighestFreePos(pos.add(
@ -968,7 +968,7 @@ public final class Server implements IThreadListener, Executor {
ExtMath.clampi(world.rand.excl(-radius, radius), -World.MAX_SIZE + 1, World.MAX_SIZE - 1)));
}
int y = pos.getY();
while(world.getState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock().getMaterial().blocksMovement() && y < 511)
while(world.getState(new LocalPos(pos.getX(), y, pos.getZ())).getBlock().getMaterial().blocksMovement() && y < 511)
y++;
return new Position(pos.getX() + 0.5, (double)y, pos.getZ() + 0.5, -180.0f + world.rand.floatv() * 360.0f, 0.0f, world);
}
@ -1007,7 +1007,7 @@ public final class Server implements IThreadListener, Executor {
else
player.onInitialSpawn(null);
if(tag == null)
player.moveToBlockPosAndAngles(new BlockPos(0, 16384, 0), 0.0f, 0.0f);
player.moveToBlockPosAndAngles(new LocalPos(0, 16384, 0), 0.0f, 0.0f);
Log.NETWORK.info(loginUser + "[" + connection.getCutAddress() + "] hat sich mit Objekt-ID "
+ player.getId() + " auf " + UniverseRegistry.getName(world.dimension) + ": "
@ -1108,15 +1108,15 @@ public final class Server implements IThreadListener, Executor {
public void recreatePlayer(Player conn) {
EntityNPC old = conn.getEntity();
BlockPos pos = old.getPosition();
LocalPos pos = old.getPosition();
WorldServer oldWorld = (WorldServer)old.getServerWorld();
oldWorld.removePlayerFromTrackers(old);
oldWorld.untrackEntity(old);
oldWorld.removePlayer(old);
oldWorld.removePlayerEntityDangerously(old);
WorldPos bed = old.getSpawnPoint();
WorldPos origin = old.getOrigin();
BlockPos spawn = null;
GlobalPos bed = old.getSpawnPoint();
GlobalPos origin = old.getOrigin();
LocalPos spawn = null;
String message = null;
WorldServer world = bed == null ? this.space : this.getWorld(bed.getDimension());
if(world == null) {
@ -1193,7 +1193,7 @@ public final class Server implements IThreadListener, Executor {
nplayer.onInitialSpawn(null);
nplayer.setId(old.getId());
if(tag == null)
nplayer.moveToBlockPosAndAngles(new BlockPos(0, 16384, 0), 0.0f, 0.0f);
nplayer.moveToBlockPosAndAngles(new LocalPos(0, 16384, 0), 0.0f, 0.0f);
world.loadChunk((int)nplayer.posX >> 4, (int)nplayer.posZ >> 4);
world.addPlayer(nplayer);
world.spawnEntityInWorld(nplayer);
@ -1212,7 +1212,7 @@ public final class Server implements IThreadListener, Executor {
return oldTag;
}
public void transferToDimension(EntityNPC player, Dimension dimension, BlockPos pos, float yaw, float pitch, PortalType portal) {
public void transferToDimension(EntityNPC player, Dimension dimension, LocalPos pos, float yaw, float pitch, PortalType portal) {
WorldServer oldWorld = (WorldServer)player.getServerWorld(); // this.getWorld(player.dimension);
WorldServer newWorld = this.getWorld(dimension);
player.connection.sendPacket(new SPacketRespawn(newWorld.dimension, this.time, UniverseRegistry.getName(newWorld.dimension), EntityRegistry.getEntityID(player), player.connection.isInEditor()));
@ -1236,7 +1236,7 @@ public final class Server implements IThreadListener, Executor {
player.connection.sendPlayerAbilities();
}
public void placeInDimension(Entity entity, WorldServer oldWorld, WorldServer world, BlockPos pos, PortalType portal) {
public void placeInDimension(Entity entity, WorldServer oldWorld, WorldServer world, LocalPos pos, PortalType portal) {
double newX = entity.posX;
double newY = entity.posY;
double newZ = entity.posZ;
@ -1248,7 +1248,7 @@ public final class Server implements IThreadListener, Executor {
newZ = ((double)pos.getZ()) + 0.5;
}
else {
pos = world.getHighestFreePos(new BlockPos(newX, 0, newZ));
pos = world.getHighestFreePos(new LocalPos(newX, 0, newZ));
newX = ((double)pos.getX()) + 0.5;
newY = (double)pos.getY();
newZ = ((double)pos.getZ()) + 0.5;
@ -1262,7 +1262,7 @@ public final class Server implements IThreadListener, Executor {
if(entity.isEntityAlive()) {
entity.setLocationAndAngles(newX, entity.posY, newZ, entity.rotYaw, entity.rotPitch);
if(portal != null)
world.makePortal(new BlockPos(ExtMath.floord(entity.posX)
world.makePortal(new LocalPos(ExtMath.floord(entity.posX)
,ExtMath.floord(entity.posY)
,ExtMath.floord(entity.posZ)), 128, portal);
}

View file

@ -16,16 +16,16 @@ import common.collect.Lists;
import common.init.Blocks;
import common.inventory.IInventory;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Vec3i;
import server.world.WorldServer;
public class ClipboardPlacer {
private static class BlockEntry {
private final BlockPos pos;
private final LocalPos pos;
private final ClipboardBlock block;
private BlockEntry(BlockPos pos, ClipboardBlock block) {
private BlockEntry(LocalPos pos, ClipboardBlock block) {
this.pos = pos;
this.block = block;
}
@ -40,7 +40,7 @@ public class ClipboardPlacer {
this.world = world;
}
public void setBlock(BlockPos location, ClipboardBlock block) {
public void setBlock(LocalPos location, ClipboardBlock block) {
Block type = block.getState().getBlock();
if (ReorderRegistry.shouldPlaceLast(type)) {
// Place torches, etc. last
@ -57,7 +57,7 @@ public class ClipboardPlacer {
}
}
private boolean setBlockQuirk(BlockPos location, ClipboardBlock block) {
private boolean setBlockQuirk(LocalPos location, ClipboardBlock block) {
Block existing = this.world.getState(location).getBlock();
if (existing instanceof ITileEntityProvider) {
TileEntity tile = this.world.getTileEntity(location);
@ -90,8 +90,8 @@ public class ClipboardPlacer {
}
this.stage2.clear();
final Set<BlockPos> blocks = new HashSet<BlockPos>();
final Map<BlockPos, ClipboardBlock> blockTypes = new HashMap<BlockPos, ClipboardBlock>();
final Set<LocalPos> blocks = new HashSet<LocalPos>();
final Map<LocalPos, ClipboardBlock> blockTypes = new HashMap<LocalPos, ClipboardBlock>();
for(BlockEntry entry : this.stage3) {
// final BlockPos pt = entry.getKey();
blocks.add(entry.pos);
@ -100,12 +100,12 @@ public class ClipboardPlacer {
this.stage3.clear();
while (!blocks.isEmpty()) {
BlockPos current = blocks.iterator().next();
LocalPos current = blocks.iterator().next();
if (!blocks.contains(current)) {
continue;
}
final Deque<BlockPos> walked = new LinkedList<BlockPos>();
final Deque<LocalPos> walked = new LinkedList<LocalPos>();
while (true) {
walked.addFirst(current);
@ -119,7 +119,7 @@ public class ClipboardPlacer {
if(type instanceof BlockDoor) {
if (baseBlock.getState().getValue(BlockDoor.HALF) == BlockDoor.EnumDoorHalf.LOWER) {
// Deal with lower door halves being attached to the floor AND the upper half
BlockPos upperBlock = current.add(0, 1, 0);
LocalPos upperBlock = current.add(0, 1, 0);
if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) {
walked.addFirst(upperBlock);
}
@ -128,7 +128,7 @@ public class ClipboardPlacer {
else if(type instanceof BlockRail) {
// Here, rails are hardcoded to be attached to the block below them.
// They're also attached to the block they're ascending towards via BlockType.getAttachment.
BlockPos lowerBlock = current.add(0, -1, 0);
LocalPos lowerBlock = current.add(0, -1, 0);
if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) {
walked.addFirst(lowerBlock);
}
@ -154,7 +154,7 @@ public class ClipboardPlacer {
}
}
for(BlockPos pt : walked) {
for(LocalPos pt : walked) {
this.setBlockQuirk(pt, blockTypes.get(pt));
blocks.remove(pt);
}

View file

@ -7,7 +7,7 @@ import java.util.Map;
import common.collect.Lists;
import common.collect.Maps;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.CharValidator;
import common.util.Color;
import common.util.Vec3;
@ -92,12 +92,12 @@ public abstract class Command implements Executable {
protected Command addBlockPos(String name, boolean defaulted) {
return this.addParameter(name, new ArgCombiner<Integer>() {
public BlockPos combine(Integer[] values) {
return new BlockPos(values[0], values[1], values[2]);
public LocalPos combine(Integer[] values) {
return new LocalPos(values[0], values[1], values[2]);
}
public Class<?> getTypeClass() {
return BlockPos.class;
return LocalPos.class;
}
public Class<Integer> getInputClass() {

View file

@ -3,7 +3,7 @@ package server.command;
import java.util.Collection;
import common.collect.Lists;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Position;
public class DoubleParser extends DefaultingParser {
@ -87,7 +87,7 @@ public class DoubleParser extends DefaultingParser {
}
public Collection<String> getCompletions(CommandEnvironment env, String last) {
BlockPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition();
LocalPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition();
if(this.defType != null)
switch(this.defType) {
case X:

View file

@ -1,7 +1,7 @@
package server.command;
import common.entity.Entity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Position;
public interface Executor {
@ -13,7 +13,7 @@ public interface Executor {
return null;
}
default BlockPos getPointedPosition() {
default LocalPos getPointedPosition() {
return null;
}

View file

@ -3,7 +3,7 @@ package server.command;
import java.util.Collection;
import common.collect.Lists;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import common.util.Position;
@ -82,7 +82,7 @@ public class IntParser extends DefaultingParser {
}
public Collection<String> getCompletions(CommandEnvironment env, String last) {
BlockPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition();
LocalPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition();
if(this.defType != null)
switch(this.defType) {
case X:

View file

@ -8,7 +8,7 @@ import common.collect.Lists;
import common.init.BlockRegistry;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.command.Command;
import server.command.CommandEnvironment;
@ -39,7 +39,7 @@ public class CommandBlock extends Command {
this.addTag("tag", 't');
}
public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) {
public Object exec(CommandEnvironment env, Executor exec, String block, LocalPos position, WorldServer world, TagObject tag) {
State state = BlockRegistry.byName(block, null);
if(state == null)
throw new RunException("Block '%s' existiert nicht", block);

View file

@ -28,6 +28,6 @@ public class CommandCamera extends Command {
}
public void exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, double yaw, double pitch, int radius, double speed, CameraType type, boolean fixed, Player player) {
player.setCamera(dim, position.xCoord, position.yCoord, position.zCoord, (float)yaw, (float)pitch, radius, (float)speed, type, fixed);
player.setCamera(dim, position.x, position.y, position.z, (float)yaw, (float)pitch, radius, (float)speed, type, fixed);
}
}

View file

@ -20,6 +20,6 @@ public class CommandDelwarp extends Command {
throw new RunException("Warp '%s' existiert nicht", warp);
Position pos = env.getServer().getWarps().remove(warp);
Dimension wdim = pos.getDimension();
exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), wdim == null ? "<?>" : wdim.getDisplay());
exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), wdim == null ? "<?>" : wdim.getDisplay());
}
}

View file

@ -22,7 +22,7 @@ public class CommandEffect extends Command {
public void exec(CommandEnvironment env, Executor exec, List<Player> players, ParticleType type, Vec3 pos) {
for(Player player : players) {
player.sendPacket(new SPacketParticles(type, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0));
player.sendPacket(new SPacketParticles(type, (float)pos.x, (float)pos.y, (float)pos.z, 0));
}
}
}

View file

@ -4,7 +4,7 @@ import java.util.List;
import common.entity.Entity;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -23,7 +23,7 @@ public class CommandEntity extends Command {
int done = 0;
for(Entity entity : entities) {
if(entity.isEntityAlive()) {
BlockPos pos = entity.getPosition();
LocalPos pos = entity.getPosition();
TagObject etag = new TagObject();
entity.writeTags(etag);
if(tag == null) {

View file

@ -24,9 +24,9 @@ public class CommandExplode extends Command {
public void exec(CommandEnvironment env, Executor exec, Vec3 pos, WorldServer world, int radius, boolean ticked, boolean fire, boolean noblocks, boolean altsound) {
if(ticked)
world.explodeTicked(null, pos.xCoord, pos.yCoord, pos.zCoord, radius);
world.explodeTicked(null, pos.x, pos.y, pos.z, radius);
else
world.explode(null, null, pos.xCoord, pos.yCoord, pos.zCoord, radius, fire, !noblocks, altsound);
exec.log("Explosion bei %d, %d, %d in %s erzeugt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay());
world.explode(null, null, pos.x, pos.y, pos.z, radius, fire, !noblocks, altsound);
exec.log("Explosion bei %d, %d, %d in %s erzeugt", ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay());
}
}

View file

@ -3,7 +3,7 @@ package server.command.commands;
import java.util.List;
import common.entity.Entity;
import common.util.BlockPos;
import common.util.LocalPos;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -20,7 +20,7 @@ public class CommandFind extends Command {
int done = 0;
for(Entity entity : entities) {
if(entity.isEntityAlive()) {
BlockPos pos = entity.getPosition();
LocalPos pos = entity.getPosition();
exec.log("%s bei %d, %d, %d in %s gefunden %s", entity.getRawName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getDisplay(),
asCommand(null, "tp #%d", entity.getId()));
done++;

View file

@ -8,7 +8,7 @@ import common.collect.Lists;
import common.init.BlockRegistry;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos.MutableBlockPos;
import common.util.MutablePos;
import common.world.State;
import server.command.Command;
import server.command.CommandEnvironment;
@ -41,7 +41,7 @@ public class CommandSet extends Command {
if(!exec.isPlayer() || ((Player)exec).getPresentEntity() == null)
throw new RunException("Nur Spieler können diesen Befehl ausführen");
Player player = (Player)exec;
Iterable<MutableBlockPos> blocks = player.getSelectedBlocks();
Iterable<MutablePos> blocks = player.getSelectedBlocks();
if(blocks == null)
throw new RunException("Es ist keine Auswahl vorhanden");
State state;
@ -59,7 +59,7 @@ public class CommandSet extends Command {
}
WorldServer world = (WorldServer)player.getPresentEntity().getServerWorld();
int changed = 0;
for(MutableBlockPos pos : blocks) {
for(MutablePos pos : blocks) {
boolean success = world.setState(pos, state);
if(tag != null) {
TileEntity tile = world.getTileEntity(pos);

View file

@ -28,13 +28,13 @@ public class CommandSetwarp extends Command {
Position pos = env.getServer().getWarps().get(warp);
Dimension wdim = pos.getDimension();
if(wdim != null)
exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), dim.getDisplay());
exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), dim.getDisplay());
}
else {
throw new RunException("Warp '%s' existiert bereits", warp);
}
}
env.getServer().getWarps().put(warp, new Position(position.xCoord, position.yCoord, position.zCoord, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim));
exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getDisplay());
env.getServer().getWarps().put(warp, new Position(position.x, position.y, position.z, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim));
exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.x), ExtMath.floord(position.y), ExtMath.floord(position.z), dim.getDisplay());
}
}

View file

@ -19,6 +19,6 @@ public class CommandShowwarp extends Command {
throw new RunException("Warp '%s' existiert nicht", warp);
Position pos = env.getServer().getWarps().get(warp);
Dimension wdim = pos.getDimension();
exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.xCoord, pos.yCoord, pos.zCoord, pos.yaw(), pos.pitch(), wdim == null ? "<?>" : wdim.getDisplay());
exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.x, pos.y, pos.z, pos.yaw(), pos.pitch(), wdim == null ? "<?>" : wdim.getDisplay());
}
}

View file

@ -52,11 +52,11 @@ public class CommandSpawn extends Command {
catch(NumberFormatException e) {
}
}
world.strikeLightning(pos.xCoord, pos.yCoord, pos.zCoord, color,
world.strikeLightning(pos.x, pos.y, pos.z, color,
tag != null && tag.hasInt("damage") ? tag.getInt("damage") : 0, tag != null && tag.hasBool("fire") && tag.getBool("fire"),
exec.isPlayer() && tag != null && tag.hasBool("summoned") && tag.getBool("summoned") ? ((Player)exec).getPresentEntity() : null);
}
exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay());
exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay());
return null;
}
else {
@ -65,7 +65,7 @@ public class CommandSpawn extends Command {
Entity entity = EntityRegistry.createEntityByName(type, world);
if(entity == null)
throw new RunException("Objekt konnte nicht erzeugt werden");
entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f);
entity.setLocationAndAngles(pos.x, pos.y, pos.z, world.rand.floatv() * 360.0f, 0.0f);
if(tag != null) {
TagObject ent = new TagObject();
entity.writeTags(ent);
@ -83,7 +83,7 @@ public class CommandSpawn extends Command {
}
spawned.add("#" + entity.getId());
}
exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay());
exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay());
return Util.buildLines(",", spawned);
}
}

View file

@ -27,8 +27,8 @@ public class CommandTele extends Command {
public Object exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, Double yaw, Double pitch, List<Entity> entities) {
for(Entity entity : entities) {
entity.teleport(position.xCoord, position.yCoord, position.zCoord, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getDisplay());
entity.teleport(position.x, position.y, position.z, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), ExtMath.floord(position.x), ExtMath.floord(position.y), ExtMath.floord(position.z), dim.getDisplay());
}
return entities.size();
}

View file

@ -40,7 +40,7 @@ public class CommandWarps extends Command {
Position pos = warp.getValue();
Dimension wdim = pos.getDimension();
if(wdim != null && (dim == null || wdim == dim))
exec.log(Color.NEON + "%s" + Color.GRAY + ": " + Color.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord));
exec.log(Color.NEON + "%s" + Color.GRAY + ": " + Color.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z));
}
}
}

View file

@ -3,7 +3,7 @@ package server.command.commands;
import java.util.List;
import common.entity.Entity;
import common.util.BlockPos;
import common.util.LocalPos;
import server.command.Command;
import server.command.CommandEnvironment;
import server.command.Executor;
@ -21,15 +21,15 @@ public class CommandWorld extends Command {
public Object exec(CommandEnvironment env, Executor exec, WorldServer world, List<Entity> entities) {
for(Entity entity : entities) {
BlockPos pos = adjust(world, entity.getPosition());
LocalPos pos = adjust(world, entity.getPosition());
entity.teleport(pos, world);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), pos.getX(), pos.getY(), pos.getZ(), world.dimension.getDisplay());
}
return entities.size();
}
public static BlockPos adjust(WorldServer world, BlockPos pos) {
pos = pos.getY() < 0 ? new BlockPos(pos.getX(), 0, pos.getZ()) : pos;
public static LocalPos adjust(WorldServer world, LocalPos pos) {
pos = pos.getY() < 0 ? new LocalPos(pos.getX(), 0, pos.getZ()) : pos;
if(world.getState(pos).getBlock().getMaterial().blocksMovement() || world.getState(pos).getBlock().getMaterial().isLiquid()) {
while((world.getState(pos).getBlock().getMaterial().blocksMovement() || world.getState(pos).getBlock().getMaterial().isLiquid()) && pos.getY() < 511)
pos = pos.up();

View file

@ -107,19 +107,19 @@ import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.tileentity.Device;
import common.tileentity.TileEntitySign;
import common.util.BlockPos;
import common.util.BlockPos.MutableBlockPos;
import common.util.LocalPos;
import common.util.BoundingBox;
import common.util.ChunkPos;
import common.util.ExtMath;
import common.util.Facing;
import common.util.IntHashMap;
import common.util.MutablePos;
import common.util.PortalType;
import common.util.Position;
import common.util.Color;
import common.util.Equipment;
import common.util.Vec3i;
import common.util.WorldPos;
import common.util.GlobalPos;
import common.vars.Vars;
import common.village.MerchantRecipeList;
import common.world.BlockArray;
@ -180,13 +180,13 @@ public class Player extends User implements Executor, IPlayer
private int rotation;
private boolean flipX;
private boolean flipZ;
private BlockPos selPos1;
private BlockPos selPos2;
private LocalPos selPos1;
private LocalPos selPos2;
private Vec3i selOffset;
private EditAction edit = EditAction.SELECT;
private BlockPos startPos = BlockPos.ORIGIN;
private BlockPos removingPos = BlockPos.ORIGIN;
private LocalPos startPos = LocalPos.ORIGIN;
private LocalPos removingPos = LocalPos.ORIGIN;
private boolean isDestroyingBlock;
private boolean receivedFinishDiggingPacket;
private int initialDamage;
@ -207,7 +207,7 @@ public class Player extends User implements Executor, IPlayer
private int itemUseCooldown;
private int pointedEntity;
private BlockPos pointedPosition;
private LocalPos pointedPosition;
private final List<ChunkPos> loadedChunks = new LinkedList<ChunkPos>();
private final List<Integer> destroyedItemsNetCache = new LinkedList<Integer>();
@ -421,7 +421,7 @@ public class Player extends User implements Executor, IPlayer
int i = ExtMath.floord(this.entity.posX);
int j = ExtMath.floord(this.entity.posY - 0.20000000298023224D);
int k = ExtMath.floord(this.entity.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
LocalPos blockpos = new LocalPos(i, j, k);
Block block = this.entity.worldObj.getState(blockpos).getBlock();
if (block == Blocks.air)
@ -665,7 +665,7 @@ public class Player extends User implements Executor, IPlayer
this.lastExperience = -1;
}
public void travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal)
public void travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal)
{
if(this.camera != null)
return;
@ -684,7 +684,7 @@ public class Player extends User implements Executor, IPlayer
this.entity.unmount();
// this.mountEntity(null);
if(this.entity.worldObj.dimension != dimension)
this.travelToDimension(dimension, new BlockPos(x, y, z), yaw, pitch, null);
this.travelToDimension(dimension, new LocalPos(x, y, z), yaw, pitch, null);
this.setPlayerLocation(x, y, z, yaw, pitch);
this.entity.setRotationYawHead(yaw);
}
@ -904,7 +904,7 @@ public class Player extends User implements Executor, IPlayer
{
int x = (chunk.xPos << 4) | (n >> 4);
int z = (chunk.zPos << 4) | (n & 15);
int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new BlockPos(x, 0, z)).temperature);
int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new LocalPos(x, 0, z)).temperature);
int off = Float.floatToIntBits(world.getTempNoise(x, z));
dataset.data[j++] = (byte)(temp & 255);
dataset.data[j++] = (byte)(temp >> 8 & 255);
@ -996,7 +996,7 @@ public class Player extends User implements Executor, IPlayer
if (chunkcoordintpair != null)
{
if (world.isBlockLoaded(new BlockPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)))
if (world.isBlockLoaded(new LocalPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)))
{
ChunkServer chunk = world.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
@ -1100,7 +1100,7 @@ public class Player extends User implements Executor, IPlayer
}
}
public void onBlockClicked(BlockPos pos, Facing side)
public void onBlockClicked(LocalPos pos, Facing side)
{
if(this.onPlayerInteract(true, pos)) {
this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos));
@ -1145,7 +1145,7 @@ public class Player extends User implements Executor, IPlayer
// }
}
public void blockRemoving(BlockPos pos)
public void blockRemoving(LocalPos pos)
{
if (pos.equals(this.startPos))
{
@ -1177,7 +1177,7 @@ public class Player extends User implements Executor, IPlayer
this.isDestroyingBlock = false;
}
private boolean removeBlock(BlockPos pos)
private boolean removeBlock(LocalPos pos)
{
State iblockstate = this.entity.worldObj.getState(pos);
iblockstate.getBlock().preBroken(this.entity.worldObj, pos, iblockstate, this.entity);
@ -1191,7 +1191,7 @@ public class Player extends User implements Executor, IPlayer
return flag;
}
private boolean tryHarvestBlock(BlockPos pos)
private boolean tryHarvestBlock(LocalPos pos)
{
// if (this.getHeldItem() != null && !this.getHeldItem().getItem().canBreakBlocks())
// {
@ -1259,7 +1259,7 @@ public class Player extends User implements Executor, IPlayer
}
}
public boolean activateBlockOrUseItem(ItemStack stack, BlockPos pos, Facing side, float offsetX, float offsetY, float offsetZ)
public boolean activateBlockOrUseItem(ItemStack stack, LocalPos pos, Facing side, float offsetX, float offsetY, float offsetZ)
{
if(this.onPlayerInteract(false, pos)) {
this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos));
@ -1300,7 +1300,7 @@ public class Player extends User implements Executor, IPlayer
}
public void setSelection(boolean primary, BlockPos pos) {
public void setSelection(boolean primary, LocalPos pos) {
switch(this.edit) {
case SELECT:
if(primary)
@ -1322,34 +1322,34 @@ public class Player extends User implements Executor, IPlayer
}
}
private boolean onPlayerInteract(boolean primary, BlockPos pos) {
private boolean onPlayerInteract(boolean primary, LocalPos pos) {
if(this.entity.getHeldItem() != null && this.entity.getHeldItem().getItem().onAction(this.entity.getHeldItem(), this.entity, this.entity.worldObj, primary ? ItemControl.PRIMARY : ItemControl.SECONDARY, pos))
return true;
return false;
}
private void selectPos1(BlockPos pos) {
BlockPos point = pos == null ? this.entity.getPosition() : pos;
private void selectPos1(LocalPos pos) {
LocalPos point = pos == null ? this.entity.getPosition() : pos;
String msg = this.selectPoint(point, false);
if(msg != null)
this.addHotbar(Color.DARK_RED + msg);
}
private void selectPos2(BlockPos pos) {
BlockPos point = pos == null ? this.entity.getPosition() : pos;
private void selectPos2(LocalPos pos) {
LocalPos point = pos == null ? this.entity.getPosition() : pos;
String msg = this.selectPoint(point, true);
if(msg != null)
this.addHotbar(Color.MIDNIGHT + msg);
}
private String selectPoint(BlockPos position, boolean second) {
private String selectPoint(LocalPos position, boolean second) {
if(this.selectionDim == Integer.MIN_VALUE || this.selectionDim != UniverseRegistry.getId(this.entity.worldObj.dimension)) {
this.selectionDim = UniverseRegistry.getId(this.entity.worldObj.dimension);
this.selPos1 = null;
this.selPos2 = null;
}
// this.setSelectionWorld();
BlockPos current = second ? this.selPos2 : this.selPos1;
LocalPos current = second ? this.selPos2 : this.selPos1;
if(current != null && (position.compareTo(current) == 0))
return null;
if(second)
@ -1401,7 +1401,7 @@ public class Player extends User implements Executor, IPlayer
int nx = this.clipboard.length;
int ny = this.clipboard[0].length;
int nz = this.clipboard[0][0].length;
BlockPos to = this.entity.getPosition();
LocalPos to = this.entity.getPosition();
ClipboardPlacer placer = new ClipboardPlacer(this.getEntityWorld());
Mat2i transform = null;
if(this.rotation != 0 || this.flipX || this.flipZ) {
@ -1470,11 +1470,11 @@ public class Player extends User implements Executor, IPlayer
return newValue;
}
public Iterable<MutableBlockPos> getSelectedBlocks() {
public Iterable<MutablePos> getSelectedBlocks() {
if(this.selectionDim == Integer.MIN_VALUE || this.selectionDim != UniverseRegistry.getId(this.entity.worldObj.dimension) ||
this.selPos1 == null || this.selPos2 == null)
return null;
return BlockPos.getAllInBoxMutable(this.selPos1, this.selPos2);
return MutablePos.mutableArea(this.selPos1, this.selPos2);
}
private boolean copyClipboard() {
@ -1492,13 +1492,13 @@ public class Player extends User implements Executor, IPlayer
for(int x = mx; x <= nx; x++) {
for(int y = my; y <= ny; y++) {
for(int z = mz; z <= nz; z++) {
this.clipboard[x - mx][y - my][z - mz] = source.getBlock(new BlockPos(x, y, z));
this.clipboard[x - mx][y - my][z - mz] = source.getBlock(new LocalPos(x, y, z));
}
}
}
this.rotation = 0;
this.flipX = this.flipZ = false;
BlockPos pos = this.entity.getPosition();
LocalPos pos = this.entity.getPosition();
this.selOffset = new Vec3i(mx - pos.getX(), my - pos.getY(), mz - pos.getZ());
this.addHotbar(Color.YELLOW + "Auswahl wurde in die Zwischenablage kopiert");
return true;
@ -1584,7 +1584,7 @@ public class Player extends User implements Executor, IPlayer
Alignment align = Alignment.getByName(tag.getString("Align"));
Dimension dimension = UniverseRegistry.getDimension(tag.getString("Dimension"));
String dim = dimension == null ? "???" : dimension.getDisplay();
BlockPos pos = new BlockPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ"));
LocalPos pos = new LocalPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ"));
String type = EntityRegistry.getEntityName(tag.getString("id"));
int level = tag.getInt("XpLevel");
Dimension origin = UniverseRegistry.getDimension(tag.getString("OriginDim"));
@ -1899,7 +1899,7 @@ public class Player extends User implements Executor, IPlayer
return this.pointedEntity != -1 && this.entity != null ? this.entity.worldObj.getEntityByID(this.pointedEntity) : null;
}
public BlockPos getPointedPosition() {
public LocalPos getPointedPosition() {
return this.pointedPosition;
}
@ -2249,7 +2249,7 @@ public class Player extends User implements Executor, IPlayer
if(this.charEditor || this.entity instanceof EntityCameraHolder)
return;
WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension);
BlockPos blockpos = packetIn.getPosition();
LocalPos blockpos = packetIn.getPosition();
switch (packetIn.getStatus())
{
@ -2337,7 +2337,7 @@ public class Player extends User implements Executor, IPlayer
WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension);
ItemStack itemstack = this.entity.getHeldItem();
boolean flag = false;
BlockPos blockpos = packetIn.getPosition();
LocalPos blockpos = packetIn.getPosition();
Facing enumfacing = Facing.getFront(packetIn.getPlacedBlockDirection());
if (packetIn.getPlacedBlockDirection() == 255)
@ -2466,7 +2466,7 @@ public class Player extends User implements Executor, IPlayer
this.characters.add(new TagObject());
WorldServer world = this.server.getWorld(UniverseRegistry.getDimension(packetIn.getAuxData()));
world = world == null ? this.server.getSpace() : world;
WorldPos origin = new WorldPos(world.rand.range(-SVars.originRadius, SVars.originRadius), 64, world.rand.range(-SVars.originRadius, SVars.originRadius), world);
GlobalPos origin = new GlobalPos(world.rand.range(-SVars.originRadius, SVars.originRadius), 64, world.rand.range(-SVars.originRadius, SVars.originRadius), world);
this.entity.setOrigin(origin);
Position pos = this.server.getRandomSpawnPosition(origin);
this.entity.teleport(pos);
@ -2756,7 +2756,7 @@ public class Player extends User implements Executor, IPlayer
case MAGNET:
if(this.isAdmin()) {
List<Entity> list = this.entity.worldObj.getEntitiesWithinAABB(Entity.class, new BoundingBox(this.entity.getPosition().subtract(new BlockPos(128, 128, 128)), this.entity.getPosition().add(new BlockPos(128, 128, 128))), new Predicate<Entity>() {
List<Entity> list = this.entity.worldObj.getEntitiesWithinAABB(Entity.class, new BoundingBox(this.entity.getPosition().subtract(new LocalPos(128, 128, 128)), this.entity.getPosition().add(new LocalPos(128, 128, 128))), new Predicate<Entity>() {
public boolean test(Entity entity) {
return entity.isEntityAlive() && (entity instanceof EntityItem || entity instanceof EntityXp);
}
@ -2950,7 +2950,7 @@ public class Player extends User implements Executor, IPlayer
return;
WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension);
BlockPos blockpos = packetIn.getPosition();
LocalPos blockpos = packetIn.getPosition();
if (worldserver.isBlockLoaded(blockpos))
{

View file

@ -8,7 +8,7 @@ import common.block.Material;
import common.block.artificial.BlockDoor;
import common.collect.Lists;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.village.Village;
import common.village.VillageDoorInfo;
@ -16,7 +16,7 @@ import server.world.WorldServer;
public class VillageCollection
{
private final List<BlockPos> villagerPositionsList = Lists.<BlockPos>newArrayList();
private final List<LocalPos> villagerPositionsList = Lists.<LocalPos>newArrayList();
private final List<VillageDoorInfo> newDoors = Lists.<VillageDoorInfo>newArrayList();
private final List<Village> villageList = Lists.<Village>newArrayList();
private int tickCounter;
@ -37,7 +37,7 @@ public class VillageCollection
}
}
public void addToVillagerPositionList(BlockPos pos)
public void addToVillagerPositionList(LocalPos pos)
{
if (this.villagerPositionsList.size() <= 64)
{
@ -88,7 +88,7 @@ public class VillageCollection
return this.villageList;
}
public Village getNearestVillage(BlockPos doorBlock, int radius)
public Village getNearestVillage(LocalPos doorBlock, int radius)
{
Village village = null;
double d0 = 3.4028234663852886E38D;
@ -140,7 +140,7 @@ public class VillageCollection
this.newDoors.clear();
}
private void addDoorsAround(WorldServer world, BlockPos central)
private void addDoorsAround(WorldServer world, LocalPos central)
{
int i = 16;
int j = 4;
@ -152,7 +152,7 @@ public class VillageCollection
{
for (int j1 = -k; j1 < k; ++j1)
{
BlockPos blockpos = central.add(l, i1, j1);
LocalPos blockpos = central.add(l, i1, j1);
if (this.isWoodDoor(world, blockpos))
{
@ -172,7 +172,7 @@ public class VillageCollection
}
}
private VillageDoorInfo checkDoorExistence(BlockPos doorBlock)
private VillageDoorInfo checkDoorExistence(LocalPos doorBlock)
{
for (VillageDoorInfo villagedoorinfo : this.newDoors)
{
@ -195,7 +195,7 @@ public class VillageCollection
return null;
}
private void addToNewDoorsList(WorldServer world, BlockPos doorBlock)
private void addToNewDoorsList(WorldServer world, LocalPos doorBlock)
{
Facing enumfacing = BlockDoor.getFacing(world, doorBlock);
Facing enumfacing1 = enumfacing.getOpposite();
@ -208,7 +208,7 @@ public class VillageCollection
}
}
private int countBlocksCanSeeSky(WorldServer world, BlockPos centerPos, Facing direction, int limitation)
private int countBlocksCanSeeSky(WorldServer world, LocalPos centerPos, Facing direction, int limitation)
{
int i = 0;
@ -228,9 +228,9 @@ public class VillageCollection
return i;
}
private boolean positionInList(BlockPos pos)
private boolean positionInList(LocalPos pos)
{
for (BlockPos blockpos : this.villagerPositionsList)
for (LocalPos blockpos : this.villagerPositionsList)
{
if (blockpos.equals(pos))
{
@ -241,7 +241,7 @@ public class VillageCollection
return false;
}
private boolean isWoodDoor(WorldServer world, BlockPos doorPos)
private boolean isWoodDoor(WorldServer world, LocalPos doorPos)
{
Block block = world.getState(doorPos).getBlock();
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;

View file

@ -9,7 +9,7 @@ import common.init.Blocks;
import common.log.Log;
import common.rng.Random;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.BlockArray;
import common.world.Chunk;
import common.world.State;
@ -146,7 +146,7 @@ public class ChunkServer extends Chunk {
}
}
public Map<BlockPos, TileEntity> getTiles() {
public Map<LocalPos, TileEntity> getTiles() {
return this.tiles;
}

View file

@ -78,10 +78,9 @@ import common.init.Blocks;
import common.log.Log;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.Facing.Axis;
import common.util.NibbleArray;
import common.util.Color;
import common.world.State;
@ -227,6 +226,22 @@ public abstract class Converter {
}
}
private static class NibbleArray {
private final byte[] data;
public NibbleArray(byte[] data) {
if(data.length != 2048)
throw new IllegalArgumentException("NibbleArray sollte 2048 Bytes groß sein, nicht " + data.length);
this.data = data;
}
public int get(int x, int y, int z) {
int idx = y << 8 | z << 4 | x;
int off = idx >> 1;
return (idx & 1) == 0 ? this.data[off] & 15 : this.data[off] >> 4 & 15;
}
}
private static interface BlockFunction {
State getState(int id, int data);
}
@ -1586,7 +1601,7 @@ public abstract class Converter {
return start;
}
public static BlockPos convert(File dir, String dest, Consumer<BlockPos> finish) {
public static LocalPos convert(File dir, String dest, Consumer<LocalPos> finish) {
File ldat = new File(dir, "level.dat");
if(!ldat.exists())
ldat = new File(dir, "level.dat_old");
@ -1643,7 +1658,7 @@ public abstract class Converter {
if(ver == SaveVersion.RELEASE_1_9)
Log.IO.warn("Konvertiere von neuerer Version, dies wird Blöcke entfernen ...");
chunkDir.mkdirs();
BlockPos pos = new BlockPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"));
LocalPos pos = new LocalPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"));
new Thread(new Runnable() {
public void run() {
int progress = 0;

View file

@ -1,18 +1,18 @@
package server.world;
import common.block.Block;
import common.util.BlockPos;
import common.util.LocalPos;
public class NextTickListEntry implements Comparable<NextTickListEntry> {
private static long nextId;
private final Block block;
public final BlockPos position;
public final LocalPos position;
private final long id;
public long scheduledTime;
public int priority;
public NextTickListEntry(BlockPos pos, Block block) {
public NextTickListEntry(LocalPos pos, Block block) {
this.id = nextId++;
this.position = pos;
this.block = block;

View file

@ -29,7 +29,7 @@ import common.init.EntityRegistry;
import common.log.Log;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Util;
import common.world.BlockArray;
import common.world.State;
@ -539,12 +539,12 @@ public class Region {
if(tiles != null) {
for(int n = 0; n < tiles.size(); ++n) {
TagObject tile = tiles.get(n);
BlockPos pos = new BlockPos(tile.getByte("X"), tile.getShort("Y"), tile.getByte("Z"));
LocalPos pos = new LocalPos(tile.getByte("X"), tile.getShort("Y"), tile.getByte("Z"));
if(pos.getX() < 0 || pos.getX() >= 16 || pos.getZ() < 0 || pos.getZ() >= 16 || pos.getY() < -World.MAX_SIZE_Y || pos.getY() >= World.MAX_SIZE_Y) {
Log.TICK.warn("Ignoriere Block-Objekt mit ungültigen Koordinaten %d, %d, %d in Chunk %d, %d", pos.getX(), pos.getY(), pos.getZ(), chunk.xPos, chunk.zPos);
continue;
}
pos = new BlockPos(chunk.xPos << 4 | pos.getX(), pos.getY(), chunk.zPos << 4 | pos.getZ());
pos = new LocalPos(chunk.xPos << 4 | pos.getX(), pos.getY(), chunk.zPos << 4 | pos.getZ());
TileEntity tileentity = TileEntity.createTile(world, chunk, pos, tile);
if(tileentity != null) {
@ -563,7 +563,7 @@ public class Region {
Block block = BlockRegistry.byName(tick.getString("B"));
if(block != Blocks.air) { // FIX
world.scheduleBlockUpdate(new BlockPos(tick.getInt("X"), tick.getInt("Y"), tick.getInt("Z")), block,
world.scheduleBlockUpdate(new LocalPos(tick.getInt("X"), tick.getInt("Y"), tick.getInt("Z")), block,
tick.getInt("T"), tick.getInt("P"));
}
else if(invalid++ < 10) {

View file

@ -10,7 +10,7 @@ import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.rng.Random;
import common.rng.WeightedList;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ChunkPos;
import common.util.ExtMath;
import common.world.World;
@ -21,7 +21,7 @@ public abstract class Spawner {
private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D);
private static final Set<ChunkPos> CHUNKS = Sets.<ChunkPos>newHashSet();
public static boolean canSpawnAt(boolean water, WorldServer world, BlockPos pos) {
public static boolean canSpawnAt(boolean water, WorldServer world, LocalPos pos) {
if(!World.isValidXZ(pos)) {
return false;
}
@ -34,7 +34,7 @@ public abstract class Spawner {
// return pos.getY() >= 118;
// }
else {
BlockPos down = pos.down();
LocalPos down = pos.down();
if(!world.isBlockSolid(down)) {
return false;
}
@ -92,7 +92,7 @@ public abstract class Spawner {
if(h == Integer.MIN_VALUE)
continue;
int y = world.rand.range(chunk.getBottomSegment(), h + 16);
BlockPos pos = new BlockPos(x, y, z);
LocalPos pos = new LocalPos(x, y, z);
Block block = world.getState(pos).getBlock();
if(!block.isNormalCube()) {
int group = 0;
@ -107,7 +107,7 @@ public abstract class Spawner {
mx += world.rand.zrange(mobSpread) - world.rand.zrange(mobSpread);
my += world.rand.zrange(1) - world.rand.zrange(1);
mz += world.rand.zrange(mobSpread) - world.rand.zrange(mobSpread);
BlockPos mpos = new BlockPos(mx, my, mz);
LocalPos mpos = new LocalPos(mx, my, mz);
float fx = (float)mx + 0.5F;
float fz = (float)mz + 0.5F;
if(!world.isAnyPlayerWithinRangeAt((double)fx, (double)my, (double)fz, playerDist)) {
@ -172,7 +172,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.getHighestFreePos(new BlockPos(mx, 0, mz));
LocalPos pos = world.getHighestFreePos(new LocalPos(mx, 0, mz));
if(canSpawnAt(EntityWaterNPC.class.isAssignableFrom(entry.type), world, pos)) {
EntityLiving entity;
try {

View file

@ -57,12 +57,13 @@ import common.rng.Random;
import common.rng.WeightedList;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.BoundingBox;
import common.util.ChunkPos;
import common.util.ExtMath;
import common.util.IntHashMap;
import common.util.LongHashMap;
import common.util.MutablePos;
import common.util.ParticleType;
import common.util.PortalType;
import common.util.Position;
@ -70,7 +71,6 @@ import common.util.Vec3;
import common.vars.Vars;
import common.village.Village;
import common.world.BlockArray;
import common.world.Chunk;
import common.world.AWorldServer;
import common.world.State;
import common.world.Weather;
@ -150,8 +150,8 @@ public final class WorldServer extends AWorldServer {
private final List<ChunkServer> loaded = Lists.<ChunkServer>newArrayList();
private final Map<ChunkPos, TagObject> toRemove = new ConcurrentHashMap();
private final Set<ChunkPos> pending = Collections.<ChunkPos>newSetFromMap(new ConcurrentHashMap());
private final LongHashMap<BlockPos> loaders = new LongHashMap();
private final Set<BlockPos> loaderList = Sets.<BlockPos>newHashSet();
private final LongHashMap<LocalPos> loaders = new LongHashMap();
private final Set<LocalPos> loaderList = Sets.<LocalPos>newHashSet();
private final List<EntityNPC> managed = Lists.<EntityNPC>newArrayList();
private final LongHashMap<PlayerInstance> instances = new LongHashMap();
private final List<PlayerInstance> toUpdate = Lists.<PlayerInstance>newArrayList();
@ -316,7 +316,7 @@ public final class WorldServer extends AWorldServer {
List<TagObject> list = tag.getList("Loaders");
for(int z = 0; z < list.size(); z++) {
TagObject pos = list.get(z);
this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
this.addLoader(new LocalPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z")));
}
this.loadersModified = false;
}
@ -391,7 +391,7 @@ public final class WorldServer extends AWorldServer {
return this.ores;
}
public boolean addLoader(BlockPos pos) {
public boolean addLoader(LocalPos pos) {
long chunk = LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16);
if(this.loaders.containsItem(chunk))
return false;
@ -405,9 +405,9 @@ public final class WorldServer extends AWorldServer {
// this.warpsModified = true;
// }
public boolean removeLoader(BlockPos pos) {
public boolean removeLoader(LocalPos pos) {
long chunk = LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16);
BlockPos loader = this.loaders.getValueByKey(chunk);
LocalPos loader = this.loaders.getValueByKey(chunk);
if(!pos.equals(loader))
return false;
this.loaders.remove(chunk);
@ -416,16 +416,16 @@ public final class WorldServer extends AWorldServer {
return true;
}
private WeightedList<RngSpawn> getSpawnTypes(BlockPos pos) {
private WeightedList<RngSpawn> getSpawnTypes(LocalPos pos) {
return this.mobs;
}
public RngSpawn getSpawnListEntryForTypeAt(BlockPos pos) {
public RngSpawn getSpawnListEntryForTypeAt(LocalPos pos) {
WeightedList<RngSpawn> list = this.getSpawnTypes(pos);
return list != null && !list.isEmpty() ? (RngSpawn)list.pick(this.rand) : null;
}
public boolean canCreatureTypeSpawnHere(RngSpawn spawnListEntry, BlockPos pos) {
public boolean canCreatureTypeSpawnHere(RngSpawn spawnListEntry, LocalPos pos) {
WeightedList<RngSpawn> list = this.getSpawnTypes(pos);
return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false;
}
@ -467,7 +467,7 @@ public final class WorldServer extends AWorldServer {
if(tics > 0 && this.rand.zrange(tics) == 0 && this.isThundering()) {
this.updateLCG = this.updateLCG * 3 + 1013904223;
int i1 = this.updateLCG >> 2;
BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(cx + (i1 & 15), 0, cz + (i1 >> 8 & 15)));
LocalPos blockpos = this.adjustPosToNearbyEntity(new LocalPos(cx + (i1 & 15), 0, cz + (i1 >> 8 & 15)));
if(this.canStrikeAt(blockpos)) {
this.strikeLightning((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0x737380, 120, true, null);
@ -481,8 +481,8 @@ public final class WorldServer extends AWorldServer {
if(this.rand.zrange(16) == 0) {
this.updateLCG = this.updateLCG * 3 + 1013904223;
int k2 = this.updateLCG >> 2;
BlockPos blockpos2 = this.getPrecipitationHeight(new BlockPos(cx + (k2 & 15), 0, cz + (k2 >> 8 & 15)));
BlockPos blockpos1 = blockpos2.down();
LocalPos blockpos2 = this.getPrecipitationHeight(new LocalPos(cx + (k2 & 15), 0, cz + (k2 >> 8 & 15)));
LocalPos blockpos1 = blockpos2.down();
if(this.snow && this.isRaining() && this.canSnowAt(blockpos2, true, SVars.snowStack)) {
State layer = SVars.snowStack ? this.getState(blockpos2) : null;
@ -522,7 +522,7 @@ public final class WorldServer extends AWorldServer {
if(block.isTicked()) {
++dtics;
BlockPos bpos = new BlockPos(x + cx, y + section.getY(), z + cz);
LocalPos bpos = new LocalPos(x + cx, y + section.getY(), z + cz);
block.tick(this, bpos, state, this.rand);
if(block.getRadiation() > 0.0f && this.rand.chance(tics / 3))
this.applyRadiation(bpos, state, block);
@ -537,7 +537,7 @@ public final class WorldServer extends AWorldServer {
}
}
private void applyRadiation(BlockPos pos, State state, Block block) {
private void applyRadiation(LocalPos pos, State state, Block block) {
float rad = block.getRadiation() * 8.0f * 0.25f;
float r = ExtMath.clampf(rad * 2.0f, 0.0f, 25.0f);
BoundingBox box = block.getCollisionBox(this, pos, state);
@ -550,9 +550,9 @@ public final class WorldServer extends AWorldServer {
}
}
private BlockPos adjustPosToNearbyEntity(BlockPos pos) {
BlockPos blockpos = this.getPrecipitationHeight(pos);
BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D,
private LocalPos adjustPosToNearbyEntity(LocalPos pos) {
LocalPos blockpos = this.getPrecipitationHeight(pos);
BoundingBox axisalignedbb = (new BoundingBox(blockpos, new LocalPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D,
3.0D, 3.0D);
List<EntityLiving> list = this.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new Predicate<EntityLiving>() {
public boolean test(EntityLiving p_apply_1_) {
@ -562,16 +562,16 @@ public final class WorldServer extends AWorldServer {
return !list.isEmpty() ? ((EntityLiving)list.get(this.rand.zrange(list.size()))).getPosition() : blockpos;
}
public boolean isBlockTickPending(BlockPos pos, Block blockType) {
public boolean isBlockTickPending(LocalPos pos, Block blockType) {
NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockType);
return this.ticksNow.contains(nextticklistentry);
}
public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) {
public void scheduleUpdate(LocalPos pos, Block blockIn, int delay) {
this.updateBlockTick(pos, blockIn, delay, 0);
}
public void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority) {
public void updateBlockTick(LocalPos pos, Block blockIn, int delay, int priority) {
NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn);
int i = 0;
@ -607,7 +607,7 @@ public final class WorldServer extends AWorldServer {
}
}
public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) {
public void scheduleBlockUpdate(LocalPos pos, Block blockIn, int delay, int priority) {
NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn);
nextticklistentry.setPriority(priority);
@ -709,7 +709,7 @@ public final class WorldServer extends AWorldServer {
iter = this.ticksNow.iterator();
while(iter.hasNext()) {
NextTickListEntry tick = iter.next();
BlockPos pos = tick.position;
LocalPos pos = tick.position;
if(pos.getX() >= x1 && pos.getX() < x2 && pos.getZ() >= z1 && pos.getZ() < z2) {
if(list == null)
list = Lists.<NextTickListEntry>newArrayList();
@ -725,7 +725,7 @@ public final class WorldServer extends AWorldServer {
for(int i = 0; i < this.tiles.size(); ++i) {
TileEntity tileentity = (TileEntity)this.tiles.get(i);
BlockPos blockpos = tileentity.getPos();
LocalPos blockpos = tileentity.getPos();
if(blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY
&& blockpos.getZ() < maxZ) {
@ -838,7 +838,7 @@ public final class WorldServer extends AWorldServer {
this.loadersModified = false;
TagObject loaders = new TagObject();
List<TagObject> list = Lists.newArrayList();
for(BlockPos pos : this.loaderList) {
for(LocalPos pos : this.loaderList) {
TagObject loader = new TagObject();
loader.setInt("X", pos.getX());
loader.setInt("Y", pos.getY());
@ -907,12 +907,12 @@ public final class WorldServer extends AWorldServer {
this.sendNear(entity.posX, entity.posY, entity.posZ, 512.0D,
new SPacketSpawnGlobalEntity(entity, 1, entity.color));
if(fire && Vars.fire) {
BlockPos pos = new BlockPos(entity);
LocalPos pos = new LocalPos(entity);
if(this.isAreaLoaded(pos, 10)) {
if(this.getState(pos).getBlock() == Blocks.air && Blocks.fire.canPlace(this, pos))
this.setState(pos, Blocks.fire.getState());
for(int n = 0; n < 4; n++) {
BlockPos extra = pos.add(this.rand.range(-1, 1), this.rand.range(-1, 1), this.rand.range(-1, 1));
LocalPos extra = pos.add(this.rand.range(-1, 1), this.rand.range(-1, 1), this.rand.range(-1, 1));
if(this.getState(extra).getBlock() == Blocks.air && Blocks.fire.canPlace(this, extra))
this.setState(extra, Blocks.fire.getState());
}
@ -924,7 +924,7 @@ public final class WorldServer extends AWorldServer {
this.sendToAllTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state));
}
private boolean destroyBlock(BlockPos pos, float power, EntityLiving source) {
private boolean destroyBlock(LocalPos pos, float power, EntityLiving source) {
State state = this.getState(pos);
Block block = state.getBlock();
if(block != Blocks.air && (block.getMaterial().isLiquid() || power - (block.getResistance() / 5.0F + 0.3F) * 0.3F > 0.0F)) {
@ -985,7 +985,7 @@ public final class WorldServer extends AWorldServer {
}
public void explode(EntityLiving source, Entity exploder, double posX, double posY, double posZ, float radius, boolean fire, boolean destroy, boolean altSound) {
Set<BlockPos> set = Sets.<BlockPos>newHashSet();
Set<LocalPos> set = Sets.<LocalPos>newHashSet();
int d = ((int)radius) + 1;
double falloff = radius * 0.125d;
falloff = falloff > 4.0d ? 4.0d : falloff;
@ -998,14 +998,14 @@ public final class WorldServer extends AWorldServer {
double dist = (double)ExtMath.sqrtd(((double)x) * ((double)x) + ((double)y) * ((double)y) + ((double)z) * ((double)z));
if(dist < radius - falloff ||
(dist < radius && this.rand.doublev() + ((dist - (radius - falloff)) / falloff) < 1.0d)) {
BlockPos pos = new BlockPos(posX + x, posY + y, posZ + z);
LocalPos pos = new LocalPos(posX + x, posY + y, posZ + z);
if(this.destroyBlock(pos, radius, source))
set.add(pos);
}
}
}
}
List<BlockPos> blocks = Lists.<BlockPos>newArrayList(set);
List<LocalPos> blocks = Lists.<LocalPos>newArrayList(set);
set.clear();
Set<EntityNPC> velocity = this.damageEntities(exploder, source, posX, posY, posZ, radius);
@ -1014,7 +1014,7 @@ public final class WorldServer extends AWorldServer {
if (fire)
{
for (BlockPos pos : blocks)
for (LocalPos pos : blocks)
{
if(this.getState(pos).getBlock() == Blocks.air && this.getState(pos.down()).getBlock().isFullBlock() && this.rand.zrange(3) == 0)
this.setState(pos, Blocks.fire.getState());
@ -1048,7 +1048,7 @@ public final class WorldServer extends AWorldServer {
double dist = (double)ExtMath.sqrtd(((double)x) * ((double)x) + ((double)y) * ((double)y) + ((double)z) * ((double)z));
if(dist > minDist && (dist < radius - falloff ||
(dist < radius && this.rand.doublev() + ((dist - (radius - falloff)) / falloff) < 1.0d))) {
BlockPos pos = new BlockPos(posX + x, posY + y, posZ + z);
LocalPos pos = new LocalPos(posX + x, posY + y, posZ + z);
if(this.destroyBlock(pos, (float)radius, null) && this.rand.chance(1000)) {
this.sendSound(SoundEvent.EXPLODE, posX + x, posY + y, posZ + z, 4.0F);
this.spawnParticles(ParticleType.EXPLOSION_HUGE, posX + x, posY + y, posZ + z);
@ -1187,7 +1187,7 @@ public final class WorldServer extends AWorldServer {
for(int i = 0; i < this.players.size(); ++i) {
EntityNPC entityplayermp = this.players.get(i);
BlockPos blockpos = entityplayermp.getPosition();
LocalPos blockpos = entityplayermp.getPosition();
double d0 = blockpos.distanceSq(xCoord, yCoord, zCoord);
if(d0 <= 256.0D || particleType.isUnlimited() && d0 <= 65536.0D) {
@ -1205,7 +1205,7 @@ public final class WorldServer extends AWorldServer {
return chunk == null ? this.loadChunk(x, z) : chunk;
}
public ChunkServer getChunk(BlockPos pos) {
public ChunkServer getChunk(LocalPos pos) {
return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
}
@ -1220,7 +1220,7 @@ public final class WorldServer extends AWorldServer {
}
public void loadForcedChunks() {
for(BlockPos pos : this.loaderList) {
for(LocalPos pos : this.loaderList) {
this.loadChunk(pos.getX() / 16, pos.getZ() / 16);
}
}
@ -1400,7 +1400,7 @@ public final class WorldServer extends AWorldServer {
BlockFalling.fallInstantly = true;
int bx = x * 16;
int bz = z * 16;
BlockPos pos = new BlockPos(bx, 0, bz);
LocalPos pos = new LocalPos(bx, 0, bz);
this.grng.setSeed(this.seed);
long sx = this.grng.longv() / 2L * 2L + 1L;
long sz = this.grng.longv() / 2L * 2L + 1L;
@ -1446,8 +1446,8 @@ public final class WorldServer extends AWorldServer {
pos = pos.add(8, 0, 8);
for(int fx = 0; fx < 16; ++fx) {
for(int fz = 0; fz < 16; ++fz) {
BlockPos snow = this.getPrecipitationHeight(pos.add(fx, 0, fz));
BlockPos ice = snow.down();
LocalPos snow = this.getPrecipitationHeight(pos.add(fx, 0, fz));
LocalPos ice = snow.down();
if(this.canBlockFreeze(ice, false)) {
this.setState(ice, Blocks.ice.getState(), 2);
}
@ -1499,7 +1499,7 @@ public final class WorldServer extends AWorldServer {
// this.reloadChunks(); //TODO: why was this here?
for(EntityNPC player : this.players) {
player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000);
Packet packet = new SPacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0);
Packet packet = new SPacketEffect(1025, new LocalPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0);
player.connection.sendPacket(packet);
}
return true;
@ -1514,7 +1514,7 @@ public final class WorldServer extends AWorldServer {
this.resetWeather();
if(!this.loaderList.isEmpty())
this.loadersModified = true;
for(BlockPos pos : this.loaderList) {
for(LocalPos pos : this.loaderList) {
this.loaders.remove(LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16));
}
this.loaderList.clear();
@ -1640,17 +1640,17 @@ public final class WorldServer extends AWorldServer {
return String.format("%d C, %d O, %d t, %d T, %d F", chunks, entities, tiles, ticked, forced);
}
public void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random) {
public void forceBlockUpdateTick(Block blockType, LocalPos pos, Random random) {
this.updatesForced = 128;
blockType.tick(this, pos, this.getState(pos), random);
this.updatesForced = 0;
}
public Village getNearestVillage(BlockPos doorBlock, int radius) {
public Village getNearestVillage(LocalPos doorBlock, int radius) {
return this.villageStorage == null ? null : this.villageStorage.getNearestVillage(doorBlock, radius);
}
public void addToVillagerPositionList(BlockPos blockpos) {
public void addToVillagerPositionList(LocalPos blockpos) {
if(this.villageStorage != null)
this.villageStorage.addToVillagerPositionList(blockpos);
}
@ -1664,7 +1664,7 @@ public final class WorldServer extends AWorldServer {
this.sendNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, new SPacketSoundEffect(sound, x, y, z, volume));
}
public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data)
public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data)
{
this.sendNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, new SPacketEffect(sfxType, blockPosIn, data));
}
@ -1718,7 +1718,7 @@ public final class WorldServer extends AWorldServer {
return inst;
}
public void markBlockForUpdate(BlockPos pos) {
public void markBlockForUpdate(LocalPos pos) {
int x = pos.getX() >> 4;
int z = pos.getZ() >> 4;
PlayerInstance inst = this.getPlayerInstance(x, z, false);
@ -2007,7 +2007,7 @@ public final class WorldServer extends AWorldServer {
}
}
public boolean setState(BlockPos pos, State newState, int flags) {
public boolean setState(LocalPos pos, State newState, int flags) {
if(!isValid(pos))
return false;
ChunkServer chunk = this.getChunk(pos);
@ -2023,7 +2023,7 @@ public final class WorldServer extends AWorldServer {
return true;
}
public final boolean setBlock(BlockPos pos, ClipboardBlock block) {
public final boolean setBlock(LocalPos pos, ClipboardBlock block) {
// int x = position.getBlockX();
// int y = position.getBlockY();
// int z = position.getBlockZ();
@ -2063,7 +2063,7 @@ public final class WorldServer extends AWorldServer {
return successful;
}
public final ClipboardBlock getBlock(BlockPos pos) {
public final ClipboardBlock getBlock(LocalPos pos) {
// BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
State state = this.getState(pos);
TileEntity tile = this.getTileEntity(pos);
@ -2083,7 +2083,7 @@ public final class WorldServer extends AWorldServer {
return entities;
}
public boolean canStrikeAt(BlockPos strikePosition) {
public boolean canStrikeAt(LocalPos strikePosition) {
if(this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY()) {
return false;
}
@ -2137,7 +2137,7 @@ public final class WorldServer extends AWorldServer {
return t;
}
public boolean canPlaceFireAt(BlockPos pos) {
public boolean canPlaceFireAt(LocalPos pos) {
if(!this.canBurnAt(pos)) {
return false;
}
@ -2152,7 +2152,7 @@ public final class WorldServer extends AWorldServer {
return false;
}
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) {
public boolean canBlockFreeze(LocalPos pos, boolean noWaterAdj) {
if(!this.canFreezeAt(pos)) {
return false;
}
@ -2188,7 +2188,7 @@ public final class WorldServer extends AWorldServer {
int l = ExtMath.floord(bb.maxY);
int i1 = ExtMath.floord(bb.minZ);
int j1 = ExtMath.floord(bb.maxZ);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for(int k1 = i; k1 <= j; ++k1) {
for(int l1 = k; l1 <= l; ++l1) {
@ -2205,13 +2205,13 @@ public final class WorldServer extends AWorldServer {
return false;
}
public BlockPos getHighestFreePos(BlockPos pos) {
public LocalPos getHighestFreePos(LocalPos pos) {
ChunkServer chunk = this.getChunk(pos);
int h = chunk.getTopSegment();
if(h == Integer.MIN_VALUE)
return new BlockPos(pos.getX(), 0, pos.getZ());
BlockPos free = new BlockPos(pos.getX(), h + 16, pos.getZ());
BlockPos down;
return new LocalPos(pos.getX(), 0, pos.getZ());
LocalPos free = new LocalPos(pos.getX(), h + 16, pos.getZ());
LocalPos down;
h = chunk.getBottomSegment();
if(free.getY() - h > 512)
h = free.getY() - 512;
@ -2246,10 +2246,10 @@ public final class WorldServer extends AWorldServer {
this.onEntityRemoved(entityIn);
}
public Block getGroundAboveSeaLevel(BlockPos pos) {
BlockPos blockpos;
public Block getGroundAboveSeaLevel(LocalPos pos) {
LocalPos blockpos;
for(blockpos = new BlockPos(pos.getX(), this.getSeaLevel(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up()) {
for(blockpos = new LocalPos(pos.getX(), this.getSeaLevel(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up()) {
;
}
@ -2302,7 +2302,7 @@ public final class WorldServer extends AWorldServer {
}
}
protected float getTemperature(BlockPos pos) {
protected float getTemperature(LocalPos pos) {
float temperature = this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(pos).temperature;
return pos.getY() > 64 ? temperature - (this.getTempNoise(pos.getX(), pos.getZ()) + (float)pos.getY() - 64.0F) / 15.0f : temperature;
}
@ -2319,22 +2319,22 @@ public final class WorldServer extends AWorldServer {
return this.biomeGen == null ? 50.0f : this.biomeGen.getBiomeAt(x, z).humidity;
}
public LeavesType getLeavesGen(BlockPos pos) {
public LeavesType getLeavesGen(LocalPos pos) {
return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ?
this.gen.getLeavesType() : LeavesType.values()[(int)((this.orbit %
this.dimension.getOrbitalPeriod()) * 4L / this.dimension.getOrbitalPeriod())]);
}
public BlockPos getHeight(BlockPos pos) {
public LocalPos getHeight(LocalPos pos) {
int y;
if(pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE)
y = this.isLoaded(pos.getX() >> 4, pos.getZ() >> 4, true) ? this.getChunk(pos.getX() >> 4, pos.getZ() >> 4).getHeight(pos.getX() & 15, pos.getZ() & 15) : 0;
else
y = this.getSeaLevel() + 1;
return new BlockPos(pos.getX(), y, pos.getZ());
return new LocalPos(pos.getX(), y, pos.getZ());
}
public boolean makePortal(BlockPos pos, int maxHeight, PortalType type) // TODO: Portals
public boolean makePortal(LocalPos pos, int maxHeight, PortalType type) // TODO: Portals
{
return false;
// int i = 16;
@ -2546,7 +2546,7 @@ public final class WorldServer extends AWorldServer {
return (List)this.server.getPlayers();
}
public void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, BlockPos pos, PortalType portal) {
public void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, LocalPos pos, PortalType portal) {
this.server.placeInDimension(entity, (WorldServer)oldWorld, (WorldServer)world, pos, portal);
}
@ -2558,7 +2558,7 @@ public final class WorldServer extends AWorldServer {
return TeleportRegistry.getPortalDest(this.dimension, portal);
}
public void markChunkDirty(BlockPos pos) {
public void markChunkDirty(LocalPos pos) {
if(this.isBlockLoaded(pos))
this.getChunk(pos).setModified(true);
}
@ -2575,7 +2575,7 @@ public final class WorldServer extends AWorldServer {
}
}
public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) {
public void notifyNeighborsOfStateChange(LocalPos pos, Block blockType) {
this.notifyBlockOfStateChange(pos.west(), blockType);
this.notifyBlockOfStateChange(pos.east(), blockType);
this.notifyBlockOfStateChange(pos.down(), blockType);
@ -2584,7 +2584,7 @@ public final class WorldServer extends AWorldServer {
this.notifyBlockOfStateChange(pos.south(), blockType);
}
private void notifyBlockOfStateChange(BlockPos pos, final Block blockIn) {
private void notifyBlockOfStateChange(LocalPos pos, final Block blockIn) {
State iblockstate = this.getState(pos);
iblockstate.getBlock().onUpdate(this, pos, iblockstate, blockIn);
}
@ -2598,7 +2598,7 @@ public final class WorldServer extends AWorldServer {
return new SPacketMultiBlockChange(pos, changes);
}
public boolean generateBigMushroom(BlockPos pos, State state, Random rand)
public boolean generateBigMushroom(LocalPos pos, State state, Random rand)
{
this.setBlockToAir(pos);
FeatureGenerator worldgenerator = null;
@ -2623,18 +2623,18 @@ public final class WorldServer extends AWorldServer {
}
}
private boolean isTypeAt(BlockPos pos, WoodType type)
private boolean isTypeAt(LocalPos pos, WoodType type)
{
State iblockstate = this.getState(pos);
return iblockstate.getBlock() instanceof BlockSapling && ((BlockSapling)iblockstate.getBlock()).getWoodType() == type;
}
private boolean isSameSaplingTypeIn(BlockPos pos, int xOff, int yOff, WoodType type)
private boolean isSameSaplingTypeIn(LocalPos pos, int xOff, int yOff, WoodType type)
{
return this.isTypeAt(pos.add(xOff, 0, yOff), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff), type) && this.isTypeAt(pos.add(xOff, 0, yOff + 1), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff + 1), type);
}
public void generateTree(BlockPos pos, State state, Random rand)
public void generateTree(LocalPos pos, State state, Random rand)
{
WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : WoodType.OAK;
State log = type == WoodType.CHERRY ? Blocks.cherry_log.getState() : // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY) :
@ -2767,13 +2767,13 @@ public final class WorldServer extends AWorldServer {
}
}
public void growGrass(BlockPos pos, State state, Random rand)
public void growGrass(LocalPos pos, State state, Random rand)
{
BlockPos blockpos = pos.up();
LocalPos blockpos = pos.up();
for (int i = 0; i < 128; ++i)
{
BlockPos blockpos1 = blockpos;
LocalPos blockpos1 = blockpos;
int j = 0;
while (true)
@ -2927,7 +2927,7 @@ public final class WorldServer extends AWorldServer {
int x = (int)(this.changes[0] >> 36 & 15L) + this.position.x * 16;
int y = (int)(this.changes[0] & 4294967295L);
int z = (int)(this.changes[0] >> 32 & 15L) + this.position.z * 16;
BlockPos pos = new BlockPos(x, y, z);
LocalPos pos = new LocalPos(x, y, z);
this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos));
if(WorldServer.this.getState(pos).getBlock() instanceof ITileEntityProvider) {
@ -2974,7 +2974,7 @@ public final class WorldServer extends AWorldServer {
int x = (int)(this.changes[n] >> 36 & 15L) + this.position.x * 16;
int y = (int)(this.changes[n] & 4294967295L);
int z = (int)(this.changes[n] >> 32 & 15L) + this.position.z * 16;
BlockPos pos = new BlockPos(x, y, z);
LocalPos pos = new LocalPos(x, y, z);
if(WorldServer.this.getState(pos).getBlock() instanceof ITileEntityProvider) {
this.sendTileToAllPlayersWatchingChunk(WorldServer.this.getTileEntity(pos));

View file

@ -1,7 +1,7 @@
package server.worldgen;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
@ -16,9 +16,9 @@ public abstract class FeatureGenerator {
this.notify = notify;
}
public abstract boolean generate(WorldServer world, Random rand, BlockPos pos);
public abstract boolean generate(WorldServer world, Random rand, LocalPos pos);
protected final void setBlockNotify(WorldServer world, BlockPos pos, State state) {
protected final void setBlockNotify(WorldServer world, LocalPos pos, State state) {
world.setState(pos, state, this.notify ? 3 : 2);
}
}

View file

@ -5,8 +5,8 @@ import common.block.natural.BlockColoredClay;
import common.dimension.Dimension;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.MutablePos;
import common.world.State;
import server.dimension.GeneratorData;
import server.world.WorldServer;
@ -173,7 +173,7 @@ public class MapGenCaves extends MapGenBase
if (!flag3)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int j3 = k2; j3 < k; ++j3)
{

View file

@ -4,8 +4,8 @@ import common.block.Block;
import common.dimension.Dimension;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.MutablePos;
import common.world.State;
import server.dimension.GeneratorData;
import server.world.WorldServer;
@ -165,7 +165,7 @@ public class MapGenRavine extends MapGenBase
if (!flag2)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int j3 = k2; j3 < k; ++j3)
{

View file

@ -14,7 +14,7 @@ import common.rng.Random;
import common.rng.WeightedList;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.vars.Vars;
import common.world.World;
@ -35,7 +35,7 @@ public class FeatureDungeons
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) {
public boolean generate(WorldServer worldIn, Random rand, LocalPos position) {
boolean flag = false;
for(int z = 0; z < this.chance; z++) {
flag |= this.generateDungeon(worldIn, rand, position.add(rand.chOffset(), rand.zrange(this.height), rand.chOffset()));
@ -43,7 +43,7 @@ public class FeatureDungeons
return flag;
}
private boolean generateDungeon(WorldServer worldIn, Random rand, BlockPos position)
private boolean generateDungeon(WorldServer worldIn, Random rand, LocalPos position)
{
int i = 3;
int j = rand.zrange(2) + 2;
@ -62,7 +62,7 @@ public class FeatureDungeons
{
for (int i3 = l1; i3 <= i2; ++i3)
{
BlockPos blockpos = position.add(k2, l2, i3);
LocalPos blockpos = position.add(k2, l2, i3);
Material material = worldIn.getState(blockpos).getBlock().getMaterial();
boolean flag = material.isSolid();
@ -92,7 +92,7 @@ public class FeatureDungeons
{
for (int k4 = l1; k4 <= i2; ++k4)
{
BlockPos blockpos1 = position.add(k3, i4, k4);
LocalPos blockpos1 = position.add(k3, i4, k4);
if (k3 != k && i4 != -1 && k4 != l1 && k3 != l && i4 != 4 && k4 != i2)
{
@ -127,7 +127,7 @@ public class FeatureDungeons
int l4 = position.getX() + rand.zrange(j * 2 + 1) - j;
int i5 = position.getY();
int j5 = position.getZ() + rand.zrange(k1 * 2 + 1) - k1;
BlockPos blockpos2 = new BlockPos(l4, i5, j5);
LocalPos blockpos2 = new LocalPos(l4, i5, j5);
if (worldIn.isAirBlock(blockpos2))
{

View file

@ -4,7 +4,7 @@ import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
@ -45,7 +45,7 @@ public class FeatureLakes
// this(block, block == Blocks.lava ? Blocks.stone.getDefaultState() : null, Blocks.dirt, Blocks.grass.getDefaultState());
// }
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) {
public boolean generate(WorldServer worldIn, Random rand, LocalPos position) {
if(this.ratiod) {
if(this.chance >= 1 && rand.chance(this.chance)) {
int y = rand.range(this.minHeight, this.maxHeight); // rand.zrange(rand.zrange(248) + 8);
@ -61,7 +61,7 @@ public class FeatureLakes
return false;
}
private boolean generateLake(WorldServer worldIn, Random rand, BlockPos position)
private boolean generateLake(WorldServer worldIn, Random rand, LocalPos position)
{
for (position = position.add(-8, 0, -8); position.getY() > 5 && worldIn.isAirBlock(position); position = position.down())
{
@ -164,7 +164,7 @@ public class FeatureLakes
{
if (aboolean[(i2 * 16 + j3) * 8 + j4])
{
BlockPos blockpos = position.add(i2, j4 - 1, j3);
LocalPos blockpos = position.add(i2, j4 - 1, j3);
if (worldIn.getState(blockpos).getBlock() == replace && worldIn.getState(blockpos.up()).getBlock() == Blocks.air)
{

View file

@ -3,7 +3,7 @@ package server.worldgen.component;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
@ -40,7 +40,7 @@ public class FeatureLiquids
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) {
public boolean generate(WorldServer worldIn, Random rand, LocalPos position) {
Block replace = worldIn.dimension.getFiller().getBlock();
boolean flag = false;
for(int z = 0; z < this.chance; z++) {
@ -56,7 +56,7 @@ public class FeatureLiquids
return flag;
}
private boolean generateLiquid(WorldServer worldIn, Random rand, BlockPos position, Block replace)
private boolean generateLiquid(WorldServer worldIn, Random rand, LocalPos position, Block replace)
{
if (worldIn.getState(position.up()).getBlock() != replace)
{

View file

@ -2,7 +2,7 @@ package server.worldgen.component;
import common.block.Block;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import common.world.State;
import common.world.World;
@ -81,14 +81,14 @@ public class FeatureOres
// this.replace = replace;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) {
public boolean generate(WorldServer worldIn, Random rand, LocalPos position) {
Block replace = /* this.replace != null ? this.replace : */ worldIn.dimension.getFiller().getBlock();
int tries = this.spawnTries == 0 ?
(rand.zrange(this.moreTries) == 0 ? 1 : 0) :
(this.spawnTries + (this.moreTries == 0 ? 0 : rand.zrange(this.moreTries + 1)));
// tries = tries == 0 ? (this.numberOfBlocks == 1 ? (rand.nextInt(10) == 0 ? 1 : 0) : rand.nextInt(2)) : tries;
for(int j = 0; j < tries; j++) {
BlockPos blockpos;
LocalPos blockpos;
if(this.distributed) {
blockpos = position.add(rand.zrange(16), rand.zrange(this.maxHeight) + rand.zrange(this.maxHeight) + this.minHeight - this.maxHeight, rand.zrange(16));
}
@ -107,7 +107,7 @@ public class FeatureOres
return true;
}
private void generateVein(WorldServer worldIn, Random rand, BlockPos position, Block replace)
private void generateVein(WorldServer worldIn, Random rand, LocalPos position, Block replace)
{
float f = rand.floatv() * (float)Math.PI;
double d0 = (double)(/* (float)(position.getX() + 8) */ 8.0f + ExtMath.sin(f) * (float)this.numberOfBlocks / 8.0F);
@ -151,7 +151,7 @@ public class FeatureOres
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
{
BlockPos blockpos = position.add(l1, i2, j2); // new BlockPos(l1, i2, j2);
LocalPos blockpos = position.add(l1, i2, j2); // new BlockPos(l1, i2, j2);
if (worldIn.getState(blockpos).getBlock() == replace)
{

View file

@ -9,7 +9,7 @@ import common.rng.Random;
import common.rng.WeightedList;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -32,7 +32,7 @@ public class WorldGenAbandonedChest extends FeatureGenerator
this(LootConstants.ABANDONED_ITEMS, 10);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
Block block;
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 1)
@ -48,7 +48,7 @@ public class WorldGenAbandonedChest extends FeatureGenerator
position = position.up();
for (int i = 0; i < 4; ++i)
{
BlockPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), rand.zrange(3) - rand.zrange(3), rand.zrange(4) - rand.zrange(4));
LocalPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), rand.zrange(3) - rand.zrange(3), rand.zrange(4) - rand.zrange(4));
if (worldIn.isAirBlock(blockpos) && worldIn.isBlockSolid(blockpos.down()))
{
worldIn.setState(blockpos, Blocks.wood_chest.getState().withProperty(BlockChest.FACING, Facing.randHorizontal(rand)), 2);

View file

@ -1,7 +1,7 @@
package server.worldgen.feature;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -13,7 +13,7 @@ public class WorldGenAsteroid extends FeatureGenerator {
this.blocks = blocks;
}
public boolean generate(WorldServer world, Random rand, BlockPos pos) {
public boolean generate(WorldServer world, Random rand, LocalPos pos) {
for(pos = pos.add(-8, 0, -8); pos.getY() > 9 && !world.isAirBlock(pos); pos = pos.down()) {
;
}

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -19,7 +19,7 @@ public class WorldGenBlockBlob extends FeatureGenerator
this.field_150544_b = p_i45450_2_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
while (true)
{
@ -54,7 +54,7 @@ public class WorldGenBlockBlob extends FeatureGenerator
int l = i1 + rand.zrange(2);
float f = (float)(j + k + l) * 0.333F + 0.5F;
for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l)))
for (LocalPos blockpos : LocalPos.area(position.add(-j, -k, -l), position.add(j, k, l)))
{
if (blockpos.distanceSq(position) <= (double)(f * f))
{

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -19,7 +19,7 @@ public class WorldGenClay extends FeatureGenerator
this.numberOfBlocks = blocks;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid())
{
@ -41,7 +41,7 @@ public class WorldGenClay extends FeatureGenerator
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
LocalPos blockpos = new LocalPos(k, k1, l);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.clay)

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import server.world.WorldServer;
@ -12,7 +12,7 @@ public class WorldGenClayExt extends WorldGenClay {
super(blocks);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) {
public boolean generate(WorldServer worldIn, Random rand, LocalPos position) {
if(!worldIn.getState(position).getBlock().getMaterial().isColdLiquid()) {
return false;
}
@ -39,7 +39,7 @@ public class WorldGenClayExt extends WorldGenClay {
if(d12 * d12 + d13 * d13 + d14 * d14 >= 1.0D) {
continue;
}
BlockPos blockpos = new BlockPos(i1, j1, k1);
LocalPos blockpos = new LocalPos(i1, j1, k1);
Block block = worldIn.getState(blockpos).getBlock();
if(block == Blocks.sand) {

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.artificial.BlockSlab;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.world.State;
import server.world.WorldServer;
@ -15,7 +15,7 @@ public class WorldGenDesertWells extends FeatureGenerator
private final State field_175912_c = Blocks.sandstone.getState();
private final State field_175910_d = Blocks.flowing_water.getState();
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
while (worldIn.isAirBlock(position) && position.getY() > 2)
{

View file

@ -2,17 +2,17 @@ package server.worldgen.feature;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenFire extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.hellrock)
{

View file

@ -2,14 +2,14 @@ package server.worldgen.feature;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenGlowStone extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
if (!worldIn.isAirBlock(position))
{
@ -25,7 +25,7 @@ public class WorldGenGlowStone extends FeatureGenerator
for (int i = 0; i < 1500; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), -rand.zrange(12), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), -rand.zrange(12), rand.zrange(8) - rand.zrange(8));
if (worldIn.getState(blockpos).getBlock() == Blocks.air)
{

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -18,7 +18,7 @@ public class WorldGenHellLava extends FeatureGenerator
this.field_94524_b = p_i45453_2_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
if (worldIn.getState(position.up()).getBlock() != Blocks.hellrock)
{

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -17,7 +17,7 @@ public class WorldGenIcePath extends FeatureGenerator
this.basePathWidth = p_i45454_1_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
while (worldIn.isAirBlock(position) && position.getY() > 2)
{
@ -44,7 +44,7 @@ public class WorldGenIcePath extends FeatureGenerator
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
LocalPos blockpos = new LocalPos(k, k1, l);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice)

View file

@ -3,14 +3,14 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenIceSpike extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
while (worldIn.isAirBlock(position) && position.getY() > 2)
{
@ -83,7 +83,7 @@ public class WorldGenIceSpike extends FeatureGenerator
{
for (int i2 = -k1; i2 <= k1; ++i2)
{
BlockPos blockpos = position.add(l1, -1, i2);
LocalPos blockpos = position.add(l1, -1, i2);
int j2 = 50;
if (Math.abs(l1) == 1 && Math.abs(i2) == 1)

View file

@ -3,7 +3,7 @@ package server.worldgen.feature;
import common.block.Block;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -20,7 +20,7 @@ public class WorldGenSand extends FeatureGenerator
this.radius = p_i45462_2_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid())
{
@ -42,7 +42,7 @@ public class WorldGenSand extends FeatureGenerator
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
LocalPos blockpos = new LocalPos(k, k1, l);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.grass)

View file

@ -4,7 +4,8 @@ import common.block.Block;
import common.entity.Entity;
import common.entity.item.EntityCrystal;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -28,13 +29,13 @@ public class WorldGenSpikes extends FeatureGenerator
this.crystals = crystals;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
if (worldIn.isAirBlock(position) && worldIn.getState(position.down()).getBlock() == this.base)
{
int i = rand.zrange(this.maxHeight - 6) + 6;
int j = rand.range(this.minRadius, this.maxRadius);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k = position.getX() - j; k <= position.getX() + j; ++k)
{
@ -61,7 +62,7 @@ public class WorldGenSpikes extends FeatureGenerator
if (k2 * k2 + k1 * k1 <= j * j + 1)
{
worldIn.setState(new BlockPos(i2, l1, j2), this.block, 2);
worldIn.setState(new LocalPos(i2, l1, j2), this.block, 2);
}
}
}

View file

@ -2,7 +2,7 @@ package server.worldgen.foliage;
import common.block.foliage.BlockDoublePlant;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
public class FeatureDoublePlant
@ -14,13 +14,13 @@ public class FeatureDoublePlant
this.type = type;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
boolean flag = false;
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 254) && this.type.canPlace(worldIn, blockpos))
{

View file

@ -6,7 +6,8 @@ import common.block.foliage.BlockHugeMushroom;
import common.block.foliage.BlockHugeMushroom.EnumType;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -26,7 +27,7 @@ public class WorldGenBigMushroom extends FeatureGenerator
super(false);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
// if (this.mushroomType == null)
// {
@ -47,7 +48,7 @@ public class WorldGenBigMushroom extends FeatureGenerator
k = 0;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
{
@ -189,7 +190,7 @@ public class WorldGenBigMushroom extends FeatureGenerator
if (position.getY() >= position.getY() + i - 1 || dir != BlockHugeMushroom.EnumType.ALL_INSIDE)
{
BlockPos blockpos = new BlockPos(l1, l2, i2);
LocalPos blockpos = new LocalPos(l1, l2, i2);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{

View file

@ -2,17 +2,17 @@ package server.worldgen.foliage;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenCactus extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 10; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos))
{

View file

@ -4,13 +4,13 @@ import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenDeadBush extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
Block block;
@ -21,7 +21,7 @@ public class WorldGenDeadBush extends FeatureGenerator
for (int i = 0; i < 4; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && Blocks.deadbush.canBlockStay(worldIn, blockpos, Blocks.deadbush.getState()))
{

View file

@ -2,7 +2,7 @@ package server.worldgen.foliage;
import common.block.foliage.BlockFlower;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -23,11 +23,11 @@ public class WorldGenFlowers extends FeatureGenerator
this.state = block.getState();
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state))
{

View file

@ -2,17 +2,17 @@ package server.worldgen.foliage;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenMelon extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (Blocks.melon_block.canPlace(worldIn, blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass)
{

View file

@ -2,7 +2,7 @@ package server.worldgen.foliage;
import common.block.foliage.BlockBush;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -15,11 +15,11 @@ public class WorldGenMushroom extends FeatureGenerator
this.field_175908_a = p_i45633_1_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getState()))
{

View file

@ -2,17 +2,17 @@ package server.worldgen.foliage;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenPumpkin extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 64; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlace(worldIn, blockpos))
{

View file

@ -3,21 +3,21 @@ package server.worldgen.foliage;
import common.block.Material;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenReed extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 20; ++i)
{
BlockPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), 0, rand.zrange(4) - rand.zrange(4));
LocalPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), 0, rand.zrange(4) - rand.zrange(4));
if (worldIn.isAirBlock(blockpos))
{
BlockPos blockpos1 = blockpos.down();
LocalPos blockpos1 = blockpos.down();
if (worldIn.getState(blockpos1.west()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.east()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.north()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.south()).getBlock().getMaterial() == Material.WATER)
{

View file

@ -6,7 +6,7 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.tree.WorldGenBaseTree;
@ -23,7 +23,7 @@ public class WorldGenShrub extends WorldGenBaseTree
this.leavesMetadata = leaves;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
Block block;
@ -54,7 +54,7 @@ public class WorldGenShrub extends WorldGenBaseTree
if (Math.abs(i1) != k || Math.abs(k1) != k || rand.zrange(2) != 0)
{
BlockPos blockpos = new BlockPos(l, i, j1);
LocalPos blockpos = new LocalPos(l, i, j1);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{

View file

@ -5,7 +5,7 @@ import common.block.Material;
import common.block.foliage.BlockTallGrass;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -21,7 +21,7 @@ public class WorldGenTallGrass extends FeatureGenerator
this.tallGrassState = block.getState();
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
Block block;
@ -32,7 +32,7 @@ public class WorldGenTallGrass extends FeatureGenerator
for (int i = 0; i < 128; ++i)
{
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && this.tallGrass.canBlockStay(worldIn, blockpos, this.tallGrassState))
{

View file

@ -3,7 +3,7 @@ package server.worldgen.foliage;
import common.block.foliage.BlockVine;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.world.State;
import server.world.WorldServer;
@ -11,7 +11,7 @@ import server.worldgen.FeatureGenerator;
public class WorldGenVines extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (; position.getY() < 128; position = position.up())
{

View file

@ -3,14 +3,14 @@ package server.worldgen.foliage;
import common.block.foliage.BlockLilyPad;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
public class WorldGenWaterlily extends FeatureGenerator
{
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
for (int i = 0; i < 10; ++i)
{
@ -18,9 +18,9 @@ public class WorldGenWaterlily extends FeatureGenerator
int k = position.getY() + rand.zrange(4) - rand.zrange(4);
int l = position.getZ() + rand.zrange(8) - rand.zrange(8);
if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlace(worldIn, new BlockPos(j, k, l)))
if (worldIn.isAirBlock(new LocalPos(j, k, l)) && Blocks.waterlily.canPlace(worldIn, new LocalPos(j, k, l)))
{
worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2);
worldIn.setState(new LocalPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2);
}
}

View file

@ -3,7 +3,7 @@ package server.worldgen.layer;
import java.util.List;
import common.collect.Lists;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.LongHashMap;
import server.worldgen.Scaling;
@ -172,7 +172,7 @@ public class BiomeGenerator {
return id < 0 || id >= this.biomes.length || this.biomes[id] == null ? this.defBiome : this.biomes[id];
}
public Biome getBiomeAt(BlockPos pos) {
public Biome getBiomeAt(LocalPos pos) {
int x = pos.getX();
int z = pos.getZ();
Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z);

View file

@ -1,9 +1,9 @@
package server.worldgen.populator;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
public interface Populator {
void decorate(WorldServer world, Random rand, BlockPos pos);
void decorate(WorldServer world, Random rand, LocalPos pos);
}

View file

@ -1,7 +1,7 @@
package server.worldgen.populator;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.rng.PerlinGen;
import server.world.WorldServer;
@ -13,7 +13,7 @@ public class PopulatorAlphaLike extends PopulatorBasic {
this.clayExtPerChunk = 10;
}
public void decorate(WorldServer world, Random rand, BlockPos pos) {
public void decorate(WorldServer world, Random rand, LocalPos pos) {
this.treesPerChunk = (int)((TREE_NOISE.generate((double)pos.getX() * 0.5D, (double)pos.getZ() * 0.5D) / 8D + rand.doublev() * 4D + 4D) / 3D) + 5;
super.decorate(world, rand, pos);
}

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
import server.worldgen.feature.WorldGenAsteroid;
@ -14,7 +14,7 @@ public class PopulatorAsteroids extends PopulatorBasic
protected FeatureGenerator asteroidGen2 = new WorldGenAsteroid(Blocks.dirt.getState(),
Blocks.coarse_dirt.getState());
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
if(rand.chance(5)) {
int x = rand.chOffset();

View file

@ -3,7 +3,7 @@ package server.worldgen.populator;
import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
import server.worldgen.feature.WorldGenClay;
@ -64,12 +64,12 @@ public abstract class PopulatorBasic implements Populator {
return new WorldGenTallGrass(Blocks.tallgrass);
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos)
{
return rand.rarity(3) ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.ROSE;
}
public void decorate(WorldServer world, Random rand, BlockPos pos)
public void decorate(WorldServer world, Random rand, LocalPos pos)
{
for (int i = 0; i < this.sandPerChunk2; ++i)
{
@ -112,7 +112,7 @@ public abstract class PopulatorBasic implements Populator {
int l = rand.chOffset();
WorldGenTree treeGen = this.genBigTreeChance(rand);
treeGen.prepare();
BlockPos blockpos = world.getHeight(pos.add(k6, 0, l));
LocalPos blockpos = world.getHeight(pos.add(k6, 0, l));
if (treeGen.generate(world, rand, blockpos))
{
@ -136,7 +136,7 @@ public abstract class PopulatorBasic implements Populator {
if (j14 > 0)
{
int k17 = rand.zrange(j14);
BlockPos blockpos1 = pos.add(i7, k17, l10);
LocalPos blockpos1 = pos.add(i7, k17, l10);
BlockFlower.EnumFlowerType blockflower$enumflowertype = this.pickRandomFlower(rand, blockpos1);
this.yellowFlowerGen.setGeneratedBlock(BlockFlower.getByType(blockflower$enumflowertype));
@ -179,8 +179,8 @@ public abstract class PopulatorBasic implements Populator {
if (i15 > 0)
{
int j18 = rand.zrange(i15);
BlockPos blockpos4;
BlockPos blockpos7;
LocalPos blockpos4;
LocalPos blockpos7;
for (blockpos4 = pos.add(l7, j18, k11); blockpos4.getY() > 0; blockpos4 = blockpos7)
{
@ -202,7 +202,7 @@ public abstract class PopulatorBasic implements Populator {
{
int i8 = rand.chOffset();
int l11 = rand.chOffset();
BlockPos blockpos2 = world.getHeight(pos.add(i8, 0, l11));
LocalPos blockpos2 = world.getHeight(pos.add(i8, 0, l11));
this.mushroomBrownGen.generate(world, rand, blockpos2);
}
@ -215,7 +215,7 @@ public abstract class PopulatorBasic implements Populator {
if (j15 > 0)
{
int k18 = rand.zrange(j15);
BlockPos blockpos5 = pos.add(j8, k18, i12);
LocalPos blockpos5 = pos.add(j8, k18, i12);
this.mushroomRedGen.generate(world, rand, blockpos5);
}
}

View file

@ -4,7 +4,7 @@ import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.worldgen.tree.WorldGenBaseTree;
import server.worldgen.tree.WorldGenTree;
@ -15,7 +15,7 @@ public class PopulatorBlackened extends PopulatorBasic {
this.treesPerChunk = 3;
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) {
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) {
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
}

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
import server.worldgen.foliage.WorldGenMushroom;
@ -11,7 +11,7 @@ public class PopulatorChaos extends PopulatorBasic
{
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
super.decorate(worldIn, rand, pos);
@ -19,7 +19,7 @@ public class PopulatorChaos extends PopulatorBasic
{
int i8 = rand.chOffset();
int l11 = rand.chOffset();
BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
LocalPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
this.mushroomBlueGen.generate(worldIn, rand, blockpos2);
}
}

View file

@ -1,7 +1,7 @@
package server.worldgen.populator;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.feature.WorldGenDesertWells;
@ -15,7 +15,7 @@ public class PopulatorDesert extends PopulatorBasic
this.cactiPerChunk = 10;
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
super.decorate(worldIn, rand, pos);
@ -23,7 +23,7 @@ public class PopulatorDesert extends PopulatorBasic
{
int i = rand.chOffset();
int j = rand.chOffset();
BlockPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up();
LocalPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up();
(new WorldGenDesertWells()).generate(worldIn, rand, blockpos);
}
}

View file

@ -5,7 +5,7 @@ import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import server.rng.PerlinGen;
import server.world.WorldServer;
@ -76,7 +76,7 @@ public class PopulatorForest extends PopulatorBasic
(this.subType == 4 || rand.chance(2) ? (rand.chance(this.subType == 4 ? 32 : 5) ? this.mapleBig : this.maple) : normalBirch)));
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos)
{
if(this.subType == 0) {
double d0 = GRASS_NOISE.generate((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
@ -124,7 +124,7 @@ public class PopulatorForest extends PopulatorBasic
}
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
if(this.subType == 0) {
double d0 = GRASS_NOISE.generate((double)(pos.getX() + 8) / 200.0D, (double)(pos.getZ() + 8) / 200.0D);
@ -192,7 +192,7 @@ public class PopulatorForest extends PopulatorBasic
{
int k = i * 4 + rand.range(9, 11);
int l = j * 4 + rand.range(9, 11);
BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
LocalPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
if (rand.chance(20))
{
@ -238,7 +238,7 @@ public class PopulatorForest extends PopulatorBasic
int k2 = rand.chOffset();
int i1 = rand.zrange(worldIn.getHeight(pos.add(j2, 0, k2)).getY() + 32);
if (DOUBLE_PLANT_GEN.generate(worldIn, rand, new BlockPos(pos.getX() + j2, i1, pos.getZ() + k2)))
if (DOUBLE_PLANT_GEN.generate(worldIn, rand, new LocalPos(pos.getX() + j2, i1, pos.getZ() + k2)))
{
break;
}

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.component.FeatureOres;
import server.worldgen.feature.WorldGenFire;
@ -33,7 +33,7 @@ public class PopulatorHell extends PopulatorBasic
this.redMushroomGen = new WorldGenMushroom(Blocks.red_mushroom);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
for (int i = 0; i < 8; ++i)
{

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.component.FeatureOres;
import server.worldgen.tree.WorldGenTaiga2;
@ -24,7 +24,7 @@ public class PopulatorHills extends PopulatorBasic
return (WorldGenTree)(rand.rarity(3) ? this.field_150634_aD : super.genBigTreeChance(rand));
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
super.decorate(worldIn, rand, pos);
this.theEmeraldGenerator.generate(worldIn, rand, pos);

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.tree.WorldGenSavanna;
import server.worldgen.tree.WorldGenTree;
@ -23,7 +23,7 @@ public class PopulatorSavanna extends PopulatorBasic
return (WorldGenTree)(rand.rarity(5) ? field_150627_aC : this.worldGeneratorTrees);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass);

View file

@ -1,7 +1,7 @@
package server.worldgen.populator;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.feature.WorldGenIcePath;
import server.worldgen.feature.WorldGenIceSpike;
@ -13,7 +13,7 @@ public class PopulatorSpikes extends PopulatorBasic
private final WorldGenIceSpike spikeGen = new WorldGenIceSpike();
private final WorldGenIcePath pathGen = new WorldGenIcePath(4);
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
for (int i = 0; i < 3; ++i)
{

View file

@ -3,7 +3,7 @@ package server.worldgen.populator;
import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.worldgen.FeatureGenerator;
import server.worldgen.foliage.WorldGenTallGrass;
import server.worldgen.tree.WorldGenSwamp;
@ -32,7 +32,7 @@ public class PopulatorSwamp extends PopulatorBasic
return this.worldGeneratorSwamp;
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos)
{
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
}

View file

@ -2,7 +2,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
import server.worldgen.feature.WorldGenBlockBlob;
@ -49,7 +49,7 @@ public class PopulatorTaiga extends PopulatorBasic
return rand.rarity(5) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
if (this.subType == 1 || this.subType == 2)
{
@ -59,7 +59,7 @@ public class PopulatorTaiga extends PopulatorBasic
{
int k = rand.chOffset();
int l = rand.chOffset();
BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
LocalPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
field_150643_aG.generate(worldIn, rand, blockpos);
}
}

View file

@ -1,7 +1,7 @@
package server.worldgen.populator;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
public class PopulatorTerranian implements Populator {
@ -20,7 +20,7 @@ public class PopulatorTerranian implements Populator {
private final Populator tallTreeTaiga = new PopulatorTaiga(2);
private final Populator tallBirchForest = new PopulatorForest(1);
public void decorate(WorldServer world, Random rand, BlockPos pos) {
public void decorate(WorldServer world, Random rand, LocalPos pos) {
float absTemp = world.getGenTemperature(pos.getX(), pos.getZ());
float humidity = world.getGenHumidity(pos.getX(), pos.getZ());

View file

@ -4,7 +4,7 @@ import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
import server.worldgen.feature.WorldGenSpikes;
@ -32,7 +32,7 @@ public class PopulatorTian extends PopulatorBasic
this.treesPerChunk = 1;
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos)
{
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
}
@ -42,7 +42,7 @@ public class PopulatorTian extends PopulatorBasic
return rand.pick(rand.chance(this.treeGen2, this.treeGen1, 4), rand.chance(this.treeGen3, this.treeGen4, 15));
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
super.decorate(worldIn, rand, pos);
@ -52,7 +52,7 @@ public class PopulatorTian extends PopulatorBasic
{
int i8 = rand.chOffset();
int l11 = rand.chOffset();
BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
LocalPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
this.mushroomBlueGen.generate(worldIn, rand, blockpos2);
}
}

View file

@ -3,7 +3,7 @@ package server.worldgen.populator;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -38,7 +38,7 @@ public class PopulatorTropical extends PopulatorBasic
return rand.chance(4) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
public void decorate(WorldServer worldIn, Random rand, LocalPos pos)
{
super.decorate(worldIn, rand, pos);
int i = rand.chOffset();

View file

@ -3,7 +3,7 @@ package server.worldgen.replacer;
import common.dimension.Dimension;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import common.util.MutablePos;
import common.world.State;
import server.dimension.GeneratorData;
import server.world.WorldServer;
@ -75,7 +75,7 @@ public class ReplacerAltSimple extends ReplacerBiome
int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D);
int bx = x & 15;
int bz = z & 15;
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
MutablePos pos = new MutablePos();
for (int by = primer.height - 1; by >= 0; by--)
{

View file

@ -1,7 +1,7 @@
package server.worldgen.structure;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import server.world.WorldServer;
public class MapGenScatteredFeature extends MapGenStructure
@ -50,7 +50,7 @@ public class MapGenScatteredFeature extends MapGenStructure
return new MapGenScatteredFeature.Start(this.worldObj, this.rand, chunkX, chunkZ);
}
public boolean hasMageHut(BlockPos pos)
public boolean hasMageHut(LocalPos pos)
{
StructureStart structurestart = this.func_175797_c(pos);

View file

@ -6,7 +6,7 @@ import java.util.Map;
import common.collect.Maps;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ChunkPos;
import common.util.LongHashMap;
import common.world.World;
@ -69,13 +69,13 @@ public abstract class MapGenStructure extends MapGenBase
return flag;
}
public boolean isPresent(BlockPos pos)
public boolean isPresent(LocalPos pos)
{
this.initializeStructureData(this.worldObj);
return this.func_175797_c(pos) != null;
}
protected StructureStart func_175797_c(BlockPos pos)
protected StructureStart func_175797_c(LocalPos pos)
{
label24:
@ -107,7 +107,7 @@ public abstract class MapGenStructure extends MapGenBase
return null;
}
public boolean isPositionInStructure(WorldServer worldIn, BlockPos pos)
public boolean isPositionInStructure(WorldServer worldIn, LocalPos pos)
{
this.initializeStructureData(worldIn);

View file

@ -1,6 +1,6 @@
package server.worldgen.structure;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.Vec3i;
@ -210,7 +210,7 @@ public class StructureBoundingBox
public Vec3i getCenter()
{
return new BlockPos(this.minX + (this.maxX - this.minX + 1) / 2, this.minY + (this.maxY - this.minY + 1) / 2, this.minZ + (this.maxZ - this.minZ + 1) / 2);
return new LocalPos(this.minX + (this.maxX - this.minX + 1) / 2, this.minY + (this.maxY - this.minY + 1) / 2, this.minZ + (this.maxZ - this.minZ + 1) / 2);
}
// public String toString()

View file

@ -8,7 +8,7 @@ import common.entity.npc.EntityDarkMage;
import common.init.Blocks;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.vars.Vars;
import common.world.State;
@ -153,7 +153,7 @@ public class StructureBridge
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false);
if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
{
this.field_111021_b = false;
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, LootConstants.HELL_FORTRESS, 2 + randomIn.zrange(4));
@ -224,7 +224,7 @@ public class StructureBridge
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false);
if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3))))
if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3))))
{
this.field_111020_b = false;
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, LootConstants.HELL_FORTRESS, 2 + randomIn.zrange(4));
@ -783,7 +783,7 @@ public class StructureBridge
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 6, 6, 4, 6, Blocks.air.getState(), Blocks.air.getState(), false);
this.setBlockState(worldIn, Blocks.blood_brick.getState(), 6, 0, 6, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.flowing_lava.getState(), 6, 5, 6, structureBoundingBoxIn);
BlockPos blockpos = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6));
LocalPos blockpos = new LocalPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6));
if (structureBoundingBoxIn.isVecInside(blockpos))
{
@ -1369,7 +1369,7 @@ public class StructureBridge
if (!this.hasSpawner && Vars.mobs && SVars.spawnBridgeMobs)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5));
LocalPos blockpos = new LocalPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5));
if (structureBoundingBoxIn.isVecInside(blockpos))
{

View file

@ -17,8 +17,9 @@ import common.rng.WeightedList;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -128,9 +129,9 @@ public abstract class StructureComponent
return null;
}
public BlockPos getBoundingBoxCenter()
public LocalPos getBoundingBoxCenter()
{
return new BlockPos(this.boundingBox.getCenter());
return new LocalPos(this.boundingBox.getCenter());
}
/**
@ -144,7 +145,7 @@ public abstract class StructureComponent
int l = Math.min(this.boundingBox.maxX + 1, boundingboxIn.maxX);
int i1 = Math.min(this.boundingBox.maxY + 1, boundingboxIn.maxY);
int j1 = Math.min(this.boundingBox.maxZ + 1, boundingboxIn.maxZ);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k1 = i; k1 <= l; ++k1)
{
@ -505,7 +506,7 @@ public abstract class StructureComponent
protected void setBlockState(WorldServer worldIn, State blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingboxIn.isVecInside(blockpos))
{
@ -518,7 +519,7 @@ public abstract class StructureComponent
int i = this.getXWithOffset(x, z);
int j = this.getYWithOffset(y);
int k = this.getZWithOffset(x, z);
BlockPos blockpos = new BlockPos(i, j, k);
LocalPos blockpos = new LocalPos(i, j, k);
return !boundingboxIn.isVecInside(blockpos) ? Blocks.air.getState() : worldIn.getState(blockpos);
}
@ -660,7 +661,7 @@ public abstract class StructureComponent
*/
protected void clearCurrentPositionBlocksUpwards(WorldServer worldIn, int x, int y, int z, StructureBoundingBox structurebb)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (structurebb.isVecInside(blockpos))
{
@ -681,11 +682,11 @@ public abstract class StructureComponent
int j = this.getYWithOffset(y);
int k = this.getZWithOffset(x, z);
if (boundingboxIn.isVecInside(new BlockPos(i, j, k)))
if (boundingboxIn.isVecInside(new LocalPos(i, j, k)))
{
while ((worldIn.isAirBlock(new BlockPos(i, j, k)) || worldIn.getState(new BlockPos(i, j, k)).getBlock().getMaterial().isLiquid()) && j > 1)
while ((worldIn.isAirBlock(new LocalPos(i, j, k)) || worldIn.getState(new LocalPos(i, j, k)).getBlock().getMaterial().isLiquid()) && j > 1)
{
worldIn.setState(new BlockPos(i, j, k), blockstateIn, 2);
worldIn.setState(new LocalPos(i, j, k), blockstateIn, 2);
--j;
}
}
@ -693,7 +694,7 @@ public abstract class StructureComponent
protected boolean generateChestContents(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, WeightedList<RngLoot> listIn, int max)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos) && worldIn.getState(blockpos).getBlock() != Blocks.wood_chest)
{
@ -719,7 +720,7 @@ public abstract class StructureComponent
*/
protected void placeDoorCurrentPosition(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, State state)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos))
{

View file

@ -15,7 +15,7 @@ import common.rng.WeightedList;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.vars.Vars;
import common.world.State;
@ -290,7 +290,7 @@ public class StructureMineshaft
protected boolean generateChestContents(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, WeightedList<RngLoot> listIn, int max)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos) && worldIn.getState(blockpos).getBlock() == Blocks.air && worldIn.isBlockSolid(blockpos.down()))
{
@ -370,7 +370,7 @@ public class StructureMineshaft
int i2 = k1 - 1 + randomIn.zrange(3);
int j2 = this.getXWithOffset(1, i2);
i2 = this.getZWithOffset(1, i2);
BlockPos blockpos = new BlockPos(j2, l1, i2);
LocalPos blockpos = new LocalPos(j2, l1, i2);
if (structureBoundingBoxIn.isVecInside(blockpos))
{

View file

@ -8,8 +8,9 @@ import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.MutablePos;
import common.vars.Vars;
import common.world.State;
import server.vars.SVars;
@ -313,7 +314,7 @@ public class StructureScattered
{
int i = 0;
int j = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
{
@ -624,7 +625,7 @@ public class StructureScattered
int i2 = this.getYWithOffset(2);
int k1 = this.getZWithOffset(2, 5);
if (structureBoundingBoxIn.isVecInside(new BlockPos(l1, i2, k1)))
if (structureBoundingBoxIn.isVecInside(new LocalPos(l1, i2, k1)))
{
this.hasMage = true;
EntityMage mage = new EntityMage(worldIn);

View file

@ -15,7 +15,7 @@ import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.vars.Vars;
import common.world.State;
@ -301,7 +301,7 @@ public class StructureStronghold
this.setBlockState(worldIn, Blocks.stonebrick_slab.getState(), 2, 1, i, structureBoundingBoxIn);
}
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
{
this.hasMadeChest = true;
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, RngLoot.addToList(LootConstants.STRONGHOLD_CHEST, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(2));
@ -906,7 +906,7 @@ public class StructureStronghold
if (!this.hasSpawner && Vars.mobs && SVars.spawnStrongholdMobs)
{
i = this.getYWithOffset(3);
BlockPos blockpos = new BlockPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6));
LocalPos blockpos = new LocalPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6));
if (structureBoundingBoxIn.isVecInside(blockpos))
{
@ -1276,7 +1276,7 @@ public class StructureStronghold
super(0, p_i2083_2_, p_i2083_3_, p_i2083_4_);
}
public BlockPos getBoundingBoxCenter()
public LocalPos getBoundingBoxCenter()
{
return this.strongholdPortalRoom != null ? this.strongholdPortalRoom.getBoundingBoxCenter() : super.getBoundingBoxCenter();
}

View file

@ -15,8 +15,9 @@ import common.init.BlockRegistry;
import common.init.Blocks;
import common.rng.Random;
import common.tags.TagObject;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.MutablePos;
import common.vars.Vars;
import common.world.State;
import server.vars.SVars;
@ -909,7 +910,7 @@ public class StructureVillage
this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.oak_stairs.getState().withProperty(BlockStairs.FACING, Facing.NORTH)), 2, 1, 5, structureBoundingBoxIn);
this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.oak_stairs.getState().withProperty(BlockStairs.FACING, Facing.WEST)), 1, 1, 4, structureBoundingBoxIn);
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5))))
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5))))
{
this.hasMadeChest = true;
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, LootConstants.VILLAGE_BLACKSMITH, 3 + randomIn.zrange(6));
@ -1349,7 +1350,7 @@ public class StructureVillage
{
for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j)
{
BlockPos blockpos = new BlockPos(i, 64, j);
LocalPos blockpos = new LocalPos(i, 64, j);
if (structureBoundingBoxIn.isVecInside(blockpos))
{
@ -1555,7 +1556,7 @@ public class StructureVillage
{
int i = 0;
int j = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
{
@ -1596,7 +1597,7 @@ public class StructureVillage
int k = this.getYWithOffset(p_74893_4_);
int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
if (!p_74893_2_.isVecInside(new LocalPos(j, k, l)))
{
break;
}
@ -1911,7 +1912,7 @@ public class StructureVillage
int k = this.getYWithOffset(y);
int l = this.getZWithOffset(x, z);
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
if (!p_74893_2_.isVecInside(new LocalPos(j, k, l)))
{
return;
}

View file

@ -8,7 +8,8 @@ import common.init.Blocks;
import common.init.WoodType;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -41,7 +42,7 @@ public class WorldGenBaseTree extends WorldGenTree
this.vinesGrow = vines;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(3) + this.minTreeHeight;
boolean flag = true;
@ -62,7 +63,7 @@ public class WorldGenBaseTree extends WorldGenTree
k = 2;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
{
@ -112,7 +113,7 @@ public class WorldGenBaseTree extends WorldGenTree
if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.zrange(2) != 0 && i4 != 0)
{
BlockPos blockpos = new BlockPos(k1, i3, i2);
LocalPos blockpos = new LocalPos(k1, i3, i2);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH)
@ -163,7 +164,7 @@ public class WorldGenBaseTree extends WorldGenTree
{
int j4 = k3 - (position.getY() + i);
int k4 = 2 - j4 / 2;
BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos1 = new MutablePos();
for (int l4 = position.getX() - k4; l4 <= position.getX() + k4; ++l4)
{
@ -173,10 +174,10 @@ public class WorldGenBaseTree extends WorldGenTree
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES)
{
BlockPos blockpos2 = blockpos$mutableblockpos1.west();
BlockPos blockpos3 = blockpos$mutableblockpos1.east();
BlockPos blockpos4 = blockpos$mutableblockpos1.north();
BlockPos blockpos1 = blockpos$mutableblockpos1.south();
LocalPos blockpos2 = blockpos$mutableblockpos1.west();
LocalPos blockpos3 = blockpos$mutableblockpos1.east();
LocalPos blockpos4 = blockpos$mutableblockpos1.north();
LocalPos blockpos1 = blockpos$mutableblockpos1.south();
if (rand.zrange(4) == 0 && worldIn.getState(blockpos2).getBlock() == Blocks.air)
{
@ -217,12 +218,12 @@ public class WorldGenBaseTree extends WorldGenTree
}
}
private void func_181651_a(WorldServer p_181651_1_, BlockPos p_181651_2_, PropertyBool p_181651_3_)
private void func_181651_a(WorldServer p_181651_1_, LocalPos p_181651_2_, PropertyBool p_181651_3_)
{
this.setBlockNotify(p_181651_1_, p_181651_2_, Blocks.vine.getState().withProperty(p_181651_3_, Boolean.valueOf(true)));
}
private void func_181650_b(WorldServer p_181650_1_, BlockPos p_181650_2_, PropertyBool p_181650_3_)
private void func_181650_b(WorldServer p_181650_1_, LocalPos p_181650_2_, PropertyBool p_181650_3_)
{
this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
int i = 4;

View file

@ -10,7 +10,7 @@ import common.collect.Lists;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.State;
@ -23,7 +23,7 @@ public class WorldGenBigTree extends WorldGenTree
private Random rand;
private WorldServer world;
private BlockPos basePos = BlockPos.ORIGIN;
private LocalPos basePos = LocalPos.ORIGIN;
private int heightLimit;
private int height;
double heightAttenuation = 0.618D;
@ -34,7 +34,7 @@ public class WorldGenBigTree extends WorldGenTree
private int heightLimitLower = 5;
private int heightLimitLimit = 16;
private int leafDistanceLimit = 4;
List<WorldGenBigTree.FoliageCoordinates> field_175948_j;
List<WorldGenBigTree.LeafPos> field_175948_j;
public WorldGenBigTree(boolean notify, State logBase, WoodType leavesBase)
{
@ -80,8 +80,8 @@ public class WorldGenBigTree extends WorldGenTree
int j = this.basePos.getY() + this.height;
int k = this.heightLimit - this.leafDistanceLimit;
this.field_175948_j = Lists.<WorldGenBigTree.FoliageCoordinates>newArrayList();
this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(this.basePos.up(k), j));
this.field_175948_j = Lists.<WorldGenBigTree.LeafPos>newArrayList();
this.field_175948_j.add(new WorldGenBigTree.LeafPos(this.basePos.up(k), j));
for (; k >= 0; --k)
{
@ -95,8 +95,8 @@ public class WorldGenBigTree extends WorldGenTree
double d1 = (double)(this.rand.floatv() * 2.0F) * Math.PI;
double d2 = d0 * Math.sin(d1) + 0.5D;
double d3 = d0 * Math.cos(d1) + 0.5D;
BlockPos blockpos = this.basePos.add(d2, (double)(k - 1), d3);
BlockPos blockpos1 = blockpos.up(this.leafDistanceLimit);
LocalPos blockpos = this.basePos.add(d2, (double)(k - 1), d3);
LocalPos blockpos1 = blockpos.up(this.leafDistanceLimit);
if (this.checkBlockLine(blockpos, blockpos1) == -1)
{
@ -104,11 +104,11 @@ public class WorldGenBigTree extends WorldGenTree
int j1 = this.basePos.getZ() - blockpos.getZ();
double d4 = (double)blockpos.getY() - Math.sqrt((double)(i1 * i1 + j1 * j1)) * this.branchSlope;
int k1 = d4 > (double)j ? j : (int)d4;
BlockPos blockpos2 = new BlockPos(this.basePos.getX(), k1, this.basePos.getZ());
LocalPos blockpos2 = new LocalPos(this.basePos.getX(), k1, this.basePos.getZ());
if (this.checkBlockLine(blockpos2, blockpos) == -1)
{
this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(blockpos, blockpos2.getY()));
this.field_175948_j.add(new WorldGenBigTree.LeafPos(blockpos, blockpos2.getY()));
}
}
}
@ -116,7 +116,7 @@ public class WorldGenBigTree extends WorldGenTree
}
}
void func_181631_a(BlockPos p_181631_1_, float p_181631_2_, State p_181631_3_)
void func_181631_a(LocalPos p_181631_1_, float p_181631_2_, State p_181631_3_)
{
int i = (int)((double)p_181631_2_ + 0.618D);
@ -126,7 +126,7 @@ public class WorldGenBigTree extends WorldGenTree
{
if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_))
{
BlockPos blockpos = p_181631_1_.add(j, 0, k);
LocalPos blockpos = p_181631_1_.add(j, 0, k);
Block block = this.world.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
@ -174,7 +174,7 @@ public class WorldGenBigTree extends WorldGenTree
/**
* Generates the leaves surrounding an individual entry in the leafNodes list.
*/
void generateLeafNode(BlockPos pos)
void generateLeafNode(LocalPos pos)
{
for (int i = 0; i < this.leafDistanceLimit; ++i)
{
@ -182,9 +182,9 @@ public class WorldGenBigTree extends WorldGenTree
}
}
void func_175937_a(BlockPos p_175937_1_, BlockPos p_175937_2_)
void func_175937_a(LocalPos p_175937_1_, LocalPos p_175937_2_)
{
BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
LocalPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
int i = this.getGreatestDistance(blockpos);
float f = (float)blockpos.getX() / (float)i;
float f1 = (float)blockpos.getY() / (float)i;
@ -192,7 +192,7 @@ public class WorldGenBigTree extends WorldGenTree
for (int j = 0; j <= i; ++j)
{
BlockPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
LocalPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
Facing.Axis blocklog$enumaxis = this.func_175938_b(p_175937_1_, blockpos1);
this.setBlockNotify(this.world, blockpos1, this.logBase.withProperty(BlockLog.AXIS, blocklog$enumaxis));
}
@ -201,7 +201,7 @@ public class WorldGenBigTree extends WorldGenTree
/**
* Returns the absolute greatest distance in the BlockPos object.
*/
private int getGreatestDistance(BlockPos posIn)
private int getGreatestDistance(LocalPos posIn)
{
int i = ExtMath.absi(posIn.getX());
int j = ExtMath.absi(posIn.getY());
@ -209,7 +209,7 @@ public class WorldGenBigTree extends WorldGenTree
return k > i && k > j ? k : (j > i ? j : i);
}
private Facing.Axis func_175938_b(BlockPos p_175938_1_, BlockPos p_175938_2_)
private Facing.Axis func_175938_b(LocalPos p_175938_1_, LocalPos p_175938_2_)
{
Facing.Axis blocklog$enumaxis = Facing.Axis.Y;
int i = Math.abs(p_175938_2_.getX() - p_175938_1_.getX());
@ -236,7 +236,7 @@ public class WorldGenBigTree extends WorldGenTree
*/
void generateLeaves()
{
for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j)
for (WorldGenBigTree.LeafPos worldgenbigtree$foliagecoordinates : this.field_175948_j)
{
this.generateLeafNode(worldgenbigtree$foliagecoordinates);
}
@ -256,8 +256,8 @@ public class WorldGenBigTree extends WorldGenTree
*/
void generateTrunk()
{
BlockPos blockpos = this.basePos;
BlockPos blockpos1 = this.basePos.up(this.height);
LocalPos blockpos = this.basePos;
LocalPos blockpos1 = this.basePos.up(this.height);
this.func_175937_a(blockpos, blockpos1);
if (this.trunkSize == 2)
@ -273,10 +273,10 @@ public class WorldGenBigTree extends WorldGenTree
*/
void generateLeafNodeBases()
{
for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j)
for (WorldGenBigTree.LeafPos worldgenbigtree$foliagecoordinates : this.field_175948_j)
{
int i = worldgenbigtree$foliagecoordinates.func_177999_q();
BlockPos blockpos = new BlockPos(this.basePos.getX(), i, this.basePos.getZ());
int i = worldgenbigtree$foliagecoordinates.getHeight();
LocalPos blockpos = new LocalPos(this.basePos.getX(), i, this.basePos.getZ());
if (!blockpos.equals(worldgenbigtree$foliagecoordinates) && this.leafNodeNeedsBase(i - this.basePos.getY()))
{
@ -289,9 +289,9 @@ public class WorldGenBigTree extends WorldGenTree
* Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance
* (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered.
*/
int checkBlockLine(BlockPos posOne, BlockPos posTwo)
int checkBlockLine(LocalPos posOne, LocalPos posTwo)
{
BlockPos blockpos = posTwo.add(-posOne.getX(), -posOne.getY(), -posOne.getZ());
LocalPos blockpos = posTwo.add(-posOne.getX(), -posOne.getY(), -posOne.getZ());
int i = this.getGreatestDistance(blockpos);
float f = (float)blockpos.getX() / (float)i;
float f1 = (float)blockpos.getY() / (float)i;
@ -305,7 +305,7 @@ public class WorldGenBigTree extends WorldGenTree
{
for (int j = 0; j <= i; ++j)
{
BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
LocalPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
if (!this.canBeReplaced(this.world.getState(blockpos1).getBlock()))
{
@ -323,7 +323,7 @@ public class WorldGenBigTree extends WorldGenTree
this.leafDistanceLimit = 5;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
this.world = worldIn;
this.basePos = position;
@ -380,19 +380,16 @@ public class WorldGenBigTree extends WorldGenTree
}
}
static class FoliageCoordinates extends BlockPos
{
private final int field_178000_b;
private static class LeafPos extends LocalPos {
private final int height;
public FoliageCoordinates(BlockPos p_i45635_1_, int p_i45635_2_)
{
super(p_i45635_1_.getX(), p_i45635_1_.getY(), p_i45635_1_.getZ());
this.field_178000_b = p_i45635_2_;
}
public LeafPos(LocalPos pos, int height) {
super(pos.getX(), pos.getY(), pos.getZ());
this.height = height;
}
public int func_177999_q()
{
return this.field_178000_b;
}
}
public int getHeight() {
return this.height;
}
}
}

View file

@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -23,7 +24,7 @@ public class WorldGenBirch extends WorldGenTree
this.useExtraRandomHeight = extra;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(3) + 5;
@ -50,7 +51,7 @@ public class WorldGenBirch extends WorldGenTree
k = 2;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
{
@ -98,7 +99,7 @@ public class WorldGenBirch extends WorldGenTree
if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.zrange(2) != 0 && k2 != 0)
{
BlockPos blockpos = new BlockPos(i3, i2, k1);
LocalPos blockpos = new LocalPos(i3, i2, k1);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)

View file

@ -6,8 +6,9 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -22,7 +23,7 @@ public class WorldGenDarkOak extends WorldGenTree
super(notify);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(3) + rand.zrange(2) + 6;
int j = position.getX();
@ -31,7 +32,7 @@ public class WorldGenDarkOak extends WorldGenTree
if (k >= 1 && k + i + 1 < 512)
{
BlockPos blockpos = position.down();
LocalPos blockpos = position.down();
Block block = worldIn.getState(blockpos).getBlock();
if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.coarse_dirt && block != Blocks.podzol)
@ -65,7 +66,7 @@ public class WorldGenDarkOak extends WorldGenTree
}
int k2 = k + j2;
BlockPos blockpos1 = new BlockPos(k1, k2, l1);
LocalPos blockpos1 = new LocalPos(k1, k2, l1);
Block block1 = worldIn.getState(blockpos1).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
@ -127,7 +128,7 @@ public class WorldGenDarkOak extends WorldGenTree
for (int i5 = 0; i5 < l4; ++i5)
{
this.func_181639_b(worldIn, new BlockPos(j + k3, i2 - i5 - 1, l + j4));
this.func_181639_b(worldIn, new LocalPos(j + k3, i2 - i5 - 1, l + j4));
}
for (int j5 = -1; j5 <= 1; ++j5)
@ -161,12 +162,12 @@ public class WorldGenDarkOak extends WorldGenTree
}
}
private boolean func_181638_a(WorldServer p_181638_1_, BlockPos p_181638_2_, int p_181638_3_)
private boolean func_181638_a(WorldServer p_181638_1_, LocalPos p_181638_2_, int p_181638_3_)
{
int i = p_181638_2_.getX();
int j = p_181638_2_.getY();
int k = p_181638_2_.getZ();
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = 0; l <= p_181638_3_ + 1; ++l)
{
@ -197,7 +198,7 @@ public class WorldGenDarkOak extends WorldGenTree
return true;
}
private void func_181639_b(WorldServer p_181639_1_, BlockPos p_181639_2_)
private void func_181639_b(WorldServer p_181639_1_, LocalPos p_181639_2_)
{
if (this.canBeReplaced(p_181639_1_.getState(p_181639_2_).getBlock()))
{
@ -207,7 +208,7 @@ public class WorldGenDarkOak extends WorldGenTree
private void func_150526_a(WorldServer worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_)
{
BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_);
LocalPos blockpos = new LocalPos(p_150526_2_, p_150526_3_, p_150526_4_);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air)

View file

@ -6,7 +6,7 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.world.State;
import server.world.WorldServer;
@ -43,7 +43,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
return i;
}
private boolean func_175926_c(WorldServer worldIn, BlockPos p_175926_2_, int p_175926_3_)
private boolean func_175926_c(WorldServer worldIn, LocalPos p_175926_2_, int p_175926_3_)
{
boolean flag = true;
@ -82,9 +82,9 @@ public abstract class WorldGenHugeTree extends WorldGenTree
}
}
private boolean func_175927_a(BlockPos p_175927_1_, WorldServer worldIn)
private boolean func_175927_a(LocalPos p_175927_1_, WorldServer worldIn)
{
BlockPos blockpos = p_175927_1_.down();
LocalPos blockpos = p_175927_1_.down();
Block block = worldIn.getState(blockpos).getBlock();
if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) && p_175927_1_.getY() >= 2)
@ -101,12 +101,12 @@ public abstract class WorldGenHugeTree extends WorldGenTree
}
}
protected boolean func_175929_a(WorldServer worldIn, Random p_175929_2_, BlockPos p_175929_3_, int p_175929_4_)
protected boolean func_175929_a(WorldServer worldIn, Random p_175929_2_, LocalPos p_175929_3_, int p_175929_4_)
{
return this.func_175926_c(worldIn, p_175929_3_, p_175929_4_) && this.func_175927_a(p_175929_3_, worldIn);
}
protected void func_175925_a(WorldServer worldIn, BlockPos p_175925_2_, int p_175925_3_)
protected void func_175925_a(WorldServer worldIn, LocalPos p_175925_2_, int p_175925_3_)
{
int i = p_175925_3_ * p_175925_3_;
@ -119,7 +119,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i)
{
BlockPos blockpos = p_175925_2_.add(j, 0, k);
LocalPos blockpos = p_175925_2_.add(j, 0, k);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
@ -131,7 +131,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
}
}
protected void func_175928_b(WorldServer worldIn, BlockPos p_175928_2_, int p_175928_3_)
protected void func_175928_b(WorldServer worldIn, LocalPos p_175928_2_, int p_175928_3_)
{
int i = p_175928_3_ * p_175928_3_;
@ -141,7 +141,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
{
if (j * j + k * k <= i)
{
BlockPos blockpos = p_175928_2_.add(j, 0, k);
LocalPos blockpos = p_175928_2_.add(j, 0, k);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)

View file

@ -5,7 +5,7 @@ import common.init.Blocks;
import common.init.WoodType;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import common.world.State;
import server.world.WorldServer;
@ -17,7 +17,7 @@ public class WorldGenJungle extends WorldGenHugeTree
super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = this.func_150533_a(rand);
@ -39,7 +39,7 @@ public class WorldGenJungle extends WorldGenHugeTree
{
k = position.getX() + (int)(1.5F + ExtMath.cos(f) * (float)i1);
l = position.getZ() + (int)(1.5F + ExtMath.sin(f) * (float)i1);
this.setBlockNotify(worldIn, new BlockPos(k, j - 3 + i1 / 2, l), this.woodMetadata);
this.setBlockNotify(worldIn, new LocalPos(k, j - 3 + i1 / 2, l), this.woodMetadata);
}
int j2 = 1 + rand.zrange(2);
@ -48,13 +48,13 @@ public class WorldGenJungle extends WorldGenHugeTree
for (int k1 = j - j2; k1 <= j1; ++k1)
{
int l1 = k1 - j1;
this.func_175928_b(worldIn, new BlockPos(k, k1, l), 1 - l1);
this.func_175928_b(worldIn, new LocalPos(k, k1, l), 1 - l1);
}
}
for (int i2 = 0; i2 < i; ++i2)
{
BlockPos blockpos = position.up(i2);
LocalPos blockpos = position.up(i2);
if (this.canBeReplaced(worldIn.getState(blockpos).getBlock()))
{
@ -69,7 +69,7 @@ public class WorldGenJungle extends WorldGenHugeTree
if (i2 < i - 1)
{
BlockPos blockpos1 = blockpos.east();
LocalPos blockpos1 = blockpos.east();
if (this.canBeReplaced(worldIn.getState(blockpos1).getBlock()))
{
@ -82,7 +82,7 @@ public class WorldGenJungle extends WorldGenHugeTree
}
}
BlockPos blockpos2 = blockpos.south().east();
LocalPos blockpos2 = blockpos.south().east();
if (this.canBeReplaced(worldIn.getState(blockpos2).getBlock()))
{
@ -95,7 +95,7 @@ public class WorldGenJungle extends WorldGenHugeTree
}
}
BlockPos blockpos3 = blockpos.south();
LocalPos blockpos3 = blockpos.south();
if (this.canBeReplaced(worldIn.getState(blockpos3).getBlock()))
{
@ -114,7 +114,7 @@ public class WorldGenJungle extends WorldGenHugeTree
}
}
private void func_181632_a(WorldServer p_181632_1_, Random p_181632_2_, BlockPos p_181632_3_, PropertyBool p_181632_4_)
private void func_181632_a(WorldServer p_181632_1_, Random p_181632_2_, LocalPos p_181632_3_, PropertyBool p_181632_4_)
{
if (p_181632_2_.zrange(3) > 0 && p_181632_1_.isAirBlock(p_181632_3_))
{
@ -122,7 +122,7 @@ public class WorldGenJungle extends WorldGenHugeTree
}
}
private void func_175930_c(WorldServer worldIn, BlockPos p_175930_2_, int p_175930_3_)
private void func_175930_c(WorldServer worldIn, LocalPos p_175930_2_, int p_175930_3_)
{
int i = 2;

View file

@ -5,7 +5,7 @@ import common.block.Material;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.ExtMath;
import common.world.State;
import server.world.WorldServer;
@ -24,7 +24,7 @@ public class WorldGenPine extends WorldGenHugeTree
this.useBaseHeight = p_i45457_2_;
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = this.func_150533_a(rand);
@ -83,12 +83,12 @@ public class WorldGenPine extends WorldGenHugeTree
{
int l = p_150541_4_ - k;
int i1 = p_150541_5_ + ExtMath.floorf((float)l / (float)i * 3.5F);
this.func_175925_a(worldIn, new BlockPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0));
this.func_175925_a(worldIn, new LocalPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0));
j = i1;
}
}
public void finish(WorldServer worldIn, Random p_180711_2_, BlockPos p_180711_3_)
public void finish(WorldServer worldIn, Random p_180711_2_, LocalPos p_180711_3_)
{
this.func_175933_b(worldIn, p_180711_3_.west().north());
this.func_175933_b(worldIn, p_180711_3_.east(2).north());
@ -108,7 +108,7 @@ public class WorldGenPine extends WorldGenHugeTree
}
}
private void func_175933_b(WorldServer worldIn, BlockPos p_175933_2_)
private void func_175933_b(WorldServer worldIn, LocalPos p_175933_2_)
{
for (int i = -2; i <= 2; ++i)
{
@ -122,11 +122,11 @@ public class WorldGenPine extends WorldGenHugeTree
}
}
private void func_175934_c(WorldServer worldIn, BlockPos p_175934_2_)
private void func_175934_c(WorldServer worldIn, LocalPos p_175934_2_)
{
for (int i = 2; i >= -3; --i)
{
BlockPos blockpos = p_175934_2_.up(i);
LocalPos blockpos = p_175934_2_.up(i);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol)

View file

@ -6,8 +6,9 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.Facing;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -23,7 +24,7 @@ public class WorldGenSavanna extends WorldGenTree
super(p_i45463_1_);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(3) + rand.zrange(3) + 5;
boolean flag = true;
@ -44,7 +45,7 @@ public class WorldGenSavanna extends WorldGenTree
k = 2;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
{
@ -94,7 +95,7 @@ public class WorldGenSavanna extends WorldGenTree
--l2;
}
BlockPos blockpos = new BlockPos(i3, i2, j1);
LocalPos blockpos = new LocalPos(i3, i2, j1);
Block block1 = worldIn.getState(blockpos).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
@ -104,7 +105,7 @@ public class WorldGenSavanna extends WorldGenTree
}
}
BlockPos blockpos2 = new BlockPos(i3, k1, j1);
LocalPos blockpos2 = new LocalPos(i3, k1, j1);
for (int j3 = -3; j3 <= 3; ++j3)
{
@ -148,7 +149,7 @@ public class WorldGenSavanna extends WorldGenTree
int j2 = position.getY() + l4;
i3 += enumfacing1.getFrontOffsetX();
j1 += enumfacing1.getFrontOffsetZ();
BlockPos blockpos1 = new BlockPos(i3, j2, j1);
LocalPos blockpos1 = new LocalPos(i3, j2, j1);
Block block1 = worldIn.getState(blockpos1).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
@ -163,7 +164,7 @@ public class WorldGenSavanna extends WorldGenTree
if (k1 > 0)
{
BlockPos blockpos3 = new BlockPos(i3, k1, j1);
LocalPos blockpos3 = new LocalPos(i3, k1, j1);
for (int i5 = -2; i5 <= 2; ++i5)
{
@ -202,12 +203,12 @@ public class WorldGenSavanna extends WorldGenTree
}
}
private void func_181642_b(WorldServer p_181642_1_, BlockPos p_181642_2_)
private void func_181642_b(WorldServer p_181642_1_, LocalPos p_181642_2_)
{
this.setBlockNotify(p_181642_1_, p_181642_2_, field_181643_a);
}
private void func_175924_b(WorldServer worldIn, BlockPos p_175924_2_)
private void func_175924_b(WorldServer worldIn, LocalPos p_175924_2_)
{
Block block = worldIn.getState(p_175924_2_).getBlock();

View file

@ -8,7 +8,8 @@ import common.init.Blocks;
import common.init.WoodType;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -24,7 +25,7 @@ public class WorldGenSwamp extends WorldGenTree
super(false);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i;
@ -51,7 +52,7 @@ public class WorldGenSwamp extends WorldGenTree
k = 3;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
{
@ -108,7 +109,7 @@ public class WorldGenSwamp extends WorldGenTree
if (Math.abs(l3) != i3 || Math.abs(k1) != i3 || rand.zrange(2) != 0 && k2 != 0)
{
BlockPos blockpos = new BlockPos(k3, l1, j1);
LocalPos blockpos = new LocalPos(k3, l1, j1);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{
@ -133,7 +134,7 @@ public class WorldGenSwamp extends WorldGenTree
{
int l2 = j2 - (position.getY() + i);
int j3 = 2 - l2 / 2;
BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos1 = new MutablePos();
for (int i4 = position.getX() - j3; i4 <= position.getX() + j3; ++i4)
{
@ -143,10 +144,10 @@ public class WorldGenSwamp extends WorldGenTree
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES)
{
BlockPos blockpos3 = blockpos$mutableblockpos1.west();
BlockPos blockpos4 = blockpos$mutableblockpos1.east();
BlockPos blockpos1 = blockpos$mutableblockpos1.north();
BlockPos blockpos2 = blockpos$mutableblockpos1.south();
LocalPos blockpos3 = blockpos$mutableblockpos1.west();
LocalPos blockpos4 = blockpos$mutableblockpos1.east();
LocalPos blockpos1 = blockpos$mutableblockpos1.north();
LocalPos blockpos2 = blockpos$mutableblockpos1.south();
if (rand.zrange(4) == 0 && worldIn.getState(blockpos3).getBlock() == Blocks.air)
{
@ -186,7 +187,7 @@ public class WorldGenSwamp extends WorldGenTree
}
}
private void func_181647_a(WorldServer p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_)
private void func_181647_a(WorldServer p_181647_1_, LocalPos p_181647_2_, PropertyBool p_181647_3_)
{
State iblockstate = Blocks.swamp_vine.getState().withProperty(p_181647_3_, Boolean.valueOf(true));
this.setBlockNotify(p_181647_1_, p_181647_2_, iblockstate);

View file

@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -22,7 +23,7 @@ public class WorldGenTaiga1 extends WorldGenTree
super(false);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(5) + 7;
int j = i - rand.zrange(2) - 3;
@ -45,7 +46,7 @@ public class WorldGenTaiga1 extends WorldGenTree
j1 = l;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1)
{
@ -91,7 +92,7 @@ public class WorldGenTaiga1 extends WorldGenTree
if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0)
{
BlockPos blockpos = new BlockPos(j3, l2, i2);
LocalPos blockpos = new LocalPos(j3, l2, i2);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{

View file

@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.MutablePos;
import common.world.State;
import server.world.WorldServer;
@ -22,7 +23,7 @@ public class WorldGenTaiga2 extends WorldGenTree
super(p_i2025_1_);
}
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
public boolean generate(WorldServer worldIn, Random rand, LocalPos position)
{
int i = rand.zrange(4) + 6;
int j = 1 + rand.zrange(2);
@ -45,7 +46,7 @@ public class WorldGenTaiga2 extends WorldGenTree
j1 = l;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
MutablePos blockpos$mutableblockpos = new MutablePos();
for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1)
{
@ -97,7 +98,7 @@ public class WorldGenTaiga2 extends WorldGenTree
if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0)
{
BlockPos blockpos = new BlockPos(i2, j4, k2);
LocalPos blockpos = new LocalPos(i2, j4, k2);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{

Some files were not shown because too many files have changed in this diff Show more