Still porting Scala to Java. This still runs by the way.

This commit is contained in:
Leon 2016-10-22 17:22:01 -04:00
parent c85f95f6c3
commit bd887f87dd
154 changed files with 2142 additions and 1032 deletions

View file

@ -18,13 +18,13 @@ public class ModuleManager {
public static final String ONLINE = "Active";
protected static final Map<String, List<ItemStack>> customInstallCosts = new HashMap<String, List<ItemStack>>();
protected static final Map<String, IPowerModule> moduleMap = new HashMap<String, IPowerModule>();
protected static final List<IPowerModule> moduleList = new ArrayList<IPowerModule>();
protected static final List<IPlayerTickModule> playerTickModules = new ArrayList<IPlayerTickModule>();
protected static final List<IRightClickModule> rightClickModules = new ArrayList<IRightClickModule>();
protected static final List<IToggleableModule> toggleableModules = new ArrayList<IToggleableModule>();
protected static final List<IBlockBreakingModule> blockBreakingModules = new ArrayList<IBlockBreakingModule>();
protected static final Map<String, List<ItemStack>> customInstallCosts = new HashMap<>();
protected static final Map<String, IPowerModule> moduleMap = new HashMap<>();
protected static final List<IPowerModule> moduleList = new ArrayList<>();
protected static final List<IPlayerTickModule> playerTickModules = new ArrayList<>();
protected static final List<IRightClickModule> rightClickModules = new ArrayList<>();
protected static final List<IToggleableModule> toggleableModules = new ArrayList<>();
protected static final List<IBlockBreakingModule> blockBreakingModules = new ArrayList<>();
public static List<IPowerModule> getAllModules() {
return moduleList;

View file

@ -6,7 +6,6 @@ package net.machinemuse.general;
import net.machinemuse.numina.general.MuseLogger;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -68,7 +67,7 @@ public class NBTTagAccessor extends NBTTagCompound {
public static List<NBTTagCompound> getValues(NBTTagCompound nbt) {
Set<String> keyset = (Set<String>) nbt.func_150296_c();
ArrayList<NBTTagCompound> a = new ArrayList<NBTTagCompound>(keyset.size());
ArrayList<NBTTagCompound> a = new ArrayList<>(keyset.size());
for (String key : keyset) {
NBTBase c = nbt.getTag(key);
if (c instanceof NBTTagCompound) {

View file

@ -14,10 +14,10 @@ import net.minecraft.item.ItemStack;
* Ported to Java by lehjr on 10/19/16.
*/
public class CosmeticGui extends MuseGui {
EntityPlayer player;
int worldx;
int worldy;
int worldz;
final EntityPlayer player;
final int worldx;
final int worldy;
final int worldz;
ItemSelectionFrame itemSelect;
ItemStack lastSelectedItem;

View file

@ -4,7 +4,6 @@ import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import org.lwjgl.opengl.GL11;

View file

@ -1,8 +1,11 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.gui.frame.DetailedSummaryFrame;
import net.machinemuse.general.gui.frame.ItemSelectionFrame;
import net.machinemuse.general.gui.frame.ModuleSelectionFrame;
import net.machinemuse.general.gui.frame.ModuleTweakFrame;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.frame.*;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
@ -14,7 +17,7 @@ import net.minecraft.util.StatCollector;
* @author MachineMuse
*/
public class GuiFieldTinker extends MuseGui {
protected EntityClientPlayerMP player;
protected final EntityClientPlayerMP player;
protected ItemSelectionFrame itemSelectFrame;

View file

@ -14,7 +14,7 @@ import net.minecraft.util.StatCollector;
* @author MachineMuse
*/
public class GuiTinkerTable extends MuseGui {
protected EntityClientPlayerMP player;
protected final EntityClientPlayerMP player;
protected ItemSelectionFrame itemSelectFrame;

View file

@ -5,14 +5,13 @@ import net.machinemuse.numina.render.MuseIconUtils;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.common.Config;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import org.lwjgl.opengl.GL11;
public class HeatMeter {
int xsize = 8;
int ysize = 32;
final int xsize = 8;
final int ysize = 32;
public void draw(double xpos, double ypos, double value) {
MuseTextureUtils.pushTexture(MuseTextureUtils.BLOCK_TEXTURE_QUILT());

View file

@ -1,17 +1,17 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.gui.frame.KeybindConfigFrame;
import net.machinemuse.general.gui.frame.TabSelectFrame;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.frame.KeybindConfigFrame;
import net.machinemuse.powersuits.control.KeybindManager;
import net.minecraft.entity.player.EntityPlayer;
public class KeyConfigGui extends MuseGui {
private EntityPlayer player;
private final EntityPlayer player;
protected KeybindConfigFrame frame;
protected int worldx;
protected int worldy;
protected int worldz;
protected final int worldx;
protected final int worldy;
protected final int worldz;
public KeyConfigGui(EntityPlayer player, int x, int y, int z) {
super();

View file

@ -1,9 +1,9 @@
package net.machinemuse.general.gui;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.general.gui.clickable.IClickable;
import net.machinemuse.general.gui.frame.IGuiFrame;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.input.Keyboard;
@ -28,7 +28,7 @@ public class MuseGui extends GuiScreen {
protected DrawableMuseRect backgroundRect;
protected DrawableMuseRect tooltipRect;
protected List<IGuiFrame> frames;
protected final List<IGuiFrame> frames;
public MuseGui() {
super();
@ -161,8 +161,7 @@ public class MuseGui extends GuiScreen {
*/
public int relX(double absx) {
int padding = (width - getxSize()) / 2;
int relx = (int) ((absx - padding) * 2 / getxSize() - 1);
return relx;
return (int) ((absx - padding) * 2 / getxSize() - 1);
}
/**
@ -184,8 +183,7 @@ public class MuseGui extends GuiScreen {
*/
public int relY(float absy) {
int padding = (height - ySize) / 2;
int rely = (int) ((absy - padding) * 2 / ySize - 1);
return rely;
return (int) ((absy - padding) * 2 / ySize - 1);
}
/**
@ -279,7 +277,7 @@ public class MuseGui extends GuiScreen {
* @return
*/
public List<String> getToolTip(int x, int y) {
List<String> hitTip = null;
List<String> hitTip;
for (IGuiFrame frame : frames) {
hitTip = frame.getToolTip(x, y);
if (hitTip != null) {

View file

@ -98,7 +98,7 @@ public class MuseIcon {
public static final MuseIcon ARCREACTOR = new MuseIcon("jetboots");
public static final MuseIcon PUNCHY = new MuseIcon("jetboots");
protected String texturename;
protected final String texturename;
protected IIcon icon;
public MuseIcon(String texturename) {

View file

@ -1,19 +1,14 @@
package net.machinemuse.general.gui;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.machinemuse.general.gui.frame.PortableCraftingContainer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.machinemuse.general.gui.frame.PortableCraftingContainer;
import net.machinemuse.powersuits.common.Config;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)

View file

@ -1,6 +1,5 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.gui.HeatMeter;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.minecraft.init.Blocks;

View file

@ -14,9 +14,9 @@ import java.util.List;
* @author MachineMuse
*/
public class ClickableButton extends Clickable {
protected String label;
protected MusePoint2D radius;
protected DrawableMuseRect rect;
protected final String label;
protected final MusePoint2D radius;
protected final DrawableMuseRect rect;
protected boolean enabled;
public ClickableButton(String label, MusePoint2D position, boolean enabled) {

View file

@ -19,8 +19,8 @@ public class ClickableItem extends Clickable {
public static final int offsetx = 8;
public static final int offsety = 8;
public static RenderItem itemRenderer;
public int inventorySlot;
protected ItemStack item;
public final int inventorySlot;
protected final ItemStack item;
public ClickableItem(ItemStack item, MusePoint2D pos, int inventorySlot) {
super(pos);

View file

@ -17,6 +17,7 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.ChatComponentText;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -25,11 +26,11 @@ import java.util.List;
* Ported to Java by lehjr on 10/19/16.
*/
public class ClickableKeybinding extends ClickableButton {
protected List<ClickableModule> boundModules = new ArrayList<ClickableModule>();
protected final List<ClickableModule> boundModules = new ArrayList<>();
public boolean toggleval = false;
public boolean toggled = false;
public Boolean displayOnHUD;
public KeyBinding keybind;
public final KeyBinding keybind;
public ClickableKeybinding(KeyBinding keybind, MusePoint2D position, boolean free, Boolean displayOnHUD) {
@ -115,7 +116,7 @@ public class ClickableKeybinding extends ClickableButton {
public void unbindFarModules() {
Iterator<ClickableModule> iterator = boundModules.iterator();
ClickableModule module = null;
ClickableModule module;
while (iterator.hasNext()) {
module = iterator.next();
int maxDistance = getTargetDistance() * 2;

View file

@ -6,8 +6,8 @@ import net.machinemuse.utils.render.MuseRenderer;
import java.util.List;
public class ClickableLabel implements IClickable {
protected String label;
protected MusePoint2D position;
protected final String label;
protected final MusePoint2D position;
public ClickableLabel(String label, MusePoint2D position) {
this.label = label;

View file

@ -23,20 +23,20 @@ import java.util.List;
* Ported to Java by lehjr on 10/19/16.
*/
public class ClickableModule extends Clickable {
IPowerModule module;
private final IPowerModule module;
public ClickableModule(IPowerModule module , MusePoint2D position) {
super(position);
this.module = module;
}
boolean allowed = true;
boolean installed = false;
Colour checkmarkcolour = new Colour(0.0F, 0.667F, 0.0F, 1.0F);
private boolean allowed = true;
private boolean installed = false;
private final Colour checkmarkcolour = new Colour(0.0F, 0.667F, 0.0F, 1.0F);
@Override
public List<String> getToolTip() {
List<String> toolTipText = new ArrayList<String>();
List<String> toolTipText = new ArrayList<>();
toolTipText.add(getLocalizedName(getModule()));
toolTipText.addAll(MuseStringUtils.wrapStringToLength(getLocalizedDescription(getModule()), 30));
return toolTipText;

View file

@ -0,0 +1,143 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.numina.general.MuseMathUtils;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.utils.render.MuseRenderer;
/**
* Author: MachineMuse (Claire Semple)
* Created: 7:08 AM, 06/05/13
*
* Ported to Java by lehjr on 10/19/16.
*/
//public class ClickableSlider extends Clickable {
// public static MusePoint2D pos;
// private static double width;
// public static String name;
// private static final int cornersize = 3;
// private final DrawableMuseRect insideRect;
// private final DrawableMuseRect outsideRect;
// private double valueInternal = 0;
//
// public ClickableSlider(MusePoint2D pos, double width, String name) {
// this.pos = pos;
// this.width = width;
// this.name = name;
// this.position = pos;
//
// this.insideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, 0, position.y() + 16, Colour.LIGHTBLUE, Colour.ORANGE);
// this.outsideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, position.x() + width / 2.0 + cornersize, position.y() + 16, Colour.LIGHTBLUE, Colour.DARKBLUE);
//
// System.out.println("===========================================================");
// System.out.println("name: " + this.name);
// System.out.println("pos.x: " + this.pos.x());
// System.out.println("pos.y: " + this.pos.y());
// System.out.println("============================================================");
// }
//
// @Override
// public void draw() {
// MuseRenderer.drawCenteredString(name, position.x(), position.y());
// this.insideRect.setRight(position.x() + width * (value() - 0.5) + cornersize);
// this.outsideRect.draw();
// this.insideRect.draw();
// }
//
// @Override
// public boolean hitBox(double x, double y) {
// return Math.abs(position.x() - x) < width / 2 && Math.abs(position.y() + 12 - y) < 4;
// }
//
// public double value() {
// return valueInternal;
// }
//
// public void setValueByX(double x) {
// double v = (x - pos.x()) / width + 0.5;
// valueInternal = MuseMathUtils.clampDouble(v, 0, 1);
// }
//
// public void setValue(double v) {
// valueInternal = v;
// }
//}
public class ClickableSlider extends Clickable {
private final MusePoint2D pos;
private final double width;
private final String name;
private final int cornersize;
private final DrawableMuseRect insideRect;
private final DrawableMuseRect outsideRect;
private double valueInternal;
public ClickableSlider(final MusePoint2D pos, final double width, final String name) {
this.pos = pos;
this.width = width;
this.name = name;
super.position = pos;
this.cornersize = 3;
this.insideRect = new DrawableMuseRect(this.position.x() - width / 2.0 - this.cornersize(), this.position.y() + 8, 0.0, this.position.y() + 16, Colour.LIGHTBLUE, Colour.ORANGE);
this.outsideRect = new DrawableMuseRect(this.position.x() - width / 2.0 - this.cornersize(), this.position.y() + 8, this.position.x() + width / 2.0 + this.cornersize(), this.position.y() + 16, Colour.LIGHTBLUE, Colour.DARKBLUE);
this.valueInternal = 0.0;
}
public MusePoint2D pos() {
return this.pos;
}
public double width() {
return this.width;
}
public String name() {
return this.name;
}
public int cornersize() {
return this.cornersize;
}
public DrawableMuseRect insideRect() {
return this.insideRect;
}
public DrawableMuseRect outsideRect() {
return this.outsideRect;
}
@Override
public void draw() {
MuseRenderer.drawCenteredString(this.name(), this.position.x(), this.position.y());
this.insideRect().setRight(this.position.x() + this.width() * (this.value() - 0.5) + this.cornersize());
this.outsideRect().draw();
this.insideRect().draw();
}
@Override
public boolean hitBox(final double x, final double y) {
return Math.abs(this.position.x() - x) < this.width() / 2 && Math.abs(this.position.y() + 12 - y) < 4;
}
public double valueInternal() {
return this.valueInternal;
}
public void valueInternal_$eq(final double x$1) {
this.valueInternal = x$1;
}
public double value() {
return this.valueInternal();
}
public void setValueByX(final double x) {
final double v = (x - this.pos().x()) / this.width() + 0.5;
this.valueInternal = (MuseMathUtils.clampDouble(v, 0.0, 1.0));
}
public void setValue(final double v) {
this.valueInternal_$eq(v);
}
}

View file

@ -0,0 +1,32 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.numina.general.MuseMathUtils;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.minecraft.nbt.NBTTagCompound;
/**
* Ported to Java by lehjr on 10/19/16.
*/
public class ClickableTinkerSlider extends ClickableSlider {
private final NBTTagCompound moduleTag;
public ClickableTinkerSlider(final MusePoint2D topmiddle, final double width, final NBTTagCompound moduleTag, final String name) {
super(topmiddle, width, name);
this.moduleTag = moduleTag;
}
public NBTTagCompound moduleTag() {
return this.moduleTag;
}
@Override
public double value() {
return this.moduleTag().hasKey(super.name()) ? this.moduleTag().getDouble(super.name()) : 0.0;
}
public void moveSlider(final double x, final double y) {
final double xval = this.position.x() - x;
final double xratio = MuseMathUtils.clampDouble(0.5 - xval / super.width(), 0.0, 1.0);
this.moduleTag().setDouble(super.name(), xratio);
}
}

View file

@ -1,18 +1,18 @@
package net.machinemuse.general.gui.clickable;
import java.util.List;
import net.machinemuse.numina.geometry.MusePoint2D;
import java.util.List;
public interface IClickable {
public abstract void draw();
void draw();
public abstract void move(double x, double y);
void move(double x, double y);
public abstract MusePoint2D getPosition();
MusePoint2D getPosition();
public abstract boolean hitBox(double x, double y);
boolean hitBox(double x, double y);
public abstract List<String> getToolTip();
List getToolTip();
}

View file

@ -19,7 +19,7 @@ import java.util.List;
public class DetailedSummaryFrame extends ScrollableFrame {
public static final double SCALEFACTOR = 1;
protected EntityPlayer player;
protected final EntityPlayer player;
protected double weight;
protected double energy;
protected double armor;
@ -71,7 +71,8 @@ public class DetailedSummaryFrame extends ScrollableFrame {
valueWidth = MuseRenderer.getStringWidth(formattedValue);
allowedNameWidth = border.width() - valueWidth - margin * 2;
namesList = MuseStringUtils.wrapStringToVisualLength(name, allowedNameWidth);
for(int i=0; i<namesList.size();i++) {
assert namesList != null;
for(int i = 0; i<namesList.size(); i++) {
MuseRenderer.drawString(namesList.get(i), border.left() + margin, nexty + 9*i);
}
MuseRenderer.drawRightAlignedString(formattedValue, border.right() - margin, nexty + 9 * (namesList.size() - 1) / 2);
@ -82,7 +83,8 @@ public class DetailedSummaryFrame extends ScrollableFrame {
valueWidth = MuseRenderer.getStringWidth(formattedValue);
allowedNameWidth = border.width() - valueWidth - margin * 2;
namesList = MuseStringUtils.wrapStringToVisualLength(name, allowedNameWidth);
for(int i=0; i<namesList.size();i++) {
assert namesList != null;
for(int i = 0; i<namesList.size(); i++) {
MuseRenderer.drawString(namesList.get(i), border.left() + margin, nexty + 9*i);
}
MuseRenderer.drawRightAlignedString(formattedValue, border.right() - margin, nexty + 9 * (namesList.size() - 1) / 2);

View file

@ -25,11 +25,11 @@ import java.util.List;
@SideOnly(Side.CLIENT)
public class InstallSalvageFrame extends ScrollableFrame {
protected ItemSelectionFrame targetItem;
protected ModuleSelectionFrame targetModule;
protected ClickableButton installButton;
protected ClickableButton salvageButton;
protected EntityClientPlayerMP player;
protected final ItemSelectionFrame targetItem;
protected final ModuleSelectionFrame targetModule;
protected final ClickableButton installButton;
protected final ClickableButton salvageButton;
protected final EntityClientPlayerMP player;
public InstallSalvageFrame(EntityClientPlayerMP player, MusePoint2D topleft,
MusePoint2D bottomright,
@ -76,8 +76,7 @@ public class InstallSalvageFrame extends ScrollableFrame {
+ (border.left() + border.right()) / 2;
if (xoffset + 16 * itemsToCheck.size() > x && xoffset < x) {
int index = (int) (x - xoffset) / 16;
List<String> tip = itemsToCheck.get(index).getTooltip(player, false);
return tip;
return (List<String>) itemsToCheck.get(index).getTooltip(player, false);
}
}
}

View file

@ -1,9 +1,9 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IModularItem;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.entity.player.EntityPlayer;
@ -14,8 +14,8 @@ import java.util.List;
public class ItemInfoFrame extends ScrollableFrame {
public static final double SCALEFACTOR = 1;
protected ItemSelectionFrame target;
protected EntityPlayer player;
protected final ItemSelectionFrame target;
protected final EntityPlayer player;
protected List<String> info;
public ItemInfoFrame(EntityPlayer player, MusePoint2D topleft,

View file

@ -18,7 +18,7 @@ import java.util.List;
public class ItemSelectionFrame extends ScrollableFrame {
protected List<ClickableItem> itemButtons;
protected int selectedItemStack = -1;
protected EntityPlayer player;
protected final EntityPlayer player;
protected List<MusePoint2D> itemPoints;
public ItemSelectionFrame(MusePoint2D topleft, MusePoint2D bottomright,
@ -48,7 +48,7 @@ public class ItemSelectionFrame extends ScrollableFrame {
private void loadItems() {
if (player != null) {
itemButtons = new ArrayList<ClickableItem>();
itemButtons = new ArrayList<>();
double centerx = (border.left() + border.right()) / 2;
double centery = (border.top() + border.bottom()) / 2;
List<Integer> slots = MuseItemUtils

View file

@ -28,16 +28,16 @@ import java.util.List;
import java.util.Set;
public class KeybindConfigFrame implements IGuiFrame {
protected Set<ClickableModule> modules;
protected final Set<ClickableModule> modules;
protected IClickable selectedClickie;
protected ClickableKeybinding closestKeybind;
protected EntityPlayer player;
protected MusePoint2D ul;
protected MusePoint2D br;
protected MuseGui gui;
protected final EntityPlayer player;
protected final MusePoint2D ul;
protected final MusePoint2D br;
protected final MuseGui gui;
protected boolean selecting;
protected ClickableButton newKeybindButton;
protected ClickableButton trashKeybindButton;
protected final ClickableButton newKeybindButton;
protected final ClickableButton trashKeybindButton;
protected long takenTime;
public KeybindConfigFrame(MuseGui gui, MusePoint2D ul, MusePoint2D br, EntityPlayer player) {

View file

@ -16,7 +16,7 @@ import org.lwjgl.opengl.GL11;
import java.util.*;
public class ModuleSelectionFrame extends ScrollableFrame {
protected ItemSelectionFrame target;
protected final ItemSelectionFrame target;
protected Map<String, ModuleSelectionSubFrame> categories;
protected List<ClickableModule> moduleButtons;
protected int selectedModule = -1;
@ -29,8 +29,8 @@ public class ModuleSelectionFrame extends ScrollableFrame {
super(topleft, bottomright, borderColour, insideColour);
this.target = target;
moduleButtons = new ArrayList<ClickableModule>();
categories = new HashMap<String, ModuleSelectionSubFrame>();
moduleButtons = new ArrayList<>();
categories = new HashMap<>();
}
@Override
@ -94,8 +94,8 @@ public class ModuleSelectionFrame extends ScrollableFrame {
this.lastPosition = null;
ClickableItem selectedItem = target.getSelectedItem();
if (selectedItem != null) {
moduleButtons = new ArrayList<ClickableModule>();
categories = new HashMap<String, ModuleSelectionSubFrame>();
moduleButtons = new ArrayList<>();
categories = new HashMap<>();
List<IPowerModule> workingModules = ModuleManager.getValidModulesForItem(null, selectedItem.getItem());
@ -103,8 +103,8 @@ public class ModuleSelectionFrame extends ScrollableFrame {
// item.
for (Iterator<IPowerModule> it = workingModules.iterator(); it.hasNext(); ) {
IPowerModule module = it.next();
if (module.isAllowed() == false &&
ModuleManager.itemHasModule(selectedItem.getItem(), module.getDataName()) == false) {
if (!module.isAllowed() &&
!ModuleManager.itemHasModule(selectedItem.getItem(), module.getDataName())) {
it.remove();
}
}

View file

@ -1,24 +1,24 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MuseRect;
import net.machinemuse.numina.geometry.MuseRelativeRect;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.utils.render.MuseRenderer;
import java.util.ArrayList;
import java.util.List;
public class ModuleSelectionSubFrame {
protected List<ClickableModule> moduleButtons;
protected MuseRelativeRect border;
protected String category;
protected final List<ClickableModule> moduleButtons;
protected final MuseRelativeRect border;
protected final String category;
public ModuleSelectionSubFrame(String category, MuseRelativeRect border) {
this.category = category;
this.border = border;
this.moduleButtons = new ArrayList<ClickableModule>();
this.moduleButtons = new ArrayList<>();
}
// public void draw() {

View file

@ -61,6 +61,7 @@ public class ModuleTweakFrame extends ScrollableFrame {
propertyStrings = null;
}
if (selectedSlider != null) {
System.out.println("moving slider name: " + selectedSlider.name());
selectedSlider.moveSlider(mousex, mousey);
}
@ -99,7 +100,7 @@ public class ModuleTweakFrame extends ScrollableFrame {
NBTTagCompound moduleTag = itemTag.getCompoundTag(module.getDataName());
propertyStrings = new HashMap();
Set<String> tweaks = new HashSet<String>();
Set<String> tweaks = new HashSet<>();
Map<String, List<IPropertyModifier>> propertyModifiers = module.getPropertyModifiers();
for (Map.Entry<String, List<IPropertyModifier>> property : propertyModifiers.entrySet()) {
@ -150,7 +151,7 @@ public class ModuleTweakFrame extends ScrollableFrame {
if (selectedSlider != null && itemTarget.getSelectedItem() != null && moduleTarget.getSelectedModule() != null) {
ClickableItem item = itemTarget.getSelectedItem();
IPowerModule module = moduleTarget.getSelectedModule().getModule();
MusePacket tweakRequest = new MusePacketTweakRequest(player, item.inventorySlot, module.getDataName(), selectedSlider.name,
MusePacket tweakRequest = new MusePacketTweakRequest(player, item.inventorySlot, module.getDataName(), selectedSlider.name(),
selectedSlider.value());
PacketSender.sendToServer(tweakRequest.getPacket131());
}
@ -158,4 +159,4 @@ public class ModuleTweakFrame extends ScrollableFrame {
selectedSlider = null;
}
}
}
}

View file

@ -13,13 +13,13 @@ import java.util.List;
public class ScrollableFrame implements IGuiFrame {
protected int totalsize;
protected int currentscrollpixels;
protected int buttonsize = 5;
protected final int buttonsize = 5;
protected boolean scrollbarPicked = false;
protected boolean scrolldownPicked = false;
protected boolean scrollupPicked = false;
protected int lastdWheel = Mouse.getDWheel();
protected DrawableMuseRect border;
protected final DrawableMuseRect border;
public ScrollableFrame(MusePoint2D topleft, MusePoint2D bottomright,
Colour borderColour, Colour insideColour) {

View file

@ -13,9 +13,9 @@ import java.util.List;
import java.util.Set;
public class StatsFrame extends ScrollableFrame {
protected NBTTagCompound properties;
protected ItemStack stack;
protected Set<String> propertiesToList;
protected final NBTTagCompound properties;
protected final ItemStack stack;
protected final Set<String> propertiesToList;
public StatsFrame(MusePoint2D topleft, MusePoint2D bottomright,
Colour borderColour, Colour insideColour, ItemStack stack) {

View file

@ -6,7 +6,10 @@ import net.machinemuse.powersuits.common.ModularPowersuits;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.StatCollector;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author MachineMuse
@ -14,14 +17,14 @@ import java.util.*;
* Ported to Java by lehjr on 10/19/16.
*/
public class TabSelectFrame implements IGuiFrame {
EntityPlayer p;
MusePoint2D topleft;
MusePoint2D bottomright;
int worldx;
int worldy;
int worldz;
final EntityPlayer p;
final MusePoint2D topleft;
final MusePoint2D bottomright;
final int worldx;
final int worldy;
final int worldz;
Map<ClickableButton, Integer> buttons = new HashMap<>();
final Map<ClickableButton, Integer> buttons = new HashMap<>();
public TabSelectFrame(EntityPlayer p, MusePoint2D topleft, MusePoint2D bottomright, int worldx, int worldy, int worldz) {
this.p = p;
@ -61,7 +64,7 @@ public class TabSelectFrame implements IGuiFrame {
b.draw();
}
List<String> toolTip = new ArrayList<String>();
List<String> toolTip = new ArrayList<>();
@Override
public List<String> getToolTip(int x, int y) {

View file

@ -12,7 +12,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Random;

View file

@ -0,0 +1,147 @@
package net.machinemuse.powersuits.block;
import cpw.mods.fml.common.registry.GameRegistry;
import net.machinemuse.general.gui.MuseIcon;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
/**
* This is the tinkertable block. It doesn't do much except look pretty
* (eventually) and provide a way for the player to access the TinkerTable GUI.
*
* @author MachineMuse
*
*
* Ported to Java by lehjr on 10/21/16.
*/
public class BlockTinkerTable extends Block {
public static IIcon energyIcon;
protected static int renderType = 0;
public BlockTinkerTable() {
super(Material.iron);
setCreativeTab(Config.getCreativeTab());
setHardness(1.5F);
setResistance(1000.0F);
setStepSound(Block.soundTypeMetal);
setLightOpacity(0);
setLightLevel(0.4f);
setTickRandomly(false);
GameRegistry.registerTileEntity(TileEntityTinkerTable.class, "tinkerTable");
setBlockName("tinkerTable");
}
public static void setRenderType(int id) {
renderType = id;
return;// this;
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(MuseIcon.ICON_PREFIX + "heatresistantplating");
energyIcon = blockIcon;
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking()) {
return false;
}
player.openGui(ModularPowersuits.INSTANCE(), 0, world, x, y, z);
return true;
}
/**
* returns some value from 0 to 30 or so for different models. Since we're
* using a custom renderer, we pass in a completely different ID: the
* assigned block ID. It won't conflict with other mods, since Forge looks
* it up in a table anyway, but it's still best to have different internal
* IDs.
*/
@Override
public int getRenderType() {
return renderType;
}
/**
* This method is called on a block after all other blocks gets already
* created. You can use it to reference and configure something on the block
* that needs the others ones.
*/
protected void initializeBlock() {
}
/**
* If this block doesn't render as an ordinary block it will return False
* (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock() {
return false;
}
/**
* Returns Returns true if the given side of this block type should be
* rendered (if it's solid or not), if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
@Override
public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) {
return true;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether
* or not to render the shared face of two adjacent blocks and also
* whether the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube() {
return false;
}
/**
* Called throughout the code as a replacement for block instanceof
* BlockContainer Moving this to the Block base class allows for mods that
* wish
* to extend vinella blocks, and also want to have a tile entity on that
* block, may.
*
* Return true from this function to specify this block has a tile entity.
*
* @param metadata
* Metadata of the current block
* @return True if block has a tile entity, false otherwise
*/
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
/**
* Called throughout the code as a replacement for
* BlockContainer.getBlockEntity Return the same thing you would from that
* function. This will
* fall back to BlockContainer.getBlockEntity if this block is a
* BlockContainer.
*
* @param metadata
* The Metadata of the current block
* @return A instance of a class extending TileEntity
*/
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileEntityTinkerTable();
}
}

View file

@ -0,0 +1,15 @@
package net.machinemuse.powersuits.block;
import net.minecraft.tileentity.TileEntity;
/**
* @author MachineMuse
*
* Ported to Java by lehjr on 10/21/16.
*/
public class TileEntityTinkerTable extends TileEntity {
@Override
public boolean canUpdate() {
return false;
}
}

View file

@ -20,7 +20,7 @@ import static org.lwjgl.opengl.GL11.*;
public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRenderingHandler {
protected static WavefrontObject lightmodel;
protected static WavefrontObject framemodel;
protected int renderId;
protected final int renderId;
public RenderLuxCapacitorTESR(int renderId) {
this.renderId = renderId;

View file

@ -11,7 +11,7 @@ import java.util.Random;
public class TinkerTableModel extends ModelBase {
// public float onGround;
// public boolean isRiding = false;
protected ModelBase model = new ModelBase() {
protected final ModelBase model = new ModelBase() {
};
private static final Random random = new Random();
@ -29,26 +29,26 @@ public class TinkerTableModel extends ModelBase {
// public int textureWidth = 64;
// public int textureHeight = 32;
ModelRenderer cube;
ModelRenderer screen3;
ModelRenderer screen2;
ModelRenderer screen1;
ModelRenderer middletable;
ModelRenderer uppertable;
ModelRenderer particles;
ModelRenderer footbase;
ModelRenderer foot1;
ModelRenderer fatfoot2;
ModelRenderer fatfoot1;
ModelRenderer backsupport;
ModelRenderer tank3;
ModelRenderer tank2;
ModelRenderer tank1;
ModelRenderer wireshort4;
ModelRenderer wireshort3;
ModelRenderer wireshort2;
ModelRenderer Wireshort1;
ModelRenderer Wirelong1;
final ModelRenderer cube;
final ModelRenderer screen3;
final ModelRenderer screen2;
final ModelRenderer screen1;
final ModelRenderer middletable;
final ModelRenderer uppertable;
final ModelRenderer particles;
final ModelRenderer footbase;
final ModelRenderer foot1;
final ModelRenderer fatfoot2;
final ModelRenderer fatfoot1;
final ModelRenderer backsupport;
final ModelRenderer tank3;
final ModelRenderer tank2;
final ModelRenderer tank1;
final ModelRenderer wireshort4;
final ModelRenderer wireshort3;
final ModelRenderer wireshort2;
final ModelRenderer Wireshort1;
final ModelRenderer Wirelong1;
/**
*
@ -175,9 +175,9 @@ public class TinkerTableModel extends ModelBase {
setRotation(Wirelong1, 0F, 0F, 0F);
}
public void doRender(Entity entity, double x, double y, double z, float f,
public void doRender(Entity entity, double x, double y, double z,
float f1) {
f = 0.0625f;
float f = 0.0625f;
RenderState.blendingOn();
int timestep = (int) ((System.currentTimeMillis()) % 10000);
double angle = timestep * Math.PI / 5000.0;

View file

@ -18,8 +18,8 @@ import org.lwjgl.opengl.GL11;
* @author MachineMuse
*/
public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderingHandler {
protected TinkerTableModel model;
protected int renderId;
protected final TinkerTableModel model;
protected final int renderId;
public TinkerTableRenderer(int renderId) {
model = new TinkerTableModel();
@ -32,7 +32,7 @@ public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderi
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
model.doRender(null, x, y, z, partialTickTime, partialTickTime);
model.doRender(null, x, y, z, partialTickTime);
// float texturex = 80 / 256.0f;
// float texturey = 32 / 256.0f;
// float texturex2 = 96 / 256.0f;
@ -52,7 +52,7 @@ public class TinkerTableRenderer extends MuseTESR implements ISimpleBlockRenderi
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH());
GL11.glPushMatrix();
GL11.glTranslated(-0.5, -0.5 + -1.0 / 16.0, -0.5);
model.doRender(null, 0, 0, 0, 0, 0);
model.doRender(null, 0, 0, 0, 0);
GL11.glPopMatrix();
}

View file

@ -26,41 +26,41 @@ public class ToolModel extends ModelBase {
public int boltSize;
// fields
ModelRenderer mainarm;
ModelRenderer armorright;
ModelRenderer armorleft;
ModelRenderer wristtopright;
ModelRenderer wristtopleft;
ModelRenderer wristbottomright;
ModelRenderer wristbottomleft;
ModelRenderer index1;
ModelRenderer index2;
ModelRenderer middlefinger1;
ModelRenderer middlefinger2;
ModelRenderer ringfinger1;
ModelRenderer ringfinger2;
ModelRenderer pinky1;
ModelRenderer pinky2;
ModelRenderer thumb1;
ModelRenderer thumb2;
ModelRenderer fingerguard;
ModelRenderer crystalholder;
ModelRenderer crystal;
ModelRenderer supportright1;
ModelRenderer supportright2;
ModelRenderer supportright3;
ModelRenderer supportright4;
ModelRenderer supportright5;
ModelRenderer supportbaseright;
ModelRenderer palm;
ModelRenderer supportbaseleft;
ModelRenderer supportleftfront;
ModelRenderer supportrightfront;
ModelRenderer supportleft1;
ModelRenderer supportleft2;
ModelRenderer supportleft3;
ModelRenderer supportleft4;
ModelRenderer supportleft5;
final ModelRenderer mainarm;
final ModelRenderer armorright;
final ModelRenderer armorleft;
final ModelRenderer wristtopright;
final ModelRenderer wristtopleft;
final ModelRenderer wristbottomright;
final ModelRenderer wristbottomleft;
final ModelRenderer index1;
final ModelRenderer index2;
final ModelRenderer middlefinger1;
final ModelRenderer middlefinger2;
final ModelRenderer ringfinger1;
final ModelRenderer ringfinger2;
final ModelRenderer pinky1;
final ModelRenderer pinky2;
final ModelRenderer thumb1;
final ModelRenderer thumb2;
final ModelRenderer fingerguard;
final ModelRenderer crystalholder;
final ModelRenderer crystal;
final ModelRenderer supportright1;
final ModelRenderer supportright2;
final ModelRenderer supportright3;
final ModelRenderer supportright4;
final ModelRenderer supportright5;
final ModelRenderer supportbaseright;
final ModelRenderer palm;
final ModelRenderer supportbaseleft;
final ModelRenderer supportleftfront;
final ModelRenderer supportrightfront;
final ModelRenderer supportleft1;
final ModelRenderer supportleft2;
final ModelRenderer supportleft3;
final ModelRenderer supportleft4;
final ModelRenderer supportleft5;
public ToolModel() {
textureWidth = 64;

View file

@ -4,7 +4,6 @@ import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseIconUtils;
import net.machinemuse.powersuits.client.render.entity.MuseRender;
import net.machinemuse.powersuits.common.MPSItems;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.machinemuse.powersuits.item.ItemPowerFist;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
@ -31,7 +30,7 @@ import org.lwjgl.opengl.GL12;
* @author MachineMuse
*/
public class ToolRenderer extends MuseRender implements IItemRenderer {
public ToolModel model = new ToolModel();
public final ToolModel model = new ToolModel();
/**
* Forge checks this to see if our custom renderer will handle a certain type of rendering.

View file

@ -11,6 +11,7 @@ import net.machinemuse.powersuits.powermodule.misc.AirtightSealModule;
import net.machinemuse.powersuits.powermodule.misc.ThaumGogglesModule;
import net.machinemuse.powersuits.powermodule.tool.*;
import net.minecraftforge.common.config.Configuration;
import java.util.Arrays;
import java.util.Collections;

View file

@ -16,13 +16,13 @@ import org.lwjgl.input.Keyboard;
@SideOnly(Side.CLIENT)
public class KeybindKeyHandler {
public static final String mps = "Modular Powersuits";
public static KeyBinding openKeybindGUI = new KeyBinding("Open MPS Keybind GUI", -1, mps);
public static KeyBinding goDownKey = new KeyBinding("Go Down (MPS Flight Control)", Keyboard.KEY_Z, mps);
public static KeyBinding cycleToolBackward = new KeyBinding("Cycle Tool Backward (MPS)", -1, mps);
public static KeyBinding cycleToolForward = new KeyBinding("Cycle Tool Forward (MPS)", -1, mps);
public static KeyBinding zoom = new KeyBinding("Zoom (MPS)", Keyboard.KEY_Y, mps);
public static KeyBinding openCosmeticGUI = new KeyBinding("Cosmetic (MPS)", -1, mps);
public static KeyBinding[] keybindArray = new KeyBinding[]{openKeybindGUI, goDownKey, cycleToolBackward, cycleToolForward, zoom, openCosmeticGUI};
public static final KeyBinding openKeybindGUI = new KeyBinding("Open MPS Keybind GUI", -1, mps);
public static final KeyBinding goDownKey = new KeyBinding("Go Down (MPS Flight Control)", Keyboard.KEY_Z, mps);
public static final KeyBinding cycleToolBackward = new KeyBinding("Cycle Tool Backward (MPS)", -1, mps);
public static final KeyBinding cycleToolForward = new KeyBinding("Cycle Tool Forward (MPS)", -1, mps);
public static final KeyBinding zoom = new KeyBinding("Zoom (MPS)", Keyboard.KEY_Y, mps);
public static final KeyBinding openCosmeticGUI = new KeyBinding("Cosmetic (MPS)", -1, mps);
public static final KeyBinding[] keybindArray = new KeyBinding[]{openKeybindGUI, goDownKey, cycleToolBackward, cycleToolForward, zoom, openCosmeticGUI};
public static boolean[] repeats = new boolean[keybindArray.length];
public KeybindKeyHandler() {

View file

@ -19,7 +19,7 @@ import java.util.Set;
public class KeybindManager {
// only stores keybindings relevant to us!!
protected Set<ClickableKeybinding> keybindings;
protected final Set<ClickableKeybinding> keybindings;
protected static KeybindManager instance;
protected KeybindManager() {
@ -73,7 +73,7 @@ public class KeybindManager {
} finally {
try {
writer.close();
} catch (Throwable e) {
} catch (Throwable ignored) {
}
}
}

View file

@ -7,7 +7,7 @@ import java.util.HashMap;
import java.util.Map;
public class PlayerInputMap {
protected static Map<String, PlayerInputMap> playerInputs = new HashMap();
protected static final Map<String, PlayerInputMap> playerInputs = new HashMap();
public static PlayerInputMap getInputMapFor(String playerName) {
PlayerInputMap map = playerInputs.get(playerName);
@ -83,7 +83,7 @@ public class PlayerInputMap {
&& other.motionX == this.motionX
&& other.motionY == this.motionY
&& other.motionZ == this.motionZ;
} catch (ClassCastException e) {
} catch (ClassCastException ignored) {
}
return false;
}

View file

@ -1,6 +1,5 @@
package net.machinemuse.powersuits.entity;
import net.machinemuse.powersuits.block.BlockLuxCapacitor;
import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
import net.machinemuse.powersuits.common.MPSItems;
import net.minecraft.block.Block;

View file

@ -1,5 +1,8 @@
package net.machinemuse.powersuits.entity;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
@ -8,9 +11,6 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityPlasmaBolt extends EntityThrowable {
public double size;

View file

@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.Map;
public class MovementManager {
public static Map<String, Double> playerJumpMultipliers = new HashMap();
public static final Map<String, Double> playerJumpMultipliers = new HashMap();
public static double getPlayerJumpMultiplier(EntityPlayer player) {
@ -46,7 +46,7 @@ public class MovementManager {
double drain = ModuleManager.computeModularProperty(stack, JumpAssistModule.JUMP_ENERGY_CONSUMPTION);
double avail = ElectricItemUtils.getPlayerEnergy(player);
if ((FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) && NuminaConfig.useSounds()) {
Musique.playerSound(player, SoundDictionary.SOUND_JUMP_ASSIST, (float) (jumpAssist / 8.0), 1, false);
Musique.playerSound(player, SoundDictionary.SOUND_JUMP_ASSIST, (float) (jumpAssist / 8.0), (float)1, false);
}
if (drain < avail) {
ElectricItemUtils.drainPlayerEnergy(player, drain);
@ -73,7 +73,7 @@ public class MovementManager {
if (ModuleManager.itemHasActiveModule(boots, ShockAbsorberModule.MODULE_SHOCK_ABSORBER) && event.distance > 3) {
double distanceAbsorb = event.distance * ModuleManager.computeModularProperty(boots, ShockAbsorberModule.SHOCK_ABSORB_MULTIPLIER);
if ((FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) && NuminaConfig.useSounds()) {
Musique.playerSound(player, SoundDictionary.SOUND_GUI_INSTALL, (float) (distanceAbsorb), 1, false);
Musique.playerSound(player, SoundDictionary.SOUND_GUI_INSTALL, (float) (distanceAbsorb), (float)1, false);
}
double drain = distanceAbsorb * ModuleManager.computeModularProperty(boots, ShockAbsorberModule.SHOCK_ABSORB_ENERGY_CONSUMPTION);
@ -94,7 +94,6 @@ public class MovementManager {
public static double computeFallHeightFromVelocity(double velocity) {
double ticks = velocity / DEFAULT_GRAVITY;
double distance = -0.5 * DEFAULT_GRAVITY * ticks * ticks;
return distance;
return -0.5 * DEFAULT_GRAVITY * ticks * ticks;
}
}

View file

@ -58,10 +58,10 @@ public class ItemComponent extends Item {
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setCreativeTab(Config.getCreativeTab());
icons = new ArrayList<IIcon>();
iconNames = new ArrayList<String>();
names = new ArrayList<String>();
descriptions = new ArrayList<String>();
icons = new ArrayList<>();
iconNames = new ArrayList<>();
names = new ArrayList<>();
descriptions = new ArrayList<>();
}
public ItemStack addComponent(String oredictName, String description, String iconName) {

View file

@ -5,10 +5,10 @@ import net.machinemuse.api.IModularItem;
import java.util.List;
public class PowerModule extends PowerModuleBase {
protected String name;
protected final String name;
protected String description;
protected String category;
protected String textureFile;
protected final String textureFile;
public PowerModule(String name, List<IModularItem> validItems, String textureFile, String category) {
super(name, validItems);

View file

@ -15,11 +15,11 @@ import net.minecraft.util.StatCollector;
import java.util.*;
public abstract class PowerModuleBase implements ILocalizeableModule {
protected List<ItemStack> defaultInstallCost;
protected List<IModularItem> validItems;
protected Map<String, List<IPropertyModifier>> propertyModifiers;
protected static Map<String, String> units = new HashMap<String, String>();
protected NBTTagCompound defaultTag;
protected final List<ItemStack> defaultInstallCost;
protected final List<IModularItem> validItems;
protected final Map<String, List<IPropertyModifier>> propertyModifiers;
protected static final Map<String, String> units = new HashMap<>();
protected final NBTTagCompound defaultTag;
protected boolean isAllowed;
protected IIcon icon;

View file

@ -1,9 +1,7 @@
package net.machinemuse.powersuits.powermodule;
import net.machinemuse.api.IPropertyModifier;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.machinemuse.powersuits.powermodule.PropertyModifierLinearAdditive;
public class PropertyModifierIntLinearAdditive extends PropertyModifierLinearAdditive {

View file

@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
public class PropertyModifierLinearAdditive implements IPropertyModifier {
public double multiplier;
public String tradeoffName;
public final String tradeoffName;
public PropertyModifierLinearAdditive(String tradeoffName, double multiplier) {
this.multiplier = multiplier;

View file

@ -9,10 +9,8 @@ import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import java.util.List;

View file

@ -1,6 +1,5 @@
package net.machinemuse.powersuits.powermodule.armor;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
@ -12,9 +11,7 @@ import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseHeatUtils;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import java.util.List;

View file

@ -15,7 +15,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import java.util.List;
@ -27,7 +26,7 @@ public class WaterTankModule extends PowerModuleBase implements IPlayerTickModul
public static final String MODULE_WATER_TANK = "Water Tank";
public static final String WATER_TANK_SIZE = "Tank Size";
public static final String ACTIVATION_PERCENT = "Heat Activation Percent";
ItemStack bucketWater = new ItemStack(Items.water_bucket);
final ItemStack bucketWater = new ItemStack(Items.water_bucket);
public WaterTankModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -12,7 +12,6 @@ import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
@ -21,7 +20,7 @@ import java.util.List;
* Created by Eximius88 on 1/12/14.
*/
public class AdvancedSolarGenerator extends PowerModuleBase implements IPlayerTickModule {
public static String MODULE_ADVANCED_SOLAR_GENERATOR = "Advanced Solar Generator";
public static final String MODULE_ADVANCED_SOLAR_GENERATOR = "Advanced Solar Generator";
public static final String A_SOLAR_ENERGY_GENERATION_DAY = "Daytime Energy Generation";
public static final String A_SOLAR_ENERGY_GENERATION_NIGHT = "Nighttime Energy Generation";
public static final String SOLAR_HEAT_GENERATION_DAY = "Daytime Heat Generation";

View file

@ -6,18 +6,13 @@ import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseHeatUtils;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import java.util.List;

View file

@ -14,7 +14,6 @@ import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import java.util.List;

View file

@ -12,7 +12,6 @@ import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;

View file

@ -4,7 +4,6 @@ package net.machinemuse.powersuits.powermodule.energy;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.ElectricItemUtils;
@ -13,7 +12,6 @@ import net.machinemuse.utils.MuseHeatUtils;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import java.util.List;

View file

@ -1,24 +1,20 @@
package net.machinemuse.powersuits.powermodule.misc;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.FoodStats;
import net.minecraft.util.StatCollector;
import java.util.List;
import java.util.List;

View file

@ -9,7 +9,6 @@ import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List;
@ -20,7 +19,7 @@ import java.util.List;
public class ClockModule extends PowerModuleBase implements IToggleableModule {
public static final String MODULE_CLOCK = "Clock";
public static ItemStack clock = new ItemStack(Items.clock);
public static final ItemStack clock = new ItemStack(Items.clock);
public ClockModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -9,7 +9,6 @@ import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List;
@ -20,7 +19,7 @@ import java.util.List;
public class CompassModule extends PowerModuleBase implements IToggleableModule {
public static final String MODULE_COMPASS = "Compass";
public static ItemStack compass = new ItemStack(Items.compass);
public static final ItemStack compass = new ItemStack(Items.compass);
public CompassModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -1,17 +1,15 @@
package net.machinemuse.powersuits.powermodule.misc;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;

View file

@ -9,6 +9,7 @@ import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
@ -16,12 +17,9 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import java.util.List;

View file

@ -19,7 +19,6 @@ import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.Iterator;
@ -104,10 +103,9 @@ public class MobRepulsorModule extends PowerModuleBase implements IPlayerTickMod
private void push(Entity entity, int i, int j, int k) {
if (!(entity instanceof EntityPlayer) && !(entity instanceof EntityDragon)) {
Entity entity2 = entity;
double d = i - entity2.posX;
double d1 = j - entity2.posY;
double d2 = k - entity2.posZ;
double d = i - entity.posX;
double d1 = j - entity.posY;
double d2 = k - entity.posZ;
double d4 = d * d + d1 * d1 + d2 * d2;
d4 *= d4;
if (d4 <= Math.pow(6.0D, 4.0D)) {
@ -129,9 +127,9 @@ public class MobRepulsorModule extends PowerModuleBase implements IPlayerTickMod
} else if (d7 < 0.0D) {
d7 = -0.22D;
}
entity2.motionX += d5;
entity2.motionY += d6;
entity2.motionZ += d7;
entity.motionX += d5;
entity.motionY += d6;
entity.motionZ += d7;
}
}
}

View file

@ -7,7 +7,7 @@ import net.machinemuse.utils.MuseCommonStrings;
import java.util.List;
public class TintModule extends PowerModuleBase {
public static String MODULE_TINT = "Custom Colour Module";
public static final String MODULE_TINT = "Custom Colour Module";
public static final String RED_TINT = "Red Tint";
public static final String GREEN_TINT = "Green Tint";
public static final String BLUE_TINT = "Blue Tint";

View file

@ -9,11 +9,11 @@ import net.minecraft.nbt.NBTTagCompound;
* Created by leon on 10/18/16.
*/
public class AttributeModifier {
int operation;
UUID uuid;
double amount;
String attributeName;
String name;
final int operation;
final UUID uuid;
final double amount;
final String attributeName;
final String name;
public AttributeModifier(int operation, UUID uuid, double amount, String attributeName, String name) {
this.operation = operation;

View file

@ -21,13 +21,13 @@ import java.util.List;
* Created by leon on 10/18/16.
*/
public class SprintAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static String MODULE_SPRINT_ASSIST = "Sprint Assist";
public static String SPRINT_ENERGY_CONSUMPTION = "Sprint Energy Consumption";
public static String SPRINT_SPEED_MULTIPLIER = "Sprint Speed Multiplier";
public static String SPRINT_FOOD_COMPENSATION = "Sprint Exhaustion Compensation";
public static String WALKING_ENERGY_CONSUMPTION = "Walking Energy Consumption";
public static String WALKING_SPEED_MULTIPLIER = "Walking Speed Multiplier";
public static UUID TAGUUID = new UUID(-7931854408382894632l, -8160638015224787553l);
public static final String MODULE_SPRINT_ASSIST = "Sprint Assist";
public static final String SPRINT_ENERGY_CONSUMPTION = "Sprint Energy Consumption";
public static final String SPRINT_SPEED_MULTIPLIER = "Sprint Speed Multiplier";
public static final String SPRINT_FOOD_COMPENSATION = "Sprint Exhaustion Compensation";
public static final String WALKING_ENERGY_CONSUMPTION = "Walking Energy Consumption";
public static final String WALKING_SPEED_MULTIPLIER = "Walking Speed Multiplier";
public static final UUID TAGUUID = new UUID(-7931854408382894632L, -8160638015224787553L);
public SprintAssistModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -9,8 +9,8 @@ import net.minecraft.nbt.NBTTagCompound;
* Ported to Java by lehjr on 10/13/16.
*/
public class UUID {
long least;
long most;
final long least;
final long most;
public UUID(long least, long most){
this.least = least;

View file

@ -1,32 +1,18 @@
package net.machinemuse.powersuits.powermodule.tool;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IBlockBreakingModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.powermodule.tool.PickaxeModule;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockStone;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.entity.player.PlayerEvent;
import java.util.ArrayList;
import java.util.List;
/**

View file

@ -2,28 +2,15 @@ package net.machinemuse.powersuits.powermodule.tool;
import com.google.common.base.Optional;
import extracells.api.ECApi;
import extracells.item.ItemWirelessTerminalFluid;
import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.IMachineSet;
import appeng.api.util.DimensionalCoord;
import cpw.mods.fml.common.registry.GameRegistry;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;

View file

@ -1,9 +1,7 @@
package net.machinemuse.powersuits.powermodule.tool;
import appeng.api.AEApi;
import appeng.items.tools.powered.ToolWirelessTerminal;
import com.google.common.base.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
@ -12,7 +10,6 @@ import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;

View file

@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import java.util.List;

View file

@ -1,17 +1,12 @@
package net.machinemuse.powersuits.powermodule.tool;
import net.machinemuse.utils.MPSTeleporter;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseHeatUtils;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.machinemuse.utils.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;

View file

@ -14,7 +14,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
@ -28,8 +27,8 @@ public class FlintAndSteelModule extends PowerModuleBase implements IRightClickM
public static final String MODULE_FLINT_AND_STEEL = "Flint and Steel";
public static final String IGNITION_ENERGY_CONSUMPTION = "Ignition Energy Consumption";
public ItemStack fas = new ItemStack(Items.flint_and_steel);
Random ran = new Random();
public final ItemStack fas = new ItemStack(Items.flint_and_steel);
final Random ran = new Random();
public FlintAndSteelModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -5,6 +5,7 @@ import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
@ -13,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import java.util.List;
@ -82,7 +83,7 @@ public class LeafBlowerModule extends PowerModuleBase implements IRightClickModu
return false;
// Plants
if (blocktype == "plants" && (block != null) && ((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;

View file

@ -2,28 +2,23 @@ package net.machinemuse.powersuits.powermodule.tool;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.Optional;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.util.StatCollector;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.block.Block;
import net.minecraftforge.client.MinecraftForgeClient;
//import mrtjp.projectred.transmission.bundledwires.TWireCommons;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.List;
//import mrtjp.projectred.transmission.bundledwires.TWireCommons;
/**
* Created by User: Korynkai
* 6:30 PM 2014-11-17

View file

@ -8,7 +8,6 @@ import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

View file

@ -4,8 +4,10 @@ package net.machinemuse.powersuits.powermodule.tool;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import net.machinemuse.utils.ElectricItemUtils;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
@ -15,14 +17,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import net.machinemuse.powersuits.powermodule.PropertyModifierIntLinearAdditive;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.powersuits.common.Config;
import java.util.ArrayList;
import java.util.Arrays;
@ -37,10 +34,10 @@ public class OreScannerModule extends PowerModuleBase implements IRightClickModu
public static final String ORE_SCANNER_RADIUS_Y = "Y Radius";
public static final String ORE_SCANNER_RADIUS_Z = "Z Radius";
private static String[] oreNames = {"oreCopper", "oreTin", "oreSilver", "oreLead", "oreNickel", "orePlatinum", "oreZinc", "oreApatite", "oreUranium"};
private static ArrayList<ArrayList<ItemStack>> ores = new ArrayList<ArrayList<ItemStack>>();
private static HashMap<List, String> oreMap = new HashMap();
private static HashMap<String, Integer> valueMap = new HashMap();
private static final String[] oreNames = {"oreCopper", "oreTin", "oreSilver", "oreLead", "oreNickel", "orePlatinum", "oreZinc", "oreApatite", "oreUranium"};
private static final ArrayList<ArrayList<ItemStack>> ores = new ArrayList<>();
private static final HashMap<List, String> oreMap = new HashMap();
private static final HashMap<String, Integer> valueMap = new HashMap();
public OreScannerModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -2,20 +2,17 @@ package net.machinemuse.powersuits.powermodule.tool;
import cpw.mods.fml.common.registry.GameRegistry;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.api.moduletrigger.IPlayerTickModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraft.block.Block;
import org.dave.CompactMachines.CompactMachines;
import java.util.List;
@ -26,7 +23,7 @@ import java.util.List;
public class PersonalShrinkingModule extends PowerModuleBase implements IRightClickModule, IPlayerTickModule {
public static final String MODULE_CM_PSD = "Personal Shrinking Device";
private ItemStack cpmPSD;
private final ItemStack cpmPSD;
public PersonalShrinkingModule(List<IModularItem> validItems) {
super(validItems);

View file

@ -17,7 +17,7 @@ import net.minecraft.item.ItemTool;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import java.util.*;
import java.util.List;
public class ShovelModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule {
public static final String MODULE_SHOVEL = "Shovel";

View file

@ -1,10 +1,5 @@
package net.machinemuse.powersuits.powermodule.tool;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@ -12,16 +7,20 @@ import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.util.IConfigManager;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import extracells.api.ECApi;
import extracells.api.IWirelessFluidTermHandler;
import net.machinemuse.powersuits.common.ModCompatibility;
import net.machinemuse.utils.ElectricItemUtils;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
/**
* Created by Eximius88 on 1/13/14.
*/
@ -38,9 +37,7 @@ public boolean canHandle(ItemStack is) {
return false;
if(is.getUnlocalizedName() == null)
return false;
if(is.getUnlocalizedName().equals("item.powerFist"))
return true;
return false;
return is.getUnlocalizedName().equals("item.powerFist");
}
@Optional.Method(modid = "appliedenergistics2")
@ -142,7 +139,7 @@ public static NBTTagCompound openNbtData(ItemStack item) {
@Optional.Interface(iface = "appeng.api.util.IConfigManager", modid = "appliedenergistics2", striprefs = true)
class WirelessConfig implements IConfigManager {
private final Map<Settings, Enum<?>> enums = new EnumMap<Settings, Enum<?>>( Settings.class );
private final Map<Settings, Enum<?>> enums = new EnumMap<>(Settings.class);
final ItemStack stack;
@ -217,7 +214,7 @@ public void readFromNBT(NBTTagCompound tagCompound)
putSetting( key, newValue );
}
}
catch (IllegalArgumentException e)
catch (IllegalArgumentException ignored)
{
}

View file

@ -11,7 +11,6 @@ import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
@ -81,7 +80,7 @@ public class LightningModule extends PowerModuleBase implements IRightClickModul
}
}*/
}
} catch (Exception e) {
} catch (Exception ignored) {
}
}

View file

@ -1,9 +1,8 @@
package net.machinemuse.utils;
import net.machinemuse.powersuits.powermodule.armor.WaterTankModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.powersuits.item.ItemPowerArmorChestplate;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.powersuits.powermodule.armor.WaterTankModule;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View file

@ -1,11 +1,7 @@
package net.machinemuse.utils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.machinemuse.powersuits.entity.TileEntityPortal;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
@ -14,18 +10,21 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.machinemuse.powersuits.entity.TileEntityPortal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
public class MPSTeleporter extends Teleporter {
private final WorldServer worldServerInstance;
private final Random random;
private final LongHashMap destinationCoordinateCache = new LongHashMap();
private final List destinationCoordinateKeys = new ArrayList();
public MPSTeleporter(WorldServer par1WorldServer) {
super(par1WorldServer);
this.worldServerInstance = par1WorldServer;
this.random = new Random(par1WorldServer.getSeed());
Random random = new Random(par1WorldServer.getSeed());
}
public void placeInPortal(Entity entity, double x, double y, double z, float r) {
@ -41,9 +40,7 @@ public class MPSTeleporter extends Teleporter {
public TileEntity findPortalInChunk(double x, double z) {
Chunk chunk = this.worldServerInstance.getChunkFromBlockCoords((int) x, (int) z);
Iterator t = chunk.chunkTileEntityMap.values().iterator();
while (t.hasNext()) {
Object tile = t.next();
for (Object tile : chunk.chunkTileEntityMap.values()) {
if ((tile instanceof TileEntityPortal)) {
return (TileEntity) tile;
}
@ -109,10 +106,10 @@ public class MPSTeleporter extends Teleporter {
long j = par1 - 600L;
while (iterator.hasNext()) {
Long olong = (Long) iterator.next();
PortalPosition portalposition = (PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue());
PortalPosition portalposition = (PortalPosition) this.destinationCoordinateCache.getValueByKey(olong);
if ((portalposition == null) || (portalposition.lastUpdateTime < j)) {
iterator.remove();
this.destinationCoordinateCache.remove(olong.longValue());
this.destinationCoordinateCache.remove(olong);
}
}
}

View file

@ -7,7 +7,7 @@ import net.minecraft.world.World;
* 5:50 PM 4/21/13
*/
public class MuseBlockUtils {
public static byte[] rotateType = new byte[4096];
public static final byte[] rotateType = new byte[4096];
public static final int[][] SIDE_COORD_MOD = {{0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1}, {-1, 0, 0}, {1, 0, 0}};
public static final int[] SIDE_LEFT = {4, 5, 5, 4, 2, 3};
public static final int[] SIDE_RIGHT = {5, 4, 4, 5, 3, 2};
@ -70,7 +70,7 @@ public class MuseBlockUtils {
if (meta == 6)
return 5 + shift;
if (meta == 7)
return 0 + shift;
return shift;
if (meta == 0) {
return 7 + shift;
}
@ -129,7 +129,7 @@ public class MuseBlockUtils {
if (meta == 6)
return 5 + shift;
if (meta == 7)
return 0 + shift;
return shift;
if (meta == 0)
return 7 + shift;
break;

View file

@ -1,5 +1,7 @@
package net.machinemuse.utils;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
@ -15,8 +17,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import java.util.*;
@ -61,7 +61,7 @@ public class MuseItemUtils {
* IModularItem
*/
public static List<ItemStack> getModularItemsInInventory(IInventory inv) {
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
ArrayList<ItemStack> stacks = new ArrayList<>();
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
@ -83,7 +83,7 @@ public class MuseItemUtils {
* @return A List of inventory slots containing an IModularItem
*/
public static List<Integer> getModularItemSlotsInInventory(IInventory inv) {
ArrayList<Integer> slots = new ArrayList<Integer>();
ArrayList<Integer> slots = new ArrayList<>();
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
@ -130,7 +130,7 @@ public class MuseItemUtils {
}
public static List<Integer> deleteFromInventory(List<ItemStack> cost, InventoryPlayer inventory) {
List<Integer> slots = new LinkedList<Integer>();
List<Integer> slots = new LinkedList<>();
for (ItemStack stackInCost : cost) {
int remaining = stackInCost.stackSize;
for (int i = 0; i < inventory.getSizeInventory() && remaining > 0; i++) {
@ -150,7 +150,7 @@ public class MuseItemUtils {
}
public static List<Integer> findInInventoryForCost(List<ItemStack> workingUpgradeCost, InventoryPlayer inventory) {
List<Integer> slots = new LinkedList<Integer>();
List<Integer> slots = new LinkedList<>();
for (ItemStack stackInCost : workingUpgradeCost) {
int found = 0;
for (int i = 0; i < inventory.getSizeInventory() && found < stackInCost.stackSize; i++) {
@ -247,13 +247,12 @@ public class MuseItemUtils {
}
public static ItemStack[] itemsEquipped(EntityPlayer player) {
ItemStack[] equipped = {
return new ItemStack[]{
player.inventory.armorInventory[0],
player.inventory.armorInventory[1],
player.inventory.armorInventory[2],
player.inventory.armorInventory[3],
player.inventory.getCurrentItem()};
return equipped;
}
public static boolean canStackTogether(ItemStack stack1, ItemStack stack2) {
@ -303,7 +302,7 @@ public class MuseItemUtils {
}
public static Set<Integer> giveOrDropItemWithChance(ItemStack itemsToGive, EntityPlayer player, double chanceOfSuccess) {
Set<Integer> slots = new HashSet<Integer>();
Set<Integer> slots = new HashSet<>();
// First try to add the items to existing stacks
for (int i = 0; i < player.inventory.getSizeInventory() && itemsToGive.stackSize > 0; i++) {
@ -405,9 +404,7 @@ public class MuseItemUtils {
if (stack != null && stack.getItem() instanceof IModularItem) {
NBTTagCompound itemTag = MuseItemUtils.getMuseItemTag(stack);
Double foodLevel = itemTag.getDouble("Food");
if (foodLevel != null) {
return foodLevel;
}
return foodLevel;
}
return 0.0;
}

View file

@ -57,8 +57,7 @@ public abstract class MuseStringUtils {
format.setMaximumFractionDigits(2);
format.applyPattern("##0.##");
String formattedNumber = format.format(number * 100);
return formattedNumber;
return format.format(number * 100);
}
/**
@ -194,7 +193,7 @@ public abstract class MuseStringUtils {
* </pre>
*/
public static List<String> wrapStringToVisualLength(String str, double length) {
List<String> strlist = new ArrayList<String>();
List<String> strlist = new ArrayList<>();
String[] words = str.split(" ");
if(words.length == 0) {
@ -234,7 +233,7 @@ public abstract class MuseStringUtils {
*
* @author MachineMuse
*/
public static enum FormatCodes {
public enum FormatCodes {
Black('0'),
DarkBlue('1'),
DarkGreen('2'),
@ -258,9 +257,9 @@ public abstract class MuseStringUtils {
Italic('o'),
Reset('r');
public char character;
public final char character;
private FormatCodes(char character) {
FormatCodes(char character) {
this.character = character;
}
}

View file

@ -0,0 +1,25 @@
package net.machinemuse.utils;
import net.minecraft.nbt.NBTTagCompound;
/**
* Author: MachineMuse (Claire Semple)
* Created: 5:47 AM, 29/04/13
*
* Ported to Java by lehjr on 10/21/16.
*/
public class ScalaNBT extends NBTTagCompound {
private final NBTTagCompound nbt;
public NBTTagCompound nbt() {
return this.nbt;
}
public ScalaNBT wrap(final NBTTagCompound nbt) {
return new ScalaNBT(nbt);
}
public ScalaNBT(final NBTTagCompound nbt) {
this.nbt = nbt;
}
}

View file

@ -35,16 +35,16 @@ public class GuiIcons {
}
public static class GuiIcon implements IGuiIcon {
double size;
String filepath;
final double size;
final String filepath;
double x;
double y;
Colour c;
double xmin;
double ymin;
double xmax;
double ymax;
final double x;
final double y;
final Colour c;
final double xmin;
final double ymin;
final double xmax;
final double ymax;
public GuiIcon (double size, String filepath, double x, double y, Colour c, Double xmin, Double ymin, Double xmax, Double ymax) {
this.size = size;

View file

@ -1,7 +1,6 @@
package net.machinemuse.utils.render;
import net.machinemuse.general.gui.clickable.IClickable;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.SwirlyMuseCircle;

View file

@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
* Ported to Java by lehjr on 10/19/16.
*/
public class MuseStencilManager {
int stencilMask = 0x10;
final int stencilMask = 0x10;
public void stencilOn() {
GL11.glStencilMask(stencilMask);

View file

@ -17,10 +17,10 @@ import static org.lwjgl.opengl.GL14.GL_DEPTH_COMPONENT24;
*/
public class TextureBuffer {
// Allocate IDs for a FBO, colour buffer, and depth buffer
int framebufferID = glGenFramebuffersEXT();
int colorTextureID = GL11.glGenTextures();
int depthRenderBufferID = GL11.glGenTextures();
int texDimension;
final int framebufferID = glGenFramebuffersEXT();
final int colorTextureID = GL11.glGenTextures();
final int depthRenderBufferID = GL11.glGenTextures();
final int texDimension;
public TextureBuffer(int texDimension) {
this.texDimension = texDimension;

View file

@ -1,12 +1,12 @@
package net.machinemuse.api
import cpw.mods.fml.common.Optional
import forestry.api.apiculture.IArmorApiarist
import net.machinemuse.powersuits.powermodule.armor.ApiaristArmorModule
import net.machinemuse.utils.ElectricItemUtils
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.{ItemArmor, ItemStack}
import net.machinemuse.utils.ElectricItemUtils
import net.machinemuse.powersuits.powermodule.armor.{HazmatModule, ApiaristArmorModule}
import forestry.api.apiculture.IArmorApiarist
import net.minecraft.entity.EntityLivingBase
//import atomicscience.api.IAntiPoisonArmor
/**

View file

@ -1,6 +1,7 @@
package net.machinemuse.api
import java.util.List
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack

View file

@ -1,11 +1,7 @@
package net.machinemuse.api
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.item.ItemStack
import java.lang.String
import net.machinemuse.numina.scala.OptionCast
import net.machinemuse.numina.item.ModeChangingItem
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.nbt.NBTTagCompound
/**
* Author: MachineMuse (Claire Semple)

View file

@ -3,8 +3,7 @@ package net.machinemuse.api.electricity
import appeng.api.config.AccessRestriction
import appeng.api.implementations.items.IAEItemPowerStorage
import cofh.api.energy.IEnergyContainerItem
import ic2.api.item.ElectricItem
import ic2.api.item.IElectricItem
import ic2.api.item.{ElectricItem, IElectricItem}
import net.machinemuse.powersuits.common.ModCompatibility
import net.minecraft.item.ItemStack

View file

@ -1,8 +1,8 @@
package net.machinemuse.api.electricity
import net.minecraft.item.ItemStack
import net.machinemuse.powersuits.common.ModCompatibility
import net.machinemuse.api.ModuleManager
import net.machinemuse.powersuits.common.ModCompatibility
import net.minecraft.item.ItemStack
/**
* Author: MachineMuse (Claire Semple)

View file

@ -4,7 +4,7 @@ import appeng.api.config.AccessRestriction
import appeng.api.implementations.items.IAEItemPowerStorage
import cofh.api.energy.IEnergyContainerItem
import cpw.mods.fml.common.Optional
import ic2.api.item.{IElectricItemManager, ISpecialElectricItem, IElectricItem, ElectricItem}
import ic2.api.item.{ElectricItem, IElectricItem, IElectricItemManager, ISpecialElectricItem}
import net.machinemuse.api.ModuleManager
import net.machinemuse.api.electricity.ElectricConversions._
import net.machinemuse.utils.{ElectricItemUtils, MuseItemUtils}

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