Bugfixes 2

This commit is contained in:
Muramasa 2016-08-14 03:50:59 +01:00
parent 349510f2da
commit 8cdba03c0a
11 changed files with 46 additions and 41 deletions

View file

@ -103,6 +103,7 @@ public class GT_Mod
@Mod.EventHandler @Mod.EventHandler
public void onPreLoad(FMLPreInitializationEvent aEvent) { public void onPreLoad(FMLPreInitializationEvent aEvent) {
Locale.setDefault(Locale.ENGLISH);
if (GregTech_API.sPreloadStarted) { if (GregTech_API.sPreloadStarted) {
return; return;
} }

View file

@ -207,7 +207,7 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci
if (tStats[3] == -2 && tCharge <= 0) { if (tStats[3] == -2 && tCharge <= 0) {
aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY);
} else { } else {
aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharfge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY);
} }
} }
} }

View file

@ -425,10 +425,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return; return;
} }
if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) { if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
try { //try {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
} catch (Exception e) { //} catch (Exception e) {
} //}
doEnergyExplosion(); doEnergyExplosion();
} }
} }

View file

@ -17,14 +17,16 @@ public class ElementStack implements Cloneable {
@Override @Override
public ElementStack clone() { public ElementStack clone() {
return new ElementStack(mElement, mAmount); try { Object cloneES = super.clone();
//return new ElementStack(mElement, mAmount);
return (ElementStack) cloneES; } catch (Exception e) { return new ElementStack(mElement, mAmount); }
} }
@Override @Override
public boolean equals(Object aObject) { public boolean equals(Object aObject) {
if (aObject == this) return true; if (aObject == this) return true;
if (aObject == null) return false; if (aObject == null) return false;
if (aObject instanceof Element) return aObject == mElement; if (aObject instanceof Element) {return aObject == mElement;}
if (aObject instanceof ElementStack) if (aObject instanceof ElementStack)
return ((ElementStack) aObject).mElement == mElement && (mAmount < 0 || ((ElementStack) aObject).mAmount < 0 || ((ElementStack) aObject).mAmount == mAmount); return ((ElementStack) aObject).mElement == mElement && (mAmount < 0 || ((ElementStack) aObject).mAmount < 0 || ((ElementStack) aObject).mAmount == mAmount);
return false; return false;

View file

@ -17,7 +17,9 @@ public class MaterialStack implements Cloneable {
@Override @Override
public MaterialStack clone() { public MaterialStack clone() {
return new MaterialStack(mMaterial, mAmount); try { Object cloneMS = super.clone();
//return new MaterialStack(mMaterial, mAmount);
return (MaterialStack) cloneMS;} catch (Exception e) { return new MaterialStack(mMaterial, mAmount); }
} }
@Override @Override

View file

@ -259,7 +259,7 @@ public class GT_OreDictUnificator {
public static ItemStack getGem(Materials aMaterial, long aMaterialAmount) { public static ItemStack getGem(Materials aMaterial, long aMaterialAmount) {
ItemStack rStack = null; ItemStack rStack = null;
if (((aMaterialAmount >= M) || aMaterialAmount >= M * 32)) if (((aMaterialAmount >= M)/* || aMaterialAmount >= M * 32*/))
rStack = get(OrePrefixes.gem, aMaterial, aMaterialAmount / M); rStack = get(OrePrefixes.gem, aMaterial, aMaterialAmount / M);
if (rStack == null && (((aMaterialAmount * 2) % M == 0) || aMaterialAmount >= M * 16)) if (rStack == null && (((aMaterialAmount * 2) % M == 0) || aMaterialAmount >= M * 16))
rStack = get(OrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M); rStack = get(OrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M);

View file

@ -176,7 +176,7 @@ public class GT_RecipeRegistrator {
} }
public static void registerReverseArcSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03) { public static void registerReverseArcSmelting(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03) {
registerReverseArcSmelting(aStack, new ItemData(aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03)); registerReverseArcSmelting(aStack, new ItemData(/*aMaterial == null ? null : */new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03));
} }
public static void registerReverseArcSmelting(ItemStack aStack, ItemData aData) { public static void registerReverseArcSmelting(ItemStack aStack, ItemData aData) {
@ -234,7 +234,7 @@ public class GT_RecipeRegistrator {
} }
public static void registerReverseMacerating(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03, boolean aAllowHammer) { public static void registerReverseMacerating(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByProduct01, MaterialStack aByProduct02, MaterialStack aByProduct03, boolean aAllowHammer) {
registerReverseMacerating(aStack, new ItemData(aMaterial == null ? null : new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03), aAllowHammer); registerReverseMacerating(aStack, new ItemData(/*aMaterial == null ? null : */new MaterialStack(aMaterial, aMaterialAmount), aByProduct01, aByProduct02, aByProduct03), aAllowHammer);
} }
public static void registerReverseMacerating(ItemStack aStack, ItemData aData, boolean aAllowHammer) { public static void registerReverseMacerating(ItemStack aStack, ItemData aData, boolean aAllowHammer) {

View file

@ -1410,7 +1410,7 @@ public class GT_Utility {
Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() { Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() {
@Override @Override
public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) { public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) {
return -aValue1.getValue().compareTo(aValue2.getValue()); return aValue2.getValue().compareTo(aValue1.getValue());//FB: RV - RV_NEGATING_RESULT_OF_COMPARETO
} }
}); });
LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>(); LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>();

View file

@ -9,15 +9,12 @@ import codechicken.lib.vec.Rotation;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials; import gregtech.api.enums.Materials;
import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.objects.GT_FluidStack;
import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_PlayedSound; import gregtech.api.util.GT_PlayedSound;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
@ -31,12 +28,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.net.URL;
import java.util.*; import java.util.*;
// Referenced classes of package gregtech.common: // Referenced classes of package gregtech.common:
@ -231,45 +226,47 @@ public class GT_Client extends GT_Proxy
} }
public void run() { public void run() {
//skip - dead code, rly, txt files on server is now empty
try { try {
GT_Log.out.println("GT_Mod: Downloading Cape List."); GT_Log.out.println("Skip: GT_Mod: Downloading Cape List.");
@SuppressWarnings("resource") /*@*//*SuppressWarnings("resource")*/
Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream()); //Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
while (tScanner.hasNextLine()) { //while (tScanner.hasNextLine()) {
String tName = tScanner.nextLine(); //String tName = tScanner.nextLine();
if (!this.mCapeList.contains(tName.toLowerCase())) { //if (!this.mCapeList.contains(tName.toLowerCase())) {
this.mCapeList.add(tName.toLowerCase()); //this.mCapeList.add(tName.toLowerCase());
} //}
} //}
} catch (Throwable e) { } catch (Throwable e) {
} }
try { try {
GT_Log.out.println("GT_Mod: Downloading News."); GT_Log.out.println("Skip: GT_Mod: Downloading News.");
@SuppressWarnings("resource") /*@*//*SuppressWarnings("resource")*/
Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream()); //Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
while (tScanner.hasNextLine()) { //while (tScanner.hasNextLine()) {
this.mMessage = (this.mMessage + tScanner.nextLine() + " "); //this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
} //}
} catch (Throwable e) { } catch (Throwable e) {
} }
} }
@SubscribeEvent @SubscribeEvent
public void onPlayerTickEventClient(TickEvent.PlayerTickEvent aEvent) { public void onPlayerTickEventClient(TickEvent.PlayerTickEvent aEvent) {
if ((!aEvent.player.isDead) && (aEvent.phase == TickEvent.Phase.END) && (aEvent.side.isClient())) { if ((aEvent.side.isClient()) && (aEvent.phase == TickEvent.Phase.END) && (!aEvent.player.isDead)) {
ArrayList<GT_PlayedSound> tList = new ArrayList(); ArrayList<GT_PlayedSound> tList = new ArrayList();
for (Map.Entry<GT_PlayedSound, Integer> tEntry : GT_Utility.sPlayedSoundMap.entrySet()) { for (Map.Entry<GT_PlayedSound, Integer> tEntry : GT_Utility.sPlayedSoundMap.entrySet()) {
if (((Integer) tEntry.getValue()).intValue() < 0) { if (tEntry.getValue().intValue() < 0) {//Integer -> Integer -> int? >_<, fix
tList.add(tEntry.getKey()); tList.add(tEntry.getKey());
} else { } else {
tEntry.setValue(Integer.valueOf(((Integer) tEntry.getValue()).intValue() - 1)); tEntry.setValue(Integer.valueOf(tEntry.getValue().intValue() - 1));
} }
} }
GT_PlayedSound tKey; GT_PlayedSound tKey;
for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) { for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) {
tKey = (GT_PlayedSound) i$.next(); tKey = (GT_PlayedSound) i$.next();
} }
if ((this.isFirstClientPlayerTick) && (aEvent.player == GT_Values.GT.getThePlayer())) { //wut, every tick? baaad, not need (and other) -> dead code
/*if ((this.isFirstClientPlayerTick) && (aEvent.player == GT_Values.GT.getThePlayer())) {
this.isFirstClientPlayerTick = false; this.isFirstClientPlayerTick = false;
GT_FluidStack.fixAllThoseFuckingFluidIDs(); GT_FluidStack.fixAllThoseFuckingFluidIDs();
if ((this.mMessage.length() > 5) && (GregTech_API.sSpecialFile.get(ConfigCategories.news, this.mMessage, true))) { if ((this.mMessage.length() > 5) && (GregTech_API.sSpecialFile.get(ConfigCategories.news, this.mMessage, true))) {
@ -291,7 +288,7 @@ public class GT_Client extends GT_Proxy
aEvent.player.addChatComponentMessage(new ChatComponentText("GregTech: Please get the recommended Version of IndustrialCraft here:")); aEvent.player.addChatComponentMessage(new ChatComponentText("GregTech: Please get the recommended Version of IndustrialCraft here:"));
aEvent.player.addChatComponentMessage(new ChatComponentText("ic2api.player.to:8080/job/IC2_experimental/" + (GT_Mod.MAX_IC2 < Integer.MAX_VALUE ? GT_Mod.MAX_IC2 : 624) + "/")); aEvent.player.addChatComponentMessage(new ChatComponentText("ic2api.player.to:8080/job/IC2_experimental/" + (GT_Mod.MAX_IC2 < Integer.MAX_VALUE ? GT_Mod.MAX_IC2 : 624) + "/"));
} }
} }*/
} }
} }
@ -328,17 +325,19 @@ public class GT_Client extends GT_Proxy
} }
} }
@SubscribeEvent //dead event
/*@*//*SubscribeEvent*/
/*@SubscribeEvent
public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) { public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) {
mCapeRenderer.receiveRenderSpecialsEvent(aEvent); mCapeRenderer.receiveRenderSpecialsEvent(aEvent);
} }*/
@SubscribeEvent @SubscribeEvent
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) { public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) { if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
mAnimationTick++; mAnimationTick++;
if (mAnimationTick % 50L == 0L) if (mAnimationTick % 50L == 0L)
mAnimationDirection = !mAnimationDirection; {mAnimationDirection = !mAnimationDirection;}
int tDirection = mAnimationDirection ? 1 : -1; int tDirection = mAnimationDirection ? 1 : -1;
for (Iterator i$ = mPosR.iterator(); i$.hasNext(); ) { for (Iterator i$ = mPosR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next(); Materials tMaterial = (Materials) i$.next();

View file

@ -132,6 +132,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
return false; return false;
} }
//FindBugs
@Deprecated
private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> list) { private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> list) {
if (list != null) { if (list != null) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {

View file

@ -289,8 +289,7 @@ public class GT_NEI_DefaultHandler
} }
} }
public class FixedPositionedStack public static class FixedPositionedStack extends PositionedStack {
extends PositionedStack {
public final int mChance; public final int mChance;
public boolean permutated = false; public boolean permutated = false;