Skip to content

Commit

Permalink
fix some dodgy code
Browse files Browse the repository at this point in the history
  • Loading branch information
BleachDev committed Sep 14, 2020
1 parent b0c64e2 commit 09a6976
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mcosm/src/main/java/bleach/mcosm/OSMInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void tick() {
}

Creatable c = structures.get(0);
if (c.progress != "") Minecraft.getMinecraft().ingameGUI.addChatMessage(
if (!c.progress.isEmpty()) Minecraft.getMinecraft().ingameGUI.addChatMessage(
ChatType.GAME_INFO, new TextComponentString("\u00a75" + structures.size() + " Queue | \u00a76" + c.progress));

if (c.tick()) {
Expand Down
11 changes: 5 additions & 6 deletions mcosm/src/main/java/bleach/mcosm/gui/GuiOSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.stream.Collectors;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.math.NumberUtils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
Expand Down Expand Up @@ -159,17 +160,15 @@ protected void actionPerformed(GuiButton button) throws IOException {
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);

if (Character.isLetter(typedChar)) return;

latField.textboxKeyTyped(typedChar, keyCode);
lonField.textboxKeyTyped(typedChar, keyCode);
lat1Field.textboxKeyTyped(typedChar, keyCode);
lon1Field.textboxKeyTyped(typedChar, keyCode);

if (latField.isFocused()) try { lat = Double.parseDouble(latField.getText()); } catch (Exception e) { }
if (lonField.isFocused()) try { lon = Double.parseDouble(lonField.getText()); } catch (Exception e) { }
if (lat1Field.isFocused()) try { lat1 = Double.parseDouble(lat1Field.getText()); } catch (Exception e) { }
if (lon1Field.isFocused()) try { lon1 = Double.parseDouble(lon1Field.getText()); } catch (Exception e) { }
if (latField.isFocused() && NumberUtils.isCreatable(latField.getText())) lat = NumberUtils.createNumber(latField.getText()).doubleValue();
if (lonField.isFocused() && NumberUtils.isCreatable(lonField.getText())) lon = NumberUtils.createNumber(lonField.getText()).doubleValue();
if (lat1Field.isFocused() && NumberUtils.isCreatable(lat1Field.getText())) lat1 = NumberUtils.createNumber(lat1Field.getText()).doubleValue();
if (lon1Field.isFocused() && NumberUtils.isCreatable(lon1Field.getText())) lon1 = NumberUtils.createNumber(lon1Field.getText()).doubleValue();
}

protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void generateTree(TreeType type, BlockPos pos) {
World world = Minecraft.getMinecraft().getIntegratedServer().getWorld(Minecraft.getMinecraft().player.dimension);

Random rand = new Random();
WorldGenAbstractTree gen = null;
WorldGenAbstractTree gen;

if (type == null) {
gen = new OSMGenCanopyTree(true);
Expand Down Expand Up @@ -80,6 +80,7 @@ protected void generateTree(TreeType type, BlockPos pos) {
case HEDGE:
gen = new OSMGenHedge(true, 1);
default:
return;
}
}

Expand Down

0 comments on commit 09a6976

Please sign in to comment.