在第 3 行的这段代码中,我不断收到“操作符 == 未定义参数类型 boolean、int”:
public void loadState(int i)
{
if (statesSaved[i] == 0)
{
return;
}
List list = TMIUtils.getMinecraft().h.at.e;
for (int j = 0; j < 44; j++)
{
sx slot = (sx)list.get(j + 1);
slot.c(null);
ul itemstack = TMIUtils.copyStack(states[i][j]);
if ((itemstack == null) || (itemstack.c < 0) || (itemstack.c >= sv.f.length) || (sv.f[itemstack.c] == null))
continue;
slot.c(itemstack);
}
}
我不知道为什么会发生这种情况,因为我有另一个类文件,其中没有错误。
如果有帮助,这是我的完整课程文件:
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.Minecraft;
public class TMIConfig
{
public static final String VERSION = "1.7.2 2011-07-01";
public static final int NUM_SAVES = 7;
public static final int INVENTORY_SulE = 44;
public static boolean isModloaderEnabled = false;
private static TMIConfig instance;
private static List items = new ArrayList();
private static HashSet toolIds;
private static HashSet nonUnlimitedIds;
private Map settings;
private static ul[][] states = new ul[7][44];
private static boolean[] statesSaved = new boolean[7];
private static HashSet excludeIds;
public TMIConfig()
{
this.settings = new LinkedHashMap();
this.settings.put("enable", "true");
this.settings.put("enablemp", "false");
this.settings.put("give-command", "/give {0} {1} {2}");
for (int i = 0; i < getNumSaves(); i++)
{
this.settings.put(new StringBuilder().append("save-name").append(i + 1).toString(), new StringBuilder().append("").append(i + 1).toString());
}
for (int j = 0; j < getNumSaves(); j++)
{
this.settings.put(new StringBuilder().append("save").append(j + 1).toString(), "");
}
instance = this;
}
public static boolean isMultiplayer()
{
return TMIUtils.getMinecraft().f.I;
}
public static TMIConfig getInstance()
{
if (instance == null)
{
new TMIConfig();
}
return instance;
}
public Map getSettings()
{
return this.settings;
}
public List getItems()
{
return items;
}
public int getNumSaves()
{
return 7;
}
public boolean isStateSaved(int i)
{
return statesSaved[i];
}
public ul[] getState(int i)
{
return states[i];
}
public boolean getBooleanSetting(String s)
{
return Boolean.parseBoolean((String)this.settings.get(s));
}
public boolean isEnabled()
{
return ((isMultiplayer()) && (getBooleanSetting("enablemp"))) || ((!isMultiplayer()) && (getBooleanSetting("enable")));
}
public void toggleEnabled()
{
String s = isMultiplayer() ? "enablemp" : "enable";
this.settings.put(s, Boolean.toString(!getBooleanSetting(s)));
}
public void setEnabled(boolean flag)
{
String s = isMultiplayer() ? "enablemp" : "enable";
this.settings.put(s, Boolean.toString(flag));
}
public static boolean isItemIncluded(int i)
{
return !excludeIds.contains(Integer.valueOf(i));
}
public static boolean isTool(sv item)
{
return toolIds.contains(Integer.valueOf(item.br));
}
public static boolean canItemBeUnlimited(sv item)
{
return !nonUnlimitedIds.contains(Integer.valueOf(item.br));
}
public boolean areDamageVariantsShown()
{
if (isMultiplayer())
{
String s = (String)getSettings().get("give-command");
return s.contains("{3}");
}
return true;
}
public void clearState(int i)
{
for (int j = 0; j < 44; j++)
{
states[i][j] = null;
statesSaved[i] = false;
}
this.settings.put(new StringBuilder().append("save").append(i + 1).toString(), "");
}
public void loadState(int i)
{
if (statesSaved[i] == 0)
{
return;
}
List list = TMIUtils.getMinecraft().h.at.e;
for (int j = 0; j < 44; j++)
{
sx slot = (sx)list.get(j + 1);
slot.c(null);
ul itemstack = TMIUtils.copyStack(states[i][j]);
if ((itemstack == null) || (itemstack.c < 0) || (itemstack.c >= sv.f.length) || (sv.f[itemstack.c] == null))
continue;
slot.c(itemstack);
}
}
public void saveState(int i)
{
List list = TMIUtils.getMinecraft().h.at.e;
for (int j = 0; j < 44; j++)
{
states[i][j] = TMIUtils.copyStack(((sx)list.get(j + 1)).a());
}
this.settings.put(new StringBuilder().append("save").append(i + 1).toString(), encodeState(i));
statesSaved[i] = true;
}
public String encodeState(int i)
{
StringBuilder stringbuilder = new StringBuilder();
for (int j = 0; j < 44; j++)
{
if (states[i][j] != null)
{
stringbuilder.append(states[i][j].c);
stringbuilder.append(":");
stringbuilder.append(states[i][j].a);
stringbuilder.append(":");
stringbuilder.append(states[i][j].i());
}
stringbuilder.append(",");
}
return stringbuilder.toString();
}
public void decodeState(int i, String s)
{
if (s.trim().equals(""))
{
statesSaved[i] = false;
}
else {
String[] as = s.split(",", 0);
for (int j = 0; (j < as.length) && (j < states[i].length); j++)
{
String[] as1 = as[j].split(":");
if (as1.length != 3)
{
continue;
}
try
{
states[i][j] = new ul(Integer.parseInt(as1[0]), Integer.parseInt(as1[1]), Integer.parseInt(as1[2]));
}
catch (Exception exception)
{
System.out.println(exception);
}
}
statesSaved[i] = true;
}
}
static
{
toolIds = new HashSet();
for (int i = 1; i <= 3; i++)
{
toolIds.add(Integer.valueOf(i + 256));
}
for (int j = 11; j <= 23; j++)
{
toolIds.add(Integer.valueOf(j + 256));
}
for (int k = 27; k <= 30; k++)
{
toolIds.add(Integer.valueOf(k + 256));
}
for (int l = 34; l <= 38; l++)
{
toolIds.add(Integer.valueOf(l + 256));
}
for (int m = 42; m <= 61; m++)
{
toolIds.add(Integer.valueOf(m + 256));
}
toolIds.add(Integer.valueOf(359));
toolIds.add(Integer.valueOf(346));
nonUnlimitedIds = new HashSet();
nonUnlimitedIds.add(Integer.valueOf(358));
excludeIds = new HashSet();
excludeIds.add(Integer.valueOf(9));
excludeIds.add(Integer.valueOf(11));
excludeIds.add(Integer.valueOf(63));
excludeIds.add(Integer.valueOf(64));
excludeIds.add(Integer.valueOf(68));
excludeIds.add(Integer.valueOf(71));
excludeIds.add(Integer.valueOf(74));
excludeIds.add(Integer.valueOf(75));
excludeIds.add(Integer.valueOf(59));
excludeIds.add(Integer.valueOf(83));
excludeIds.add(Integer.valueOf(55));
excludeIds.add(Integer.valueOf(26));
excludeIds.add(Integer.valueOf(93));
excludeIds.add(Integer.valueOf(94));
try
{
Class.forName("mod_RedPowerWiring");
excludeIds.add((Integer)ModLoader.getPrivateValue(mod_RedPowerWiring.class, null, "InsWireID"));
excludeIds.add((Integer)ModLoader.getPrivateValue(mod_RedPowerWiring.class, null, "CableID"));
}
catch (Exception exception)
{
}
}
}