v5.5.6 Beta #21

*Liquid now renders with Item-based color.
*Better IC2/TE recipe integration.
*Cleanups.
This commit is contained in:
Aidan Brady 2013-06-25 12:28:40 -04:00
parent e1c600dab3
commit 0969a06dba
6 changed files with 70 additions and 21 deletions

View file

@ -10,9 +10,9 @@ import mekanism.common.SynchronizedTankData.ValveData;
import mekanism.common.TileEntityDynamicTank; import mekanism.common.TileEntityDynamicTank;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
@ -48,7 +48,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
bindTextureByName(tileEntity.structure.liquidStored.canonical().getTextureSheet()); bindTextureByName(tileEntity.structure.liquidStored.canonical().getTextureSheet());
if(data.location != null && data.height > 0) if(data.location != null && data.height > 0 && Item.itemsList[tileEntity.structure.liquidStored.itemID] != null)
{ {
push(); push();
@ -122,6 +122,12 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
cachedCenterLiquids.put(data, map); cachedCenterLiquids.put(data, map);
} }
int color = stack.asItemStack().getItem().getColorFromItemStack(stack.asItemStack(), 0);
float cR = (color >> 16 & 0xFF) / 255.0F;
float cG = (color >> 8 & 0xFF) / 255.0F;
float cB = (color & 0xFF) / 255.0F;
GL11.glColor4f(cR, cG, cB, 1.0F);
for(int i = 0; i < stages; i++) for(int i = 0; i < stages; i++)
{ {
displays[i] = GLAllocation.generateDisplayLists(1); displays[i] = GLAllocation.generateDisplayLists(1);
@ -139,6 +145,8 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
GL11.glEndList(); GL11.glEndList();
} }
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return displays; return displays;
} }

View file

@ -168,6 +168,12 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
cachedLiquids.put(side, map); cachedLiquids.put(side, map);
} }
int color = stack.asItemStack().getItem().getColorFromItemStack(stack.asItemStack(), 0);
float cR = (color >> 16 & 0xFF) / 255.0F;
float cG = (color >> 8 & 0xFF) / 255.0F;
float cB = (color & 0xFF) / 255.0F;
GL11.glColor4f(cR, cG, cB, 1.0F);
switch(side) switch(side)
{ {
case UNKNOWN: case UNKNOWN:
@ -319,6 +325,8 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
} }
} }
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return null; return null;
} }
} }

View file

