Removed extra fastLighting flag.

Fast lighting is now used when available.
Dieser Commit ist enthalten in:
TomyLobo 2011-10-31 02:59:12 +01:00
Ursprung d3822ee345
Commit 6b0f237a46
5 geänderte Dateien mit 18 neuen und 88 gelöschten Zeilen

Datei anzeigen

@ -100,11 +100,6 @@ public class EditSession {
*/ */
private boolean fastMode = false; private boolean fastMode = false;
/**
* Use fast lighting as well if using fast mode.
*/
private boolean fastLighting = false;
/** /**
* Block bag to use for getting blocks. * Block bag to use for getting blocks.
*/ */
@ -214,13 +209,13 @@ public class EditSession {
if (BlockType.usesData(type)) { if (BlockType.usesData(type)) {
if (fastMode) { if (fastMode) {
result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0, fastLighting); result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0);
} else { } else {
result = world.setTypeIdAndData(pt, type, block.getData() > -1 ? block.getData() : 0); result = world.setTypeIdAndData(pt, type, block.getData() > -1 ? block.getData() : 0);
} }
} else { } else {
if (fastMode) { if (fastMode) {
result = world.setBlockTypeFast(pt, type, fastLighting); result = world.setBlockTypeFast(pt, type);
} else { } else {
result = world.setBlockType(pt, type); result = world.setBlockType(pt, type);
} }
@ -532,24 +527,6 @@ public class EditSession {
queued = false; queued = false;
} }
/**
* Set fast lighting.
*
* @param fastLighting
*/
public void setFastLighting(boolean fastLighting) {
this.fastLighting = fastLighting;
}
/**
* Return fast lighting status.
*
* @return
*/
public boolean hasFastLighting() {
return fastLighting;
}
/** /**
* Set fast mode. * Set fast mode.
* *

Datei anzeigen

@ -73,7 +73,6 @@ public class LocalSession {
private boolean beenToldVersion = false; private boolean beenToldVersion = false;
private boolean hasCUISupport = false; private boolean hasCUISupport = false;
private boolean fastMode = false; private boolean fastMode = false;
private boolean fastLighting = false;
private Mask mask; private Mask mask;
private TimeZone timezone = TimeZone.getDefault(); private TimeZone timezone = TimeZone.getDefault();
private Boolean jumptoBlock = true; private Boolean jumptoBlock = true;
@ -645,7 +644,6 @@ public class LocalSession {
new EditSession(player.getWorld(), new EditSession(player.getWorld(),
getBlockChangeLimit(), blockBag); getBlockChangeLimit(), blockBag);
editSession.setFastMode(fastMode); editSession.setFastMode(fastMode);
editSession.setFastLighting(fastLighting);
editSession.setMask(mask); editSession.setMask(mask);
return editSession; return editSession;
@ -669,24 +667,6 @@ public class LocalSession {
this.fastMode = fastMode; this.fastMode = fastMode;
} }
/**
* Checks if the session has fast lighting enabled.
*
* @return
*/
public boolean hasFastLighting() {
return fastLighting;
}
/**
* Set fast lighting.
*
* @param fastLighting
*/
public void setFastLighting(boolean fastLighting) {
this.fastLighting = fastLighting;
}
/** /**
* Get the mask. * Get the mask.
* *

Datei anzeigen

@ -63,10 +63,6 @@ public abstract class LocalWorld {
return setBlockType(pt, type); return setBlockType(pt, type);
} }
public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) {
return setBlockTypeFast(pt, type);
}
/** /**
* Get block type. * Get block type.
* *
@ -118,10 +114,6 @@ public abstract class LocalWorld {
return ret; return ret;
} }
public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) {
return setTypeIdAndDataFast(pt, type, data);
}
/** /**
* Get block data. * Get block data.
* *

Datei anzeigen

@ -111,21 +111,8 @@ public class BukkitWorld extends LocalWorld {
*/ */
@Override @Override
public boolean setBlockTypeFast(Vector pt, int type) { public boolean setBlockTypeFast(Vector pt, int type) {
return setBlockTypeFast(pt, type, false);
}
/**
* Set block type.
*
* @param pt
* @param type
* @param fastLighting
* @return
*/
@Override
public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) {
final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (fastLightingAvailable && fastLighting) { if (fastLightingAvailable) {
type = type & 255; type = type & 255;
final int previousOpacity = Block_lightOpacity[type]; final int previousOpacity = Block_lightOpacity[type];
Block_lightOpacity[type] = 0; Block_lightOpacity[type] = 0;
@ -158,13 +145,8 @@ public class BukkitWorld extends LocalWorld {
*/ */
@Override @Override
public boolean setTypeIdAndDataFast(Vector pt, int type, int data){ public boolean setTypeIdAndDataFast(Vector pt, int type, int data){
return setTypeIdAndDataFast(pt, type, data, false);
}
@Override
public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) {
final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (fastLightingAvailable && fastLighting) { if (fastLightingAvailable) {
type = type & 255; type = type & 255;
final int previousOpacity = Block_lightOpacity[type]; final int previousOpacity = Block_lightOpacity[type];
Block_lightOpacity[type] = 0; Block_lightOpacity[type] = 0;

Datei anzeigen

@ -63,7 +63,6 @@ public class GeneralCommands {
@Command( @Command(
aliases = { "/fast" }, aliases = { "/fast" },
flags = "l",
usage = "[on|off]", usage = "[on|off]",
desc = "Toggle fast mode", desc = "Toggle fast mode",
min = 0, min = 0,
@ -74,24 +73,24 @@ public class GeneralCommands {
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
boolean light = args.hasFlag('f');
String newState = args.getString(0, null); String newState = args.getString(0, null);
Boolean dir = newState == null ? null : newState.equals("on") ? true : newState.equals("off") ? false : null; if (session.hasFastMode()) {
if ("on".equals(newState)) {
player.printError("Fast mode already enabled.");
return;
}
boolean hadFast = session.hasFastMode(); session.setFastMode(false);
boolean hadLight = session.hasFastLighting(); player.print("Fast mode disabled.");
} else {
if ("off".equals(newState)) {
player.printError("Fast mode already disabled.");
return;
}
boolean setFast = dir == null ? !hadFast : dir; session.setFastMode(true);
boolean setLight = dir == null ? !hadLight : dir; player.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
session.setFastMode(setFast);
if (light) {
session.setFastLighting(setLight);
} }
player.print("Fast mode " + (setFast == hadFast ? "already " : "") + (!setFast ? "disabled." :
("enabled. You may need to rejoin to see changes"
+ (setLight ? "and lighting in affected chunks may be wrong." : "."))));
} }
@Command( @Command(