Fixed a few textures, added Salt, added NEI recipe handler for Precision Sawmill
143
common/mekanism/client/nei/ChanceMachineRecipeHandler.java
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
package mekanism.client.nei;
|
||||||
|
|
||||||
|
import static codechicken.core.gui.GuiDraw.changeTexture;
|
||||||
|
import static codechicken.core.gui.GuiDraw.drawTexturedModalRect;
|
||||||
|
import static codechicken.core.gui.GuiDraw.drawString;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import mekanism.api.ChanceOutput;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import codechicken.nei.NEIServerUtils;
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
|
|
||||||
|
public abstract class ChanceMachineRecipeHandler extends TemplateRecipeHandler
|
||||||
|
{
|
||||||
|
private int ticksPassed;
|
||||||
|
|
||||||
|
public abstract String getRecipeId();
|
||||||
|
|
||||||
|
public abstract Set<Entry<ItemStack, ChanceOutput>> getRecipes();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBackground(int i)
|
||||||
|
{
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
changeTexture(getGuiTexture());
|
||||||
|
drawTexturedModalRect(12, 0, 28, 5, 144, 68);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawExtras(int i)
|
||||||
|
{
|
||||||
|
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
|
||||||
|
|
||||||
|
float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
|
||||||
|
drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
|
||||||
|
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
|
||||||
|
drawProgressBar(149, 12, 176, 7, 4, 52, f, 3);
|
||||||
|
|
||||||
|
if(recipe.output.hasSecondary())
|
||||||
|
{
|
||||||
|
drawString(Math.round(recipe.output.secondaryChance*100) + "%", 116, 52, 0x404040);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate()
|
||||||
|
{
|
||||||
|
super.onUpdate();
|
||||||
|
ticksPassed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadTransferRects()
|
||||||
|
{
|
||||||
|
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(63, 34, 24, 7), getRecipeId(), new Object[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(String outputId, Object... results)
|
||||||
|
{
|
||||||
|
if(outputId.equals(getRecipeId()))
|
||||||
|
{
|
||||||
|
for(Map.Entry irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.loadCraftingRecipes(outputId, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(ItemStack result)
|
||||||
|
{
|
||||||
|
for(Map.Entry<ItemStack, ChanceOutput> irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(irecipe.getValue().hasPrimary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().primaryOutput, result))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
else if(irecipe.getValue().hasSecondary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().secondaryOutput, result))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadUsageRecipes(ItemStack ingredient)
|
||||||
|
{
|
||||||
|
for(Map.Entry irecipe : getRecipes())
|
||||||
|
{
|
||||||
|
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getKey(), ingredient))
|
||||||
|
{
|
||||||
|
arecipes.add(new CachedIORecipe(irecipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
|
||||||
|
{
|
||||||
|
public PositionedStack input;
|
||||||
|
public ChanceOutput output;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getIngredient()
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getResult()
|
||||||
|
{
|
||||||
|
return new PositionedStack(output.primaryOutput, 100, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getOtherStack()
|
||||||
|
{
|
||||||
|
return new PositionedStack(output.secondaryOutput, 116, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CachedIORecipe(ItemStack itemstack, ChanceOutput chance)
|
||||||
|
{
|
||||||
|
input = new PositionedStack(itemstack, 40, 12);
|
||||||
|
output = chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CachedIORecipe(Map.Entry recipe)
|
||||||
|
{
|
||||||
|
this((ItemStack)recipe.getKey(), (ChanceOutput)recipe.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import mekanism.client.gui.GuiElectrolyticSeparator;
|
||||||
import mekanism.client.gui.GuiEnrichmentChamber;
|
import mekanism.client.gui.GuiEnrichmentChamber;
|
||||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||||
|
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||||
import mekanism.client.gui.GuiPurificationChamber;
|
import mekanism.client.gui.GuiPurificationChamber;
|
||||||
import mekanism.client.gui.GuiRotaryCondensentrator;
|
import mekanism.client.gui.GuiRotaryCondensentrator;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
@ -56,6 +57,9 @@ public class NEIMekanismConfig implements IConfigureNEI
|
||||||
API.registerRecipeHandler(new ElectrolyticSeparatorRecipeHandler());
|
API.registerRecipeHandler(new ElectrolyticSeparatorRecipeHandler());
|
||||||
API.registerUsageHandler(new ElectrolyticSeparatorRecipeHandler());
|
API.registerUsageHandler(new ElectrolyticSeparatorRecipeHandler());
|
||||||
|
|
||||||
|
API.registerRecipeHandler(new PrecisionSawmillRecipeHandler());
|
||||||
|
API.registerUsageHandler(new PrecisionSawmillRecipeHandler());
|
||||||
|
|
||||||
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
|
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
|
||||||
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
|
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
|
||||||
API.setGuiOffset(GuiCrusher.class, 16, 6);
|
API.setGuiOffset(GuiCrusher.class, 16, 6);
|
||||||
|
@ -67,6 +71,7 @@ public class NEIMekanismConfig implements IConfigureNEI
|
||||||
API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset);
|
API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset);
|
||||||
API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset);
|
API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset);
|
||||||
API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset);
|
API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset);
|
||||||
|
API.setGuiOffset(GuiPrecisionSawmill.class, 16, 6);
|
||||||
|
|
||||||
API.hideItem(Mekanism.boundingBlockID);
|
API.hideItem(Mekanism.boundingBlockID);
|
||||||
API.hideItem(Mekanism.ItemProxy.itemID);
|
API.hideItem(Mekanism.ItemProxy.itemID);
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package mekanism.client.nei;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||||
|
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||||
|
|
||||||
|
public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getRecipeName()
|
||||||
|
{
|
||||||
|
return "Precision Sawmill";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRecipeId()
|
||||||
|
{
|
||||||
|
return "mekanism.precisionsawmill";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOverlayIdentifier()
|
||||||
|
{
|
||||||
|
return "precisionsawmill";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set getRecipes()
|
||||||
|
{
|
||||||
|
return Recipe.PRECISION_SAWMILL.get().entrySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGuiTexture()
|
||||||
|
{
|
||||||
|
return "mekanism:gui/GuiPrecisionSawmill.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class getGuiClass()
|
||||||
|
{
|
||||||
|
return GuiPrecisionSawmill.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -246,6 +246,7 @@ public class Mekanism
|
||||||
public static Item ElectrolyticCore;
|
public static Item ElectrolyticCore;
|
||||||
public static Item CompressedRedstone;
|
public static Item CompressedRedstone;
|
||||||
public static Item Sawdust;
|
public static Item Sawdust;
|
||||||
|
public static Item Salt;
|
||||||
|
|
||||||
//Blocks
|
//Blocks
|
||||||
public static Block BasicBlock;
|
public static Block BasicBlock;
|
||||||
|
@ -710,6 +711,7 @@ public class Mekanism
|
||||||
ElectrolyticCore = new ItemMekanism(configuration.getItem("ElectrolyticCore", 11228).getInt()).setUnlocalizedName("ElectrolyticCore");
|
ElectrolyticCore = new ItemMekanism(configuration.getItem("ElectrolyticCore", 11228).getInt()).setUnlocalizedName("ElectrolyticCore");
|
||||||
CompressedRedstone = new ItemMekanism(configuration.getItem("CompressedRedstone", 11229).getInt()).setUnlocalizedName("CompressedRedstone");
|
CompressedRedstone = new ItemMekanism(configuration.getItem("CompressedRedstone", 11229).getInt()).setUnlocalizedName("CompressedRedstone");
|
||||||
Sawdust = new ItemMekanism(configuration.getItem("Sawdust", 11230).getInt()).setUnlocalizedName("Sawdust");
|
Sawdust = new ItemMekanism(configuration.getItem("Sawdust", 11230).getInt()).setUnlocalizedName("Sawdust");
|
||||||
|
Salt = new ItemMekanism(configuration.getItem("Salt", 11231).getInt()).setUnlocalizedName("Salt");
|
||||||
|
|
||||||
configuration.save();
|
configuration.save();
|
||||||
|
|
||||||
|
@ -744,6 +746,7 @@ public class Mekanism
|
||||||
GameRegistry.registerItem(ElectrolyticCore, "ElectrolyticCore");
|
GameRegistry.registerItem(ElectrolyticCore, "ElectrolyticCore");
|
||||||
GameRegistry.registerItem(CompressedRedstone, "CompressedRedstone");
|
GameRegistry.registerItem(CompressedRedstone, "CompressedRedstone");
|
||||||
GameRegistry.registerItem(Sawdust, "Sawdust");
|
GameRegistry.registerItem(Sawdust, "Sawdust");
|
||||||
|
GameRegistry.registerItem(Salt, "Salt");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -783,10 +786,14 @@ public class Mekanism
|
||||||
OreDictionary.registerOre("universalCable", new ItemStack(PartTransmitter, 8, 0));
|
OreDictionary.registerOre("universalCable", new ItemStack(PartTransmitter, 8, 0));
|
||||||
OreDictionary.registerOre("battery", EnergyTablet.getUnchargedItem());
|
OreDictionary.registerOre("battery", EnergyTablet.getUnchargedItem());
|
||||||
|
|
||||||
//GregoriousT, should I use "sawdust" or "dustSaw"? I'll use both.
|
//GregoriousT, should I use "itemDust" or "dustSaw"? I'll use both.
|
||||||
OreDictionary.registerOre("sawdust", Sawdust);
|
OreDictionary.registerOre("itemSawdust", Sawdust);
|
||||||
OreDictionary.registerOre("dustSaw", Sawdust);
|
OreDictionary.registerOre("dustSaw", Sawdust);
|
||||||
|
|
||||||
|
//Same question Greg...
|
||||||
|
OreDictionary.registerOre("itemSalt", Salt);
|
||||||
|
OreDictionary.registerOre("dustSalt", Salt);
|
||||||
|
|
||||||
OreDictionary.registerOre("dustIron", new ItemStack(Dust, 1, 0));
|
OreDictionary.registerOre("dustIron", new ItemStack(Dust, 1, 0));
|
||||||
OreDictionary.registerOre("dustGold", new ItemStack(Dust, 1, 1));
|
OreDictionary.registerOre("dustGold", new ItemStack(Dust, 1, 1));
|
||||||
OreDictionary.registerOre("dustOsmium", new ItemStack(Dust, 1, 2));
|
OreDictionary.registerOre("dustOsmium", new ItemStack(Dust, 1, 2));
|
||||||
|
|
|
@ -421,34 +421,14 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
||||||
}
|
}
|
||||||
else if(blockID == Mekanism.machineBlock2ID)
|
else if(blockID == Mekanism.machineBlock2ID)
|
||||||
{
|
{
|
||||||
if(meta == 2)
|
if(meta == 3 || meta == 5)
|
||||||
{
|
{
|
||||||
if(side == 3)
|
if(side == 3)
|
||||||
{
|
{
|
||||||
return icons[2][0];
|
return icons[meta][0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return icons[2][2];
|
return icons[meta][2];
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(meta == 3)
|
|
||||||
{
|
|
||||||
if(side == 3)
|
|
||||||
{
|
|
||||||
return icons[3][0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return icons[3][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(meta == 4)
|
|
||||||
{
|
|
||||||
if(side == 3)
|
|
||||||
{
|
|
||||||
return icons[4][0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return icons[4][2];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 1.4 KiB |