some code cleanup

This commit is contained in:
Leon 2016-12-03 17:41:05 -05:00
parent 6b2268f618
commit f3857432fa
6 changed files with 13 additions and 19 deletions

View file

@ -12,7 +12,6 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
/**
* Author: MachineMuse (Claire Semple)
@ -103,7 +102,7 @@ public class PartManipContainer extends ScrollableFrame {
@Override
public void update(double mousex, double mousey) {
super.update(mousex, mousey);
if (!Objects.equals(lastItemSlot, getItemSlot())) {
if (lastItemSlot != getItemSlot()) {
lastItemSlot = getItemSlot();
colourSelect.refreshColours();
@ -114,9 +113,9 @@ public class PartManipContainer extends ScrollableFrame {
}
this.totalsize = (int) x;
}
if (colourSelect.decrAbove > -1) {
if(colourSelect.decrAbove > -1) {
decrAbove(colourSelect.decrAbove);
this.colourSelect.decrAbove = -1;
colourSelect.decrAbove = -1;
}
}

View file

@ -32,7 +32,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Objects;
/**
* Ported to Java by lehjr on 10/24/16.
@ -130,7 +129,7 @@ public class ClientTickHandler {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution screen = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
for (int i = 0; i < modules.size(); i++) {
if (Objects.equals(modules.get(i), AutoFeederModule.MODULE_AUTO_FEEDER)) {
if (modules.get(i) == AutoFeederModule.MODULE_AUTO_FEEDER) {
int foodLevel = (int) MuseItemUtils.getFoodLevel(player.getCurrentArmor(3));
String num = MuseStringUtils.formatNumberShort(foodLevel);
if (i == 0) {
@ -140,7 +139,7 @@ public class ClientTickHandler {
MuseRenderer.drawString(num, 17, yBaseString + (yOffsetString * i));
MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon * i), food);
}
} else if (Objects.equals(modules.get(i), ClockModule.MODULE_CLOCK)) {
} else if(modules.get(i) == ClockModule.MODULE_CLOCK) {
long time = player.worldObj.provider.getWorldTime();
long hour = ((time % 24000) / 1000);
if (Config.use24hClock()) {
@ -175,13 +174,13 @@ public class ClientTickHandler {
MuseRenderer.drawString(hour + ampm, 17, yBaseString + (yOffsetString * i));
MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon * i), clock);
}
} else if (Objects.equals(modules.get(i), CompassModule.MODULE_COMPASS)) {
} else if (modules.get(i) == CompassModule.MODULE_COMPASS) {
if (i == 0) {
MuseRenderer.drawItemAt(-1.0, yBaseIcon, compass);
} else {
MuseRenderer.drawItemAt(-1.0, yBaseIcon + (yOffsetIcon * i), compass);
}
} else if (Objects.equals(modules.get(i), WaterTankModule.MODULE_WATER_TANK)) {
} else if (modules.get(i) == WaterTankModule.MODULE_WATER_TANK) {
drawWaterMeter = true;
}
}

View file

@ -18,7 +18,6 @@ import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import java.util.List;
import java.util.Objects;
public class AxeModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
@ -82,7 +81,7 @@ public class AxeModule extends PowerModuleBase implements IBlockBreakingModule,
}
}
}
return Objects.equals(effectiveTool, "axe");
return (effectiveTool == "axe");
}
@Override

View file

@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.List;
import java.util.Objects;
/**
* Created by User: Andrew2448
@ -83,21 +82,21 @@ public class LeafBlowerModule extends PowerModuleBase implements IRightClickModu
return false;
// Plants
if (Objects.equals(blocktype, "plants") && (block instanceof BlockTallGrass || block instanceof BlockFlower) && block.canHarvestBlock(player, meta)) {
if ((blocktype == "plants") && (block instanceof BlockTallGrass || block instanceof BlockFlower) && block.canHarvestBlock(player, meta)) {
block.harvestBlock(world, player, x, y, z, meta);
world.setBlockToAir(x, y, z);
return true;
}
// Leaves
if (Objects.equals(blocktype, "leaves") && block instanceof BlockLeaves && block.canHarvestBlock(player, meta)) {
if ((blocktype == "leaves") && block instanceof BlockLeaves && block.canHarvestBlock(player, meta)) {
block.harvestBlock(world, player, x, y, z, meta);
world.setBlockToAir(x, y, z);
return true;
}
// Snow
if (Objects.equals(blocktype, "snow") && block instanceof BlockSnow && block.canHarvestBlock(player, meta)) {
if ((blocktype == "snow") && block instanceof BlockSnow && block.canHarvestBlock(player, meta)) {
block.harvestBlock(world, player, x, y, z, meta);
world.setBlockToAir(x, y, z);
}

View file

@ -18,7 +18,6 @@ import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import java.util.List;
import java.util.Objects;
public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
@ -84,7 +83,7 @@ public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModu
private static boolean istEffectiveHarvestTool(Block block, int metadata) {
ItemStack emulatedTool = new ItemStack(Items.iron_pickaxe);
String effectiveHarvestTool = block.getHarvestTool(metadata);
if (Objects.equals(effectiveHarvestTool, "pickaxe")) {
if (effectiveHarvestTool == "pickaxe") {
return block.getHarvestLevel(metadata) <= 2; // higher than 2 requires better then iron
}

View file

@ -18,7 +18,6 @@ import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import java.util.List;
import java.util.Objects;
public class ShovelModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
public static final String MODULE_SHOVEL = "Shovel";
@ -73,7 +72,7 @@ public class ShovelModule extends PowerModuleBase implements IBlockBreakingModul
return true;
}
}
return Objects.equals(effectiveTool, "shovel");
return (effectiveTool == "shovel");
}
@Override