diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf7e6deb3e..b6ec65a152 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,9 @@
-#### Issues
-### General
+### Pull requests
+When wanting to contribute code to IE, please make sure to follow its inherent style of formatting.
+A matching xml file for use with IntelliJ's codestyle feature can be found [here](https://gist.github.com/BluSunrize/5c05af8f29de9581426551d9b29b1809).
+
+### Issues
+#### General
- Make sure to use to the latest version of Immersive Engineering (IE for short). You can download it [here](http://minecraft.curseforge.com/projects/immersive-engineering).
- IE will create a file for its coremod in your `mods` folder. This is a `.jar` file called `ImmersiveEngineering-0.12-x-core.jar` before IE build 81 and Forge build 2656 and a directory called `memory-repo` afterwards. This is normal and not something to worry about. It's Forge convention to place coremods in separate files. The file is not downloaded, it is shipped with IE and automatically unpacked by Forge.
- Your bug report should contain answers to these questions (If adding screenshots makes answering one of these questions easier, add them):
@@ -9,12 +13,12 @@
- Did this happen on a dedicated server (multiplayer servers), in LAN multiplayer or in singleplayer? E.g. "I first noticed this on a server, but it happens in singleplayer as well".
- What other mods were installed when the bug happened? Crashlogs always contain a modlist, so you can skip this part if you already provided one. You can generate a crash and therefore a mod list by pressing and holding F3 and C for 10 seconds, then releasing. Example: "This happened when playing version 2.4.2 of the FTB Infinity modpack" or "A list of mods can be found here: ` `" or "Only IE was installed when this happened".
-### Crashlogs
+#### Crashlogs
If your Minecraft instance has crashed, a file will have been generated in the folder `crash-reports` of your minecraft folder. To understand what has happened, we need to know the content of that file. But please don't just put it directly in your report (that makes it hard to read), upload it to a site like [pastebin](http://pastebin.com) or [gist](http://gist.github.com) and put a link in the actuall bug report.
There is one case where no crash log will be generated: If it wasn't MC that crashed but Java. There will be a file called `hs_err` and then some number in your minecraft folder. If that happens, make sure your Java version is up to date (But not Java 9, Minecraft isn't compatible with it). Also make sure that Minecraft is actually using that version, the vanilla launcher includes an old Java version (Java 8 update 25, published in autumn 2014). You can see what version Minecraft is using in the top right of the debug screen (F3). There is a known JVM crash that happens at random while browsing the engineer's manual but only with the old Java version.
-### Other mods
+#### Other mods
Some mods are not officially supported by IE. They will probably work pretty well, but some thing might not work/look weird. If your modpack contains one or more of these mods and you encounter a bug, try removing the unsupported mods. If the bug/crash does not happen without those mods, don't report it since fixing interactions with those mods is usually impossible or extremely hard. The following mods are not officially supported:
- **Optifine**: Optifine changes a lot of Minecraft's rendering code and it is not legally possible to check what those changes are. Another problem is that there is no `dev`/`deobf` version of Optifine which makes running Optifine in a development environment pretty much impossible.
@@ -25,7 +29,7 @@ Some mods are not officially supported by IE. They will probably work pretty wel
- **Torcherino** and other mods to speed up machines (not crops): If they cause a crash, report it. If they don't work on IE machines or cause rendering glitches, don't report it.
-### Known issues
+#### Known issues
It is not unlikely that the issue you want to report has already been reported and maybe it has even been fixed for the next version of IE. Try searching for different terms related to your issue [here](https://github.com/Blusunrize/ImmersiveEngineering/issues?utf8=%E2%9C%93&q=is%3Aissue+). You can enter search terms in the box above the list of issues. Please always search for both open and closed issues as issues are closed when the fix has been written, not when a release containing a fix is published. If your issue has already been reported, please do not post comments like "I have the same crash: <link to crashlog>" unless someone specifically asks for additional crashlogs to help track down the issue.
Example: Assume you experienced the crash described in [#1549](https://github.com/BluSunrize/ImmersiveEngineering/issues/1549). Some possible search terms are ["crash crafting wire cutter"](https://github.com/BluSunrize/ImmersiveEngineering/issues?utf8=%E2%9C%93&q=is%3Aissue%20crash%20crafting%20wire%20cutter%20), ["crafting crash"](https://github.com/BluSunrize/ImmersiveEngineering/issues?utf8=%E2%9C%93&q=is%3Aissue%20crafting%20crash) and ["voltmeter crash"](https://github.com/BluSunrize/ImmersiveEngineering/issues?utf8=%E2%9C%93&q=is%3Aissue%20voltmeter%20crash).
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/ImmersiveEngineering.java b/src/main/java/blusunrize/immersiveengineering/ImmersiveEngineering.java
index 186902026a..468183065c 100644
--- a/src/main/java/blusunrize/immersiveengineering/ImmersiveEngineering.java
+++ b/src/main/java/blusunrize/immersiveengineering/ImmersiveEngineering.java
@@ -58,7 +58,7 @@ public class ImmersiveEngineering
@Mod.Instance(MODID)
public static ImmersiveEngineering instance = new ImmersiveEngineering();
- @SidedProxy(clientSide="blusunrize.immersiveengineering.client.ClientProxy", serverSide="blusunrize.immersiveengineering.common.CommonProxy")
+ @SidedProxy(clientSide = "blusunrize.immersiveengineering.client.ClientProxy", serverSide = "blusunrize.immersiveengineering.common.CommonProxy")
public static CommonProxy proxy;
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
@@ -83,20 +83,21 @@ public void preInit(FMLPreInitializationEvent event)
for(int b : IEConfig.Ores.oreDimBlacklist)
IEWorldGen.oreDimBlacklist.add(b);
IEApi.modPreference = Arrays.asList(IEConfig.preferredOres);
- IEApi.prefixToIngotMap.put("ingot", new Integer[]{1,1});
- IEApi.prefixToIngotMap.put("nugget", new Integer[]{1,9});
- IEApi.prefixToIngotMap.put("block", new Integer[]{9,1});
- IEApi.prefixToIngotMap.put("plate", new Integer[]{1,1});
- IEApi.prefixToIngotMap.put("wire", new Integer[]{1,1});
- IEApi.prefixToIngotMap.put("gear", new Integer[]{4,1});
- IEApi.prefixToIngotMap.put("rod", new Integer[]{2,1});
- IEApi.prefixToIngotMap.put("fence", new Integer[]{5,3});
+ IEApi.prefixToIngotMap.put("ingot", new Integer[]{1, 1});
+ IEApi.prefixToIngotMap.put("nugget", new Integer[]{1, 9});
+ IEApi.prefixToIngotMap.put("block", new Integer[]{9, 1});
+ IEApi.prefixToIngotMap.put("plate", new Integer[]{1, 1});
+ IEApi.prefixToIngotMap.put("wire", new Integer[]{1, 1});
+ IEApi.prefixToIngotMap.put("gear", new Integer[]{4, 1});
+ IEApi.prefixToIngotMap.put("rod", new Integer[]{2, 1});
+ IEApi.prefixToIngotMap.put("fence", new Integer[]{5, 3});
IECompatModule.doModulesPreInit();
new ThreadContributorSpecialsDownloader();
IEContent.preInitEnd();
}
+
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
@@ -138,6 +139,7 @@ public void init(FMLInitializationEvent event)
IEIMCHandler.init();
IEIMCHandler.handleIMCMessages(FMLInterModComms.fetchRuntimeMessages(instance));
}
+
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
@@ -148,11 +150,13 @@ public void postInit(FMLPostInitializationEvent event)
proxy.postInitEnd();
ShaderRegistry.compileWeight();
}
+
@Mod.EventHandler
public void loadComplete(FMLLoadCompleteEvent event)
{
IECompatModule.doModulesLoadComplete();
}
+
@Mod.EventHandler
public void modIDMapping(FMLModIdMappingEvent event)
{
@@ -167,17 +171,16 @@ public void modIDMapping(FMLModIdMappingEvent event)
public void wrongSignature(FMLFingerprintViolationEvent event)
{
System.out.println("[Immersive Engineering/Error] THIS IS NOT AN OFFICIAL BUILD OF IMMERSIVE ENGINEERING! Found these fingerprints: "+event.getFingerprints());
- for (String altCert:alternativeCerts)
- if (event.getFingerprints().contains(altCert))
+ for(String altCert : alternativeCerts)
+ if(event.getFingerprints().contains(altCert))
{
- System.out.println("[Immersive Engineering/Error] "+altCert+" is considered an alternative certificate (which may be ok to use in some cases). " +
+ System.out.println("[Immersive Engineering/Error] "+altCert+" is considered an alternative certificate (which may be ok to use in some cases). "+
"If you thought this was an official build you probably shouldn't use it.");
break;
}
}
-
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
@@ -186,10 +189,11 @@ public void serverStarting(FMLServerStartingEvent event)
if(IEConfig.Machines.arcfurnace_recycle)
ArcRecyclingThreadHandler.doRecipeProfiling();
}
+
@Mod.EventHandler
public void serverStarted(FMLServerStartedEvent event)
{
- if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
+ if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
{
World world = FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld();
if(!world.isRemote)
@@ -197,9 +201,9 @@ public void serverStarted(FMLServerStartedEvent event)
IELogger.info("WorldData loading");
//Clear out any info from previous worlds
- for (int dim: ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
+ for(int dim : ImmersiveNetHandler.INSTANCE.getRelevantDimensions())
ImmersiveNetHandler.INSTANCE.clearAllConnections(dim);
- IESaveData worldData = (IESaveData) world.loadData(IESaveData.class, IESaveData.dataName);
+ IESaveData worldData = (IESaveData)world.loadData(IESaveData.class, IESaveData.dataName);
if(worldData==null)
{
@@ -255,10 +259,11 @@ public ItemStack getTabIconItem()
{
return ItemStack.EMPTY;
}
+
@Override
public ItemStack getIconItemStack()
{
- return new ItemStack(IEContent.blockMetalDecoration0,1,0);
+ return new ItemStack(IEContent.blockMetalDecoration0, 1, 0);
}
};
@@ -278,13 +283,15 @@ public ThreadContributorSpecialsDownloader()
public void run()
{
Gson gson = new Gson();
- try {
+ try
+ {
IELogger.info("Attempting to download special revolvers from GitHub");
URL url = new URL("https://raw.githubusercontent.com/BluSunrize/ImmersiveEngineering/master/contributorRevolvers.json");
JsonStreamParser parser = new JsonStreamParser(new InputStreamReader(url.openStream()));
while(parser.hasNext())
{
- try{
+ try
+ {
JsonElement je = parser.next();
ItemRevolver.SpecialRevolver revolver = gson.fromJson(je, ItemRevolver.SpecialRevolver.class);
if(revolver!=null)
@@ -292,14 +299,15 @@ public void run()
if(revolver.uuid!=null)
for(String uuid : revolver.uuid)
ItemRevolver.specialRevolvers.put(uuid, revolver);
- ItemRevolver.specialRevolversByTag.put(!revolver.tag.isEmpty()?revolver.tag:revolver.flavour, revolver);
+ ItemRevolver.specialRevolversByTag.put(!revolver.tag.isEmpty()?revolver.tag: revolver.flavour, revolver);
}
- }catch(Exception excepParse)
+ } catch(Exception excepParse)
{
IELogger.warn("Error on parsing a SpecialRevolver");
}
}
- } catch(Exception e) {
+ } catch(Exception e)
+ {
IELogger.info("Could not load contributor+special revolver list.");
e.printStackTrace();
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/AdvancedAABB.java b/src/main/java/blusunrize/immersiveengineering/api/AdvancedAABB.java
index b18a4537f1..79e028d8c1 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/AdvancedAABB.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/AdvancedAABB.java
@@ -14,28 +14,31 @@
/**
* @author BluSunrize - 24.09.2015
- *
+ *
* Just an AABB with additional info, for use with pipes
*/
public class AdvancedAABB extends AxisAlignedBB
{
public EnumFacing fd;
public Vec3d[][] drawOverride;
+
public AdvancedAABB(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, EnumFacing fd, Vec3d[]... drawOverride)
{
super(xMin, yMin, zMin, xMax, yMax, zMax);
this.fd = fd;
this.drawOverride = drawOverride;
}
-
+
public AdvancedAABB(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, EnumFacing fd)
{
this(xMin, yMin, zMin, xMax, yMax, zMax, fd, new Vec3d[0][]);
}
+
public AdvancedAABB(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, Vec3d[]... drawOverride)
{
this(xMin, yMin, zMin, xMax, yMax, zMax, null, drawOverride);
}
+
public AdvancedAABB(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax)
{
this(xMin, yMin, zMin, xMax, yMax, zMax, null, new Vec3d[0][]);
diff --git a/src/main/java/blusunrize/immersiveengineering/api/ApiUtils.java b/src/main/java/blusunrize/immersiveengineering/api/ApiUtils.java
index 272bb283e1..ab033ea839 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/ApiUtils.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/ApiUtils.java
@@ -10,15 +10,11 @@
import blusunrize.immersiveengineering.ImmersiveEngineering;
import blusunrize.immersiveengineering.api.crafting.IngredientStack;
-import blusunrize.immersiveengineering.api.energy.wires.IICProxy;
-import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
-import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
+import blusunrize.immersiveengineering.api.energy.wires.*;
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
-import blusunrize.immersiveengineering.api.energy.wires.IWireCoil;
-import blusunrize.immersiveengineering.api.energy.wires.WireType;
import blusunrize.immersiveengineering.common.EventHandler;
-import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGeneralMultiblock;
import blusunrize.immersiveengineering.common.IESaveData;
+import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGeneralMultiblock;
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import blusunrize.immersiveengineering.common.util.Utils;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
@@ -34,18 +30,13 @@
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumActionResult;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumHand;
-import net.minecraft.util.NonNullList;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.*;
import net.minecraft.util.math.*;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
@@ -81,11 +72,12 @@ public static boolean compareToOreName(ItemStack stack, String oreName)
if(!isExistingOreName(oreName))
return false;
List s = OreDictionary.getOres(oreName);
- for(ItemStack st:s)
+ for(ItemStack st : s)
if(OreDictionary.itemMatches(st, stack, false))
return true;
return false;
}
+
public static boolean stackMatchesObject(ItemStack stack, Object o)
{
return stackMatchesObject(stack, o, false);
@@ -94,28 +86,31 @@ public static boolean stackMatchesObject(ItemStack stack, Object o)
public static boolean stackMatchesObject(ItemStack stack, Object o, boolean checkNBT)
{
if(o instanceof ItemStack)
- return OreDictionary.itemMatches((ItemStack)o, stack, false) && (!checkNBT || ((ItemStack)o).getItemDamage() == OreDictionary.WILDCARD_VALUE || Utils.compareItemNBT((ItemStack)o, stack));
+ return OreDictionary.itemMatches((ItemStack)o, stack, false)&&(!checkNBT||((ItemStack)o).getItemDamage()==OreDictionary.WILDCARD_VALUE||Utils.compareItemNBT((ItemStack)o, stack));
else if(o instanceof Collection)
{
for(Object io : (Collection)o)
- if(io instanceof ItemStack && OreDictionary.itemMatches((ItemStack)io, stack, false) && (!checkNBT || ((ItemStack)io).getItemDamage() == OreDictionary.WILDCARD_VALUE || Utils.compareItemNBT((ItemStack)io, stack)))
+ if(io instanceof ItemStack&&OreDictionary.itemMatches((ItemStack)io, stack, false)&&(!checkNBT||((ItemStack)io).getItemDamage()==OreDictionary.WILDCARD_VALUE||Utils.compareItemNBT((ItemStack)io, stack)))
return true;
- } else if(o instanceof IngredientStack)
+ }
+ else if(o instanceof IngredientStack)
return ((IngredientStack)o).matchesItemStack(stack);
else if(o instanceof ItemStack[])
{
for(ItemStack io : (ItemStack[])o)
- if(OreDictionary.itemMatches(io, stack, false) && (!checkNBT || io.getItemDamage() == OreDictionary.WILDCARD_VALUE || Utils.compareItemNBT(io, stack)))
+ if(OreDictionary.itemMatches(io, stack, false)&&(!checkNBT||io.getItemDamage()==OreDictionary.WILDCARD_VALUE||Utils.compareItemNBT(io, stack)))
return true;
- } else if(o instanceof FluidStack)
+ }
+ else if(o instanceof FluidStack)
{
FluidStack fs = FluidUtil.getFluidContained(stack);
- return fs != null && fs.containsFluid((FluidStack)o);
+ return fs!=null&&fs.containsFluid((FluidStack)o);
}
else if(o instanceof String)
return compareToOreName(stack, (String)o);
return false;
}
+
public static ItemStack copyStackWithAmount(ItemStack stack, int amount)
{
if(stack.isEmpty())
@@ -124,6 +119,7 @@ public static ItemStack copyStackWithAmount(ItemStack stack, int amount)
s2.setCount(amount);
return s2;
}
+
public static boolean stacksMatchIngredientList(List list, NonNullList stacks)
{
ArrayList queryList = new ArrayList(stacks.size());
@@ -146,21 +142,21 @@ public static boolean stacksMatchIngredientList(List list, NonN
if(query.getCount() > amount)
{
query.shrink(amount);
- amount=0;
+ amount = 0;
}
else
{
- amount-=query.getCount();
+ amount -= query.getCount();
query.setCount(0);
}
}
- if(query.getCount()<=0)
+ if(query.getCount() <= 0)
it.remove();
- if(amount<=0)
+ if(amount <= 0)
break;
}
}
- if(amount>0)
+ if(amount > 0)
return false;
}
return true;
@@ -180,8 +176,9 @@ public static ComparableItemStack createComparableItemStack(ItemStack stack)
public static ComparableItemStack createComparableItemStack(ItemStack stack, boolean copy)
{
- return createComparableItemStack(stack, copy, stack.hasTagCompound() && !stack.getTagCompound().hasNoTags());
+ return createComparableItemStack(stack, copy, stack.hasTagCompound()&&!stack.getTagCompound().hasNoTags());
}
+
public static ComparableItemStack createComparableItemStack(ItemStack stack, boolean copy, boolean useNbt)
{
ComparableItemStack comp = new ComparableItemStack(stack, true, copy);
@@ -201,11 +198,12 @@ public static boolean isMetalComponent(ItemStack stack, String componentType)
{
return getMetalComponentType(stack, componentType)!=null;
}
+
public static String getMetalComponentType(ItemStack stack, String... componentTypes)
{
ItemStack comp = copyStackWithAmount(stack, 1);
for(String oreName : OreDictionary.getOreNames())//This is super ugly, but I don't want to force the latest forge ._.
- for(int iType=0; iType s = OreDictionary.getOres(oreName);
@@ -215,11 +213,12 @@ public static String getMetalComponentType(ItemStack stack, String... componentT
}
return null;
}
+
public static String[] getMetalComponentTypeAndMetal(ItemStack stack, String... componentTypes)
{
ItemStack comp = copyStackWithAmount(stack, 1);
for(String oreName : OreDictionary.getOreNames())//This is super ugly, but I don't want to force the latest forge ._.
- for(int iType=0; iType s = OreDictionary.getOres(oreName);
@@ -229,14 +228,17 @@ public static String[] getMetalComponentTypeAndMetal(ItemStack stack, String...
}
return null;
}
+
public static boolean isIngot(ItemStack stack)
{
return isMetalComponent(stack, "ingot");
}
+
public static boolean isPlate(ItemStack stack)
{
return isMetalComponent(stack, "plate");
}
+
public static int getComponentIngotWorth(ItemStack stack)
{
String[] keys = IEApi.prefixToIngotMap.keySet().toArray(new String[IEApi.prefixToIngotMap.size()]);
@@ -244,7 +246,7 @@ public static int getComponentIngotWorth(ItemStack stack)
if(key!=null)
{
Integer[] relation = IEApi.prefixToIngotMap.get(key);
- if(relation!=null && relation.length>1)
+ if(relation!=null&&relation.length > 1)
{
double val = relation[0]/(double)relation[1];
return (int)val;
@@ -252,6 +254,7 @@ public static int getComponentIngotWorth(ItemStack stack)
}
return 0;
}
+
public static ItemStack breakStackIntoIngots(ItemStack stack)
{
String[] keys = IEApi.prefixToIngotMap.keySet().toArray(new String[IEApi.prefixToIngotMap.size()]);
@@ -259,7 +262,7 @@ public static ItemStack breakStackIntoIngots(ItemStack stack)
if(type!=null)
{
Integer[] relation = IEApi.prefixToIngotMap.get(type[0]);
- if(relation!=null && relation.length>1)
+ if(relation!=null&&relation.length > 1)
{
double val = relation[0]/(double)relation[1];
return copyStackWithAmount(IEApi.getPreferredOreStack("ingot"+type[1]), (int)val);
@@ -267,6 +270,7 @@ public static ItemStack breakStackIntoIngots(ItemStack stack)
}
return ItemStack.EMPTY;
}
+
public static Object[] breakStackIntoPreciseIngots(ItemStack stack)
{
String[] keys = IEApi.prefixToIngotMap.keySet().toArray(new String[IEApi.prefixToIngotMap.size()]);
@@ -274,10 +278,10 @@ public static Object[] breakStackIntoPreciseIngots(ItemStack stack)
if(type!=null)
{
Integer[] relation = IEApi.prefixToIngotMap.get(type[0]);
- if(relation!=null && relation.length>1)
+ if(relation!=null&&relation.length > 1)
{
double val = relation[0]/(double)relation[1];
- return new Object[]{IEApi.getPreferredOreStack("ingot"+type[1]),val};
+ return new Object[]{IEApi.getPreferredOreStack("ingot"+type[1]), val};
}
}
return null;
@@ -285,7 +289,7 @@ public static Object[] breakStackIntoPreciseIngots(ItemStack stack)
public static boolean canInsertStackIntoInventory(TileEntity inventory, ItemStack stack, EnumFacing side)
{
- if(!stack.isEmpty() && inventory != null && inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
+ if(!stack.isEmpty()&&inventory!=null&&inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
{
IItemHandler handler = inventory.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
ItemStack temp = ItemHandlerHelper.insertItem(handler, stack.copy(), true);
@@ -296,11 +300,11 @@ public static boolean canInsertStackIntoInventory(TileEntity inventory, ItemStac
public static ItemStack insertStackIntoInventory(TileEntity inventory, ItemStack stack, EnumFacing side)
{
- if(!stack.isEmpty() && inventory != null && inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
+ if(!stack.isEmpty()&&inventory!=null&&inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
{
IItemHandler handler = inventory.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
ItemStack temp = ItemHandlerHelper.insertItem(handler, stack.copy(), true);
- if(temp.isEmpty() || temp.getCount() < stack.getCount())
+ if(temp.isEmpty()||temp.getCount() < stack.getCount())
return ItemHandlerHelper.insertItem(handler, stack, false);
}
return stack;
@@ -308,7 +312,7 @@ public static ItemStack insertStackIntoInventory(TileEntity inventory, ItemStack
public static ItemStack insertStackIntoInventory(TileEntity inventory, ItemStack stack, EnumFacing side, boolean simulate)
{
- if(inventory != null && !stack.isEmpty() && inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
+ if(inventory!=null&&!stack.isEmpty()&&inventory.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
{
IItemHandler handler = inventory.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
return ItemHandlerHelper.insertItem(handler, stack.copy(), simulate);
@@ -322,10 +326,11 @@ public static BlockPos toBlockPos(Object object)
return (BlockPos)object;
if(object instanceof TileEntity)
return ((TileEntity)object).getPos();
- if (object instanceof IICProxy)
- return ((IICProxy) object).getPos();
+ if(object instanceof IICProxy)
+ return ((IICProxy)object).getPos();
return null;
}
+
public static IImmersiveConnectable toIIC(Object object, World world)
{
return toIIC(object, world, true);
@@ -338,16 +343,16 @@ public static IImmersiveConnectable toIIC(Object object, World world, boolean al
return (IImmersiveConnectable)object;
else if(object instanceof BlockPos)
{
- if (world!=null && world.isBlockLoaded((BlockPos)object))
+ if(world!=null&&world.isBlockLoaded((BlockPos)object))
{
TileEntity te = world.getTileEntity((BlockPos)object);
if(te instanceof IImmersiveConnectable)
- return (IImmersiveConnectable) te;
+ return (IImmersiveConnectable)te;
}
- if (allowProxies)
+ if(allowProxies)
{
DimensionBlockPos pos = new DimensionBlockPos((BlockPos)object, world);
- if (ImmersiveNetHandler.INSTANCE.proxies.containsKey(pos))
+ if(ImmersiveNetHandler.INSTANCE.proxies.containsKey(pos))
return ImmersiveNetHandler.INSTANCE.proxies.get(pos);
}
}
@@ -361,7 +366,7 @@ public static Vec3d getVecForIICAt(World world, BlockPos pos, Connection conn)
IImmersiveConnectable iicPos = toIIC(pos, world, false);
if(iicPos!=null)
offset = iicPos.getConnectionOffset(conn);
- if (pos.equals(conn.end))
+ if(pos.equals(conn.end))
offset = offset.addVector(conn.end.getX()-conn.start.getX(),
conn.end.getY()-conn.start.getY(),
conn.end.getZ()-conn.start.getZ());
@@ -370,23 +375,24 @@ public static Vec3d getVecForIICAt(World world, BlockPos pos, Connection conn)
public static Vec3d addVectors(Vec3d vec0, Vec3d vec1)
{
- return vec0.addVector(vec1.x,vec1.y,vec1.z);
+ return vec0.addVector(vec1.x, vec1.y, vec1.z);
}
- public static double acosh(double x) {
+ public static double acosh(double x)
+ {
//See http://mathworld.wolfram.com/InverseHyperbolicCosine.html
return Math.log(x+Math.sqrt(x+1)*Math.sqrt(x-1));
}
public static Vec3d[] getConnectionCatenary(Connection connection, Vec3d start, Vec3d end)
{
- boolean vertical = end.x==start.x && end.z==start.z;
+ boolean vertical = end.x==start.x&&end.z==start.z;
if(vertical)
{
Vec3d[] ret = new Vec3d[vertices+1];
double height = end.y-start.y;
- for (int i = 0;i= Math.sqrt(k*k - dy*dy)/dw)
+ if(Math.sinh(l)/l >= Math.sqrt(k*k-dy*dy)/dw)
break;
}
double a = dw/2/l;
double offsetX = (0+dw-a*Math.log((k+dy)/(k-dy)))*0.5;
double offsetY = (dy+0-k*Math.cosh(l)/Math.sinh(l))*0.5;
- if (c!=null)
+ if(c!=null)
{
c.catOffsetX = offsetX;
c.catOffsetY = offsetY;
@@ -428,12 +434,12 @@ public static Vec3d[] getConnectionCatenary(Vec3d start, Vec3d end, double slack
Vec3d[] vex = new Vec3d[vertices+1];
vex[0] = new Vec3d(start.x, start.y, start.z);
- for(int i=1; i> shouldStop,
@@ -471,6 +480,7 @@ public static boolean raytraceAlongCatenary(Connection conn, Predicate> shouldStop,
Consumer> close, Vec3d vStart, Vec3d vEnd)
{
@@ -484,54 +494,54 @@ public static boolean raytraceAlongCatenaryRelative(Connection conn, Predicate= 0 && posRel <= 1 && handleVec(pos, pos, 0, halfScanned, done, shouldStop, near, conn.start))
+ if(posRel >= 0&&posRel <= 1&&handleVec(pos, pos, 0, halfScanned, done, shouldStop, near, conn.start))
return false;
}
}
}
- for (Triple p : near)
+ for(Triple p : near)
close.accept(p);
- for (Map.Entry p : halfScanned.entrySet())
- if (shouldStop.test(new ImmutableTriple<>(p.getKey(), p.getValue(), p.getValue())))
+ for(Map.Entry p : halfScanned.entrySet())
+ if(shouldStop.test(new ImmutableTriple<>(p.getKey(), p.getValue(), p.getValue())))
return false;
return true;
}
@@ -543,25 +553,25 @@ private static boolean handleVec(Vec3d pos, Vec3d origPos, int start, HashMap> shouldStop, HashSet> near)
{
final double DELTA_NEAR = .3;
- if (!done.contains(posB))
+ if(!done.contains(posB))
{
- if (halfScanned.containsKey(posB)&&!pos.equals(halfScanned.get(posB)))
+ if(halfScanned.containsKey(posB)&&!pos.equals(halfScanned.get(posB)))
{
Triple added = new ImmutableTriple<>(posB, halfScanned.get(posB), pos);
boolean stop = shouldStop.test(added);
done.add(posB);
halfScanned.remove(posB);
near.removeIf((t) -> t.getLeft().equals(posB));
- if (stop)
+ if(stop)
return true;
- for (int i = 0;i<3;i++)
+ for(int i = 0; i < 3; i++)
{
double coord = getDim(pos, i);
double diff = coord-Math.floor(coord);
- if (diff(offsetDim(posB, i, -1), added.getMiddle(), added.getRight()));
diff = Math.ceil(coord)-coord;
- if (diff(offsetDim(posB, i, 1), added.getMiddle(), added.getRight()));
}
}
@@ -615,140 +625,141 @@ public static WireType getWireTypeFromNBT(NBTTagCompound tag, String key)
else
return WireType.getValue(tag.getString(key));
}
-
+
public static EnumActionResult doCoilUse(IWireCoil coil, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
- TileEntity tileEntity = world.getTileEntity(pos);
- if(tileEntity instanceof IImmersiveConnectable && ((IImmersiveConnectable)tileEntity).canConnect())
+ TileEntity tileEntity = world.getTileEntity(pos);
+ if(tileEntity instanceof IImmersiveConnectable&&((IImmersiveConnectable)tileEntity).canConnect())
+ {
+ ItemStack stack = player.getHeldItem(hand);
+ TargetingInfo target = new TargetingInfo(side, hitX, hitY, hitZ);
+ WireType wire = coil.getWireType(stack);
+ BlockPos masterPos = ((IImmersiveConnectable)tileEntity).getConnectionMaster(wire, target);
+ Vec3i offset = pos.subtract(masterPos);
+ tileEntity = world.getTileEntity(masterPos);
+ if(!(tileEntity instanceof IImmersiveConnectable)||!((IImmersiveConnectable)tileEntity).canConnect())
+ return EnumActionResult.PASS;
+
+ if(!((IImmersiveConnectable)tileEntity).canConnectCable(wire, target, offset)||!coil.canConnectCable(stack, tileEntity))
{
- ItemStack stack = player.getHeldItem(hand);
- TargetingInfo target = new TargetingInfo(side, hitX,hitY,hitZ);
- WireType wire = coil.getWireType(stack);
- BlockPos masterPos = ((IImmersiveConnectable)tileEntity).getConnectionMaster(wire, target);
- Vec3i offset = pos.subtract(masterPos);
- tileEntity = world.getTileEntity(masterPos);
- if( !(tileEntity instanceof IImmersiveConnectable) || !((IImmersiveConnectable)tileEntity).canConnect())
- return EnumActionResult.PASS;
-
- if( !((IImmersiveConnectable)tileEntity).canConnectCable(wire, target, offset) || !coil.canConnectCable(stack, tileEntity))
+ if(!world.isRemote)
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongCable"), true);
+ return EnumActionResult.FAIL;
+ }
+
+ if(!world.isRemote)
+ if(!ItemNBTHelper.hasKey(stack, "linkingPos"))
{
- if (!world.isRemote)
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongCable"), true);
- return EnumActionResult.FAIL;
+ ItemNBTHelper.setIntArray(stack, "linkingPos", new int[]{world.provider.getDimension(), masterPos.getX(), masterPos.getY(), masterPos.getZ(),
+ offset.getX(), offset.getY(), offset.getZ()});
+ NBTTagCompound targetNbt = new NBTTagCompound();
+ target.writeToNBT(targetNbt);
+ ItemNBTHelper.setTagCompound(stack, "targettingInfo", targetNbt);
}
-
- if(!world.isRemote)
- if(!ItemNBTHelper.hasKey(stack, "linkingPos"))
- {
- ItemNBTHelper.setIntArray(stack, "linkingPos", new int[]{world.provider.getDimension(),masterPos.getX(),masterPos.getY(),masterPos.getZ(),
- offset.getX(), offset.getY(), offset.getZ()});
- NBTTagCompound targetNbt = new NBTTagCompound();
- target.writeToNBT(targetNbt);
- ItemNBTHelper.setTagCompound(stack, "targettingInfo", targetNbt);
- }
+ else
+ {
+ int[] array = ItemNBTHelper.getIntArray(stack, "linkingPos");
+ BlockPos linkPos = new BlockPos(array[1], array[2], array[3]);
+ Vec3i offsetLink = BlockPos.NULL_VECTOR;
+ if(array.length==7)
+ offsetLink = new Vec3i(array[4], array[5], array[6]);
+ TileEntity tileEntityLinkingPos = world.getTileEntity(linkPos);
+ int distanceSq = (int)Math.ceil(linkPos.distanceSq(masterPos));
+ int maxLengthSq = coil.getMaxLength(stack); //not squared yet
+ maxLengthSq *= maxLengthSq;
+ if(array[0]!=world.provider.getDimension())
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongDimension"), true);
+ else if(linkPos.equals(masterPos))
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"sameConnection"), true);
+ else if(distanceSq > maxLengthSq)
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"tooFar"), true);
else
{
- int[] array = ItemNBTHelper.getIntArray(stack, "linkingPos");
- BlockPos linkPos = new BlockPos(array[1],array[2],array[3]);
- Vec3i offsetLink = BlockPos.NULL_VECTOR;
- if (array.length==7)
- offsetLink = new Vec3i(array[4], array[5], array[6]);
- TileEntity tileEntityLinkingPos = world.getTileEntity(linkPos);
- int distanceSq = (int) Math.ceil( linkPos.distanceSq(masterPos) );
- int maxLengthSq = coil.getMaxLength(stack); //not squared yet
- maxLengthSq *= maxLengthSq;
- if(array[0]!=world.provider.getDimension())
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"wrongDimension"), true);
- else if(linkPos.equals(masterPos))
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"sameConnection"), true);
- else if( distanceSq > maxLengthSq)
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"tooFar"), true);
+ TargetingInfo targetLink = TargetingInfo.readFromNBT(ItemNBTHelper.getTagCompound(stack, "targettingInfo"));
+ if(!(tileEntityLinkingPos instanceof IImmersiveConnectable)||
+ !((IImmersiveConnectable)tileEntityLinkingPos).canConnectCable(wire, targetLink, offsetLink)||
+ !((IImmersiveConnectable)tileEntityLinkingPos).getConnectionMaster(wire, targetLink).equals(linkPos)||
+ !coil.canConnectCable(stack, tileEntityLinkingPos))
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"invalidPoint"), true);
else
{
- TargetingInfo targetLink = TargetingInfo.readFromNBT(ItemNBTHelper.getTagCompound(stack, "targettingInfo"));
- if(!(tileEntityLinkingPos instanceof IImmersiveConnectable)||
- !((IImmersiveConnectable) tileEntityLinkingPos).canConnectCable(wire, targetLink, offsetLink)||
- !((IImmersiveConnectable) tileEntityLinkingPos).getConnectionMaster(wire, targetLink).equals(linkPos)||
- !coil.canConnectCable(stack, tileEntityLinkingPos))
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"invalidPoint"), true);
+ IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity;
+ IImmersiveConnectable nodeLink = (IImmersiveConnectable)tileEntityLinkingPos;
+ boolean connectionExists = false;
+ Set outputs = ImmersiveNetHandler.INSTANCE.getConnections(world, Utils.toCC(nodeHere));
+ if(outputs!=null)
+ for(Connection con : outputs)
+ {
+ if(con.end.equals(Utils.toCC(nodeLink)))
+ connectionExists = true;
+ }
+ if(connectionExists)
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"connectionExists"), true);
else
{
- IImmersiveConnectable nodeHere = (IImmersiveConnectable)tileEntity;
- IImmersiveConnectable nodeLink = (IImmersiveConnectable)tileEntityLinkingPos;
- boolean connectionExists = false;
- Set outputs = ImmersiveNetHandler.INSTANCE.getConnections(world, Utils.toCC(nodeHere));
- if(outputs!=null)
- for(Connection con : outputs)
+ Set ignore = new HashSet<>();
+ ignore.addAll(nodeHere.getIgnored(nodeLink));
+ ignore.addAll(nodeLink.getIgnored(nodeHere));
+ Connection tmpConn = new Connection(Utils.toCC(nodeHere), Utils.toCC(nodeLink), wire,
+ (int)Math.sqrt(distanceSq));
+ Vec3d start = nodeHere.getConnectionOffset(tmpConn, target, pos.subtract(masterPos));
+ Vec3d end = nodeLink.getConnectionOffset(tmpConn, targetLink, offsetLink).addVector(linkPos.getX()-masterPos.getX(),
+ linkPos.getY()-masterPos.getY(),
+ linkPos.getZ()-masterPos.getZ());
+ BlockPos.MutableBlockPos failedReason = new BlockPos.MutableBlockPos();
+ boolean canSee = ApiUtils.raytraceAlongCatenaryRelative(tmpConn, (p) -> {
+ if(ignore.contains(p.getLeft()))
+ return false;
+ IBlockState state = world.getBlockState(p.getLeft());
+ if(ApiUtils.preventsConnection(world, p.getLeft(), state, p.getMiddle(), p.getRight()))
{
- if(con.end.equals(Utils.toCC(nodeLink)))
- connectionExists = true;
+ failedReason.setPos(p.getLeft());
+ return true;
}
- if(connectionExists)
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"connectionExists"), true);
+ return false;
+ }, (p) -> {
+ }, start, end);
+ if(canSee)
+ {
+ Connection conn = ImmersiveNetHandler.INSTANCE.addAndGetConnection(world, Utils.toCC(nodeHere), Utils.toCC(nodeLink),
+ (int)Math.sqrt(distanceSq), wire);
+
+
+ nodeHere.connectCable(wire, target, nodeLink, offset);
+ nodeLink.connectCable(wire, targetLink, nodeHere, offsetLink);
+ ImmersiveNetHandler.INSTANCE.addBlockData(world, conn);
+ IESaveData.setDirty(world.provider.getDimension());
+ Utils.unlockIEAdvancement(player, "main/connect_wire");
+
+ if(!player.capabilities.isCreativeMode)
+ coil.consumeWire(stack, (int)Math.sqrt(distanceSq));
+ ((TileEntity)nodeHere).markDirty();
+ world.addBlockEvent(masterPos, ((TileEntity)nodeHere).getBlockType(), -1, 0);
+ IBlockState state = world.getBlockState(masterPos);
+ world.notifyBlockUpdate(masterPos, state, state, 3);
+ ((TileEntity)nodeLink).markDirty();
+ world.addBlockEvent(linkPos, ((TileEntity)nodeLink).getBlockType(), -1, 0);
+ state = world.getBlockState(linkPos);
+ world.notifyBlockUpdate(linkPos, state, state, 3);
+ }
else
{
- Set ignore = new HashSet<>();
- ignore.addAll(nodeHere.getIgnored(nodeLink));
- ignore.addAll(nodeLink.getIgnored(nodeHere));
- Connection tmpConn = new Connection(Utils.toCC(nodeHere), Utils.toCC(nodeLink), wire,
- (int)Math.sqrt(distanceSq));
- Vec3d start = nodeHere.getConnectionOffset(tmpConn, target, pos.subtract(masterPos));
- Vec3d end = nodeLink.getConnectionOffset(tmpConn, targetLink, offsetLink).addVector(linkPos.getX()-masterPos.getX(),
- linkPos.getY()-masterPos.getY(),
- linkPos.getZ()-masterPos.getZ());
- BlockPos.MutableBlockPos failedReason = new BlockPos.MutableBlockPos();
- boolean canSee = ApiUtils.raytraceAlongCatenaryRelative(tmpConn, (p)->{
- if (ignore.contains(p.getLeft()))
- return false;
- IBlockState state = world.getBlockState(p.getLeft());
- if (ApiUtils.preventsConnection(world, p.getLeft(), state, p.getMiddle(), p.getRight()))
- {
- failedReason.setPos(p.getLeft());
- return true;
- }
- return false;
- }, (p)->{}, start, end);
- if(canSee)
- {
- Connection conn = ImmersiveNetHandler.INSTANCE.addAndGetConnection(world, Utils.toCC(nodeHere), Utils.toCC(nodeLink),
- (int)Math.sqrt(distanceSq), wire);
-
-
- nodeHere.connectCable(wire, target, nodeLink, offset);
- nodeLink.connectCable(wire, targetLink, nodeHere, offsetLink);
- ImmersiveNetHandler.INSTANCE.addBlockData(world, conn);
- IESaveData.setDirty(world.provider.getDimension());
- Utils.unlockIEAdvancement(player, "main/connect_wire");
-
- if(!player.capabilities.isCreativeMode)
- coil.consumeWire(stack, (int)Math.sqrt(distanceSq));
- ((TileEntity)nodeHere).markDirty();
- world.addBlockEvent(masterPos, ((TileEntity) nodeHere).getBlockType(), -1, 0);
- IBlockState state = world.getBlockState(masterPos);
- world.notifyBlockUpdate(masterPos, state,state, 3);
- ((TileEntity)nodeLink).markDirty();
- world.addBlockEvent(linkPos, ((TileEntity) nodeLink).getBlockType(), -1, 0);
- state = world.getBlockState(linkPos);
- world.notifyBlockUpdate(linkPos, state,state, 3);
- }
- else
- {
- player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"cantSee"), true);
- ImmersiveEngineering.packetHandler.sendToAllAround(new MessageObstructedConnection(tmpConn, failedReason, player.world),
+ player.sendStatusMessage(new TextComponentTranslation(Lib.CHAT_WARN+"cantSee"), true);
+ ImmersiveEngineering.packetHandler.sendToAllAround(new MessageObstructedConnection(tmpConn, failedReason, player.world),
new NetworkRegistry.TargetPoint(player.world.provider.getDimension(), player.posX, player.posY, player.posZ,
- 64));
- }
+ 64));
}
}
}
- ItemNBTHelper.remove(stack, "linkingPos");
- ItemNBTHelper.remove(stack, "targettingInfo");
}
- return EnumActionResult.SUCCESS;
- }
+ ItemNBTHelper.remove(stack, "linkingPos");
+ ItemNBTHelper.remove(stack, "targettingInfo");
+ }
+ return EnumActionResult.SUCCESS;
+ }
return EnumActionResult.PASS;
}
-
+
public static Object convertToValidRecipeInput(Object input)
{
if(input instanceof ItemStack)
@@ -782,31 +793,33 @@ else if(input instanceof ItemStack)
else if(input instanceof Item)
{
if(preferWildcard)
- return new IngredientStack(new ItemStack((Item)input,1,OreDictionary.WILDCARD_VALUE));
+ return new IngredientStack(new ItemStack((Item)input, 1, OreDictionary.WILDCARD_VALUE));
return new IngredientStack(new ItemStack((Item)input));
}
else if(input instanceof Block)
{
if(preferWildcard)
- return new IngredientStack(new ItemStack((Block)input,1,OreDictionary.WILDCARD_VALUE));
+ return new IngredientStack(new ItemStack((Block)input, 1, OreDictionary.WILDCARD_VALUE));
return new IngredientStack(new ItemStack((Block)input));
- } else if(input instanceof List && !((List)input).isEmpty())
+ }
+ else if(input instanceof List&&!((List)input).isEmpty())
{
if(((List)input).get(0) instanceof ItemStack)
- return new IngredientStack(((List) input));
+ return new IngredientStack(((List)input));
else if(((List)input).get(0) instanceof String)
{
ArrayList itemList = new ArrayList();
- for(String s : ((List) input))
+ for(String s : ((List)input))
itemList.addAll(OreDictionary.getOres(s));
return new IngredientStack(itemList);
}
- } else if(input instanceof ItemStack[])
- return new IngredientStack(Arrays.asList((ItemStack[]) input));
+ }
+ else if(input instanceof ItemStack[])
+ return new IngredientStack(Arrays.asList((ItemStack[])input));
else if(input instanceof String[])
{
ArrayList itemList = new ArrayList();
- for(String s : ((String[]) input))
+ for(String s : ((String[])input))
itemList.addAll(OreDictionary.getOres(s));
return new IngredientStack(itemList);
}
@@ -816,6 +829,7 @@ else if(input instanceof FluidStack)
return new IngredientStack((FluidStack)input);
throw new RuntimeException("Recipe Ingredients must always be ItemStack, Item, Block, List, String (OreDictionary name) or FluidStack; "+input+" is invalid");
}
+
public static IngredientStack createIngredientStack(Object input)
{
return createIngredientStack(input, false);
@@ -858,18 +872,19 @@ public static boolean hasPlayerIngredient(EntityPlayer player, IngredientStack i
return true;
}
}
- for(int i=0; i sortMap(Map map, boolean inverse)
{
- TreeMap sortedMap = new TreeMap(new ValueComparator(map, inverse));
+ TreeMap sortedMap = new TreeMap(new ValueComparator(map, inverse));
sortedMap.putAll(map);
return sortedMap;
}
- public static void checkForNeedlessTicking(T te)
+ public static void checkForNeedlessTicking(T te)
{
- if (!te.getWorld().isRemote&&te.isLogicDummy())
+ if(!te.getWorld().isRemote&&te.isLogicDummy())
EventHandler.REMOVE_FROM_TICKING.add(te);
}
public static boolean preventsConnection(World worldIn, BlockPos pos, IBlockState state, Vec3d a, Vec3d b)
{
- if (state.getBlock().canCollideCheck(state, false))
+ if(state.getBlock().canCollideCheck(state, false))
{
List aabbs = new ArrayList<>(1);
state.addCollisionBoxToList(worldIn, pos, Block.FULL_BLOCK_AABB.offset(pos),
aabbs, null, false);
- for (AxisAlignedBB aabb:aabbs)
+ for(AxisAlignedBB aabb : aabbs)
{
aabb = aabb.offset(-pos.getX(), -pos.getY(), -pos.getZ()).grow(1e-5);
- if (aabb.contains(a) || aabb.contains(b))
+ if(aabb.contains(a)||aabb.contains(b))
return true;
}
RayTraceResult rayResult = state.collisionRayTrace(worldIn, pos, a.addVector(pos.getX(), pos.getY(), pos.getZ()),
b.addVector(pos.getX(), pos.getY(), pos.getZ()));
- return rayResult != null && rayResult.typeOfHit == RayTraceResult.Type.BLOCK;
+ return rayResult!=null&&rayResult.typeOfHit==RayTraceResult.Type.BLOCK;
}
return false;
}
@@ -941,18 +956,18 @@ public static boolean preventsConnection(World worldIn, BlockPos pos, IBlockStat
public static void knockbackNoSource(EntityLivingBase entity, double strength, double xRatio, double zRatio)
{
entity.isAirBorne = true;
- float factor = MathHelper.sqrt(xRatio * xRatio + zRatio * zRatio);
+ float factor = MathHelper.sqrt(xRatio*xRatio+zRatio*zRatio);
entity.motionX /= 2;
entity.motionZ /= 2;
- entity.motionX -= xRatio / (double)factor * strength;
- entity.motionZ -= zRatio / (double)factor * strength;
+ entity.motionX -= xRatio/(double)factor*strength;
+ entity.motionZ -= zRatio/(double)factor*strength;
- if (entity.onGround)
+ if(entity.onGround)
{
entity.motionY /= 2;
entity.motionY += strength;
- if (entity.motionY > 0.4)
+ if(entity.motionY > 0.4)
{
entity.motionY = 0.4;
}
@@ -968,18 +983,18 @@ public static Connection getTargetConnection(World world, EntityPlayer player, C
.lookup(player.dimension);
AtomicReference ret = new AtomicReference<>();
AtomicDouble minDistSq = new AtomicDouble(Double.POSITIVE_INFINITY);
- Utils.rayTrace(start, end, world, (pos)->
+ Utils.rayTrace(start, end, world, (pos) ->
{
- if (inDim != null && inDim.containsKey(pos))
+ if(inDim!=null&&inDim.containsKey(pos))
{
ImmersiveNetHandler.BlockWireInfo info = inDim.get(pos);
- for (int i = 0; i < 2; i++)
+ for(int i = 0; i < 2; i++)
{
- Set> conns = i == 0 ? info.in : info.near;
- for (Triple conn : conns)
+ Set> conns = i==0?info.in: info.near;
+ for(Triple conn : conns)
{
Connection c = conn.getLeft();
- if (ignored == null || !c.hasSameConnectors(ignored))
+ if(ignored==null||!c.hasSameConnectors(ignored))
{
Vec3d startRelative = start.addVector(-pos.getX(), -pos.getY(), -pos.getZ());
Vec3d across = conn.getRight().subtract(conn.getMiddle());
@@ -987,7 +1002,7 @@ public static Connection getTargetConnection(World world, EntityPlayer player, C
t = MathHelper.clamp(0, t, 1);
Vec3d closest = conn.getMiddle().addVector(t*across.x, t*across.y, t*across.z);
double distSq = closest.squareDistanceTo(startRelative);
- if (distSq
{
Map base;
boolean inverse;
+
public ValueComparator(Map base, boolean inverse)
{
this.base = base;
this.inverse = inverse;
}
+
@Override
public int compare(String s0, String s1)//Cant return equal to keys separate
{
if(inverse)
{
- if (base.get(s0) <= base.get(s1))
+ if(base.get(s0) <= base.get(s1))
return -1;
else
return 1;
}
else
{
- if (base.get(s0) >= base.get(s1))
+ if(base.get(s0) >= base.get(s1))
return -1;
else
return 1;
@@ -1050,8 +1067,8 @@ public boolean equals(Object obj)
{
if(!(obj instanceof ValueComparator))
return false;
- ValueComparator other = (ValueComparator) obj;
- return other.base == base && other.inverse == inverse;
+ ValueComparator other = (ValueComparator)obj;
+ return other.base==base&&other.inverse==inverse;
}
}
@@ -1066,6 +1083,7 @@ public static TextureAtlasSprite getRegisterSprite(TextureMap map, String path)
}
return sprite;
}
+
@SideOnly(Side.CLIENT)
public static TextureAtlasSprite getRegisterSprite(TextureMap map, ResourceLocation path)
{
@@ -1085,14 +1103,14 @@ public static Function transformQuad(Matrix4 mat, VertexFo
int posPos = -1;
int normPos = -1;
int colorPos = -1;
- for (int i = 0;i> 16 & 255) / 255.0F;
- float g = (float) (multiplier >> 8 & 255) / 255.0F;
- float b = (float) (multiplier & 255) / 255.0F;
+ float r = (float)(multiplier >> 16&255)/255.0F;
+ float g = (float)(multiplier >> 8&255)/255.0F;
+ float b = (float)(multiplier&255)/255.0F;
float[] oldData = data;
data = new float[4];
- data[0] = oldData[0] * r;
- data[1] = oldData[1] * g;
- data[2] = oldData[2] * b;
+ data[0] = oldData[0]*r;
+ data[1] = oldData[1]*g;
+ data[2] = oldData[2]*b;
data[3] = oldData[3];
}
}
@@ -1177,7 +1196,7 @@ else if (element==colorPosFinal)
ref.get().put(element, data);
}
};
- return (q)->{
+ return (q) -> {
ref.set(new UnpackedBakedQuad.Builder(f));
q.pipe(transformer);
return ref.get().build();
diff --git a/src/main/java/blusunrize/immersiveengineering/api/ComparableItemStack.java b/src/main/java/blusunrize/immersiveengineering/api/ComparableItemStack.java
index f953f93735..c1e8f87d81 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/ComparableItemStack.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/ComparableItemStack.java
@@ -16,22 +16,24 @@ public class ComparableItemStack
{
public ItemStack stack;
public boolean useNBT;
- public int oreID=-1;
+ public int oreID = -1;
public ComparableItemStack(ItemStack stack)
{
this(stack, true);
}
+
public ComparableItemStack(ItemStack stack, boolean matchOre)
{
this(stack, matchOre, true);
}
+
public ComparableItemStack(ItemStack stack, boolean matchOre, boolean copy)
{
if(stack==null)
throw new RuntimeException("You cannot instantiate a ComparableItemStack with null for an Item!");
this.stack = stack;
- if (copy)
+ if(copy)
copy();
if(matchOre)
{
@@ -57,6 +59,7 @@ public ComparableItemStack setUseNBT(boolean useNBT)
this.useNBT = useNBT;
return this;
}
+
public ComparableItemStack setOreID(int oid)
{
this.oreID = oid;
@@ -68,13 +71,14 @@ public String toString()
{
return "ComparableStack: {"+this.stack.toString()+"}; oreID: "+this.oreID+"; checkNBT: "+this.useNBT;
}
+
@Override
public int hashCode()
{
if(this.oreID!=-1)
return this.oreID;
- int hash = (stack.getItemDamage()&0xffff)*31 + stack.getItem().hashCode()*31;
- if(this.useNBT && stack.hasTagCompound())
+ int hash = (stack.getItemDamage()&0xffff)*31+stack.getItem().hashCode()*31;
+ if(this.useNBT&&stack.hasTagCompound())
hash += stack.getTagCompound().hashCode()*31;
return hash;
}
@@ -85,11 +89,11 @@ public boolean equals(Object object)
if(!(object instanceof ComparableItemStack))
return false;
- if(this.oreID!=-1 && ((ComparableItemStack)object).oreID!=-1)
- return this.oreID == ((ComparableItemStack)object).oreID;
+ if(this.oreID!=-1&&((ComparableItemStack)object).oreID!=-1)
+ return this.oreID==((ComparableItemStack)object).oreID;
ItemStack otherStack = ((ComparableItemStack)object).stack;
- if(!OreDictionary.itemMatches(stack,otherStack, false))
+ if(!OreDictionary.itemMatches(stack, otherStack, false))
return false;
if(this.useNBT)
return ItemStack.areItemStackTagsEqual(stack, otherStack);
@@ -108,6 +112,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
}
return nbt;
}
+
public static ComparableItemStack readFromNBT(NBTTagCompound nbt)
{
if(nbt.hasKey("oreID"))
diff --git a/src/main/java/blusunrize/immersiveengineering/api/DimensionBlockPos.java b/src/main/java/blusunrize/immersiveengineering/api/DimensionBlockPos.java
index 6263797595..9068c30550 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/DimensionBlockPos.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/DimensionBlockPos.java
@@ -8,7 +8,6 @@
package blusunrize.immersiveengineering.api;
-import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -18,19 +17,23 @@
public class DimensionBlockPos extends BlockPos
{
public int dimension;
+
public DimensionBlockPos(int x, int y, int z, int dim)
{
super(x, y, z);
dimension = dim;
}
+
public DimensionBlockPos(int x, int y, int z, World w)
{
this(x, y, z, w.provider.getDimension());
}
+
public DimensionBlockPos(BlockPos pos, World w)
{
this(pos.getX(), pos.getY(), pos.getZ(), w.provider.getDimension());
}
+
public DimensionBlockPos(BlockPos pos, int dim)
{
this(pos.getX(), pos.getY(), pos.getZ(), dim);
@@ -46,33 +49,36 @@ public int hashCode()
{
final int prime = 31;
int result = 1;
- result = prime * result + dimension;
- result = prime * result + getX();
- result = prime * result + getY();
- result = prime * result + getZ();
+ result = prime*result+dimension;
+ result = prime*result+getX();
+ result = prime*result+getY();
+ result = prime*result+getZ();
return result;
}
+
@Override
public boolean equals(Object obj)
{
- if (this == obj)
+ if(this==obj)
return true;
- if (obj == null)
+ if(obj==null)
return false;
- if (getClass() != obj.getClass())
+ if(getClass()!=obj.getClass())
return false;
- DimensionBlockPos other = (DimensionBlockPos) obj;
- if (dimension != other.dimension)
+ DimensionBlockPos other = (DimensionBlockPos)obj;
+ if(dimension!=other.dimension)
return false;
- if (getX() != other.getX())
+ if(getX()!=other.getX())
return false;
- if (getY() != other.getY())
+ if(getY()!=other.getY())
return false;
- return getZ() == other.getZ();
+ return getZ()==other.getZ();
}
+
@Nonnull
@Override
- public String toString() {
+ public String toString()
+ {
return "Dimension: "+dimension+" Pos: "+super.toString();
}
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/DimensionChunkCoords.java b/src/main/java/blusunrize/immersiveengineering/api/DimensionChunkCoords.java
index 1920d877c7..c3621fd1c3 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/DimensionChunkCoords.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/DimensionChunkCoords.java
@@ -14,32 +14,34 @@
public class DimensionChunkCoords extends ChunkPos
{
public int dimension;
+
public DimensionChunkCoords(int dimension, int x, int z)
{
- super(x,z);
- this.dimension=dimension;
+ super(x, z);
+ this.dimension = dimension;
}
@Override
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
- else if (!(o instanceof DimensionChunkCoords))
- return false;
- else
- {
- DimensionChunkCoords coordPair = (DimensionChunkCoords)o;
- return this.dimension==coordPair.dimension && this.x==coordPair.x && this.z==coordPair.z;
- }
- }
+ public boolean equals(Object o)
+ {
+ if(this==o)
+ return true;
+ else if(!(o instanceof DimensionChunkCoords))
+ return false;
+ else
+ {
+ DimensionChunkCoords coordPair = (DimensionChunkCoords)o;
+ return this.dimension==coordPair.dimension&&this.x==coordPair.x&&this.z==coordPair.z;
+ }
+ }
+
@Override
- public String toString()
- {
- return "[dim:"+ this.dimension+ "; " +this.x+ ", " +this.z + "]";
- }
+ public String toString()
+ {
+ return "[dim:"+this.dimension+"; "+this.x+", "+this.z+"]";
+ }
- public DimensionChunkCoords withOffset(int offsetX, int offsetZ)
+ public DimensionChunkCoords withOffset(int offsetX, int offsetZ)
{
return new DimensionChunkCoords(this.dimension, this.x+offsetX, this.z+offsetZ);
}
@@ -52,10 +54,11 @@ public NBTTagCompound writeToNBT()
tag.setInteger("z", this.z);
return tag;
}
+
public static DimensionChunkCoords readFromNBT(NBTTagCompound tag)
{
- if(tag.hasKey("dim",3)&&tag.hasKey("x",3)&&tag.hasKey("z",3))
- return new DimensionChunkCoords(tag.getInteger("dim"),tag.getInteger("x"),tag.getInteger("z"));
+ if(tag.hasKey("dim", 3)&&tag.hasKey("x", 3)&&tag.hasKey("z", 3))
+ return new DimensionChunkCoords(tag.getInteger("dim"), tag.getInteger("x"), tag.getInteger("z"));
return null;
}
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/DirectionalBlockPos.java b/src/main/java/blusunrize/immersiveengineering/api/DirectionalBlockPos.java
index a1e5447bb6..8c506bbb7a 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/DirectionalBlockPos.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/DirectionalBlockPos.java
@@ -37,7 +37,7 @@ public DirectionalBlockPos(int x, int y, int z, EnumFacing direction)
@Override
public String toString()
{
- return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).add("direction", this.direction.toString()).toString();
+ return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).add("direction", this.direction.toString()).toString();
}
public TileEntity getTile(World world)
diff --git a/src/main/java/blusunrize/immersiveengineering/api/IEApi.java b/src/main/java/blusunrize/immersiveengineering/api/IEApi.java
index c52fe3fcdb..8eb2ec3323 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/IEApi.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/IEApi.java
@@ -23,7 +23,7 @@
/**
* @author BluSunrize - 13.08.2015
- *
+ *
* An API class, for features that should be accessible in compatibility
*/
public class IEApi
@@ -77,8 +77,9 @@ public static ItemStack getPreferredOreStack(String oreName)
return preferredStack;
}
ItemStack s = oreOutputPreference.get(oreName);
- return s == null ? ItemStack.EMPTY : s.copy();
+ return s==null?ItemStack.EMPTY: s.copy();
}
+
public static ItemStack getPreferredStackbyMod(Collection list)
{
ItemStack preferredStack = ItemStack.EMPTY;
@@ -91,7 +92,7 @@ public static ItemStack getPreferredStackbyMod(Collection list)
{
String modId = rl.getResourceDomain();
int idx = modId==null||modId.isEmpty()?-1: modPreference.indexOf(modId);
- if(preferredStack.isEmpty() || (idx>=0 && (lastPref<0 || idx= 0&&(lastPref < 0||idx < lastPref)))
{
preferredStack = stack;
lastPref = idx;
@@ -100,14 +101,16 @@ public static ItemStack getPreferredStackbyMod(Collection list)
}
return preferredStack.copy();
}
+
public static ItemStack getPreferredStackbyMod(ItemStack[] array)
{
return getPreferredStackbyMod(Lists.newArrayList(array));
}
+
public static boolean isAllowedInCrate(ItemStack stack)
{
- for (Predicate check:forbiddenInCrates)
- if (check.test(stack))
+ for(Predicate check : forbiddenInCrates)
+ if(check.test(stack))
return false;
return true;
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/IEProperties.java b/src/main/java/blusunrize/immersiveengineering/api/IEProperties.java
index 771efd1731..35c05c4317 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/IEProperties.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/IEProperties.java
@@ -14,7 +14,6 @@
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyHelper;
import net.minecraft.block.properties.PropertyInteger;
-import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IUnlistedProperty;
@@ -31,8 +30,8 @@ public class IEProperties
public static final PropertyBoolInverted MULTIBLOCKSLAVE = PropertyBoolInverted.create("_0multiblockslave");//Name starts with '_0' to ensure priority when overriding models
public static final PropertyBoolInverted DYNAMICRENDER = PropertyBoolInverted.create("_1dynamicrender");//Name starts with '_1' to ensure priority over anything but the multiblockslave property
public static final PropertySet CONNECTIONS = new PropertySet("conns");
-
-// public static final PropertyEnum[] SIDECONFIG = {
+
+ // public static final PropertyEnum[] SIDECONFIG = {
// PropertyEnum.create("sideconfig_down", IEEnums.SideConfig.class),
// PropertyEnum.create("sideconfig_up", IEEnums.SideConfig.class),
// PropertyEnum.create("sideconfig_north", IEEnums.SideConfig.class),
@@ -63,31 +62,36 @@ public class IEProperties
PropertyBoolInverted.create("boolean1"),
PropertyBoolInverted.create("boolean2")
};
- public static final PropertyInteger INT_4 = PropertyInteger.create("int_4", 0,3);
- public static final PropertyInteger INT_16 = PropertyInteger.create("int_16", 0,15);
+ public static final PropertyInteger INT_4 = PropertyInteger.create("int_4", 0, 3);
+ public static final PropertyInteger INT_16 = PropertyInteger.create("int_16", 0, 15);
public static class ProperySideConfig implements IUnlistedProperty
{
final String name;
+
public ProperySideConfig(String name)
{
this.name = name;
}
+
@Override
public String getName()
{
return name;
}
+
@Override
public boolean isValid(SideConfig value)
{
return true;
}
+
@Override
public Class getType()
{
return IEEnums.SideConfig.class;
}
+
@Override
public String valueToString(SideConfig value)
{
@@ -102,43 +106,52 @@ public String getName()
{
return "obj_texture_remap";
}
+
@Override
public boolean isValid(HashMap value)
{
return true;
}
+
@Override
- public Class getType() {
+ public Class getType()
+ {
return HashMap.class;
}
+
@Override
public String valueToString(HashMap value)
{
return value.toString();
}
};
-
+
public static class PropertyBoolInverted extends PropertyHelper
{
private static final ImmutableList ALLOWED_VALUES = ImmutableList.of(false, true);
+
protected PropertyBoolInverted(String name)
{
super(name, Boolean.class);
}
+
@Override
public Collection getAllowedValues()
{
return ALLOWED_VALUES;
}
+
@Override
public Optional parseValue(String value)
{
return Optional.of(Boolean.parseBoolean(value));
}
+
public static PropertyBoolInverted create(String name)
{
return new PropertyBoolInverted(name);
}
+
@Override
public String getName(Boolean value)
{
@@ -165,7 +178,7 @@ public String getName()
@Override
public boolean isValid(Set value)
{
- return value != null;
+ return value!=null;
}
@Override
diff --git a/src/main/java/blusunrize/immersiveengineering/api/IPostBlock.java b/src/main/java/blusunrize/immersiveengineering/api/IPostBlock.java
index cf1c6ff2db..ceb086e3b0 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/IPostBlock.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/IPostBlock.java
@@ -16,8 +16,8 @@
*/
public interface IPostBlock
{
- /**
- * Returns true if a transformer should render attached to this post
- */
- boolean canConnectTransformer(IBlockAccess world, BlockPos pos);
+ /**
+ * Returns true if a transformer should render attached to this post
+ */
+ boolean canConnectTransformer(IBlockAccess world, BlockPos pos);
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/Lib.java b/src/main/java/blusunrize/immersiveengineering/api/Lib.java
index d0c735626d..37ce727ea7 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/Lib.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/Lib.java
@@ -9,8 +9,8 @@
package blusunrize.immersiveengineering.api;
-import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.util.EnumHelper;
@@ -18,55 +18,57 @@ public class Lib
{
public static final String MODID = "immersiveengineering";
- public static final String[] METALS_IE = {"Copper","Aluminum","Lead","Silver","Nickel","Uranium","Constantan","Electrum","Steel"};
- public static final String[] METALS_ALL = {"Copper","Aluminum","Lead","Silver","Nickel","Uranium","Constantan","Electrum","Steel","Iron","Gold"};
+ public static final String[] METALS_IE = {"Copper", "Aluminum", "Lead", "Silver", "Nickel", "Uranium", "Constantan", "Electrum", "Steel"};
+ public static final String[] METALS_ALL = {"Copper", "Aluminum", "Lead", "Silver", "Nickel", "Uranium", "Constantan", "Electrum", "Steel", "Iron", "Gold"};
public static final String TOOL_HAMMER = "IE_HAMMER";
public static final String TOOL_WIRECUTTER = "IE_WIRECUTTER";
- public static final String CHAT = "chat." + MODID + ".";
+ public static final String CHAT = "chat."+MODID+".";
public static final String CHAT_WARN = CHAT+"warning.";
public static final String CHAT_INFO = CHAT+"info.";
public static final String CHAT_COMMAND = CHAT+"command.";
- public static final String DESC = "desc." + MODID + ".";
+ public static final String DESC = "desc."+MODID+".";
public static final String DESC_INFO = DESC+"info.";
public static final String DESC_FLAVOUR = DESC+"flavour.";
- public static final String GUI = "gui." + MODID + ".";
- public static final String GUI_CONFIG = "gui." + MODID + ".config.";
+ public static final String GUI = "gui."+MODID+".";
+ public static final String GUI_CONFIG = "gui."+MODID+".config.";
public static final int COLOUR_I_ImmersiveOrange = 0xfff78034;
- public static final float[] COLOUR_F_ImmersiveOrange = {247 / 255f, 128 / 255f, 52 / 255f};
+ public static final float[] COLOUR_F_ImmersiveOrange = {247/255f, 128/255f, 52/255f};
public static final int COLOUR_I_ImmersiveOrangeShadow = 0xff3e200d;
public static final String MAGNET_PREVENT_NBT = "PreventRemoteMovement";
- /**Gui IDs*/
+ /**
+ * Gui IDs
+ */
//Tiles
public static final int GUIID_Base_Tile = 0;
- public static final int GUIID_CokeOven = GUIID_Base_Tile +0;
- public static final int GUIID_AlloySmelter = GUIID_Base_Tile +1;
- public static final int GUIID_BlastFurnace = GUIID_Base_Tile +2;
- public static final int GUIID_WoodenCrate = GUIID_Base_Tile +3;
- public static final int GUIID_Workbench = GUIID_Base_Tile +4;
- public static final int GUIID_Assembler = GUIID_Base_Tile +5;
- public static final int GUIID_Sorter = GUIID_Base_Tile +6;
- public static final int GUIID_Squeezer = GUIID_Base_Tile +7;
- public static final int GUIID_Fermenter = GUIID_Base_Tile +8;
- public static final int GUIID_Refinery = GUIID_Base_Tile +9;
- public static final int GUIID_ArcFurnace = GUIID_Base_Tile +10;
- public static final int GUIID_AutoWorkbench = GUIID_Base_Tile +11;
- public static final int GUIID_Mixer = GUIID_Base_Tile +12;
- public static final int GUIID_Turret = GUIID_Base_Tile +13;
- public static final int GUIID_FluidSorter = GUIID_Base_Tile +14;
- public static final int GUIID_Belljar = GUIID_Base_Tile +15;
- public static final int GUIID_ToolboxBlock = GUIID_Base_Tile +16;
+ public static final int GUIID_CokeOven = GUIID_Base_Tile+0;
+ public static final int GUIID_AlloySmelter = GUIID_Base_Tile+1;
+ public static final int GUIID_BlastFurnace = GUIID_Base_Tile+2;
+ public static final int GUIID_WoodenCrate = GUIID_Base_Tile+3;
+ public static final int GUIID_Workbench = GUIID_Base_Tile+4;
+ public static final int GUIID_Assembler = GUIID_Base_Tile+5;
+ public static final int GUIID_Sorter = GUIID_Base_Tile+6;
+ public static final int GUIID_Squeezer = GUIID_Base_Tile+7;
+ public static final int GUIID_Fermenter = GUIID_Base_Tile+8;
+ public static final int GUIID_Refinery = GUIID_Base_Tile+9;
+ public static final int GUIID_ArcFurnace = GUIID_Base_Tile+10;
+ public static final int GUIID_AutoWorkbench = GUIID_Base_Tile+11;
+ public static final int GUIID_Mixer = GUIID_Base_Tile+12;
+ public static final int GUIID_Turret = GUIID_Base_Tile+13;
+ public static final int GUIID_FluidSorter = GUIID_Base_Tile+14;
+ public static final int GUIID_Belljar = GUIID_Base_Tile+15;
+ public static final int GUIID_ToolboxBlock = GUIID_Base_Tile+16;
//Items
public static final int GUIID_Base_Item = 64;
- public static final int GUIID_Manual = GUIID_Base_Item +0;
- public static final int GUIID_Revolver = GUIID_Base_Item +1;
- public static final int GUIID_Toolbox = GUIID_Base_Item +2;
+ public static final int GUIID_Manual = GUIID_Base_Item+0;
+ public static final int GUIID_Revolver = GUIID_Base_Item+1;
+ public static final int GUIID_Toolbox = GUIID_Base_Item+2;
public static final String NBT_Earmuffs = "IE:Earmuffs";
public static final String NBT_EarmuffColour = "IE:EarmuffColour";
@@ -75,24 +77,24 @@ public class Lib
public static final int colour_nixieTubeText = 0xff9900;
- public static String DMG_RevolverCasull="ieRevolver_casull";
- public static String DMG_RevolverAP="ieRevolver_armorPiercing";
- public static String DMG_RevolverBuck="ieRevolver_buckshot";
- public static String DMG_RevolverDragon="ieRevolver_dragonsbreath";
- public static String DMG_RevolverHoming="ieRevolver_homing";
- public static String DMG_RevolverWolfpack="ieRevolver_wolfpack";
+ public static String DMG_RevolverCasull = "ieRevolver_casull";
+ public static String DMG_RevolverAP = "ieRevolver_armorPiercing";
+ public static String DMG_RevolverBuck = "ieRevolver_buckshot";
+ public static String DMG_RevolverDragon = "ieRevolver_dragonsbreath";
+ public static String DMG_RevolverHoming = "ieRevolver_homing";
+ public static String DMG_RevolverWolfpack = "ieRevolver_wolfpack";
public static String DMG_RevolverSilver = "ieRevolver_silver";
public static String DMG_RevolverPotion = "ieRevolver_potion";
- public static String DMG_Crusher="ieCrushed";
- public static String DMG_Tesla="ieTesla";
- public static String DMG_Acid="ieAcid";
+ public static String DMG_Crusher = "ieCrushed";
+ public static String DMG_Tesla = "ieTesla";
+ public static String DMG_Acid = "ieAcid";
public static String DMG_Railgun = "ieRailgun";
public static String DMG_Tesla_prim = "ieTeslaPrimary";
public static String DMG_RazorWire = "ieRazorWire";
public static String DMG_RazorShock = "ieRazorShock";
public static String DMG_WireShock = "ieWireShock";
- public static final ToolMaterial MATERIAL_Steel = EnumHelper.addToolMaterial( "IE:STEEL", 2, 641, 7.0f, 2.5f, 10);
+ public static final ToolMaterial MATERIAL_Steel = EnumHelper.addToolMaterial("IE:STEEL", 2, 641, 7.0f, 2.5f, 10);
public static final EnumRarity RARITY_Masterwork = EnumHelper.addRarity("IE:MASTERWORK", TextFormatting.GOLD, "Masterwork");
public static boolean BAUBLES = false;
diff --git a/src/main/java/blusunrize/immersiveengineering/api/ManualHelper.java b/src/main/java/blusunrize/immersiveengineering/api/ManualHelper.java
index c5ff55ae07..caba41c2e0 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/ManualHelper.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/ManualHelper.java
@@ -13,7 +13,6 @@
/**
* @author BluSunrize - 04.07.2015
- *
*/
public class ManualHelper
{
@@ -24,15 +23,16 @@ public class ManualHelper
public static String CAT_TOOLS = "tools";
public static String CAT_HEAVYMACHINES = "heavymachines";
public static String CAT_UPDATE = "update";
-
+
public static ManualInstance ieManualInstance;
public static ManualInstance getManual()
{
return ieManualInstance;
}
+
/**
- * Adds a new entry to the manual. if the Category is new, it will be added to the list of categories automatically
+ * Adds a new entry to the manual. if the Category is new, it will be added to the list of categories automatically
*/
public static void addEntry(String name, String category, IManualPage... pages)
{
diff --git a/src/main/java/blusunrize/immersiveengineering/api/ManualPageBlueprint.java b/src/main/java/blusunrize/immersiveengineering/api/ManualPageBlueprint.java
index a866eec6f0..98c262ac41 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/ManualPageBlueprint.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/ManualPageBlueprint.java
@@ -55,7 +55,7 @@ public void recalculateCraftingRecipes()
{
int h = (int)Math.ceil(recipe.inputs.length/2f);
PositionedItemStack[] pIngredients = new PositionedItemStack[recipe.inputs.length+2];
- for(int i=0; i)stack.stack)
{
if(subStack.getDisplayName().toLowerCase(Locale.ENGLISH).contains(searchTag))
@@ -180,7 +181,8 @@ else if(stack.stack instanceof ItemStack)
{
if(((ItemStack)stack.stack).getDisplayName().toLowerCase(Locale.ENGLISH).contains(searchTag))
return true;
- } else if(stack.stack instanceof String)
+ }
+ else if(stack.stack instanceof String)
{
if(ManualUtils.isExistingOreName((String)stack.stack))
for(ItemStack subStack : OreDictionary.getOres((String)stack.stack))
diff --git a/src/main/java/blusunrize/immersiveengineering/api/ManualPageMultiblock.java b/src/main/java/blusunrize/immersiveengineering/api/ManualPageMultiblock.java
index d8e6b06722..2b18456d4e 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/ManualPageMultiblock.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/ManualPageMultiblock.java
@@ -52,8 +52,8 @@ public class ManualPageMultiblock extends ManualPages
float scale = 50f;
float transX = 0;
float transY = 0;
- float rotX=0;
- float rotY=0;
+ float rotX = 0;
+ float rotY = 0;
List componentTooltip;
MultiblockRenderInfo renderInfo;
MultiblockBlockAccess blockAccess;
@@ -87,26 +87,26 @@ public void initPage(GuiManual gui, int x, int y, List pageButtons)
{
this.renderInfo = new MultiblockRenderInfo(multiblock);
this.blockAccess = new MultiblockBlockAccess(renderInfo);
- transX = x+60 + renderInfo.structureWidth/2;
- transY = y+35 + (float)Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight + renderInfo.structureWidth*renderInfo.structureWidth + renderInfo.structureLength*renderInfo.structureLength)/2;
- rotX=25;
- rotY=-45;
+ transX = x+60+renderInfo.structureWidth/2;
+ transY = y+35+(float)Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight+renderInfo.structureWidth*renderInfo.structureWidth+renderInfo.structureLength*renderInfo.structureLength)/2;
+ rotX = 25;
+ rotY = -45;
scale = multiblock.getManualScale();
boolean canRenderFormed = multiblock.canRenderFormedStructure();
- yOff = (int)(transY+scale*Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight + renderInfo.structureWidth*renderInfo.structureWidth + renderInfo.structureLength*renderInfo.structureLength)/2);
- pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4, (int)transY-(canRenderFormed?11:5), 10,10, 4));
+ yOff = (int)(transY+scale*Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight+renderInfo.structureWidth*renderInfo.structureWidth+renderInfo.structureLength*renderInfo.structureLength)/2);
+ pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4, (int)transY-(canRenderFormed?11: 5), 10, 10, 4));
if(canRenderFormed)
- pageButtons.add(new GuiButtonManualNavigation(gui, 103, x+4, (int)transY+1, 10,10, 6));
- if(this.renderInfo.structureHeight>1)
+ pageButtons.add(new GuiButtonManualNavigation(gui, 103, x+4, (int)transY+1, 10, 10, 6));
+ if(this.renderInfo.structureHeight > 1)
{
- pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4, (int)transY-(canRenderFormed?14:8)-16, 10,16, 3));
- pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4, (int)transY+(canRenderFormed?14:8), 10,16, 2));
+ pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4, (int)transY-(canRenderFormed?14: 8)-16, 10, 16, 3));
+ pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4, (int)transY+(canRenderFormed?14: 8), 10, 16, 2));
}
}
IngredientStack[] totalMaterials = this.multiblock.getTotalMaterials();
- if(totalMaterials != null)
+ if(totalMaterials!=null)
{
componentTooltip = new ArrayList();
componentTooltip.add(I18n.format("desc.immersiveengineering.info.reqMaterial"));
@@ -114,14 +114,14 @@ public void initPage(GuiManual gui, int x, int y, List pageButtons)
boolean hasAnyItems = false;
boolean[] hasItems = new boolean[totalMaterials.length];
for(int ss = 0; ss < totalMaterials.length; ss++)
- if(totalMaterials[ss] != null)
+ if(totalMaterials[ss]!=null)
{
IngredientStack req = totalMaterials[ss];
int reqSize = req.inputSize;
for(int slot = 0; slot < ManualUtils.mc().player.inventory.getSizeInventory(); slot++)
{
ItemStack inSlot = ManualUtils.mc().player.inventory.getStackInSlot(slot);
- if(!inSlot.isEmpty() && req.matchesItemStackIgnoringSize(inSlot))
+ if(!inSlot.isEmpty()&&req.matchesItemStackIgnoringSize(inSlot))
if((reqSize -= inSlot.getCount()) <= 0)
break;
}
@@ -131,22 +131,22 @@ public void initPage(GuiManual gui, int x, int y, List pageButtons)
if(!hasAnyItems)
hasAnyItems = true;
}
- maxOff = Math.max(maxOff, ("" + req.inputSize).length());
+ maxOff = Math.max(maxOff, (""+req.inputSize).length());
}
for(int ss = 0; ss < totalMaterials.length; ss++)
- if(totalMaterials[ss] != null)
+ if(totalMaterials[ss]!=null)
{
IngredientStack req = totalMaterials[ss];
- int indent = maxOff - ("" + req.inputSize).length();
+ int indent = maxOff-(""+req.inputSize).length();
String sIndent = "";
if(indent > 0)
for(int ii = 0; ii < indent; ii++)
sIndent += "0";
- String s = hasItems[ss] ? (TextFormatting.GREEN + TextFormatting.BOLD.toString() + "\u2713" + TextFormatting.RESET + " ") : hasAnyItems ? (" ") : "";
- s += TextFormatting.GRAY + sIndent + req.inputSize + "x " + TextFormatting.RESET;
+ String s = hasItems[ss]?(TextFormatting.GREEN+TextFormatting.BOLD.toString()+"\u2713"+TextFormatting.RESET+" "): hasAnyItems?(" "): "";
+ s += TextFormatting.GRAY+sIndent+req.inputSize+"x "+TextFormatting.RESET;
ItemStack example = req.getExampleStack();
if(!example.isEmpty())
- s += example.getRarity().rarityColor + example.getDisplayName();
+ s += example.getRarity().rarityColor+example.getDisplayName();
else
s += "???";
componentTooltip.add(s);
@@ -162,21 +162,22 @@ public void renderPage(GuiManual gui, int x, int y, int mx, int my)
int stackDepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);
try
{
- if(multiblock.getStructureManual() != null)
+ if(multiblock.getStructureManual()!=null)
{
if(!canTick)
{
// renderInfo.reset();
// renderInfo.setShowLayer(9);
//LAYER CACHING!!
- } else if(++tick % 20 == 0)
+ }
+ else if(++tick%20==0)
renderInfo.step();
int structureLength = renderInfo.structureLength;
int structureWidth = renderInfo.structureWidth;
int structureHeight = renderInfo.structureHeight;
- int yOffTotal = (int)(transY-y+scale*Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight + renderInfo.structureWidth*renderInfo.structureWidth + renderInfo.structureLength*renderInfo.structureLength)/2);
+ int yOffTotal = (int)(transY-y+scale*Math.sqrt(renderInfo.structureHeight*renderInfo.structureHeight+renderInfo.structureWidth*renderInfo.structureWidth+renderInfo.structureLength*renderInfo.structureLength)/2);
GlStateManager.enableRescaleNormal();
GlStateManager.pushMatrix();
@@ -189,14 +190,14 @@ public void renderPage(GuiManual gui, int x, int y, int mx, int my)
final BlockRendererDispatcher blockRender = Minecraft.getMinecraft().getBlockRendererDispatcher();
- float f = (float)Math.sqrt(structureHeight * structureHeight + structureWidth * structureWidth + structureLength * structureLength);
+ float f = (float)Math.sqrt(structureHeight*structureHeight+structureWidth*structureWidth+structureLength*structureLength);
GlStateManager.translate(transX, transY, Math.max(structureHeight, Math.max(structureWidth, structureLength)));
GlStateManager.scale(scale, -scale, 1);
GlStateManager.rotate(rotX, 1, 0, 0);
GlStateManager.rotate(90+rotY, 0, 1, 0);
- GlStateManager.translate((float)structureLength / -2f, (float)structureHeight / -2f, (float)structureWidth / -2f);
+ GlStateManager.translate((float)structureLength/-2f, (float)structureHeight/-2f, (float)structureWidth/-2f);
GlStateManager.disableLighting();
@@ -207,7 +208,7 @@ public void renderPage(GuiManual gui, int x, int y, int mx, int my)
gui.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int idx = 0;
- if(showCompleted && multiblock.canRenderFormedStructure())
+ if(showCompleted&&multiblock.canRenderFormedStructure())
multiblock.renderFormedStructure();
else
for(int h = 0; h < structureHeight; h++)
@@ -243,28 +244,31 @@ public void renderPage(GuiManual gui, int x, int y, int mx, int my)
RenderHelper.disableStandardItemLighting();
manual.fontRenderer.setUnicodeFlag(true);
- if(localizedText != null && !localizedText.isEmpty())
- manual.fontRenderer.drawSplitString(localizedText, x, y + yOffTotal, 120, manual.getTextColour());
+ if(localizedText!=null&&!localizedText.isEmpty())
+ manual.fontRenderer.drawSplitString(localizedText, x, y+yOffTotal, 120, manual.getTextColour());
manual.fontRenderer.setUnicodeFlag(false);
- if(componentTooltip != null)
+ if(componentTooltip!=null)
{
- manual.fontRenderer.drawString("?", x + 116, y + yOffTotal / 2 - 4, manual.getTextColour(), false);
- if(mx >= x + 116 && mx < x + 122 && my >= y + yOffTotal / 2 - 4 && my < y + yOffTotal / 2 + 4)
+ manual.fontRenderer.drawString("?", x+116, y+yOffTotal/2-4, manual.getTextColour(), false);
+ if(mx >= x+116&&mx < x+122&&my >= y+yOffTotal/2-4&&my < y+yOffTotal/2+4)
gui.drawHoveringText(componentTooltip, mx, my, manual.fontRenderer);
}
}
- }catch(Exception e)
+ } catch(Exception e)
{
e.printStackTrace();
}
if(openBuffer)
- try{
+ try
+ {
Tessellator.getInstance().draw();
- }catch(Exception e){}
+ } catch(Exception e)
+ {
+ }
int newStackDepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);
- while (newStackDepth>stackDepth)
+ while(newStackDepth > stackDepth)
{
GlStateManager.popMatrix();
newStackDepth--;
@@ -274,7 +278,7 @@ public void renderPage(GuiManual gui, int x, int y, int mx, int my)
@Override
public void mouseDragged(int x, int y, int clickX, int clickY, int mx, int my, int lastX, int lastY, int button)
{
- if((clickX>=40 && clickX<144 && mx>=20 && mx<164)&&(clickY>=30 && clickY<130 && my>=30 && my<180))
+ if((clickX >= 40&&clickX < 144&&mx >= 20&&mx < 164)&&(clickY >= 30&&clickY < 130&&my >= 30&&my < 180))
{
int dx = mx-lastX;
int dy = my-lastY;
@@ -289,15 +293,15 @@ public void buttonPressed(GuiManual gui, GuiButton button)
if(button.id==100)
{
canTick = !canTick;
- ((GuiButtonManualNavigation)button).type = ((GuiButtonManualNavigation)button).type == 4 ? 5 : 4;
+ ((GuiButtonManualNavigation)button).type = ((GuiButtonManualNavigation)button).type==4?5: 4;
}
else if(button.id==101)
{
- this.renderInfo.setShowLayer( Math.min(renderInfo.showLayer+1, renderInfo.structureHeight-1));
+ this.renderInfo.setShowLayer(Math.min(renderInfo.showLayer+1, renderInfo.structureHeight-1));
}
else if(button.id==102)
{
- this.renderInfo.setShowLayer( Math.max(renderInfo.showLayer-1, -1));
+ this.renderInfo.setShowLayer(Math.max(renderInfo.showLayer-1, -1));
}
else if(button.id==103)
showCompleted = !showCompleted;
@@ -330,7 +334,7 @@ public MultiblockBlockAccess(MultiblockRenderInfo data)
private IBlockState convert(int index, ItemStack itemstack)
{
- if (itemstack == null)
+ if(itemstack==null)
return Blocks.AIR.getDefaultState();
IBlockState state = data.multiblock.getBlockstateFromStack(index, itemstack);
if(state!=null)
@@ -349,7 +353,7 @@ public TileEntity getTileEntity(BlockPos pos)
public int getCombinedLight(BlockPos pos, int lightValue)
{
// full brightness always
- return 15 << 20 | 15 << 4;
+ return 15<<20|15<<4;
}
@Override
@@ -359,11 +363,11 @@ public IBlockState getBlockState(BlockPos pos)
int y = pos.getY();
int z = pos.getZ();
- if(y >= 0 && y < structure.length)
- if(x >= 0 && x < structure[y].length)
- if(z >= 0 && z < structure[y][x].length)
+ if(y >= 0&&y < structure.length)
+ if(x >= 0&&x < structure[y].length)
+ if(z >= 0&&z < structure[y][x].length)
{
- int index = y * (data.structureLength * data.structureWidth) + x * data.structureWidth + z;
+ int index = y*(data.structureLength*data.structureWidth)+x*data.structureWidth+z;
if(index <= data.getLimiter())
return structure[y][x][z];
}
@@ -373,14 +377,14 @@ public IBlockState getBlockState(BlockPos pos)
@Override
public boolean isAirBlock(BlockPos pos)
{
- return getBlockState(pos).getBlock() == Blocks.AIR;
+ return getBlockState(pos).getBlock()==Blocks.AIR;
}
@Override
public Biome getBiome(BlockPos pos)
{
World world = Minecraft.getMinecraft().world;
- if (world!=null)
+ if(world!=null)
return world.getBiome(pos);
else
return Biomes.BIRCH_FOREST;
@@ -397,7 +401,7 @@ public WorldType getWorldType()
{
World world = Minecraft.getMinecraft().world;
- if (world!=null)
+ if(world!=null)
return world.getWorldType();
else
return WorldType.DEFAULT;
@@ -409,6 +413,7 @@ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default)
return false;
}
}
+
//Stolen back from boni's StructureInfo
static class MultiblockRenderInfo
{
@@ -428,7 +433,7 @@ public MultiblockRenderInfo(IMultiblock multiblock)
{
this.multiblock = multiblock;
init(multiblock.getStructureManual());
- maxBlockIndex = blockIndex = structureHeight * structureLength * structureWidth;
+ maxBlockIndex = blockIndex = structureHeight*structureLength*structureWidth;
}
public void init(ItemStack[][][] structure)
@@ -450,7 +455,7 @@ public void init(ItemStack[][][] structure)
if(structure[h][l].length > structureWidth)
structureWidth = structure[h][l].length;
for(ItemStack ss : structure[h][l])
- if(ss != null && !ss.isEmpty())
+ if(ss!=null&&!ss.isEmpty())
perLvl++;
}
countPerLevel[h] = perLvl;
@@ -461,10 +466,10 @@ public void init(ItemStack[][][] structure)
public void setShowLayer(int layer)
{
showLayer = layer;
- if(layer<0)
+ if(layer < 0)
reset();
else
- blockIndex = (layer + 1) * (structureLength * structureWidth) - 1;
+ blockIndex = (layer+1)*(structureLength*structureWidth)-1;
}
public void reset()
@@ -480,18 +485,18 @@ public void step()
if(++blockIndex >= maxBlockIndex)
blockIndex = 0;
}
- while(isEmpty(blockIndex) && blockIndex != start);
+ while(isEmpty(blockIndex)&&blockIndex!=start);
}
private boolean isEmpty(int index)
{
- int y = index / (structureLength * structureWidth);
- int r = index % (structureLength * structureWidth);
- int x = r / structureWidth;
- int z = r % structureWidth;
+ int y = index/(structureLength*structureWidth);
+ int r = index%(structureLength*structureWidth);
+ int x = r/structureWidth;
+ int z = r%structureWidth;
ItemStack stack = data[y][x][z];
- return stack == null || stack.isEmpty();
+ return stack==null||stack.isEmpty();
}
public int getLimiter()
diff --git a/src/main/java/blusunrize/immersiveengineering/api/MultiblockHandler.java b/src/main/java/blusunrize/immersiveengineering/api/MultiblockHandler.java
index 37108d1880..87ae394870 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/MultiblockHandler.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/MultiblockHandler.java
@@ -37,6 +37,7 @@ public static void registerMultiblock(IMultiblock multiblock)
{
multiblocks.add(multiblock);
}
+
public static ArrayList getMultiblocks()
{
return multiblocks;
@@ -49,7 +50,7 @@ public interface IMultiblock
* returns name of the Multiblock. This is used for the interdiction NBT system on the hammer, so this name /must/ be unique.
*/
String getUniqueName();
-
+
/**
* Check whether the given block can be used to trigger the structure creation of the multiblock.
* Basically, a less resource-intensive preliminary check to avoid checking every structure.
@@ -58,6 +59,7 @@ public interface IMultiblock
/**
* This method checks the structure and sets the new one.
+ *
* @return if the structure was valid and transformed
*/
boolean createStructure(World world, BlockPos pos, EnumFacing side, EntityPlayer player);
@@ -69,16 +71,16 @@ public interface IMultiblock
default IBlockState getBlockstateFromStack(int index, ItemStack stack)
{
- if(!stack.isEmpty() && stack.getItem() instanceof ItemBlock)
+ if(!stack.isEmpty()&&stack.getItem() instanceof ItemBlock)
return ((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getItemDamage());
return null;
}
-
+
/**
* An array of ItemStacks that summarizes the total amount of materials needed for the structure. Will be rendered in the Engineer's Manual
*/
IngredientStack[] getTotalMaterials();
-
+
/**
* Use this to overwrite the rendering of a Multiblock's Component
*/
@@ -89,12 +91,13 @@ default IBlockState getBlockstateFromStack(int index, ItemStack stack)
* returns the scale modifier to be applied when rendering the structure in the IE manual
*/
float getManualScale();
-
+
/**
* returns true to add a button that will switch between the assembly of multiblocks and the finished render
*/
@SideOnly(Side.CLIENT)
boolean canRenderFormedStructure();
+
/**
* use this function to render the complete multiblock
*/
@@ -119,6 +122,7 @@ public static class MultiblockFormEvent extends PlayerEvent
private final IMultiblock multiblock;
private final BlockPos clickedBlock;
private final ItemStack hammer;
+
public MultiblockFormEvent(EntityPlayer player, IMultiblock multiblock, BlockPos clickedBlock, ItemStack hammer)
{
super(player);
@@ -131,10 +135,12 @@ public IMultiblock getMultiblock()
{
return multiblock;
}
+
public BlockPos getClickedBlock()
{
return clickedBlock;
}
+
public ItemStack getHammer()
{
return hammer;
diff --git a/src/main/java/blusunrize/immersiveengineering/api/TargetingInfo.java b/src/main/java/blusunrize/immersiveengineering/api/TargetingInfo.java
index 52fc306009..b52f16ddb4 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/TargetingInfo.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/TargetingInfo.java
@@ -13,7 +13,7 @@
/**
* @author BluSunrize - 11.03.2015
- *
+ *
* Similar too MovingObjectPosition.class, but this is specifically designed for sub-targets on a block
*/
public class TargetingInfo
@@ -22,14 +22,15 @@ public class TargetingInfo
public final float hitX;
public final float hitY;
public final float hitZ;
+
public TargetingInfo(EnumFacing side, float hitX, float hitY, float hitZ)
{
- this.side=side;
- this.hitX=hitX;
- this.hitY=hitY;
- this.hitZ=hitZ;
+ this.side = side;
+ this.hitX = hitX;
+ this.hitY = hitY;
+ this.hitZ = hitZ;
}
-
+
public void writeToNBT(NBTTagCompound tag)
{
tag.setInteger("side", side.ordinal());
@@ -37,8 +38,9 @@ public void writeToNBT(NBTTagCompound tag)
tag.setFloat("hitY", hitY);
tag.setFloat("hitZ", hitZ);
}
+
public static TargetingInfo readFromNBT(NBTTagCompound tag)
{
- return new TargetingInfo(EnumFacing.getFront(tag.getInteger("side")), tag.getFloat("hitX"),tag.getFloat("hitY"),tag.getFloat("hitZ") );
+ return new TargetingInfo(EnumFacing.getFront(tag.getInteger("side")), tag.getFloat("hitX"), tag.getFloat("hitY"), tag.getFloat("hitZ"));
}
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/AlloyRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/AlloyRecipe.java
index 1e5aa4ee1c..deca7d086b 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/AlloyRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/AlloyRecipe.java
@@ -30,19 +30,21 @@ public class AlloyRecipe
public AlloyRecipe(ItemStack output, Object input0, Object input1, int time)
{
- this.output=output;
- this.input0=ApiUtils.createIngredientStack(input0);
- this.input1=ApiUtils.createIngredientStack(input1);
- this.time=time;
+ this.output = output;
+ this.input0 = ApiUtils.createIngredientStack(input0);
+ this.input1 = ApiUtils.createIngredientStack(input1);
+ this.time = time;
}
public static ArrayList recipeList = new ArrayList();
+
public static void addRecipe(ItemStack output, Object input0, Object input1, int time)
{
AlloyRecipe recipe = new AlloyRecipe(output, input0, input1, time);
if(recipe.input0!=null&&recipe.input1!=null)
recipeList.add(recipe);
}
+
public static AlloyRecipe findRecipe(ItemStack input0, ItemStack input1)
{
for(AlloyRecipe recipe : recipeList)
@@ -50,6 +52,7 @@ public static AlloyRecipe findRecipe(ItemStack input0, ItemStack input1)
return recipe;
return null;
}
+
public static List removeRecipes(ItemStack stack)
{
List list = new ArrayList();
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/ArcFurnaceRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/ArcFurnaceRecipe.java
index db934c0928..0baacdf37f 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/ArcFurnaceRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/ArcFurnaceRecipe.java
@@ -56,16 +56,16 @@ public ArcFurnaceRecipe(ItemStack output, Object input, @Nonnull ItemStack slag,
else
{
this.additives = new IngredientStack[additives.length];
- for(int i=0; i0)
+ if(this.additives.length > 0)
this.inputList.addAll(Lists.newArrayList(this.additives));
this.outputList = ListUtils.fromItem(this.output);
}
-
+
@Override
public void setupJEI()
{
@@ -87,7 +87,7 @@ public int getMultipleProcessTicks()
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
- if(this.additives.length>0)
+ if(this.additives.length > 0)
{
NBTTagList list = new NBTTagList();
for(IngredientStack add : this.additives)
@@ -96,6 +96,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
}
return nbt;
}
+
public static ArcFurnaceRecipe loadFromNBT(NBTTagCompound nbt)
{
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
@@ -104,21 +105,21 @@ public static ArcFurnaceRecipe loadFromNBT(NBTTagCompound nbt)
{
NBTTagList list = nbt.getTagList("additives", 10);
additives = new IngredientStack[list.tagCount()];
- for(int i=0; i getOutputs(ItemStack input, NonNullList
outputs.add(output);
return outputs;
}
+
public boolean matches(ItemStack input, NonNullList additives)
{
- if(this.input!=null && this.input.matches(input))
+ if(this.input!=null&&this.input.matches(input))
{
ArrayList qAdd = new ArrayList(additives.size());
for(ItemStack s : additives)
@@ -157,7 +159,7 @@ public boolean matches(ItemStack input, NonNullList additives)
if(query.getCount() > addAmount)
{
query.shrink(addAmount);
- addAmount=0;
+ addAmount = 0;
}
else
{
@@ -167,29 +169,32 @@ public boolean matches(ItemStack input, NonNullList additives)
}
if(query.getCount() <= 0)
it.remove();
- if(addAmount<=0)
+ if(addAmount <= 0)
break;
}
}
- if(addAmount>0)
+ if(addAmount > 0)
return false;
}
return true;
}
return false;
}
+
public boolean isValidInput(ItemStack stack)
{
- return this.input!=null && this.input.matches(stack);
+ return this.input!=null&&this.input.matches(stack);
}
+
public boolean isValidAdditive(ItemStack stack)
{
for(IngredientStack add : additives)
- if(add!=null && add.matches(stack))
+ if(add!=null&&add.matches(stack))
return true;
return false;
}
+
public ArcFurnaceRecipe setSpecialRecipeType(String type)
{
this.specialRecipeType = type;
@@ -205,13 +210,15 @@ public static ArcFurnaceRecipe addRecipe(ItemStack output, Object input, @Nonnul
recipeList.add(recipe);
return recipe;
}
+
public static ArcFurnaceRecipe findRecipe(ItemStack input, NonNullList additives)
{
for(ArcFurnaceRecipe recipe : recipeList)
- if(recipe!=null && recipe.matches(input, additives))
+ if(recipe!=null&&recipe.matches(input, additives))
return recipe;
return null;
}
+
public static List removeRecipes(ItemStack stack)
{
List list = new ArrayList();
@@ -231,19 +238,21 @@ public static List removeRecipes(ItemStack stack)
public static boolean isValidRecipeInput(ItemStack stack)
{
for(ArcFurnaceRecipe recipe : recipeList)
- if(recipe!=null && recipe.isValidInput(stack))
+ if(recipe!=null&&recipe.isValidInput(stack))
return true;
return false;
}
+
public static boolean isValidRecipeAdditive(ItemStack stack)
{
for(ArcFurnaceRecipe recipe : recipeList)
- if(recipe!=null && recipe.isValidAdditive(stack))
+ if(recipe!=null&&recipe.isValidAdditive(stack))
return true;
return false;
}
public static ArrayList recyclingAllowed = new ArrayList();
+
/**
* Set an item/oredict-entry to be considered for recycling in the arc furnace. Tools and Armor should usually be auto-detected
*/
@@ -253,6 +262,7 @@ public static void allowItemForRecycling(Object stack)
}
public static ArrayList invalidRecyclingOutput = new ArrayList();
+
/**
* Set an item/oredict-entry to be an invalid output for the recycling process. Used for magical ingots that should be reclaimable or similar
*/
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/BlastFurnaceRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/BlastFurnaceRecipe.java
index 093b05ac60..c4eed2ffb0 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/BlastFurnaceRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/BlastFurnaceRecipe.java
@@ -32,19 +32,21 @@ public class BlastFurnaceRecipe
public BlastFurnaceRecipe(ItemStack output, Object input, int time, @Nonnull ItemStack slag)
{
- this.output=output;
- this.input=ApiUtils.convertToValidRecipeInput(input);
- this.time=time;
- this.slag=slag;
+ this.output = output;
+ this.input = ApiUtils.convertToValidRecipeInput(input);
+ this.time = time;
+ this.slag = slag;
}
public static ArrayList recipeList = new ArrayList();
+
public static void addRecipe(ItemStack output, Object input, int time, @Nonnull ItemStack slag)
{
BlastFurnaceRecipe recipe = new BlastFurnaceRecipe(output, input, time, slag);
if(recipe.input!=null)
recipeList.add(recipe);
}
+
public static BlastFurnaceRecipe findRecipe(ItemStack input)
{
for(BlastFurnaceRecipe recipe : recipeList)
@@ -54,6 +56,7 @@ public static BlastFurnaceRecipe findRecipe(ItemStack input)
}
return null;
}
+
public static List removeRecipes(ItemStack stack)
{
List list = new ArrayList();
@@ -71,6 +74,7 @@ public static List removeRecipes(ItemStack stack)
}
public static ArrayList blastFuels = new ArrayList();
+
public static class BlastFurnaceFuel
{
public final IngredientStack input;
@@ -82,12 +86,14 @@ public BlastFurnaceFuel(IngredientStack input, int burnTime)
this.burnTime = burnTime;
}
}
+
public static BlastFurnaceFuel addBlastFuel(Object fuel, int burnTime)
{
BlastFurnaceFuel entry = new BlastFurnaceFuel(ApiUtils.createIngredientStack(fuel), burnTime);
blastFuels.add(entry);
return entry;
}
+
public static int getBlastFuelTime(ItemStack stack)
{
for(BlastFurnaceFuel e : blastFuels)
@@ -95,8 +101,9 @@ public static int getBlastFuelTime(ItemStack stack)
return e.burnTime;
return 0;
}
+
public static boolean isValidBlastFuel(ItemStack stack)
{
- return getBlastFuelTime(stack)>0;
+ return getBlastFuelTime(stack) > 0;
}
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/BlueprintCraftingRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/BlueprintCraftingRecipe.java
index b5a5ee195d..1d143bf563 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/BlueprintCraftingRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/BlueprintCraftingRecipe.java
@@ -51,7 +51,7 @@ public BlueprintCraftingRecipe(String blueprintCategory, ItemStack output, Objec
this.blueprintCategory = blueprintCategory;
this.output = output;
this.inputs = new IngredientStack[inputs.length];
- for(int io=0; io query)
// }
// if(inputList.isEmpty())
// return true;
- return getMaxCrafted(query)>0;
+ return getMaxCrafted(query) > 0;
}
+
public int getMaxCrafted(NonNullList query)
{
HashMap queryAmount = new HashMap();
@@ -163,19 +164,19 @@ public int getMaxCrafted(NonNullList query)
if(ingr.matchesItemStackIgnoringSize(compStack))
{
int taken = e.getValue()/req;
- if(taken>0)
+ if(taken > 0)
{
e.setValue(e.getValue()-taken*req);
- if(e.getValue()<=0)
+ if(e.getValue() <= 0)
queryIt.remove();
supplied += taken;
}
}
}
- if(supplied<=0)
+ if(supplied <= 0)
return 0;
else
- maxCrafted = maxCrafted==0?supplied:Math.min(maxCrafted, supplied);
+ maxCrafted = maxCrafted==0?supplied: Math.min(maxCrafted, supplied);
}
return maxCrafted;
}
@@ -194,7 +195,7 @@ public NonNullList consumeInputs(NonNullList query, int cr
IngredientStack ingr = inputIt.next();
int inputSize = ingr.inputSize*crafted;
- for(int i = 0; i< query.size(); i++)
+ for(int i = 0; i < query.size(); i++)
{
ItemStack queryStack = query.get(i);
if(!queryStack.isEmpty())
@@ -202,7 +203,7 @@ public NonNullList consumeInputs(NonNullList query, int cr
{
int taken = Math.min(queryStack.getCount(), inputSize);
consumed.add(ApiUtils.copyStackWithAmount(queryStack, taken));
- if(taken>=queryStack.getCount() && queryStack.getItem().hasContainerItem(queryStack))
+ if(taken >= queryStack.getCount()&&queryStack.getItem().hasContainerItem(queryStack))
query.set(i, queryStack.getItem().getContainerItem(queryStack));
else
queryStack.shrink(taken);
@@ -218,6 +219,7 @@ public NonNullList consumeInputs(NonNullList query, int cr
}
return consumed;
}
+
public ArrayList getFormattedInputs()
{
ArrayList formattedInputs = new ArrayList();
@@ -227,20 +229,20 @@ public ArrayList getFormattedInputs()
boolean isNew = true;
for(IngredientStack formatted : formattedInputs)
{
- if(ingr.oreName!=null && ingr.oreName.equals(formatted.oreName))
- isNew=false;
- else if(ingr.stackList!=null && formatted.stackList!=null)
+ if(ingr.oreName!=null&&ingr.oreName.equals(formatted.oreName))
+ isNew = false;
+ else if(ingr.stackList!=null&&formatted.stackList!=null)
{
for(ItemStack iStack : ingr.stackList)
for(ItemStack iStack2 : formatted.stackList)
if(OreDictionary.itemMatches(iStack, iStack2, false))
{
- isNew=false;
+ isNew = false;
break;
}
}
- else if(!ingr.stack.isEmpty() && OreDictionary.itemMatches(ingr.stack, formatted.stack, false))
- isNew=false;
+ else if(!ingr.stack.isEmpty()&&OreDictionary.itemMatches(ingr.stack, formatted.stack, false))
+ isNew = false;
if(!isNew)
formatted.inputSize += ingr.inputSize;
}
@@ -263,6 +265,7 @@ public static void addRecipe(String blueprintCategory, ItemStack output, Object.
if(!blueprintCategories.contains(blueprintCategory))
blueprintCategories.add(blueprintCategory);
}
+
public static BlueprintCraftingRecipe[] findRecipes(String blueprintCategory)
{
if(recipeList.containsKey(blueprintCategory))
@@ -286,6 +289,7 @@ public int getMultipleProcessTicks()
{
return 0;
}
+
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
@@ -296,20 +300,21 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
nbt.setString("blueprintCategory", this.blueprintCategory);
return nbt;
}
+
public static BlueprintCraftingRecipe loadFromNBT(NBTTagCompound nbt)
{
NBTTagList list = nbt.getTagList("inputs", 10);
IngredientStack[] inputs = new IngredientStack[list.tagCount()];
- for(int i=0; i recipeList = BlueprintCraftingRecipe.recipeList.get(nbt.getString("blueprintCategory"));
for(BlueprintCraftingRecipe recipe : recipeList)
{
boolean b = false;
- for(int i=0; i recipeList = new ArrayList();
+
public static void addRecipe(ItemStack output, Object input, FluidStack fluidInput)
{
BottlingMachineRecipe recipe = new BottlingMachineRecipe(output, input, fluidInput);
if(recipe.input!=null)
recipeList.add(recipe);
}
+
public static BottlingMachineRecipe findRecipe(ItemStack input, FluidStack fluid)
{
- if(!input.isEmpty() && fluid!=null)
+ if(!input.isEmpty()&&fluid!=null)
for(BottlingMachineRecipe recipe : recipeList)
- if(ApiUtils.stackMatchesObject(input, recipe.input) && fluid.containsFluid(recipe.fluidInput))
+ if(ApiUtils.stackMatchesObject(input, recipe.input)&&fluid.containsFluid(recipe.fluidInput))
return recipe;
return null;
}
+
public static List removeRecipes(ItemStack stack)
{
List list = new ArrayList();
@@ -84,6 +88,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static BottlingMachineRecipe loadFromNBT(NBTTagCompound nbt)
{
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/CokeOvenRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/CokeOvenRecipe.java
index 91cc48d50c..ea9266465c 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/CokeOvenRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/CokeOvenRecipe.java
@@ -30,19 +30,21 @@ public class CokeOvenRecipe
public CokeOvenRecipe(ItemStack output, Object input, int time, int creosoteOutput)
{
- this.output=output;
- this.input=ApiUtils.convertToValidRecipeInput(input);
- this.time=time;
- this.creosoteOutput=creosoteOutput;
+ this.output = output;
+ this.input = ApiUtils.convertToValidRecipeInput(input);
+ this.time = time;
+ this.creosoteOutput = creosoteOutput;
}
public static ArrayList recipeList = new ArrayList();
+
public static void addRecipe(ItemStack output, Object input, int time, int creosoteOutput)
{
CokeOvenRecipe recipe = new CokeOvenRecipe(output, input, time, creosoteOutput);
if(recipe.input!=null)
recipeList.add(recipe);
}
+
public static CokeOvenRecipe findRecipe(ItemStack input)
{
for(CokeOvenRecipe recipe : recipeList)
@@ -50,6 +52,7 @@ public static CokeOvenRecipe findRecipe(ItemStack input)
return recipe;
return null;
}
+
public static List removeRecipes(ItemStack stack)
{
List list = new ArrayList();
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/CrusherRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/CrusherRecipe.java
index a7ece38d34..38739e5bea 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/CrusherRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/CrusherRecipe.java
@@ -25,7 +25,7 @@
/**
* @author BluSunrize - 01.05.2015
- *
+ *
* The recipe for the crusher
*/
public class CrusherRecipe extends MultiblockRecipe
@@ -56,7 +56,7 @@ public NonNullList getActualItemOutputs(TileEntity tile)
{
NonNullList list = NonNullList.create();
list.add(output);
- if(secondaryOutput != null && secondaryChance != null)
+ if(secondaryOutput!=null&&secondaryChance!=null)
for(int i = 0; i < secondaryOutput.length; i++)
if(Utils.RAND.nextFloat() < secondaryChance[i])
list.add(secondaryOutput[i]);
@@ -74,12 +74,12 @@ public CrusherRecipe addToSecondaryOutput(Object... outputs)
ArrayList newSecondaryOutput = new ArrayList();
ArrayList newSecondaryChance = new ArrayList();
if(secondaryOutput!=null)
- for(int i=0; i recipeList = new ArrayList();
+
public static CrusherRecipe addRecipe(ItemStack output, Object input, int energy)
{
CrusherRecipe r = new CrusherRecipe(output, input, energy);
- if(r.input!=null && !r.output.isEmpty())
+ if(r.input!=null&&!r.output.isEmpty())
recipeList.add(r);
return r;
}
+
public static CrusherRecipe findRecipe(ItemStack input)
{
for(CrusherRecipe recipe : recipeList)
@@ -120,6 +122,7 @@ public static CrusherRecipe findRecipe(ItemStack input)
return recipe;
return null;
}
+
public static List removeRecipesForOutput(ItemStack stack)
{
List list = new ArrayList();
@@ -135,6 +138,7 @@ public static List removeRecipesForOutput(ItemStack stack)
}
return list;
}
+
public static List removeRecipesForInput(ItemStack stack)
{
List list = new ArrayList();
@@ -163,6 +167,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static CrusherRecipe loadFromNBT(NBTTagCompound nbt)
{
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/FermenterRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/FermenterRecipe.java
index 731fec095f..c6b6f4fdbe 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/FermenterRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/FermenterRecipe.java
@@ -23,18 +23,19 @@
/**
* @author BluSunrize - 01.03.2016
- *
+ *
* The recipe for the Fermenter
*/
public class FermenterRecipe extends MultiblockRecipe
{
public static float energyModifier = 1;
public static float timeModifier = 1;
-
+
public final IngredientStack input;
public final FluidStack fluidOutput;
@Nonnull
public final ItemStack itemOutput;
+
public FermenterRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Object input, int energy)
{
this.fluidOutput = fluidOutput;
@@ -47,19 +48,22 @@ public FermenterRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Ob
this.fluidOutputList = Lists.newArrayList(this.fluidOutput);
this.outputList = ListUtils.fromItem(this.itemOutput);
}
+
public FermenterRecipe setInputSize(int size)
{
this.input.inputSize = size;
return this;
}
-
+
public static ArrayList recipeList = new ArrayList();
+
public static FermenterRecipe addRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Object input, int energy)
{
FermenterRecipe r = new FermenterRecipe(fluidOutput, itemOutput, input, energy);
recipeList.add(r);
return r;
}
+
public static FermenterRecipe findRecipe(ItemStack input)
{
if(input.isEmpty())
@@ -93,13 +97,14 @@ public int getMultipleProcessTicks()
{
return 0;
}
-
+
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static FermenterRecipe loadFromNBT(NBTTagCompound nbt)
{
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
@@ -108,11 +113,12 @@ public static FermenterRecipe loadFromNBT(NBTTagCompound nbt)
return recipe;
return null;
}
+
public static Map getFluidValuesSorted(Fluid f, boolean inverse)
{
HashMap map = new HashMap();
for(FermenterRecipe recipe : recipeList)
- if(recipe.fluidOutput!=null && recipe.fluidOutput.getFluid()==f)
+ if(recipe.fluidOutput!=null&&recipe.fluidOutput.getFluid()==f)
{
ItemStack is = recipe.input.getExampleStack();
map.put(is.getDisplayName(), recipe.fluidOutput.amount);
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/IJEIRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/IJEIRecipe.java
index 74944e8eea..3039998717 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/IJEIRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/IJEIRecipe.java
@@ -15,9 +15,16 @@
public interface IJEIRecipe
{
- default boolean listInJEI() { return true; }
+ default boolean listInJEI()
+ {
+ return true;
+ }
+
List getJEITotalItemInputs();
+
List getJEITotalItemOutputs();
+
List getJEITotalFluidInputs();
+
List getJEITotalFluidOutputs();
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/IMultiblockRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/IMultiblockRecipe.java
index f2a14bbfcc..af0a69af09 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/IMultiblockRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/IMultiblockRecipe.java
@@ -26,13 +26,16 @@
public interface IMultiblockRecipe
{
List getItemInputs();
+
List getFluidInputs();
+
NonNullList getItemOutputs();
default NonNullList getActualItemOutputs(TileEntity tile)
{
return getItemOutputs();
}
+
List getFluidOutputs();
default ItemStack getDisplayStack(ItemStack input)
@@ -47,10 +50,12 @@ default List getActualFluidOutputs(TileEntity tile)
{
return getFluidOutputs();
}
-
+
int getTotalProcessTime();
+
int getTotalProcessEnergy();
+
int getMultipleProcessTicks();
-
+
NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound);
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/IngredientStack.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/IngredientStack.java
index 8a1fd028ae..04a2a51436 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/IngredientStack.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/IngredientStack.java
@@ -40,28 +40,34 @@ public IngredientStack(ItemStack stack)
this.stack = stack;
this.inputSize = stack.getCount();
}
+
public IngredientStack(String oreName, int inputSize)
{
this.oreName = oreName;
this.inputSize = inputSize;
}
+
public IngredientStack(String oreName)
{
this(oreName, 1);
}
+
public IngredientStack(List stackList, int inputSize)
{
this.stackList = stackList;
this.inputSize = inputSize;
}
+
public IngredientStack(List stackList)
{
this(stackList, 1);
}
+
public IngredientStack(FluidStack fluid)
{
this.fluid = fluid;
}
+
public IngredientStack(IngredientStack ingr)
{
this.stack = ingr.stack;
@@ -84,7 +90,7 @@ public boolean matches(Object input)
if(input==null)
return false;
if(input instanceof IngredientStack)
- return this.equals(input) && this.inputSize <= ((IngredientStack)input).inputSize;
+ return this.equals(input)&&this.inputSize <= ((IngredientStack)input).inputSize;
if(input instanceof ItemStack)
{
return matchesItemStack((ItemStack)input);
@@ -116,6 +122,7 @@ public IngredientStack copyWithSize(int size)
is.inputSize = size;
return is;
}
+
public IngredientStack copyWithMultipliedSize(double multiplier)
{
return copyWithSize((int)Math.floor(this.inputSize*multiplier));
@@ -153,13 +160,13 @@ else if(stackList!=null)
public ItemStack getRandomizedExampleStack(long rand)
{
ItemStack ret = stack;
- if(ret.isEmpty()&&stackList!=null&&stackList.size()>0)
- ret = stackList.get((int)(rand / 20) % stackList.size());
+ if(ret.isEmpty()&&stackList!=null&&stackList.size() > 0)
+ ret = stackList.get((int)(rand/20)%stackList.size());
if(ret.isEmpty()&&oreName!=null)
{
List ores = OreDictionary.getOres(oreName);
- if(ores!=null&&ores.size()>0)
- ret = ores.get((int)(rand / 20) % ores.size());
+ if(ores!=null&&ores.size() > 0)
+ ret = ores.get((int)(rand/20)%ores.size());
}
if(ret.isEmpty()&&fluid!=null&&ForgeModContainer.getInstance().universalBucket!=null)
ret = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid.getFluid());
@@ -169,22 +176,23 @@ public ItemStack getRandomizedExampleStack(long rand)
public ItemStack getExampleStack()
{
ItemStack ret = stack;
- if(ret.isEmpty() && stackList != null && stackList.size() > 0)
+ if(ret.isEmpty()&&stackList!=null&&stackList.size() > 0)
ret = stackList.get(0);
- if(ret.isEmpty() && oreName != null)
+ if(ret.isEmpty()&&oreName!=null)
{
List ores = OreDictionary.getOres(oreName);
- if(ores != null && ores.size() > 0)
+ if(ores!=null&&ores.size() > 0)
ret = ores.get(0);
}
- if(ret.isEmpty() && fluid != null && ForgeModContainer.getInstance().universalBucket != null)
+ if(ret.isEmpty()&&fluid!=null&&ForgeModContainer.getInstance().universalBucket!=null)
ret = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid.getFluid());
return ret;
}
+
public Ingredient toRecipeIngredient()
{
- Ingredient ret = stack!=null?Ingredient.fromStacks(stack):null;
- if(ret==null&&stackList!=null&&stackList.size()>0)
+ Ingredient ret = stack!=null?Ingredient.fromStacks(stack): null;
+ if(ret==null&&stackList!=null&&stackList.size() > 0)
ret = ApiUtils.createIngredientFromList(stackList);
if(ret==null&&oreName!=null)
ret = new OreIngredient(oreName);
@@ -200,24 +208,24 @@ public boolean matchesItemStack(ItemStack input)
if(this.fluid!=null)
{
FluidStack fs = FluidUtil.getFluidContained(input);
- if(fs!=null && fs.containsFluid(fluid))
+ if(fs!=null&&fs.containsFluid(fluid))
return true;
}
if(this.oreName!=null)
- return ApiUtils.compareToOreName(input, oreName) && this.inputSize <= input.getCount();
+ return ApiUtils.compareToOreName(input, oreName)&&this.inputSize <= input.getCount();
if(this.stackList!=null)
{
for(ItemStack iStack : this.stackList)
- if(OreDictionary.itemMatches(iStack, input, false) && this.inputSize <= input.getCount())
+ if(OreDictionary.itemMatches(iStack, input, false)&&this.inputSize <= input.getCount())
return true;
}
- if(!OreDictionary.itemMatches(stack,input, false) || this.inputSize > input.getCount())
+ if(!OreDictionary.itemMatches(stack, input, false)||this.inputSize > input.getCount())
return false;
if(this.useNBT)
{
- if(this.stack.hasTagCompound() != input.hasTagCompound())
+ if(this.stack.hasTagCompound()!=input.hasTagCompound())
return false;
- if(!this.stack.hasTagCompound() && !input.hasTagCompound())
+ if(!this.stack.hasTagCompound()&&!input.hasTagCompound())
return true;
return this.stack.getTagCompound().equals(input.getTagCompound());
}
@@ -231,7 +239,7 @@ public boolean matchesItemStackIgnoringSize(ItemStack input)
if(this.fluid!=null)
{
FluidStack fs = FluidUtil.getFluidContained(input);
- if(fs!=null && fs.containsFluid(fluid))
+ if(fs!=null&&fs.containsFluid(fluid))
return true;
}
if(this.oreName!=null)
@@ -242,13 +250,13 @@ public boolean matchesItemStackIgnoringSize(ItemStack input)
if(OreDictionary.itemMatches(iStack, input, false))
return true;
}
- if(!OreDictionary.itemMatches(stack,input, false))
+ if(!OreDictionary.itemMatches(stack, input, false))
return false;
if(this.useNBT)
{
- if(this.stack.hasTagCompound() != input.hasTagCompound())
+ if(this.stack.hasTagCompound()!=input.hasTagCompound())
return false;
- if(!this.stack.hasTagCompound() && !input.hasTagCompound())
+ if(!this.stack.hasTagCompound()&&!input.hasTagCompound())
return true;
return this.stack.getTagCompound().equals(input.getTagCompound());
}
@@ -260,28 +268,28 @@ public boolean equals(Object object)
{
if(!(object instanceof IngredientStack))
return false;
- if(this.fluid!=null && ((IngredientStack)object).fluid!=null)
+ if(this.fluid!=null&&((IngredientStack)object).fluid!=null)
return this.fluid.equals(((IngredientStack)object).fluid);
- if(this.oreName!=null && ((IngredientStack)object).oreName!=null)
+ if(this.oreName!=null&&((IngredientStack)object).oreName!=null)
return this.oreName.equals(((IngredientStack)object).oreName);
- if(this.stackList != null && ((IngredientStack) object).stackList != null)
+ if(this.stackList!=null&&((IngredientStack)object).stackList!=null)
{
for(ItemStack iStack : this.stackList)
- for(ItemStack iStack2 : ((IngredientStack) object).stackList)
+ for(ItemStack iStack2 : ((IngredientStack)object).stackList)
if(OreDictionary.itemMatches(iStack, iStack2, false))
return true;
return false;
}
- if(!this.stack.isEmpty() && !((IngredientStack)object).stack.isEmpty())
+ if(!this.stack.isEmpty()&&!((IngredientStack)object).stack.isEmpty())
{
ItemStack otherStack = ((IngredientStack)object).stack;
- if(!OreDictionary.itemMatches(stack,otherStack, false))
+ if(!OreDictionary.itemMatches(stack, otherStack, false))
return false;
if(this.useNBT)
{
- if(this.stack.hasTagCompound() != otherStack.hasTagCompound())
+ if(this.stack.hasTagCompound()!=otherStack.hasTagCompound())
return false;
- if(!this.stack.hasTagCompound() && !otherStack.hasTagCompound())
+ if(!this.stack.hasTagCompound()&&!otherStack.hasTagCompound())
return true;
return this.stack.getTagCompound().equals(otherStack.getTagCompound());
}
@@ -321,6 +329,7 @@ else if(this.stackList!=null)
nbt.setInteger("inputSize", inputSize);
return nbt;
}
+
public static IngredientStack readFromNBT(NBTTagCompound nbt)
{
if(nbt.hasKey("nbtType"))
@@ -335,13 +344,13 @@ public static IngredientStack readFromNBT(NBTTagCompound nbt)
case 1:
NBTTagList list = nbt.getTagList("stackList", 10);
List stackList = new ArrayList();
- for(int i=0; i
* The recipe for the metal press
*/
public class MetalPressRecipe extends MultiblockRecipe
{
public static float energyModifier = 1;
public static float timeModifier = 1;
-
+
public final IngredientStack input;
public final ComparableItemStack mold;
public final ItemStack output;
+
public MetalPressRecipe(ItemStack output, Object input, ComparableItemStack mold, int energy)
{
this.output = output;
@@ -44,17 +45,19 @@ public MetalPressRecipe(ItemStack output, Object input, ComparableItemStack mold
this.inputList = Lists.newArrayList(this.input);
this.outputList = ListUtils.fromItem(this.output);
}
+
public MetalPressRecipe setInputSize(int size)
{
this.input.inputSize = size;
return this;
}
+
@Override
public void setupJEI()
{
super.setupJEI();
this.jeiItemInputList = new ArrayList[2];
- this.jeiItemInputList[0] =Lists.newArrayList(jeiTotalItemInputList);
+ this.jeiItemInputList[0] = Lists.newArrayList(jeiTotalItemInputList);
this.jeiItemInputList[1] = Lists.newArrayList(mold.stack);
this.jeiTotalItemInputList.add(mold.stack);
}
@@ -63,25 +66,29 @@ public boolean matches(ItemStack mold, ItemStack input)
{
return this.input.matches(input);
}
+
public MetalPressRecipe getActualRecipe(ItemStack mold, ItemStack input)
{
return this;
}
public static ArrayListMultimap recipeList = ArrayListMultimap.create();
+
public static MetalPressRecipe addRecipe(ItemStack output, Object input, ItemStack mold, int energy)
{
return addRecipe(output, input, ApiUtils.createComparableItemStack(mold, true), energy);
}
+
public static MetalPressRecipe addRecipe(ItemStack output, Object input, ComparableItemStack mold, int energy)
{
MetalPressRecipe r = new MetalPressRecipe(output, input, mold, energy);
recipeList.put(mold, r);
return r;
}
+
public static MetalPressRecipe findRecipe(ItemStack mold, ItemStack input)
{
- if(mold.isEmpty() || input.isEmpty())
+ if(mold.isEmpty()||input.isEmpty())
return null;
ComparableItemStack comp = ApiUtils.createComparableItemStack(mold, false);
List list = recipeList.get(comp);
@@ -90,6 +97,7 @@ public static MetalPressRecipe findRecipe(ItemStack mold, ItemStack input)
return recipe.getActualRecipe(mold, input);
return null;
}
+
public static List removeRecipes(ItemStack output)
{
List list = new ArrayList();
@@ -109,6 +117,7 @@ public static List removeRecipes(ItemStack output)
}
return list;
}
+
public static boolean isValidMold(ItemStack itemStack)
{
if(itemStack.isEmpty())
@@ -122,7 +131,8 @@ public int getMultipleProcessTicks()
return 0;
}
- public static HashMap> deserializers = new HashMap<>();
+ public static HashMap> deserializers = new HashMap<>();
+
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
@@ -130,9 +140,10 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
nbt.setTag("mold", mold.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static MetalPressRecipe loadFromNBT(NBTTagCompound nbt)
{
- if(nbt.hasKey("type") && deserializers.containsKey(nbt.getString("type")))
+ if(nbt.hasKey("type")&&deserializers.containsKey(nbt.getString("type")))
return deserializers.get(nbt.getString("type")).apply(nbt);
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
ComparableItemStack mold = ComparableItemStack.readFromNBT(nbt.getCompoundTag("mold"));
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/MixerRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/MixerRecipe.java
index e6784d8ad3..5a665c4b30 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/MixerRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/MixerRecipe.java
@@ -23,7 +23,7 @@
/**
* @author BluSunrize - 20.02.2016
- *
+ *
* The recipe for the Squeezer
*/
public class MixerRecipe extends MultiblockRecipe
@@ -35,24 +35,26 @@ public class MixerRecipe extends MultiblockRecipe
public final FluidStack fluidInput;
public final FluidStack fluidOutput;
public final int fluidAmount;
+
public MixerRecipe(FluidStack fluidOutput, FluidStack fluidInput, Object[] itemInputs, int energy)
{
this.fluidOutput = fluidOutput;
this.fluidAmount = fluidOutput.amount;
this.fluidInput = fluidInput;
- this.itemInputs = new IngredientStack[itemInputs==null?0:itemInputs.length];
+ this.itemInputs = new IngredientStack[itemInputs==null?0: itemInputs.length];
if(itemInputs!=null)
- for(int i=0; i recipeList = new ArrayList();
+
public static MixerRecipe addRecipe(FluidStack fluidOutput, FluidStack fluidInput, Object[] itemInput, int energy)
{
MixerRecipe r = new MixerRecipe(fluidOutput, fluidInput, itemInput, energy);
@@ -77,7 +79,7 @@ public FluidStack getFluidOutput(FluidStack input, NonNullList compon
public boolean matches(FluidStack fluid, NonNullList components)
{
- if(fluid!=null && fluid.containsFluid(this.fluidInput))
+ if(fluid!=null&&fluid.containsFluid(this.fluidInput))
{
ArrayList queryList = new ArrayList(components.size());
@@ -99,7 +101,7 @@ public boolean matches(FluidStack fluid, NonNullList components)
if(query.getCount() > addAmount)
{
query.shrink(addAmount);
- addAmount=0;
+ addAmount = 0;
}
else
{
@@ -108,11 +110,11 @@ public boolean matches(FluidStack fluid, NonNullList components)
}
if(query.getCount() <= 0)
it.remove();
- if(addAmount<=0)
+ if(addAmount <= 0)
break;
}
}
- if(addAmount>0)
+ if(addAmount > 0)
return false;
}
return true;
@@ -123,11 +125,11 @@ public boolean matches(FluidStack fluid, NonNullList components)
public int[] getUsedSlots(FluidStack input, NonNullList components)
{
Set usedSlotSet = new HashSet();
- for(int i=0; i0)
+ if(this.itemInputs.length > 0)
{
NBTTagList list = new NBTTagList();
for(IngredientStack add : this.itemInputs)
@@ -159,6 +161,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
}
return nbt;
}
+
public static MixerRecipe loadFromNBT(NBTTagCompound nbt)
{
FluidStack fluidInput = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("fluidInput"));
@@ -167,21 +170,21 @@ public static MixerRecipe loadFromNBT(NBTTagCompound nbt)
{
NBTTagList list = nbt.getTagList("itemInputs", 10);
itemInputs = new IngredientStack[list.tagCount()];
- for(int i=0; i inputList;
+
@Override
public List getItemInputs()
{
return inputList;
}
+
protected NonNullList outputList;
+
@Override
public NonNullList getItemOutputs()
{
return outputList;
}
+
protected List fluidInputList;
+
@Override
public List getFluidInputs()
{
return fluidInputList;
}
+
protected List fluidOutputList;
+
@Override
public List getFluidOutputs()
{
@@ -47,12 +54,15 @@ public List getFluidOutputs()
}
int totalProcessTime;
+
@Override
public int getTotalProcessTime()
{
return this.totalProcessTime;
}
+
int totalProcessEnergy;
+
@Override
public int getTotalProcessEnergy()
{
@@ -76,7 +86,7 @@ public void setupJEI()
{
this.jeiItemInputList = new ArrayList[inputList.size()];
this.jeiTotalItemInputList = new ArrayList();
- for(int i=0; i list = Lists.newArrayList(!s.isEmpty()?s.copy():ItemStack.EMPTY);
+ ArrayList list = Lists.newArrayList(!s.isEmpty()?s.copy(): ItemStack.EMPTY);
this.jeiItemOutputList[i] = list;
this.jeiTotalItemOutputList.addAll(list);
}
@@ -112,7 +122,7 @@ else if(ingr.stackList!=null)
if(fluidInputList!=null)
{
this.jeiFluidInputList = new ArrayList();
- for(int i=0; i getJEITotalItemInputs()
{
return jeiTotalItemInputList;
}
+
@Override
public List getJEITotalItemOutputs()
{
return jeiTotalItemOutputList;
}
+
@Override
public List getJEITotalFluidInputs()
{
return jeiFluidInputList;
}
+
@Override
public List getJEITotalFluidOutputs()
{
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/RefineryRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/RefineryRecipe.java
index 4800e9e2b4..6324618961 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/RefineryRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/RefineryRecipe.java
@@ -17,7 +17,7 @@
/**
* @author BluSunrize - 02.03.2016
- *
+ *
* The recipe for the Refinery
*/
public class RefineryRecipe extends MultiblockRecipe
@@ -28,6 +28,7 @@ public class RefineryRecipe extends MultiblockRecipe
public final FluidStack output;
public final FluidStack input0;
public final FluidStack input1;
+
public RefineryRecipe(FluidStack output, FluidStack input0, FluidStack input1, int energy)
{
this.output = output;
@@ -36,69 +37,72 @@ public RefineryRecipe(FluidStack output, FluidStack input0, FluidStack input1, i
this.totalProcessEnergy = (int)Math.floor(energy*energyModifier);
this.totalProcessTime = (int)Math.floor(1*timeModifier);
- this.fluidInputList = Lists.newArrayList(this.input0,this.input1);
+ this.fluidInputList = Lists.newArrayList(this.input0, this.input1);
this.fluidOutputList = Lists.newArrayList(this.output);
}
public static ArrayList recipeList = new ArrayList();
+
public static RefineryRecipe addRecipe(FluidStack output, FluidStack input0, FluidStack input1, int energy)
{
RefineryRecipe r = new RefineryRecipe(output, input0, input1, energy);
recipeList.add(r);
return r;
}
+
public static RefineryRecipe findRecipe(FluidStack input0, FluidStack input1)
{
for(RefineryRecipe recipe : recipeList)
{
if(input0!=null)
{
- if(recipe.input0!=null && input0.containsFluid(recipe.input0))
+ if(recipe.input0!=null&&input0.containsFluid(recipe.input0))
{
- if((recipe.input1==null&&input1==null) || (recipe.input1!=null&&input1!=null&&input1.containsFluid(recipe.input1)))
+ if((recipe.input1==null&&input1==null)||(recipe.input1!=null&&input1!=null&&input1.containsFluid(recipe.input1)))
return recipe;
}
- if(recipe.input1!=null && input0.containsFluid(recipe.input1))
+ if(recipe.input1!=null&&input0.containsFluid(recipe.input1))
{
- if((recipe.input0==null&&input1==null) || (recipe.input0!=null&&input1!=null&&input1.containsFluid(recipe.input0)))
+ if((recipe.input0==null&&input1==null)||(recipe.input0!=null&&input1!=null&&input1.containsFluid(recipe.input0)))
return recipe;
}
}
else if(input1!=null)
{
- if(recipe.input0!=null && input1.containsFluid(recipe.input0) && recipe.input1==null)
+ if(recipe.input0!=null&&input1.containsFluid(recipe.input0)&&recipe.input1==null)
return recipe;
- if(recipe.input1!=null && input1.containsFluid(recipe.input1) && recipe.input0==null)
+ if(recipe.input1!=null&&input1.containsFluid(recipe.input1)&&recipe.input0==null)
return recipe;
}
}
return null;
}
+
public static List findIncompleteRefineryRecipe(FluidStack input0, FluidStack input1)
{
- if(input0==null && input1==null)
+ if(input0==null&&input1==null)
return null;
List list = Lists.newArrayList();
for(RefineryRecipe recipe : recipeList)
{
- if(input0!=null && input1==null)
+ if(input0!=null&&input1==null)
{
- if(input0.isFluidEqual(recipe.input0) || input0.isFluidEqual(recipe.input1))
+ if(input0.isFluidEqual(recipe.input0)||input0.isFluidEqual(recipe.input1))
{
list.add(recipe);
break;
}
}
- else if(input0==null && input1!=null)
+ else if(input0==null&&input1!=null)
{
- if(input1.isFluidEqual(recipe.input0) || input1.isFluidEqual(recipe.input1))
+ if(input1.isFluidEqual(recipe.input0)||input1.isFluidEqual(recipe.input1))
{
list.add(recipe);
break;
}
}
- else if( (input0.isFluidEqual(recipe.input0)&&input1.isFluidEqual(recipe.input1)) || (input0.isFluidEqual(recipe.input1)&&input1.isFluidEqual(recipe.input0)) )
+ else if((input0.isFluidEqual(recipe.input0)&&input1.isFluidEqual(recipe.input1))||(input0.isFluidEqual(recipe.input1)&&input1.isFluidEqual(recipe.input0)))
{
list.add(recipe);
break;
@@ -120,6 +124,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
nbt.setTag("input1", input1.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static RefineryRecipe loadFromNBT(NBTTagCompound nbt)
{
FluidStack input0 = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("input0"));
diff --git a/src/main/java/blusunrize/immersiveengineering/api/crafting/SqueezerRecipe.java b/src/main/java/blusunrize/immersiveengineering/api/crafting/SqueezerRecipe.java
index 55f2145a92..1a58a69b3e 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/crafting/SqueezerRecipe.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/crafting/SqueezerRecipe.java
@@ -23,18 +23,19 @@
/**
* @author BluSunrize - 20.02.2016
- *
+ *
* The recipe for the Squeezer
*/
public class SqueezerRecipe extends MultiblockRecipe
{
public static float energyModifier = 1;
public static float timeModifier = 1;
-
+
public final IngredientStack input;
public final FluidStack fluidOutput;
@Nonnull
public final ItemStack itemOutput;
+
public SqueezerRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Object input, int energy)
{
this.fluidOutput = fluidOutput;
@@ -47,19 +48,22 @@ public SqueezerRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Obj
this.fluidOutputList = Lists.newArrayList(this.fluidOutput);
this.outputList = ListUtils.fromItem(this.itemOutput);
}
+
public SqueezerRecipe setInputSize(int size)
{
this.input.inputSize = size;
return this;
}
-
+
public static ArrayList recipeList = new ArrayList();
+
public static SqueezerRecipe addRecipe(FluidStack fluidOutput, @Nonnull ItemStack itemOutput, Object input, int energy)
{
SqueezerRecipe r = new SqueezerRecipe(fluidOutput, itemOutput, input, energy);
recipeList.add(r);
return r;
}
+
public static SqueezerRecipe findRecipe(ItemStack input)
{
if(input.isEmpty())
@@ -93,13 +97,14 @@ public int getMultipleProcessTicks()
{
return 0;
}
-
+
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setTag("input", input.writeToNBT(new NBTTagCompound()));
return nbt;
}
+
public static SqueezerRecipe loadFromNBT(NBTTagCompound nbt)
{
IngredientStack input = IngredientStack.readFromNBT(nbt.getCompoundTag("input"));
@@ -108,11 +113,12 @@ public static SqueezerRecipe loadFromNBT(NBTTagCompound nbt)
return recipe;
return null;
}
+
public static Map getFluidValuesSorted(Fluid f, boolean inverse)
{
HashMap map = new HashMap();
for(SqueezerRecipe recipe : recipeList)
- if(recipe.fluidOutput!=null && recipe.fluidOutput.getFluid()==f)
+ if(recipe.fluidOutput!=null&&recipe.fluidOutput.getFluid()==f)
{
ItemStack is = recipe.input.getExampleStack();
map.put(is.getDisplayName(), recipe.fluidOutput.amount);
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/DieselHandler.java b/src/main/java/blusunrize/immersiveengineering/api/energy/DieselHandler.java
index 0a457ab047..2fdf044e3d 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/DieselHandler.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/DieselHandler.java
@@ -18,7 +18,7 @@
/**
* @author BluSunrize - 23.04.2015
- *
+ *
* The Fuel Handler for the Diesel Generator. Use this to register custom fuels
*/
public class DieselHandler
@@ -32,13 +32,13 @@ public class DieselHandler
*/
public static void registerFuel(Fluid fuel, int time)
{
- if(fuel != null)
+ if(fuel!=null)
dieselGenBurnTime.put(fuel.getName(), time);
}
public static int getBurnTime(Fluid fuel)
{
- if(fuel != null)
+ if(fuel!=null)
{
String s = fuel.getName();
if(dieselGenBurnTime.containsKey(s))
@@ -49,7 +49,7 @@ public static int getBurnTime(Fluid fuel)
public static boolean isValidFuel(Fluid fuel)
{
- if(fuel != null)
+ if(fuel!=null)
return dieselGenBurnTime.containsKey(fuel.getName());
return false;
}
@@ -66,22 +66,25 @@ public static Map getFuelValuesSorted(boolean inverse)
public static void registerDrillFuel(Fluid fuel)
{
- if(fuel != null)
+ if(fuel!=null)
drillFuel.add(fuel);
}
public static boolean isValidDrillFuel(Fluid fuel)
{
- return fuel != null && drillFuel.contains(fuel);
+ return fuel!=null&&drillFuel.contains(fuel);
}
-
- public static void removeFuel(Fluid fuel){
- if(fuel != null){
+
+ public static void removeFuel(Fluid fuel)
+ {
+ if(fuel!=null)
+ {
dieselGenBurnTime.remove(fuel.getName());
}
}
-
- public static void removeDrillFuel(Fluid fuel){
+
+ public static void removeDrillFuel(Fluid fuel)
+ {
drillFuel.remove(fuel);
}
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorage.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorage.java
index b749b486e1..5f20bc428b 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorage.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorage.java
@@ -12,9 +12,8 @@
/**
* A simple storage object for IF and an example implementation of {@link IFluxStorage}.
- *
+ *
* @author BluSunrize - 18.01.2016
- *
*/
public class FluxStorage implements IFluxStorage
{
@@ -29,10 +28,12 @@ public FluxStorage(int capacity, int limitReceive, int limitExtract)
this.limitReceive = limitReceive;
this.limitExtract = limitExtract;
}
+
public FluxStorage(int capacity, int limitTransfer)
{
this(capacity, limitTransfer, limitTransfer);
}
+
public FluxStorage(int capacity)
{
this(capacity, capacity, capacity);
@@ -41,13 +42,14 @@ public FluxStorage(int capacity)
public FluxStorage readFromNBT(NBTTagCompound nbt)
{
this.energy = nbt.getInteger("ifluxEnergy");
- if(energy>capacity)
+ if(energy > capacity)
energy = capacity;
return this;
}
+
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
- if(energy<0)
+ if(energy < 0)
energy = 0;
nbt.setInteger("ifluxEnergy", energy);
return nbt;
@@ -56,7 +58,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt)
public void setCapacity(int capacity)
{
this.capacity = capacity;
- if(energy>capacity)
+ if(energy > capacity)
energy = capacity;
}
@@ -65,10 +67,12 @@ public void setLimitTransfer(int limitTransfer)
setLimitReceive(limitTransfer);
setMaxExtract(limitTransfer);
}
+
public void setLimitReceive(int limitReceive)
{
this.limitReceive = limitReceive;
}
+
public void setMaxExtract(int limitExtract)
{
this.limitExtract = limitExtract;
@@ -78,6 +82,7 @@ public int getLimitReceive()
{
return limitReceive;
}
+
public int getLimitExtract()
{
return limitExtract;
@@ -86,17 +91,18 @@ public int getLimitExtract()
public void setEnergy(int energy)
{
this.energy = energy;
- if (this.energy>capacity)
+ if(this.energy > capacity)
this.energy = capacity;
- else if (this.energy<0)
+ else if(this.energy < 0)
this.energy = 0;
}
+
public void modifyEnergyStored(int energy)
{
this.energy += energy;
- if(this.energy>capacity)
+ if(this.energy > capacity)
this.energy = capacity;
- else if(this.energy<0)
+ else if(this.energy < 0)
this.energy = 0;
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorageAdvanced.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorageAdvanced.java
index 1a47cb1b9b..f50d0c7515 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorageAdvanced.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/FluxStorageAdvanced.java
@@ -10,24 +10,25 @@
/**
* An advanced implementation of {@link IFluxStorage}, keeps track of the average in/output to allow transfer evaluation.
- *
+ *
* @author BluSunrize - 02.02.2016
- *
*/
public class FluxStorageAdvanced extends FluxStorage
{
- int averageInsertion=0;
- int averageExtraction=0;
+ int averageInsertion = 0;
+ int averageExtraction = 0;
double averageDecayFactor = .5;
-
+
public FluxStorageAdvanced(int capacity, int limitReceive, int limitExtract)
{
super(capacity, limitReceive, limitExtract);
}
+
public FluxStorageAdvanced(int capacity, int limitTransfer)
{
super(capacity, limitTransfer);
}
+
public FluxStorageAdvanced(int capacity)
{
super(capacity, capacity, capacity);
@@ -36,9 +37,9 @@ public FluxStorageAdvanced(int capacity)
@Override
public int receiveEnergy(int energy, boolean simulate)
{
- int received = super.receiveEnergy(energy,simulate);
+ int received = super.receiveEnergy(energy, simulate);
if(!simulate)
- averageInsertion = (int)Math.round(averageInsertion*averageDecayFactor + received*(1-averageDecayFactor));
+ averageInsertion = (int)Math.round(averageInsertion*averageDecayFactor+received*(1-averageDecayFactor));
return received;
}
@@ -47,7 +48,7 @@ public int extractEnergy(int energy, boolean simulate)
{
int extracted = super.extractEnergy(energy, simulate);
if(!simulate)
- averageExtraction = (int)Math.round(averageExtraction*averageDecayFactor + extracted*(1-averageDecayFactor));
+ averageExtraction = (int)Math.round(averageExtraction*averageDecayFactor+extracted*(1-averageDecayFactor));
return extracted;
}
@@ -55,10 +56,12 @@ public int getAverageInsertion()
{
return averageInsertion;
}
+
public int getAverageExtraction()
{
return averageExtraction;
}
+
public FluxStorageAdvanced setDecayFactor(double factor)
{
this.averageDecayFactor = factor;
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxConnection.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxConnection.java
index 82403edbe1..226d776844 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxConnection.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxConnection.java
@@ -14,15 +14,14 @@
/**
* An interface to be implemented by TileEntities that can connect to an IF network
- *
- * @author BluSunrize - 18.01.2016
*
+ * @author BluSunrize - 18.01.2016
*/
public interface IFluxConnection
{
/**
- * @param from The direction the check is performed from, null for unknown.
- * @return If the TileEntity can connect.
+ * @param from The direction the check is performed from, null for unknown.
+ * @return If the TileEntity can connect.
*/
boolean canConnectEnergy(@Nullable EnumFacing from);
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxContainerItem.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxContainerItem.java
index f92ab1954a..75c607536c 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxContainerItem.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxContainerItem.java
@@ -12,39 +12,40 @@
/**
* An interface to be implemented by Items that can store IF and allow external modification of their storage.
- *
- * @author BluSunrize - 18.01.2016
*
+ * @author BluSunrize - 18.01.2016
*/
public interface IFluxContainerItem
{
/**
* Inserts energy into the Item. Returns the amount that was accepted.
- * @param container The ItemStack of the container item
- * @param energy Maximum amount of energy to be inserted.
- * @param simulate If TRUE, the process is simulated and will not increase the storage.
- * @return Amount of energy that was, or would have been, if simulated, accepted.
+ *
+ * @param container The ItemStack of the container item
+ * @param energy Maximum amount of energy to be inserted.
+ * @param simulate If TRUE, the process is simulated and will not increase the storage.
+ * @return Amount of energy that was, or would have been, if simulated, accepted.
*/
int receiveEnergy(ItemStack container, int energy, boolean simulate);
-
+
/**
* Extracts energy from the Item. Returns the amount that was extracted.
- * @param container The ItemStack of the container item
- * @param energy Maximum amount of energy to be extracted.
- * @param simulate If TRUE, the process is simulated and will not decrease the storage.
- * @return Amount of energy that was, or would have been, if simulated, extracted.
+ *
+ * @param container The ItemStack of the container item
+ * @param energy Maximum amount of energy to be extracted.
+ * @param simulate If TRUE, the process is simulated and will not decrease the storage.
+ * @return Amount of energy that was, or would have been, if simulated, extracted.
*/
int extractEnergy(ItemStack container, int energy, boolean simulate);
/**
- * @param container The ItemStack of the container item
- * @return The amount of energy stored in the Tile.
+ * @param container The ItemStack of the container item
+ * @return The amount of energy stored in the Tile.
*/
int getEnergyStored(ItemStack container);
/**
- * @param container The ItemStack of the container item
- * @return The maximum amount of energy that can be stored in the Tile.
+ * @param container The ItemStack of the container item
+ * @return The maximum amount of energy that can be stored in the Tile.
*/
int getMaxEnergyStored(ItemStack container);
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxProvider.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxProvider.java
index 12afc3a765..83feb9c437 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxProvider.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxProvider.java
@@ -14,30 +14,30 @@
/**
* An interface to be implemented by TileEntities that can provide IF.
- *
- * @author BluSunrize - 18.01.2016
*
+ * @author BluSunrize - 18.01.2016
*/
public interface IFluxProvider extends IFluxConnection
{
/**
* Extracts energy from the TileEntity. Returns the amount that was extracted.
- * @param from The direction the energy is inserted from, null for unknown. Unknown directions should ALWAYS work.
- * @param energy Maximum amount of energy to be extracted.
- * @param simulate If TRUE, the process is simulated and will not decrease the storage.
- * @return Amount of energy that was, or would have been, if simulated, extracted.
+ *
+ * @param from The direction the energy is inserted from, null for unknown. Unknown directions should ALWAYS work.
+ * @param energy Maximum amount of energy to be extracted.
+ * @param simulate If TRUE, the process is simulated and will not decrease the storage.
+ * @return Amount of energy that was, or would have been, if simulated, extracted.
*/
int extractEnergy(@Nullable EnumFacing from, int energy, boolean simulate);
/**
- * @param from The direction the check is performed from, null for unknown.
- * @return The amount of energy stored in the Tile.
+ * @param from The direction the check is performed from, null for unknown.
+ * @return The amount of energy stored in the Tile.
*/
int getEnergyStored(@Nullable EnumFacing from);
/**
- * @param from The direction the check is performed from, null for unknown.
- * @return The maximum amount of energy that can be stored in the Tile.
+ * @param from The direction the check is performed from, null for unknown.
+ * @return The maximum amount of energy that can be stored in the Tile.
*/
int getMaxEnergyStored(@Nullable EnumFacing from);
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxReceiver.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxReceiver.java
index 7f01cd81ba..99d5b202c0 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxReceiver.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxReceiver.java
@@ -14,30 +14,30 @@
/**
* An interface to be implemented by TileEntities that can receive IF.
- *
- * @author BluSunrize - 18.01.2016
*
+ * @author BluSunrize - 18.01.2016
*/
public interface IFluxReceiver extends IFluxConnection
{
/**
* Inserts energy into the TileEntity. Returns the amount that was accepted.
- * @param from The direction the energy is inserted from, null for unknown. Unknown directions should ALWAYS work.
- * @param energy Maximum amount of energy to be inserted.
- * @param simulate If TRUE, the process is simulated and will not increase the storage.
- * @return Amount of energy that was, or would have been, if simulated, accepted.
+ *
+ * @param from The direction the energy is inserted from, null for unknown. Unknown directions should ALWAYS work.
+ * @param energy Maximum amount of energy to be inserted.
+ * @param simulate If TRUE, the process is simulated and will not increase the storage.
+ * @return Amount of energy that was, or would have been, if simulated, accepted.
*/
int receiveEnergy(@Nullable EnumFacing from, int energy, boolean simulate);
/**
- * @param from The direction the check is performed from, null for unknown.
- * @return The amount of energy stored in the Tile.
+ * @param from The direction the check is performed from, null for unknown.
+ * @return The amount of energy stored in the Tile.
*/
int getEnergyStored(@Nullable EnumFacing from);
/**
- * @param from The direction the check is performed from, null for unknown.
- * @return The maximum amount of energy that can be stored in the Tile.
+ * @param from The direction the check is performed from, null for unknown.
+ * @return The maximum amount of energy that can be stored in the Tile.
*/
int getMaxEnergyStored(@Nullable EnumFacing from);
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxStorage.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxStorage.java
index 17d950814b..75148938fc 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxStorage.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/IFluxStorage.java
@@ -11,35 +11,36 @@
/**
* An interface to implement for an object that stores ImmersiveFlux
* See {@link FluxStorage} for an example implementation
- *
+ *
* @author BluSunrize - 18.01.2016
- *
*/
public interface IFluxStorage
{
/**
* Inserts energy into the storage. Returns the amount that was accepted.
- * @param energy Maximum amount of energy to be inserted.
- * @param simulate If TRUE, the process is simulated and will not increase the storage.
- * @return Amount of energy that was, or would have been, if simulated, accepted.
+ *
+ * @param energy Maximum amount of energy to be inserted.
+ * @param simulate If TRUE, the process is simulated and will not increase the storage.
+ * @return Amount of energy that was, or would have been, if simulated, accepted.
*/
int receiveEnergy(int energy, boolean simulate);
/**
* Extracts energy from the storage. Returns the amount that was extracted.
- * @param energy Maximum amount of energy to be extracted.
- * @param simulate If TRUE, the process is simulated and will not decrease the storage.
- * @return Amount of energy that was, or would have been, if simulated, extracted.
+ *
+ * @param energy Maximum amount of energy to be extracted.
+ * @param simulate If TRUE, the process is simulated and will not decrease the storage.
+ * @return Amount of energy that was, or would have been, if simulated, extracted.
*/
int extractEnergy(int energy, boolean simulate);
/**
- * @return The amount of energy stored.
+ * @return The amount of energy stored.
*/
int getEnergyStored();
/**
- * @return The maximum amount of energy that can be stored.
+ * @return The maximum amount of energy that can be stored.
*/
int getMaxEnergyStored();
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/package-info.java b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/package-info.java
index 88628eff0c..4c787b7580 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/package-info.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/immersiveflux/package-info.java
@@ -4,7 +4,6 @@
import net.minecraftforge.fml.common.API;
/**
-* Shoutout to Team CoFH for the amazing RedstoneFlux system.
-* Due to a lack of an official 1.8 version, IE has been move to its own, RF-inspired energy system, dubbed ImmersiveFlux.
-*
-*/
\ No newline at end of file
+ * Shoutout to Team CoFH for the amazing RedstoneFlux system.
+ * Due to a lack of an official 1.8 version, IE has been move to its own, RF-inspired energy system, dubbed ImmersiveFlux.
+ */
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IICProxy.java b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IICProxy.java
index 62da8d0c3c..9af46530d9 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IICProxy.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IICProxy.java
@@ -25,89 +25,106 @@ public class IICProxy implements IImmersiveConnectable
private boolean canEnergyPass;
private int dim;
private BlockPos pos;
+
public IICProxy(boolean allowPass, int dimension, BlockPos _pos)
{
canEnergyPass = allowPass;
dim = dimension;
pos = _pos;
}
+
public IICProxy(TileEntity te)
{
- if (!(te instanceof IImmersiveConnectable))
+ if(!(te instanceof IImmersiveConnectable))
throw new IllegalArgumentException("Can't create an IICProxy for a null/non-IIC TileEntity");
dim = te.getWorld().provider.getDimension();
canEnergyPass = ((IImmersiveConnectable)te).allowEnergyToPass(null);
pos = Utils.toCC(te);
}
+
@Override
public boolean allowEnergyToPass(Connection c)
{
return canEnergyPass;
}
+
public BlockPos getPos()
{
return pos;
}
+
public int getDimension()
{
return dim;
}
+
@Override
public void removeCable(Connection connection)
{
//this will load the chunk the TE is in for 1 tick since it needs to be notified about the removed wires
World w = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(dim);
- if (w==null)
+ if(w==null)
{
IELogger.warn("Tried to remove a wire in dimension "+dim+" which does not exist");
return;
}
TileEntity te = w.getTileEntity(pos);
- if (!(te instanceof IImmersiveConnectable))
+ if(!(te instanceof IImmersiveConnectable))
return;
((IImmersiveConnectable)te).removeCable(connection);
}
+
@Override
public boolean canConnect()
{
return false;
}
+
@Override
public boolean isEnergyOutput()
{
return false;
}
+
@Override
public int outputEnergy(int amount, boolean simulate, int energyType)
{
return 0;
}
+
@Override
public boolean canConnectCable(WireType cableType, TargetingInfo target, Vec3i offset)
{
return false;
}
+
@Override
public void connectCable(WireType cableType, TargetingInfo target, IImmersiveConnectable other)
- {}
+ {
+ }
+
@Override
public WireType getCableLimiter(TargetingInfo target)
{
return null;
}
+
@Override
public void onEnergyPassthrough(int amount)
- {}
+ {
+ }
@Override
public Vec3d getConnectionOffset(Connection con)
{
return null;
}
+
public static IICProxy readFromNBT(NBTTagCompound nbt)
{
return new IICProxy(nbt.getBoolean("pass"), nbt.getInteger("dim"), new BlockPos(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z")));
}
+
public NBTTagCompound writeToNBT()
{
NBTTagCompound ret = new NBTTagCompound();
@@ -118,6 +135,7 @@ public NBTTagCompound writeToNBT()
ret.setBoolean("pass", canEnergyPass);
return ret;
}
+
@Override
public BlockPos getConnectionMaster(WireType cableType, TargetingInfo target)
{
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IImmersiveConnectable.java b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IImmersiveConnectable.java
index 3dcc894ebe..cae17c0f5d 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IImmersiveConnectable.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IImmersiveConnectable.java
@@ -25,9 +25,9 @@
/**
* @author BluSunrize - 08.03.2015
- *
+ *
* An interface to be implemented by TileEntities, to allow them to connect to the IE net
- *
+ *
* "Vec3i offset" parameters give the offset between this block and the one that was clicked on, see getConnectionMaster
*/
public interface IImmersiveConnectable
@@ -36,15 +36,15 @@ public interface IImmersiveConnectable
* @return if wires can directly connect to this
*/
boolean canConnect();
-
+
/**
* @return if the tile can in or output energy from/to the network
*/
boolean isEnergyOutput();
-
+
/**
- * @param amount The amount of power input, in RF
- * @param simulate whether to actually perform the action or just simulate energy consumption
+ * @param amount The amount of power input, in RF
+ * @param simulate whether to actually perform the action or just simulate energy consumption
* @param energyType 0 for RF, 1 for EU
* @return the amount of power that was output
*/
@@ -60,6 +60,7 @@ default boolean canConnectCable(WireType cableType, TargetingInfo target)
{
return false;
}
+
/**
* @return whether you can connect the given CableType to the tile
*/
@@ -67,7 +68,7 @@ default boolean canConnectCable(WireType cableType, TargetingInfo target, Vec3i
{
return canConnectCable(cableType, target);
}
-
+
/**
* fired when a cable is attached, use to limit the cables attached to one type
*/
@@ -75,20 +76,22 @@ default void connectCable(WireType cableType, TargetingInfo target, IImmersiveCo
{
connectCable(cableType, target, other);
}
+
default void connectCable(WireType cableType, TargetingInfo target, IImmersiveConnectable other)
{
connectCable(cableType, target, other, null);
}
-
+
/**
* get the CableType limiter of the tile
*/
WireType getCableLimiter(TargetingInfo target);
-
+
/**
* return false to stop checking for available outputs from this point onward
+ *
* @param con: the connection through which energy enters. May be null, in that
- * case true should be returned if and only if all connections allow energy to pass
+ * case true should be returned if and only if all connections allow energy to pass
*/
boolean allowEnergyToPass(Connection con);
@@ -99,6 +102,7 @@ default void onEnergyPassthrough(int amount)
{
}
+
/**
* fired for every not-simulated energy packet passing through. Used for energy meter and stuff
*/
@@ -111,12 +115,14 @@ default void onEnergyPassthrough(double amount)
* Informs the connector/relay that there is a source of energy connected to it, and gives it a way to consume it.
* This is valid for a single tick.
* This can be used to add "pulling" consumers to the net or allow non-energy-outputs to consume energy (e.g. to damage entities)
- * @param amount The amount available from this source
+ *
+ * @param amount The amount available from this source
* @param consume Call this to consume the amount of energy in the parameter
*/
default void addAvailableEnergy(float amount, Consumer consume)
- {}
-
+ {
+ }
+
/**
* used to reset the CableType limiter of the tile, provided it matches the given argument
* acts as a wildcard, meaning if connection.CableType is null, you /always/ reset the limiter
@@ -128,7 +134,8 @@ default void addAvailableEnergy(float amount, Consumer consume)
* Raytracing was replaced by code following the catenary, using getConnectionOffset(Connection con, TargetingInfo target)
*/
@Deprecated
- default Vec3d getRaytraceOffset(IImmersiveConnectable link) {
+ default Vec3d getRaytraceOffset(IImmersiveConnectable link)
+ {
return new Vec3d(.5, .5, .5);
}
@@ -136,15 +143,18 @@ default Vec3d getRaytraceOffset(IImmersiveConnectable link) {
* @return Where the cable should attach
*/
Vec3d getConnectionOffset(Connection con);
+
/**
* A version of getConnectionOffset that works before the connection exists.
* Should be identical to getConnectionOffset(Connection) once the connection is added
+ *
* @return Where the cable should attach
*/
default Vec3d getConnectionOffset(Connection con, TargetingInfo target, Vec3i offsetLink)
{
return getConnectionOffset(con);
}
+
/**
* returns a set of Blocks to be ignored when raytracing
*/
@@ -166,13 +176,14 @@ default float getDamageAmount(Entity e, Connection c)
* damaged after calling getDamageAmount
*/
default void processDamage(Entity e, float amount, Connection c)
- {}
+ {
+ }
default void onConnectivityUpdate(BlockPos pos, int dimension)
{
- if (INSTANCE.indirectConnections.containsKey(dimension))
+ if(INSTANCE.indirectConnections.containsKey(dimension))
INSTANCE.indirectConnections.get(dimension).remove(pos);
- if (INSTANCE.indirectConnectionsIgnoreOut.containsKey(dimension))
+ if(INSTANCE.indirectConnectionsIgnoreOut.containsKey(dimension))
INSTANCE.indirectConnectionsIgnoreOut.get(dimension).remove(pos);
}
}
\ No newline at end of file
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IWireCoil.java b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IWireCoil.java
index 84d8fadd42..eb17a92602 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IWireCoil.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/IWireCoil.java
@@ -13,23 +13,26 @@
/**
* @author BluSunrize - 26.06.2015
- *
+ *
* An Interface to be implemented by Items that can be used to connect two connectors
*/
public interface IWireCoil
{
WireType getWireType(ItemStack stack);
- public default boolean canConnectCable(ItemStack stack, TileEntity targetEntity)
+
+ default boolean canConnectCable(ItemStack stack, TileEntity targetEntity)
{
return true;
}
- public default int getMaxLength(ItemStack stack)
+
+ default int getMaxLength(ItemStack stack)
{
WireType wire = getWireType(stack);
return wire.getMaxLength();
}
- public default void consumeWire(ItemStack stack, int length)
+
+ default void consumeWire(ItemStack stack, int length)
{
stack.shrink(1);
- }
+ }
}
diff --git a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/ImmersiveNetHandler.java b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/ImmersiveNetHandler.java
index 0e90e8d5c5..27f32f4ed8 100644
--- a/src/main/java/blusunrize/immersiveengineering/api/energy/wires/ImmersiveNetHandler.java
+++ b/src/main/java/blusunrize/immersiveengineering/api/energy/wires/ImmersiveNetHandler.java
@@ -61,20 +61,21 @@ public class ImmersiveNetHandler
public Map proxies = new ConcurrentHashMap<>();
public IntHashMap> blockWireMap = new IntHashMap<>();
-
+
private ConcurrentHashMap> getMultimap(int dimension)
{
- if (directConnections.get(dimension) == null)
+ if(directConnections.get(dimension)==null)
{
ConcurrentHashMap> mm = new ConcurrentHashMap>();
directConnections.put(dimension, mm);
}
return directConnections.get(dimension);
}
+
public HashMap getTransferedRates(int dimension)
{
- if (!transferPerTick.containsKey(dimension))
- transferPerTick.put(dimension, new HashMap());
+ if(!transferPerTick.containsKey(dimension))
+ transferPerTick.put(dimension, new HashMap());
return transferPerTick.get(dimension);
}
@@ -82,22 +83,25 @@ public void addConnection(World world, BlockPos node, BlockPos connection, int d
{
addAndGetConnection(world, node, connection, distance, cableType);
}
+
public Connection addAndGetConnection(World world, BlockPos node, BlockPos connection, int distance, WireType cableType)
{
Connection conn = new Connection(node, connection, cableType, distance);
addConnection(world, node, conn);
addConnection(world, connection, new Connection(connection, node, cableType, distance));
if(world.isBlockLoaded(node))
- world.addBlockEvent(node, world.getBlockState(node).getBlock(),-1,0);
+ world.addBlockEvent(node, world.getBlockState(node).getBlock(), -1, 0);
if(world.isBlockLoaded(connection))
- world.addBlockEvent(connection, world.getBlockState(connection).getBlock(),-1,0);
+ world.addBlockEvent(connection, world.getBlockState(connection).getBlock(), -1, 0);
return conn;
}
+
public void addConnection(World world, BlockPos node, Connection con)
{
addConnection(world.provider.getDimension(), node, con);
resetCachedIndirectConnections(world, node);
}
+
public void addConnection(int world, BlockPos node, Connection con)
{
if(!getMultimap(world).containsKey(node))
@@ -109,8 +113,8 @@ public void addConnection(int world, BlockPos node, Connection con)
public void onTEValidated(T te)
{
Set conns = getConnections(te.getWorld(), te.getPos());
- if (conns != null)
- for (Connection con : conns)
+ if(conns!=null)
+ for(Connection con : conns)
addBlockData(te.getWorld(), con);
resetCachedIndirectConnections(te.getWorld(), te.getPos());
setProxy(new DimensionBlockPos(te), null);
@@ -119,23 +123,23 @@ public void onTEValidated(T te)
public void addBlockData(World world, Connection con)
{
int dimId = world.provider.getDimension();
- if (!blockWireMap.containsItem(dimId))
+ if(!blockWireMap.containsItem(dimId))
blockWireMap.addKey(dimId, new ConcurrentHashMap<>());
Map mapForDim = blockWireMap.lookup(dimId);
- if (mapForDim==null||!world.isBlockLoaded(con.end))
+ if(mapForDim==null||!world.isBlockLoaded(con.end))
return;
raytraceAlongCatenary(con, world, (p) ->
{
- if (!mapForDim.containsKey(p.getLeft()))
+ if(!mapForDim.containsKey(p.getLeft()))
mapForDim.put(p.getLeft(), new BlockWireInfo());
- if (mapForDim.get(p.getLeft()).in.stream().noneMatch((c)->c.getLeft().hasSameConnectors(con)))
+ if(mapForDim.get(p.getLeft()).in.stream().noneMatch((c) -> c.getLeft().hasSameConnectors(con)))
mapForDim.get(p.getLeft()).in.add(new ImmutableTriple<>(con, p.getMiddle(), p.getRight()));
return false;
}, (p) ->
{
- if (!mapForDim.containsKey(p.getLeft()))
+ if(!mapForDim.containsKey(p.getLeft()))
mapForDim.put(p.getLeft(), new BlockWireInfo());
- if (mapForDim.get(p.getLeft()).near.stream().noneMatch((c)->c.getLeft().hasSameConnectors(con)))
+ if(mapForDim.get(p.getLeft()).near.stream().noneMatch((c) -> c.getLeft().hasSameConnectors(con)))
mapForDim.get(p.getLeft()).near.add(new ImmutableTriple<>(con, p.getMiddle(), p.getRight()));
});
}
@@ -143,12 +147,12 @@ public void addBlockData(World world, Connection con)
public void removeConnection(World world, Connection con)
{
- removeConnection(world, con, getVecForIICAt(world, con.start, con),getVecForIICAt(world, con.end, con));
+ removeConnection(world, con, getVecForIICAt(world, con.start, con), getVecForIICAt(world, con.end, con));
}
public void removeConnection(World world, Connection con, Vec3d vecStart, Vec3d vecEnd)
{
- if (con == null || world == null)
+ if(con==null||world==null)
return;
int dim = world.provider.getDimension();
resetCachedIndirectConnections(world, con.start);
@@ -159,89 +163,97 @@ public void removeConnection(World world, Connection con, Vec3d vecStart, Vec3d
reverseConns.removeIf(con::hasSameConnectors);
forwardConns.removeIf(con::hasSameConnectors);
Map mapForDim = blockWireMap.lookup(world.provider.getDimension());
- BiConsumer> handle = (p, map)-> {
- if (mapForDim!=null)
+ BiConsumer> handle = (p, map) -> {
+ if(mapForDim!=null)
{
BlockWireInfo info = map.get(p);
- if (info!=null)
+ if(info!=null)
{
- for (int i = 0;i<2;i++)
+ for(int i = 0; i < 2; i++)
{
- Set> s = i==0?info.in:info.near;
- s.removeIf((t) -> t.getLeft().hasSameConnectors(con));
- if (s.isEmpty())
- map.remove(p);
+ Set> s = i==0?info.in: info.near;
+ s.removeIf((t) -> t.getLeft().hasSameConnectors(con));
+ if(s.isEmpty())
+ map.remove(p);
}
- if (info.near.isEmpty()&&info.in.isEmpty())
+ if(info.near.isEmpty()&&info.in.isEmpty())
map.remove(p);
}
}
};
- raytraceAlongCatenaryRelative(con, (p)->{
+ raytraceAlongCatenaryRelative(con, (p) -> {
handle.accept(p.getLeft(), mapForDim);
return false;
- }, (p)->handle.accept(p.getLeft(), mapForDim), vecStart, vecEnd);
+ }, (p) -> handle.accept(p.getLeft(), mapForDim), vecStart, vecEnd);
IImmersiveConnectable iic = toIIC(con.end, world);
- if (iic != null)
+ if(iic!=null)
{
iic.removeCable(con);
back.ifPresent(iic::removeCable);
}
iic = toIIC(con.start, world);
- if (iic != null)
+ if(iic!=null)
{
iic.removeCable(con);
back.ifPresent(iic::removeCable);
}
- if (world.isBlockLoaded(con.start))
+ if(world.isBlockLoaded(con.start))
world.addBlockEvent(con.start, world.getBlockState(con.start).getBlock(), -1, 0);
- if (world.isBlockLoaded(con.end))
+ if(world.isBlockLoaded(con.end))
world.addBlockEvent(con.end, world.getBlockState(con.end).getBlock(), -1, 0);
IESaveData.setDirty(dim);
}
+
public Set getRelevantDimensions()
{
return directConnections.keySet();
}
+
public Collection getAllConnections(int dimensionId)
{
Set ret = newSetFromMap(new ConcurrentHashMap());
- for (Set conlist : getMultimap(dimensionId).values())
+ for(Set conlist : getMultimap(dimensionId).values())
ret.addAll(conlist);
return ret;
}
+
public Collection getAllConnections(World world)
{
return getAllConnections(world.provider.getDimension());
}
+
@Nullable
public synchronized Set getConnections(World world, BlockPos node)
{
- if(world!=null && world.provider!=null)
+ if(world!=null&&world.provider!=null)
{
return getConnections(world.provider.getDimension(), node);
}
return null;
}
+
@Nullable
public synchronized Set getConnections(int world, BlockPos node)
{
ConcurrentHashMap> map = getMultimap(world);
return map.get(node);
}
+
public void clearAllConnections(World world)
{
clearAllConnections(world.provider.getDimension());
}
+
public void clearAllConnections(int world)
{
getMultimap(world).clear();
blockWireMap.removeObject(world);
proxies.clear();
}
+
public void clearConnectionsOriginatingFrom(BlockPos node, World world)
{
resetCachedIndirectConnections(world, node);
@@ -255,7 +267,7 @@ public void clearConnectionsOriginatingFrom(BlockPos node, World world)
@Deprecated
public void resetCachedIndirectConnections()
{
- if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
+ if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
{
indirectConnections.clear();
indirectConnectionsIgnoreOut.clear();
@@ -267,25 +279,26 @@ public void resetCachedIndirectConnections()
/**
* Resets the cached energy connections for all connectors connected to an IIC.
* Call this when there are "more" wires (before removing and after adding)
- * @param w the world to reset the cache in
+ *
+ * @param w the world to reset the cache in
* @param start the starting block. If this is null, all cached connections for the dimension will be reset
*/
public void resetCachedIndirectConnections(World w, @Nullable BlockPos start)
{
- if (FMLCommonHandler.instance().getEffectiveSide()!=Side.SERVER)
+ if(FMLCommonHandler.instance().getEffectiveSide()!=Side.SERVER)
{
ImmersiveEngineering.proxy.clearConnectionModelCache();
return;
}
int dimension = w.provider.getDimension();
- if (!directConnections.containsKey(dimension))
+ if(!directConnections.containsKey(dimension))
return;
- if (start==null)
+ if(start==null)
{
- for (BlockPos pos : directConnections.get(dimension).keySet())
+ for(BlockPos pos : directConnections.get(dimension).keySet())
{
IImmersiveConnectable iic = toIIC(pos, w);
- if (iic != null)
+ if(iic!=null)
{
iic.onConnectivityUpdate(pos, dimension);
}
@@ -296,19 +309,19 @@ public void resetCachedIndirectConnections(World w, @Nullable BlockPos start)
Set open = new HashSet<>();
open.add(start);
Set closed = new HashSet<>();
- while (!open.isEmpty())
+ while(!open.isEmpty())
{
Iterator it = open.iterator();
BlockPos next = it.next();
it.remove();
closed.add(next);
IImmersiveConnectable iic = toIIC(next, w);
- if (iic!=null)
+ if(iic!=null)
iic.onConnectivityUpdate(next, dimension);
Set connsAtBlock = connsForDim.get(next);
- if (connsAtBlock!=null)
- for (Connection c:connsAtBlock)
- if (!closed.contains(c.end))
+ if(connsAtBlock!=null)
+ for(Connection c : connsAtBlock)
+ if(!closed.contains(c.end))
open.add(c.end);
}
}
@@ -316,12 +329,12 @@ public void resetCachedIndirectConnections(World w, @Nullable BlockPos start)
public void removeConnectionAndDrop(Connection conn, World world, @Nullable BlockPos dropPos)
{
removeConnection(world, conn);
- if (dropPos != null)
+ if(dropPos!=null)
{
- double dx = dropPos.getX() + .5;
- double dy = dropPos.getY() + .5;
- double dz = dropPos.getZ() + .5;
- if (world.getGameRules().getBoolean("doTileDrops"))
+ double dx = dropPos.getX()+.5;
+ double dy = dropPos.getY()+.5;
+ double dz = dropPos.getZ()+.5;
+ if(world.getGameRules().getBoolean("doTileDrops"))
world.spawnEntity(new EntityItem(world, dx, dy, dz, conn.cableType.getWireCoil(conn)));
}
}
@@ -330,26 +343,27 @@ public void clearAllConnectionsFor(BlockPos node, World world, boolean doDrops)
{
clearAllConnectionsFor(node, world, null, doDrops);
}
+
/**
* Clears all connections to and from this node.
*/
public void clearAllConnectionsFor(BlockPos node, World world, @Nullable IImmersiveConnectable iic, boolean doDrops)
{
- if (iic==null)
+ if(iic==null)
iic = toIIC(node, world);
- if (iic != null)
+ if(iic!=null)
iic.removeCable(null);
if(getMultimap(world.provider.getDimension()).containsKey(node))
{
- for (Connection con : getMultimap(world.provider.getDimension()).get(node))
+ for(Connection con : getMultimap(world.provider.getDimension()).get(node))
{
- removeConnection(world, con, iic!=null?iic.getConnectionOffset(con):Vec3d.ZERO,
+ removeConnection(world, con, iic!=null?iic.getConnectionOffset(con): Vec3d.ZERO,
getVecForIICAt(world, con.end, con));
- double dx = node.getX() + .5 + Math.signum(con.end.getX() - con.start.getX());
- double dy = node.getY() + .5 + Math.signum(con.end.getY() - con.start.getY());
- double dz = node.getZ() + .5 + Math.signum(con.end.getZ() - con.start.getZ());
- if (doDrops && world.getGameRules().getBoolean("doTileDrops"))
+ double dx = node.getX()+.5+Math.signum(con.end.getX()-con.start.getX());
+ double dy = node.getY()+.5+Math.signum(con.end.getY()-con.start.getY());
+ double dz = node.getZ()+.5+Math.signum(con.end.getZ()-con.start.getZ());
+ if(doDrops&&world.getGameRules().getBoolean("doTileDrops"))
world.spawnEntity(new EntityItem(world, dx, dy, dz, con.cableType.getWireCoil(con)));
}
}
@@ -359,14 +373,15 @@ public void clearAllConnectionsFor(BlockPos node, World world, @Nullable IImmers
public void setProxy(DimensionBlockPos pos, IICProxy p)
{
- if (p==null)
+ if(p==null)
proxies.remove(pos);
else
proxies.put(pos, p);
}
+
public void addProxy(IICProxy p)
{
- if (p==null)
+ if(p==null)
return;
setProxy(new DimensionBlockPos(p.getPos(), p.getDimension()), p);
}
@@ -385,19 +400,19 @@ public boolean clearAllConnectionsFor(BlockPos node, World world, @Nonnull Targe
boolean ret = false;
for(Connection con : getMultimap(world.provider.getDimension()).get(node))
{
- if (con.cableType == type)
+ if(con.cableType==type)
{
removeConnection(world, con);
- double dx = node.getX() + .5 + Math.signum(con.end.getX() - con.start.getX());
- double dy = node.getY() + .5 + Math.signum(con.end.getY() - con.start.getY());
- double dz = node.getZ() + .5 + Math.signum(con.end.getZ() - con.start.getZ());
- if (world.getGameRules().getBoolean("doTileDrops"))
+ double dx = node.getX()+.5+Math.signum(con.end.getX()-con.start.getX());
+ double dy = node.getY()+.5+Math.signum(con.end.getY()-con.start.getY());
+ double dz = node.getZ()+.5+Math.signum(con.end.getZ()-con.start.getZ());
+ if(world.getGameRules().getBoolean("doTileDrops"))
world.spawnEntity(new EntityItem(world, dx, dy, dz, con.cableType.getWireCoil(con)));
ret = true;
}
}
if(world.isBlockLoaded(node))
- world.addBlockEvent(node, world.getBlockState(node).getBlock(),-1,0);
+ world.addBlockEvent(node, world.getBlockState(node).getBlock(), -1, 0);
IESaveData.setDirty(dim);
return ret;
@@ -467,25 +482,26 @@ public static List getValidEnergyOutputs(BlockPos node, W
return closedList;
}
*/
-
+
public Set getIndirectEnergyConnections(BlockPos node, World world)
{
return getIndirectEnergyConnections(node, world, false);
}
+
public Set getIndirectEnergyConnections(BlockPos node, World world, boolean ignoreIsEnergyOutput)
{
int dimension = world.provider.getDimension();
if(!ignoreIsEnergyOutput&&indirectConnections.containsKey(dimension)&&
indirectConnections.get(dimension).containsKey(node))
return indirectConnections.get(dimension).get(node);
- else if(ignoreIsEnergyOutput&& indirectConnectionsIgnoreOut.containsKey(dimension)&&
+ else if(ignoreIsEnergyOutput&&indirectConnectionsIgnoreOut.containsKey(dimension)&&
indirectConnectionsIgnoreOut.get(dimension).containsKey(node))
return indirectConnectionsIgnoreOut.get(dimension).get(node);
PriorityQueue> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getRight));
Set closedList = newSetFromMap(new ConcurrentHashMap());
List checked = new ArrayList<>();
- HashMap backtracker = new HashMap<>();
+ HashMap backtracker = new HashMap<>();
checked.add(node);
Set conL = getConnections(world, node);
@@ -503,13 +519,13 @@ else if(ignoreIsEnergyOutput&& indirectConnectionsIgnoreOut.containsKey(dimensio
IImmersiveConnectable next;
final int closedListMax = 1200;
- while(closedList.size() pair = queue.poll();
next = pair.getLeft();
float loss = pair.getRight();
BlockPos nextPos = toBlockPos(next);
- if(!checked.contains(nextPos)&&queue.stream().noneMatch((p)->p.getLeft().equals(nextPos)))
+ if(!checked.contains(nextPos)&&queue.stream().noneMatch((p) -> p.getLeft().equals(nextPos)))
{
boolean isOutput = next.isEnergyOutput();
if(ignoreIsEnergyOutput||isOutput)
@@ -532,7 +548,7 @@ else if(ignoreIsEnergyOutput&& indirectConnectionsIgnoreOut.containsKey(dimensio
{
connectionParts.add(0, conB);
distance += conB.length;
- if(minimumType==null || conB.cableType.getTransferRate()> existing =
- queue.stream().filter((p)->p.getLeft()==end).findAny();
+ queue.stream().filter((p) -> p.getLeft()==end).findAny();
float newLoss = con.getBaseLoss()+loss;
- if(end!=null && !checked.contains(con.end) && existing.map(Pair::getRight).orElse(Float.MAX_VALUE)>newLoss)
+ if(end!=null&&!checked.contains(con.end)&&existing.map(Pair::getRight).orElse(Float.MAX_VALUE) > newLoss)
{
- existing.ifPresent(p1 -> queue.removeIf((p2) -> p1.getLeft() == p2.getLeft()));
+ existing.ifPresent(p1 -> queue.removeIf((p2) -> p1.getLeft()==p2.getLeft()));
queue.add(new ImmutablePair<>(end, newLoss));
backtracker.put(con.end, toBlockPos(next));
}
@@ -561,45 +577,46 @@ else if(ignoreIsEnergyOutput&& indirectConnectionsIgnoreOut.containsKey(dimensio
checked.add(toBlockPos(next));
}
}
- if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
+ if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
{
- if (ignoreIsEnergyOutput)
+ if(ignoreIsEnergyOutput)
{
- if (!indirectConnectionsIgnoreOut.containsKey(dimension))
+ if(!indirectConnectionsIgnoreOut.containsKey(dimension))
indirectConnectionsIgnoreOut.put(dimension, new ConcurrentHashMap<>());
Map> conns = indirectConnectionsIgnoreOut.get(dimension);
- if (!conns.containsKey(node))
+ if(!conns.containsKey(node))
conns.put(node, newSetFromMap(new ConcurrentHashMap<>()));
conns.get(node).addAll(closedList);
}
else
{
- if (!indirectConnections.containsKey(dimension))
+ if(!indirectConnections.containsKey(dimension))
indirectConnections.put(dimension, new ConcurrentHashMap<>());
Map> conns = indirectConnections.get(dimension);
- if (!conns.containsKey(node))
+ if(!conns.containsKey(node))
conns.put(node, newSetFromMap(new ConcurrentHashMap<>()));
conns.get(node).addAll(closedList);
}
}
return closedList;
}
+
//Called through ASM/coremod
@SuppressWarnings("unused")
public static void handleEntityCollision(BlockPos p, Entity e)
{
- if (!e.world.isRemote&&IEConfig.enableWireDamage&&e instanceof EntityLivingBase&&
+ if(!e.world.isRemote&&IEConfig.enableWireDamage&&e instanceof EntityLivingBase&&
!e.isEntityInvulnerable(IEDamageSources.wireShock)&&
- !(e instanceof EntityPlayer&&((EntityPlayer) e).capabilities.disableDamage))
+ !(e instanceof EntityPlayer&&((EntityPlayer)e).capabilities.disableDamage))
{
Map mapForDim = INSTANCE.blockWireMap.lookup(e.dimension);
- if (mapForDim!=null)
+ if(mapForDim!=null)
{
BlockWireInfo info = mapForDim.get(p);
- if (info!=null)
+ if(info!=null)
{
- handleMapForDamage(info.in, (EntityLivingBase) e, p);
- handleMapForDamage(info.near, (EntityLivingBase) e, p);
+ handleMapForDamage(info.in, (EntityLivingBase)e, p);
+ handleMapForDamage(info.near, (EntityLivingBase)e, p);
}
}
}
@@ -608,33 +625,33 @@ public static void handleEntityCollision(BlockPos p, Entity e)
private static void handleMapForDamage(Set> in, EntityLivingBase e, BlockPos here)
{
final double KNOCKBACK_PER_DAMAGE = 10;
- if (!in.isEmpty())
+ if(!in.isEmpty())
{
AxisAlignedBB eAabb = e.getEntityBoundingBox();
- for (Triple