use of io.xol.chunkstories.api.util.Configuration.OptionBoolean in project chunkstories by Hugobros3.
the class Ingame method handleInput.
@Override
public boolean handleInput(Input input) {
// Block inputs if chatting
if (input.equals("chat")) {
gameWindow.setLayer(chatManager.new ChatPanelOverlay(gameWindow, this));
focus(false);
guiHidden = false;
return true;
} else if (input.equals("hideGui")) {
guiHidden = !guiHidden;
return true;
} else if (input.equals("screenshot")) {
chatManager.insert(world.getWorldRenderer().screenShot());
} else if (input.equals("toggleDebugInfo")) {
OptionBoolean debugInfo = (OptionBoolean) client.getConfiguration().getOption("client.debug.showDebugInfo");
debugInfo.toggle();
guiHidden = false;
return true;
} else if (input.equals("takeCubemap")) {
// shouldTakeACubemap = true;
return true;
// CTRL-F12 reloads
} else if (input.equals("reloadContent")) {
// Rebuild the mod FS
gameWindow.getClient().reloadAssets();
// Reload plugins
world.getPluginManager().reloadPlugins();
// Mark some caches dirty
world.getWorldRenderer().reloadContentSpecificStuff();
return true;
// CTRL-R redraws chunks
} else if (input.equals("redrawChunks")) {
((ClientParticlesRenderer) world.getParticlesManager()).cleanAllParticles();
world.redrawEverything();
world.getWorldRenderer().flagChunksModified();
return true;
// Item slots selection
} else if (input.getName().startsWith("inventorySlot")) {
int requestedInventorySlot = Integer.parseInt(input.getName().replace("inventorySlot", ""));
// Match zero onto last slot
if (requestedInventorySlot == 0)
requestedInventorySlot = 10;
// Map to zero-indexed inventory
requestedInventorySlot--;
if (playerEntity != null && playerEntity instanceof EntityWithSelectedItem) {
// Do not accept request to select non-existent inventories slots
if (requestedInventorySlot > ((EntityWithInventory) playerEntity).getInventory().getWidth())
return false;
ItemPile p = ((EntityWithInventory) playerEntity).getInventory().getItemPileAt(requestedInventorySlot, 0);
if (p != null)
requestedInventorySlot = p.getX();
((EntityWithSelectedItem) playerEntity).setSelectedItemIndex(requestedInventorySlot);
}
return true;
} else if (input.equals("exit")) /* Exit brings up the pause menu */
{
focus(false);
guiHidden = false;
gameWindow.setLayer(new PauseMenu(gameWindow, this));
return true;
} else if (input instanceof MouseScroll) {
MouseScroll ms = (MouseScroll) input;
if (playerEntity != null && playerEntity instanceof EntityWithSelectedItem) {
ItemPile selected = null;
int selectedInventorySlot = ((EntityWithSelectedItem) playerEntity).getSelectedItemIndex();
int originalSlot = selectedInventorySlot;
if (ms.amount() < 0) {
selectedInventorySlot %= ((EntityWithInventory) playerEntity).getInventory().getWidth();
selected = ((EntityWithInventory) playerEntity).getInventory().getItemPileAt(selectedInventorySlot, 0);
if (selected != null)
selectedInventorySlot += selected.getItem().getDefinition().getSlotsWidth();
else
selectedInventorySlot++;
} else {
selectedInventorySlot--;
if (selectedInventorySlot < 0)
selectedInventorySlot += ((EntityWithInventory) playerEntity).getInventory().getWidth();
selected = ((EntityWithInventory) playerEntity).getInventory().getItemPileAt(selectedInventorySlot, 0);
if (selected != null)
selectedInventorySlot = selected.getX();
}
// Switch slot
if (originalSlot != selectedInventorySlot)
((EntityWithSelectedItem) playerEntity).setSelectedItemIndex(selectedInventorySlot);
return true;
}
}
return false;
}
use of io.xol.chunkstories.api.util.Configuration.OptionBoolean in project chunkstories by Hugobros3.
the class GLSLPreprocessor method defineConfiguration.
private static void defineConfiguration(StringBuilder shaderSource) {
for (Option option : Client.getInstance().getConfiguration().allOptions()) {
String fullname = option.getName();
if (fullname.startsWith("client.rendering")) {
String abridgedName = fullname.substring("client.rendering.".length());
abridgedName = abridgedName.replace(".", "_");
if (option instanceof OptionBoolean) {
if (option.getValue().equals("true"))
shaderSource.append("#define " + abridgedName + " " + option.getValue().toString() + "\n");
// shaderSource.append("#define " + abridgedName + " " + (option.getValue().equals("true") ? 1 : 0) + "\n");
} else
shaderSource.append("#define " + abridgedName + " " + option.getValue().toString() + "\n");
// System.out.println("#define " + abridgedName + " " + option.getValue().toString());
}
}
}
Aggregations