Removed the unnecessary and unused fuel handler, and added in some more
filtering for emc
This commit is contained in:
parent
346c4f16d8
commit
576a90e50d
|
@ -16,7 +16,6 @@ import com.pahimar.ee3.core.handlers.ActionRequestHandler;
|
|||
import com.pahimar.ee3.core.handlers.AddonHandler;
|
||||
import com.pahimar.ee3.core.handlers.CraftingHandler;
|
||||
import com.pahimar.ee3.core.handlers.EntityLivingHandler;
|
||||
import com.pahimar.ee3.core.handlers.FuelHandler;
|
||||
import com.pahimar.ee3.core.handlers.InterModCommsHandler;
|
||||
import com.pahimar.ee3.core.handlers.ItemEventHandler;
|
||||
import com.pahimar.ee3.core.handlers.ItemTooltipEventHandler;
|
||||
|
@ -160,9 +159,6 @@ public class EquivalentExchange3 {
|
|||
// Add in the ability to dye Alchemical Bags
|
||||
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
|
||||
|
||||
// Register the Fuel Handler
|
||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||
|
||||
// Quick test to see that sending an encoded recipe to be added to the
|
||||
// recipe registry works
|
||||
FMLInterModComms.sendMessage(Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT(Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill)));
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package com.pahimar.ee3.core.handlers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
|
||||
/**
|
||||
* Equivalent-Exchange-3
|
||||
*
|
||||
* FuelHandler
|
||||
*
|
||||
* @author pahimar
|
||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
*
|
||||
*/
|
||||
public class FuelHandler implements IFuelHandler {
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
|
||||
// TODO Add in fuel values for EE3 fuel related items
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
44
common/com/pahimar/ee3/core/helper/EmcHelper.java
Normal file
44
common/com/pahimar/ee3/core/helper/EmcHelper.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.pahimar.ee3.core.helper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.pahimar.ee3.emc.EmcRegistry;
|
||||
import com.pahimar.ee3.emc.EmcValue;
|
||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
||||
|
||||
public class EmcHelper {
|
||||
|
||||
public static List<CustomWrappedStack> filterStacksByEmc(List<CustomWrappedStack> unfilteredStacks, EmcValue filterValue) {
|
||||
|
||||
List<CustomWrappedStack> filteredStacks = new ArrayList<CustomWrappedStack>();
|
||||
|
||||
for (CustomWrappedStack stack : unfilteredStacks) {
|
||||
|
||||
if (EmcRegistry.hasEmcValue(stack)) {
|
||||
|
||||
EmcValue value = EmcRegistry.getEmcValue(stack);
|
||||
boolean satisfiesFilter = true;
|
||||
float[] valueSubValues = value.getComponentSubValues();
|
||||
float[] filterValueSubValues = filterValue.getComponentSubValues();
|
||||
|
||||
for (int i = 0; i < valueSubValues.length; i++) {
|
||||
if (Float.compare(valueSubValues[i], filterValueSubValues[i]) < 0) {
|
||||
satisfiesFilter = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (satisfiesFilter) {
|
||||
filteredStacks.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filteredStacks;
|
||||
}
|
||||
|
||||
public static List<CustomWrappedStack> filterStacksByEmcAndRange(float start, float end, EmcValue filterValue) {
|
||||
return filterStacksByEmc(EmcRegistry.getStacksInRange(start, end), filterValue);
|
||||
}
|
||||
|
||||
}
|
|
@ -94,6 +94,17 @@ public class EmcValue implements Comparable<EmcValue> {
|
|||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public float[] getComponentSubValues() {
|
||||
|
||||
float[] componentSubValues = new float[EmcType.TYPES.length];
|
||||
|
||||
for (int i = 0; i < componentSubValues.length; i++) {
|
||||
componentSubValues[i] = getComponentValueByType(EmcType.TYPES[i]);
|
||||
}
|
||||
|
||||
return componentSubValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
|
|
Loading…
Reference in a new issue