@ -52,8 +52,10 @@ public final class MekanismHooks
if(Loader.isModLoaded("BuildCraft|Energy")) BuildCraftLoaded = true; if(Loader.isModLoaded("BuildCraft|Energy")) BuildCraftLoaded = true;
if(Loader.isModLoaded("Forestry")) ForestryLoaded = true; if(Loader.isModLoaded("Forestry")) ForestryLoaded = true;
if(Loader.isModLoaded("ThermalExpansion")) TELoaded = true; if(Loader.isModLoaded("ThermalExpansion")) TELoaded = true;
if(Loader.isModLoaded("Metallurgy3Core")) { if(Loader.isModLoaded("Metallurgy3Core"))
{
MetallurgyCoreLoaded = true; MetallurgyCoreLoaded = true;
if(Loader.isModLoaded("Metallurgy3Base")) MetallurgyBaseLoaded = true; if(Loader.isModLoaded("Metallurgy3Base")) MetallurgyBaseLoaded = true;
} }
@ -75,19 +77,27 @@ public final class MekanismHooks
for(Map.Entry<ItemStack, ItemStack> entry : Recipes.macerator.getRecipes().entrySet()) for(Map.Entry<ItemStack, ItemStack> entry : Recipes.macerator.getRecipes().entrySet())
{ {
if(!Recipe.ENRICHMENT_CHAMBER.get().containsKey(entry.getKey())) if(MekanismUtils.getName(entry.getKey()).startsWith("ore"))
{ {
if(MekanismUtils.getName(entry.getKey()).startsWith("ore")) if(!Recipe.ENRICHMENT_CHAMBER.containsRecipe(entry.getKey()))
{ {
RecipeHandler.addEnrichmentChamberRecipe(entry.getKey(), entry.getValue()); RecipeHandler.addEnrichmentChamberRecipe(entry.getKey(), entry.getValue());
} }
} }
else if(MekanismUtils.getName(entry.getKey()).startsWith("ingot"))
{
if(!Recipe.CRUSHER.containsRecipe(entry.getKey()))
{
RecipeHandler.addCrusherRecipe(entry.getKey(), entry.getValue());
}
}
} }
Recipes.matterAmplifier.addRecipe(new ItemStack(Mekanism.EnrichedAlloy), 50000); Recipes.matterAmplifier.addRecipe(new ItemStack(Mekanism.EnrichedAlloy), 50000);
System.out.println("[Mekanism] Hooked into IC2 successfully."); System.out.println("[Mekanism] Hooked into IC2 successfully.");
} }
if(BasicComponentsLoaded) if(BasicComponentsLoaded)
{ {
if(Mekanism.disableBCSteelCrafting) if(Mekanism.disableBCSteelCrafting)
@ -104,29 +114,39 @@ public final class MekanismHooks
System.out.println("[Mekanism] Hooked into BasicComponents successfully."); System.out.println("[Mekanism] Hooked into BasicComponents successfully.");
} }
if(BuildCraftLoaded) if(BuildCraftLoaded)
{ {
System.out.println("[Mekanism] Hooked into BuildCraft successfully."); System.out.println("[Mekanism] Hooked into BuildCraft successfully.");
} }
if(ForestryLoaded) if(ForestryLoaded)
{ {
ForestryBiofuelID = getForestryItem("liquidBiofuel").itemID; ForestryBiofuelID = getForestryItem("liquidBiofuel").itemID;
ForestryBiofuelBucket = getForestryItem("bucketBiofuel"); ForestryBiofuelBucket = getForestryItem("bucketBiofuel");
System.out.println("[Mekanism] Hooked into Forestry successfully."); System.out.println("[Mekanism] Hooked into Forestry successfully.");
} }
if(TELoaded) if(TELoaded)
{ {
for(IPulverizerRecipe recipe : CraftingManagers.pulverizerManager.getRecipeList()) for(IPulverizerRecipe recipe : CraftingManagers.pulverizerManager.getRecipeList())
{ {
if(recipe.getSecondaryOutput() == null) if(recipe.getSecondaryOutput() == null)
{ {
if(!Recipe.ENRICHMENT_CHAMBER.get().containsKey(recipe.getInput())) if(MekanismUtils.getName(recipe.getInput()).startsWith("ore"))
{ {
if(MekanismUtils.getName(recipe.getInput()).startsWith("ore")) if(!Recipe.ENRICHMENT_CHAMBER.containsRecipe(recipe.getInput()))
{ {
RecipeHandler.addEnrichmentChamberRecipe(recipe.getInput(), recipe.getPrimaryOutput()); RecipeHandler.addEnrichmentChamberRecipe(recipe.getInput(), recipe.getPrimaryOutput());
} }
} }
else if(MekanismUtils.getName(recipe.getInput()).startsWith("ingot"))
{
if(!Recipe.CRUSHER.containsRecipe(recipe.getInput()))
{
RecipeHandler.addCrusherRecipe(recipe.getInput(), recipe.getPrimaryOutput());
}
}
} }
} }
} }

View file

@ -8,12 +8,9 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.api.IConfigurable; import mekanism.api.IConfigurable;
import mekanism.api.InfuseObject;
import mekanism.api.Object3D; import mekanism.api.Object3D;
import mekanism.common.IFactory.RecipeType; import mekanism.common.IFactory.RecipeType;
import mekanism.common.PacketHandler.Transmission; import mekanism.common.PacketHandler.Transmission;

View file

@ -159,6 +159,27 @@ public final class RecipeHandler
recipes.put(input, output); recipes.put(input, output);
} }
public boolean containsRecipe(ItemStack input)
{
for(Object obj : get().entrySet())
{
if(obj instanceof Map.Entry)
{
Map.Entry entry = (Map.Entry)obj;
if(entry.getKey() instanceof ItemStack)
{
if(((ItemStack)entry.getKey()).isItemEqual(input))
{
return true;
}
}
}
}
return false;
}
public HashMap get() public HashMap get()
{ {
return recipes; return recipes;

View file

@ -60,14 +60,6 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
{ {
energyNetwork = network; energyNetwork = network;
} }
public void refreshTile(TileEntity tileEntity)
{
if(tileEntity instanceof IUniversalCable)
{
getNetwork().merge(((IUniversalCable)tileEntity).getNetwork());
}
}
@Override @Override
public void refreshNetwork() public void refreshNetwork()
@ -76,12 +68,15 @@ public class TileEntityUniversalCable extends TileEntity implements IUniversalCa
{ {
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{ {
refreshTile(Object3D.get(this).getFromSide(side).getTileEntity(worldObj)); TileEntity tileEntity = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
if(tileEntity instanceof IUniversalCable)
{
getNetwork().merge(((IUniversalCable)tileEntity).getNetwork());
}
} }
getNetwork().refresh(); getNetwork().refresh();
System.out.println(getNetwork());
} }
} }