Merge branch 'master' into 1.6.4

This commit is contained in:
CrazyPants committed 2013-11-19 03:03:53 +08:00
commit 1e9101e862
9 files changed
+132 -47

No files matched your search

+2 -2
View File
@@ -125,11 +125,11 @@
<!-- Reobfuscate -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c reobfuscate.bat"/>
<arg line="/c reobfuscate_srg.bat"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate.sh"/>
<arg value="reobfuscate_srg.sh"/>
</exec>
<!-- Copy classes -->
@@ -76,10 +76,12 @@ public class ConduitUtil {
if(network == null) {
return false;
}
con.setNetwork(network);
network.addConduit(con);
network.notifyNetworkOfUpdate();
return true;
if(con.setNetwork(network)) {
network.addConduit(con);
network.notifyNetworkOfUpdate();
return true;
}
return false;
}
@SideOnly(Side.CLIENT)
@@ -30,14 +30,14 @@ public class RaytraceResult {
public static void sort(final Vec3 origin, List<RaytraceResult> toSort) {
if(origin == null || toSort == null) {
Collections.sort(toSort, new Comparator<RaytraceResult>() {
@Override
public int compare(RaytraceResult o1, RaytraceResult o2) {
return Double.compare(o1.getDistanceTo(origin), o1.getDistanceTo(origin));
}
});
return;
}
Collections.sort(toSort, new Comparator<RaytraceResult>() {
@Override
public int compare(RaytraceResult o1, RaytraceResult o2) {
return Double.compare(o1.getDistanceTo(origin), o2.getDistanceTo(origin));
}
});
}
public final CollidableComponent component;
@@ -126,6 +126,13 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit {
if(neighbour != null) {
neighbour.conduitConnectionRemoved(connDir.getOpposite());
}
FluidStack curFluidType = null;
if(network != null) {
curFluidType = network.getFluidType();
}
network.destroyNetwork();
setFluidType(curFluidType);
}
}
}
@@ -5,7 +5,6 @@ import java.util.List;
import java.util.ListIterator;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -133,8 +132,9 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
burnTime = TileEntityFurnace.getItemBurnTime(inventory[0]);
if(burnTime > 0) {
totalBurnTime = burnTime;
if(inventory[0].itemID == Item.bucketLava.itemID) {
inventory[0] = new ItemStack(Item.bucketEmpty);
ItemStack containedItem = inventory[0].getItem().getContainerItemStack(inventory[0]);
if(containedItem != null) {
inventory[0] = containedItem;
} else {
decrStackSize(0, 1);
}
@@ -170,11 +170,11 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
while (receptorIterator.hasNext() && canTransmit > 0 && appliedCount < numReceptors) {
Receptor receptor = receptorIterator.next();
PowerInterface pp = receptor.receptor;
if (pp != null && pp.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
if(pp != null && pp.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
float used = pp.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
transmitted += used;
canTransmit -= used;
}
}
if(canTransmit <= 0) {
break;
}
@@ -204,7 +204,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
PowerInterface pi = PowerInterface.create(te);
if(pi != null) {
receptors.add(new Receptor(pi, dir));
}
}
}
receptorIterator = receptors.listIterator();
receptorsDirty = false;
@@ -215,7 +215,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
PowerInterface receptor;
ForgeDirection fromDir;
private Receptor(PowerInterface rec, ForgeDirection fromDir) {
private Receptor(PowerInterface rec, ForgeDirection fromDir) {
this.receptor = rec;
this.fromDir = fromDir;
}
@@ -3,6 +3,7 @@ package crazypants.enderio.nei;
import static codechicken.core.gui.GuiDraw.changeTexture;
import static codechicken.core.gui.GuiDraw.drawTexturedModalRect;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
@@ -49,7 +50,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
//Set this up later to show all alloy recipes
//transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77, 7, 22, 12), "EnderIOAlloySmelter", new Object[0]));
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77-5, 26-3, 19, 25), "EnderIOAlloySmelter", new Object[0]));
}
@Override
@@ -58,18 +59,46 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForOutput(IEnderIoRecipe.ALLOY_SMELTER_ID, result);
for (IEnderIoRecipe recipe : recipes) {
List<IRecipeInput> ri = recipe.getInputs();
ItemStack[] ingredients = new ItemStack[ri.size()];
for (int i = 0; i < ingredients.length; i++) {
ingredients[i] = ri.get(i).getItem();
}
for (IRecipeOutput output : recipe.getOutputs()) {
AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), ingredients, output.getItem());
AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem());
arecipes.add(res);
}
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if(outputId.equals("EnderIOAlloySmelter") && getClass() == AlloySmelterRecipeHandler.class)
{
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.ALLOY_SMELTER_ID);
for (IEnderIoRecipe recipe : recipes) {
for (IRecipeOutput output : recipe.getOutputs()) {
AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem());
arecipes.add(res);
}
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.ALLOY_SMELTER_ID);
for (IEnderIoRecipe recipe : recipes) {
if (recipe.isInput(ingredient)) {
for (IRecipeOutput output : recipe.getOutputs()) {
AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem());
res.setIngredientPermutation(res.input, ingredient);
arecipes.add(res);
}
}
}
}
//Move the GUI down 8 pixels.
@Override
public void drawBackground(int recipe) {
@@ -87,6 +116,13 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
GuiDraw.drawString(energyString, 100, 57, 0xFFFFFFFF);
}
public List<ItemStack> getInputs(IRecipeInput input) {
List<ItemStack> result = new ArrayList<ItemStack>();
result.add(input.getItem());
result.addAll(input.getEquivelentInputs());
return result;
}
public class AlloySmelterRecipe extends TemplateRecipeHandler.CachedRecipe {
private ArrayList<PositionedStack> input;
@@ -100,7 +136,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
@Override
public List<PositionedStack> getIngredients() {
return input;
return getCycledIngredients(cycleticks / 20, input);
}
@Override
@@ -108,27 +144,20 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
return output;
}
public AlloySmelterRecipe(float energy, ItemStack ingredients[], ItemStack result) {
int recipeSize = ingredients.length;
public AlloySmelterRecipe(float energy, List<IRecipeInput> ingredients, ItemStack result) {
int recipeSize = ingredients.size();
this.input = new ArrayList<PositionedStack>();
if(recipeSize > 0) {
this.input.add(new PositionedStack(ingredients[0], 49, 14));
this.input.add(new PositionedStack(getInputs(ingredients.get(0)), 49, 14));
}
if(recipeSize > 1) {
this.input.add(new PositionedStack(ingredients[1], 73, 4));
this.input.add(new PositionedStack(getInputs(ingredients.get(1)), 73, 4));
}
if(recipeSize > 2) {
this.input.add(new PositionedStack(ingredients[2], 98, 14));
this.input.add(new PositionedStack(getInputs(ingredients.get(2)), 98, 14));
}
this.output = new PositionedStack(result, 74, 54);
this.energy = energy; //If we wanted to do an energy cost
}
public AlloySmelterRecipe(float energy, ItemStack ingredient, ItemStack result) {
this.input = new ArrayList<PositionedStack>();
this.input.add(new PositionedStack(ingredient, 49, 14));
this.output = new PositionedStack(result, 74, 54);
this.energy = energy;
}
}
}
@@ -12,7 +12,9 @@ public class NEIEnderIOConfig implements IConfigureNEI {
public void loadConfig() {
API.registerRecipeHandler(new AlloySmelterRecipeHandler());
API.registerRecipeHandler(new SagMillRecipeHandler());
API.setGuiOffset(GuiAlloySmelter.class, 50, 50);
API.registerUsageHandler(new AlloySmelterRecipeHandler());
API.registerUsageHandler(new SagMillRecipeHandler());
API.setGuiOffset(GuiAlloySmelter.class, 5, 3);
API.hideItem(EnderIO.blockConduitFacade.blockID);
if(!Config.photovoltaicCellEnabled) {
API.hideItem(EnderIO.blockSolarPanel.blockID);
@@ -1,6 +1,7 @@
package crazypants.enderio.nei;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -18,6 +19,7 @@ import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import crazypants.enderio.crafting.IEnderIoRecipe;
import crazypants.enderio.crafting.IRecipeInput;
import crazypants.enderio.crafting.IRecipeOutput;
import crazypants.enderio.crafting.RecipeReigistry;
import crazypants.enderio.machine.crusher.GuiCrusher;
@@ -54,7 +56,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
//Set this up later to show all alloy recipes
//transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77, 7, 22, 12), "EnderIOAlloySmelter", new Object[0]));
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(81-5, 32-11, 15, 23), "EnderIOSagMill", new Object[0]));
}
@Override
@@ -66,7 +68,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
for (IEnderIoRecipe recipe : recipes) {
List<IRecipeOutput> ro = recipe.getOutputs();
MillRecipe res = new MillRecipe(result, recipe.getRequiredEnergy(), recipe.getInputs().get(0).getItem(), ro);
MillRecipe res = new MillRecipe(result, recipe.getRequiredEnergy(), recipe.getInputs().get(0), ro);
toAdd.add(res);
}
@@ -75,6 +77,37 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
arecipes.addAll(toAdd);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if(outputId.equals("EnderIOSagMill") && getClass() == SagMillRecipeHandler.class)
{
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.SAG_MILL_ID);
for (IEnderIoRecipe recipe : recipes) {
for (IRecipeOutput output : recipe.getOutputs()) {
MillRecipe res = new MillRecipe(recipe.getRequiredEnergy(), recipe.getInputs().get(0), recipe.getOutputs());
arecipes.add(res);
}
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IEnderIoRecipe> recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.SAG_MILL_ID);
for (IEnderIoRecipe recipe : recipes) {
if (recipe.isInput(ingredient)) {
MillRecipe res = new MillRecipe(recipe.getRequiredEnergy(), recipe.getInputs().get(0), recipe.getOutputs());
arecipes.add(res);
}
}
}
@Override
public void drawExtras(int recipeIndex) {
drawProgressBar(98, 33, 176, 0, 22, 13, 48, 3);
@@ -125,6 +158,13 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1);
}
public List<ItemStack> getInputs(IRecipeInput input) {
List<ItemStack> result = new ArrayList<ItemStack>();
result.add(input.getItem());
result.addAll(input.getEquivelentInputs());
return result;
}
private static Point offset = new Point(5, 11);
public class MillRecipe extends TemplateRecipeHandler.CachedRecipe {
@@ -156,6 +196,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
@Override
public PositionedStack getIngredient() {
randomRenderPermutation(input, cycleticks / 20);
return input;
}
@@ -169,9 +210,13 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
return otherOutputs;
}
public MillRecipe(ItemStack targetedResult, float energy, ItemStack ingredient, List<IRecipeOutput> outputs) {
public MillRecipe(float energy, IRecipeInput ingredient, List<IRecipeOutput> outputs) {
this(null, energy, ingredient, outputs);
}
public MillRecipe(ItemStack targetedResult, float energy, IRecipeInput ingredient, List<IRecipeOutput> outputs) {
this.energy = energy;
input = new PositionedStack(ingredient, 80 - offset.x, 12 - offset.y);
input = new PositionedStack(getInputs(ingredient), 80 - offset.x, 12 - offset.y);
output = new PositionedStack(outputs.get(0).getItem(), 49 - offset.x, 59 - offset.y);
otherOutputs = new ArrayList<PositionedStack>();
if(outputs.size() > 1) {
@@ -189,7 +234,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
numTargetOuput = 1;
for (int i = 0; i < outputChance.length; i++) {
outputChance[i] = outputs.get(i).getChance();
if(outputs.get(i).isEquivalent(targetedResult)) {
if(targetedResult != null && outputs.get(i).isEquivalent(targetedResult)) {
indexOfTargetOutput = i;
numTargetOuput = outputs.get(i).getQuantity();
}
@@ -317,7 +317,7 @@
<itemStack itemID="82" />
</input>
<output>
<itemStack oreDictionary="dustClay" number="4" />
<itemStack itemID="337" number="2" />
</output>
<output>
<itemStack itemID="337" number="2" chance="0.1" />