First 1.6 push, still work to be done

This commit is contained in:
Aidan Brady 2013-07-20 12:10:14 -04:00
parent 1b039bce4b
commit cfc5dff445
462 changed files with 1473 additions and 4025 deletions

View file

@ -1,32 +0,0 @@
package buildcraft.api.fuels;
import java.util.LinkedList;
import net.minecraftforge.liquids.LiquidStack;
public class IronEngineCoolant {
public static LinkedList<IronEngineCoolant> coolants = new LinkedList<IronEngineCoolant>();
public static IronEngineCoolant getCoolantForLiquid(LiquidStack liquid) {
if (liquid == null)
return null;
if (liquid.itemID <= 0)
return null;
for (IronEngineCoolant coolant : coolants)
if (coolant.liquid.isLiquidEqual(liquid))
return coolant;
return null;
}
public final LiquidStack liquid;
public final float coolingPerUnit;
public IronEngineCoolant(LiquidStack liquid, float coolingPerUnit) {
this.liquid = liquid;
this.coolingPerUnit = coolingPerUnit;
}
}

View file

@ -1,47 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.fuels;
import java.util.LinkedList;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
public class IronEngineFuel {
public static LinkedList<IronEngineFuel> fuels = new LinkedList<IronEngineFuel>();
public static IronEngineFuel getFuelForLiquid(LiquidStack liquid) {
if (liquid == null)
return null;
if (liquid.itemID <= 0)
return null;
for (IronEngineFuel fuel : fuels)
if (fuel.liquid.isLiquidEqual(liquid))
return fuel;
return null;
}
public final LiquidStack liquid;
public final float powerPerCycle;
public final int totalBurningTime;
public IronEngineFuel(int liquidId, float powerPerCycle, int totalBurningTime) {
this(new LiquidStack(liquidId, LiquidContainerRegistry.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
}
public IronEngineFuel(LiquidStack liquid, float powerPerCycle, int totalBurningTime) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.totalBurningTime = totalBurningTime;
}
}

View file

@ -1,153 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.recipes;
import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;
import net.minecraftforge.liquids.LiquidStack;
public class RefineryRecipe implements Comparable<RefineryRecipe> {
private static SortedSet<RefineryRecipe> recipes = new TreeSet<RefineryRecipe>();
public static void registerRefineryRecipe(RefineryRecipe recipe) {
if (!recipes.contains(recipe)) {
recipes.add(recipe);
}
}
public static SortedSet<RefineryRecipe> getRecipes() {
return Collections.unmodifiableSortedSet(recipes);
}
public static RefineryRecipe findRefineryRecipe(LiquidStack liquid1, LiquidStack liquid2) {
for (RefineryRecipe recipe : recipes)
if (recipe.matches(liquid1, liquid2))
return recipe;
return null;
}
public final LiquidStack ingredient1;
public final LiquidStack ingredient2;
public final LiquidStack result;
public final int energy;
public final int delay;
public RefineryRecipe(int ingredientId1, int ingredientQty1, int ingredientId2, int ingredientQty2, int resultId, int resultQty, int energy, int delay) {
this(new LiquidStack(ingredientId1, ingredientQty1, 0), new LiquidStack(ingredientId2, ingredientQty2, 0), new LiquidStack(resultId, resultQty, 0),
energy, delay);
}
public RefineryRecipe(LiquidStack ingredient1, LiquidStack ingredient2, LiquidStack result, int energy, int delay) {
// Sort starting materials.
if (ingredient1 != null && ingredient2 != null) {
if ((ingredient1.itemID > ingredient2.itemID) || (ingredient1.itemID == ingredient2.itemID && ingredient1.itemMeta > ingredient2.itemMeta)) {
this.ingredient1 = ingredient2;
this.ingredient2 = ingredient1;
} else {
this.ingredient1 = ingredient1;
this.ingredient2 = ingredient2;
}
} else if (ingredient2 != null) {
this.ingredient1 = ingredient2;
this.ingredient2 = ingredient1;
} else {
this.ingredient1 = ingredient1;
this.ingredient2 = ingredient2;
}
this.result = result;
this.energy = energy;
this.delay = delay;
}
public boolean matches(LiquidStack liquid1, LiquidStack liquid2) {
// No inputs, return.
if (liquid1 == null && liquid2 == null)
return false;
// Return if two ingredients are required but only one was supplied.
if ((ingredient1 != null && ingredient2 != null) && (liquid1 == null || liquid2 == null))
return false;
if (ingredient1 != null) {
if (ingredient2 == null)
return ingredient1.isLiquidEqual(liquid1) || ingredient1.isLiquidEqual(liquid2);
else
return (ingredient1.isLiquidEqual(liquid1) && ingredient2.isLiquidEqual(liquid2))
|| (ingredient2.isLiquidEqual(liquid1) && ingredient1.isLiquidEqual(liquid2));
} else if (ingredient2 != null)
return ingredient2.isLiquidEqual(liquid1) || ingredient2.isLiquidEqual(liquid2);
else
return false;
}
// Compares to only the types of source materials.
// We consider non-null < null in order that one-ingredient recipe is checked after
// the failure of matching two-ingredient recipes which include that liquid.
@Override
public int compareTo(RefineryRecipe other) {
if (other == null)
return -1;
else if (ingredient1 == null) {
if (other.ingredient1 == null)
return 0;
else
return 1;
} else if (other.ingredient1 == null)
return -1;
else if (ingredient1.itemID != other.ingredient1.itemID)
return ingredient1.itemID - other.ingredient1.itemID;
else if (ingredient1.itemMeta != other.ingredient1.itemMeta)
return ingredient1.itemMeta - other.ingredient1.itemMeta;
else if (ingredient2 == null) {
if (other.ingredient2 == null)
return 0;
else
return 1;
} else if (other.ingredient2 == null)
return -1;
else if (ingredient2.itemID != other.ingredient2.itemID)
return ingredient2.itemID - other.ingredient2.itemID;
else if (ingredient2.itemMeta != other.ingredient2.itemMeta)
return ingredient2.itemMeta - other.ingredient2.itemMeta;
return 0;
}
// equals() should be consistent with compareTo().
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof RefineryRecipe)
return this.compareTo((RefineryRecipe) obj) == 0;
return false;
}
// hashCode() should be overridden because equals() was overridden.
@Override
public int hashCode() {
if (ingredient1 == null)
return 0;
else if (ingredient2 == null)
return ingredient1.itemID ^ ingredient1.itemMeta;
return ingredient1.itemID ^ ingredient1.itemMeta ^ ingredient2.itemID ^ ingredient2.itemMeta;
}
}

View file

@ -1,40 +0,0 @@
package buildcraft.api.tools;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidStack;
public interface IToolPipette {
/**
* @param pipette
* ItemStack of the pipette.
* @return Capacity of the pipette.
*/
int getCapacity(ItemStack pipette);
/**
* @param pipette
* @return true if the pipette can pipette.
*/
boolean canPipette(ItemStack pipette);
/**
* Fills the pipette with the given liquid stack.
*
* @param pipette
* @param liquid
* @param doFill
* @return Amount of liquid used in filling the pipette.
*/
int fill(ItemStack pipette, LiquidStack liquid, boolean doFill);
/**
* Drains liquid from the pipette
*
* @param pipette
* @param maxDrain
* @param doDrain
* @return Liquid stack representing the liquid and amount drained from the pipette.
*/
LiquidStack drain(ItemStack pipette, int maxDrain, boolean doDrain);
}

View file

@ -1,6 +1,7 @@
package ic2.api;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
/**
@ -15,7 +16,7 @@ public enum Direction {
* +X
*/
XP(1),
/**
* -Y
*/
@ -24,7 +25,7 @@ public enum Direction {
* +Y
*/
YP(3), // 1...
/**
* -Z
*/
@ -33,19 +34,19 @@ public enum Direction {
* +Z
*/
ZP(5);
Direction(int dir) {
this.dir = dir;
}
/*public CoordinateTuple ApplyToCoordinates(CoordinateTuple coordinates) {
CoordinateTuple ret = new CoordinateTuple(coordinates);
ret.coords[dir/2] += GetSign();
return ret;
}*/
/**
* Get the tile entity next to a tile entity following this direction.
*
@ -54,16 +55,16 @@ public enum Direction {
*/
public TileEntity applyToTileEntity(TileEntity tileEntity) {
int coords[] = { tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord };
coords[dir/2] += getSign();
if (tileEntity.worldObj != null && tileEntity.worldObj.blockExists(coords[0], coords[1], coords[2])) {
return tileEntity.worldObj.getBlockTileEntity(coords[0], coords[1], coords[2]);
} else {
return null;
}
}
/**
* Get the inverse of this direction (XN -> XP, XP -> XN, etc.)
*
@ -71,14 +72,14 @@ public enum Direction {
*/
public Direction getInverse() {
int inverseDir = dir - getSign();
for (Direction direction : directions) {
if (direction.dir == inverseDir) return direction;
}
return this;
}
/**
* Convert this direction to a Minecraft side value.
*
@ -87,7 +88,7 @@ public enum Direction {
public int toSideValue() {
return (dir + 4) % 6;
}
/**
* Determine direction sign (N for negative or P for positive).
*
@ -96,12 +97,12 @@ public enum Direction {
private int getSign() {
return (dir % 2) * 2 - 1;
}
public ForgeDirection toForgeDirection() {
return ForgeDirection.getOrientation(toSideValue());
}
private int dir;
private static final Direction[] directions = Direction.values();
public static final Direction[] directions = Direction.values();
}

View file

@ -2,7 +2,7 @@ package ic2.api.crops;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
@ -323,9 +323,9 @@ public abstract class CropCard
*/
public boolean onEntityCollision(ICropTile crop, Entity entity)
{
if (entity instanceof EntityLiving)
if (entity instanceof EntityLivingBase)
{
return ((EntityLiving)entity).isSprinting();
return ((EntityLivingBase)entity).isSprinting();
}
return false;
}

View file

@ -1,6 +1,6 @@
package ic2.api.item;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
@ -70,7 +70,7 @@ public interface IElectricItemManager {
* @param entity entity holding the item
* @return true if the operation succeeded
*/
boolean use(ItemStack itemStack, int amount, EntityLiving entity);
boolean use(ItemStack itemStack, int amount, EntityLivingBase entity);
/**
* Charge an item from the BatPack a player is wearing.
@ -80,7 +80,7 @@ public interface IElectricItemManager {
* @param itemStack electric item's stack
* @param entity entity holding the item
*/
void chargeFromArmor(ItemStack itemStack, EntityLiving entity);
void chargeFromArmor(ItemStack itemStack, EntityLivingBase entity);
/**
* Get the tool tip to display for electric items.

View file

@ -149,16 +149,11 @@ public final class NetworkHelper {
* This method doesn't do anything if executed on the server.
*
* @param dataProvider Object implementing the INetworkDataProvider interface
*
* @deprecated no need to call this anymore, IC2 initiates it automatically
*/
@Deprecated
public static void requestInitialData(INetworkDataProvider dataProvider) {
try {
if (NetworkManager_requestInitialData == null) NetworkManager_requestInitialData = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("requestInitialData", INetworkDataProvider.class);
if (instance == null) instance = getInstance();
NetworkManager_requestInitialData.invoke(instance, dataProvider);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
@ -236,7 +231,6 @@ public final class NetworkHelper {
private static Method NetworkManager_initiateTileEntityEvent;
private static Method NetworkManager_initiateItemEvent;
private static Method NetworkManager_announceBlockUpdate;
private static Method NetworkManager_requestInitialData;
private static Method NetworkManager_initiateClientTileEntityEvent;
private static Method NetworkManager_initiateClientItemEvent;
}

View file

@ -1,6 +1,7 @@
package mekanism.api;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
/**
* The gasses currently available in Mekanism.
@ -15,7 +16,7 @@ public enum EnumGas
public String name;
public Icon gasIcon;
public String texturePath;
public ResourceLocation texturePath;
public static EnumGas getFromName(String gasName)
{
@ -36,7 +37,7 @@ public enum EnumGas
return gasIcon != null && texturePath != null;
}
private EnumGas(String s, Icon icon, String path)
private EnumGas(String s, Icon icon, ResourceLocation path)
{
name = s;
gasIcon = icon;

View file

@ -1,5 +1,7 @@
package mekanism.api;
import net.minecraft.util.ResourceLocation;
/**
* The types of infuse currently available in Mekanism.
* @author AidanBrady
@ -11,7 +13,7 @@ public final class InfuseType
public String name;
/** The location of this infuse's GUI texture */
public String texture;
public ResourceLocation texture;
/** The infuse's GUI texture X offset. */
public int texX;
@ -19,10 +21,10 @@ public final class InfuseType
/** The infuse's GUI texture Y offset. */
public int texY;
public InfuseType(String s, String s1, int x, int y)
public InfuseType(String s, ResourceLocation location, int x, int y)
{
name = s;
texture = s1;
texture = location;
texX = x;
texY = y;
}

View file

@ -5,20 +5,12 @@ public class SideData
/** The color of this SideData */
public EnumColor color;
/** When the side's slot IDs start */
public int slotStart;
/** How many slots this side contains */
public int slotAmount;
/** Int[] of available side slots */
public int[] availableSlots;
public SideData(EnumColor colour, int start, int amount, int[] slots)
public SideData(EnumColor colour, int[] slots)
{
color = colour;
slotStart = start;
slotAmount = amount;
availableSlots = slots;
}
}

View file

@ -11,6 +11,7 @@ import mekanism.common.network.PacketConfiguratorState;
import mekanism.common.network.PacketElectricBowState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatMessageComponent;
import org.lwjgl.input.Keyboard;
@ -49,7 +50,7 @@ public class ClientPlayerTickHandler implements ITickHandler
{
item.setState(stack, (byte)(item.getState(stack) < 2 ? item.getState(stack)+1 : 0));
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfiguratorState().setParams(item.getState(stack)));
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + item.getColor(item.getState(stack)) + item.getState(item.getState(stack)));
entityPlayer.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + item.getColor(item.getState(stack)) + item.getState(item.getState(stack))));
lastTickConfiguratorChange = true;
}
}
@ -67,7 +68,7 @@ public class ClientPlayerTickHandler implements ITickHandler
{
item.setFireState(stack, !item.getFireState(stack));
PacketHandler.sendPacket(Transmission.SERVER, new PacketElectricBowState().setParams(item.getFireState(stack)));
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Fire Mode: " + (item.getFireState(stack) ? (EnumColor.DARK_GREEN + "ON") : (EnumColor.DARK_RED + "OFF")));
entityPlayer.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Fire Mode: " + (item.getFireState(stack) ? (EnumColor.DARK_GREEN + "ON") : (EnumColor.DARK_RED + "OFF"))));
lastTickElectricBowChange = true;
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client;
import java.io.File;
import java.util.HashMap;
import mekanism.api.EnumGas;
@ -11,6 +12,8 @@ import mekanism.common.IElectricChest;
import mekanism.common.InventoryElectricChest;
import mekanism.common.ItemPortableTeleporter;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.TileEntityAdvancedElectricMachine;
import mekanism.common.TileEntityAdvancedFactory;
import mekanism.common.TileEntityChargepad;
@ -36,7 +39,7 @@ import mekanism.common.TileEntityPurificationChamber;
import mekanism.common.TileEntityTeleporter;
import mekanism.common.TileEntityTheoreticalElementizer;
import mekanism.common.TileEntityUniversalCable;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -84,7 +87,7 @@ public class ClientProxy extends CommonProxy
@Override
public void registerSound(TileEntity tileEntity)
{
if(Mekanism.enableSounds && SoundManager.sndSystem != null)
if(Mekanism.enableSounds && Minecraft.getMinecraft().sndManager.sndSystem != null)
{
synchronized(Mekanism.audioHandler.sounds)
{
@ -96,7 +99,7 @@ public class ClientProxy extends CommonProxy
@Override
public void unregisterSound(TileEntity tileEntity)
{
if(Mekanism.enableSounds && SoundManager.sndSystem != null)
if(Mekanism.enableSounds && Minecraft.getMinecraft().sndManager.sndSystem != null)
{
synchronized(Mekanism.audioHandler.sounds)
{
@ -205,14 +208,14 @@ public class ClientProxy extends CommonProxy
if(!EnumGas.HYDROGEN.hasTexture())
{
EnumGas.HYDROGEN.gasIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidHydrogen");
EnumGas.HYDROGEN.texturePath = "/mods/mekanism/textures/items/LiquidHydrogen.png";
EnumGas.HYDROGEN.gasIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidHydrogen");
EnumGas.HYDROGEN.texturePath = MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidHydrogen.png");
}
if(!EnumGas.OXYGEN.hasTexture())
{
EnumGas.OXYGEN.gasIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidOxygen");
EnumGas.OXYGEN.texturePath = "/mods/mekanism/textures/items/LiquidOxygen.png";
EnumGas.OXYGEN.gasIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidOxygen");
EnumGas.OXYGEN.texturePath = MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidOxygen.png");
}
System.out.println("[Mekanism] Render registrations complete.");
@ -364,4 +367,10 @@ public class ClientProxy extends CommonProxy
return false;
}
@Override
public File getMinecraftDir()
{
return Minecraft.getMinecraft().mcDataDir;
}
}

View file

@ -1,12 +1,20 @@
package mekanism.client;
import java.lang.reflect.Method;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureObject;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
@ -26,9 +34,53 @@ public class ClientTickHandler implements ITickHandler
public Minecraft mc = FMLClientHandler.instance().getClient();
public static String MIKE_CAPE = "https://dl.dropboxusercontent.com/s/ji06yflixnszcby/cape.png";
public static String DONATE_CAPE = "https://dl.dropboxusercontent.com/u/90411166/donate.png";
public static String AIDAN_CAPE = "https://dl.dropboxusercontent.com/u/90411166/aidan.png";
public static final String MIKE_CAPE = "https://dl.dropboxusercontent.com/s/ji06yflixnszcby/cape.png";
public static final String DONATE_CAPE = "https://dl.dropboxusercontent.com/u/90411166/donate.png";
public static final String AIDAN_CAPE = "https://dl.dropboxusercontent.com/u/90411166/aidan.png";
private Map<String, ThreadDownloadImageData> mikeDownload = new HashMap<String, ThreadDownloadImageData>();
private Map<String, ThreadDownloadImageData> donateDownload = new HashMap<String, ThreadDownloadImageData>();
private Map<String, ThreadDownloadImageData> aidanDownload = new HashMap<String, ThreadDownloadImageData>();
private void updateCape(EntityPlayer player, ThreadDownloadImageData newCape)
{
if(player.getHideCape())
{
try {
Method m = EntityPlayer.class.getDeclaredMethod("setHideCape", Integer.class, Boolean.class);
m.invoke(player, 1, false);
} catch(Exception e) {}
}
if(MekanismUtils.getPrivateValue(player, AbstractClientPlayer.class, "field_110315_c") != newCape)
{
MekanismUtils.setPrivateValue(player, newCape, AbstractClientPlayer.class, "field_110315_c");
}
}
private ResourceLocation getCapeResource(EntityPlayer player)
{
if(player instanceof AbstractClientPlayer)
{
return (ResourceLocation)MekanismUtils.getPrivateValue(player, AbstractClientPlayer.class, "field_110313_e");
}
return null;
}
private ThreadDownloadImageData getCape(EntityPlayer player, String cape)
{
TextureManager texturemanager = Minecraft.getMinecraft().func_110434_K();
Object object = texturemanager.func_110581_b(getCapeResource(player));
if(object == null)
{
object = new ThreadDownloadImageData(cape, getCapeResource(player), new CapeBufferDownload());
texturemanager.func_110579_a(getCapeResource(player), (TextureObject)object);
}
return (ThreadDownloadImageData)object;
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
@ -41,32 +93,42 @@ public class ClientTickHandler implements ITickHandler
if(mc.theWorld != null)
{
for(EntityPlayer player : (List<EntityPlayer>)mc.theWorld.playerEntities)
for(EntityPlayer entityPlayer : (List<EntityPlayer>)mc.theWorld.playerEntities)
{
String oldCloak = player.cloakUrl;
if(player != null && player.cloakUrl != null)
if(entityPlayer instanceof AbstractClientPlayer)
{
if(player.cloakUrl.startsWith("http://skins.minecraft.net/MinecraftCloaks/"))
{
AbstractClientPlayer player = (AbstractClientPlayer)entityPlayer;
if(player != null)
{
if(StringUtils.stripControlCodes(player.username).equals("mikeacttck"))
{
player.cloakUrl = MIKE_CAPE;
if(mikeDownload.get(player.username) == null)
{
mikeDownload.put(player.username, getCape(player, MIKE_CAPE));
}
updateCape(player, mikeDownload.get(player.username));
}
else if(StringUtils.stripControlCodes(player.username).equals("aidancbrady"))
{
player.cloakUrl = AIDAN_CAPE;
if(aidanDownload.get(player.username) == null)
{
aidanDownload.put(player.username, getCape(player, AIDAN_CAPE));
}
updateCape(player, aidanDownload.get(player.username));
}
else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.username)))
else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.username)) || player.username.contains("Player"))
{
player.cloakUrl = DONATE_CAPE;
if(donateDownload.get(player.username) == null)
{
donateDownload.put(player.username, getCape(player, DONATE_CAPE));
}
updateCape(player, donateDownload.get(player.username));
}
if(!oldCloak.equals(player.cloakUrl))
{
mc.renderEngine.obtainImageData(player.cloakUrl, new CapeBufferDownload());
}
}
}
}
}
}

View file

@ -5,9 +5,9 @@ import java.util.ArrayList;
import mekanism.common.IMechanicalPipe;
import mekanism.common.PipeUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
public class LiquidClientUpdate
public class FluidClientUpdate
{
/** List of iterated pipes, to prevent infinite loops. */
public ArrayList<TileEntity> iteratedPipes = new ArrayList<TileEntity>();
@ -15,13 +15,13 @@ public class LiquidClientUpdate
/** Pointer pipe of this calculation */
public TileEntity pointer;
/** Type of liquid to distribute */
public LiquidStack liquidToSend;
/** Type of fluid to distribute */
public FluidStack fluidToSend;
public LiquidClientUpdate(TileEntity head, LiquidStack liquid)
public FluidClientUpdate(TileEntity head, FluidStack fluid)
{
pointer = head;
liquidToSend = liquid;
fluidToSend = fluid;
}
public void loopThrough(TileEntity tile)
@ -53,7 +53,7 @@ public class LiquidClientUpdate
{
if(tileEntity instanceof IMechanicalPipe)
{
((IMechanicalPipe)tileEntity).onTransfer(liquidToSend);
((IMechanicalPipe)tileEntity).onTransfer(fluidToSend);
}
}
}

View file

@ -58,7 +58,7 @@ public class GuiAdvancedElectricMachine extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture(tileEntity.guiTexturePath);
mc.renderEngine.func_110577_a(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -3,7 +3,9 @@ package mekanism.client;
import mekanism.api.EnumColor;
import mekanism.api.IAccessibleGui;
import mekanism.api.Object3D;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.TileEntityControlPanel;
import mekanism.common.network.PacketControlPanel;
@ -11,6 +13,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@ -63,7 +66,7 @@ public class GuiControlPanel extends GuiScreen
public void drawScreen(int i, int j, float f)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiControlPanel.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiControlPanel.png"));
drawTexturedModalRect(width / 2 - 100, height / 2 - 100, 0, 0, 176, 166);
xField.drawTextBox();
yField.drawTextBox();

View file

@ -1,11 +1,14 @@
package mekanism.client;
import mekanism.common.ContainerDynamicTank;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.TileEntityDynamicTank;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
@ -35,42 +38,42 @@ public class GuiDynamicTank extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 94) + 2, 0x404040);
fontRenderer.drawString("Volume: " + tileEntity.clientCapacity/16000, 53, 26, 0x00CD00);
fontRenderer.drawString(tileEntity.structure.liquidStored != null ? LiquidDictionary.findLiquidName(tileEntity.structure.liquidStored) + ":" : "No liquid.", 53, 44, 0x00CD00);
fontRenderer.drawString(tileEntity.structure.fluidStored != null ? FluidRegistry.getFluidName(tileEntity.structure.fluidStored) + ":" : "No fluid.", 53, 44, 0x00CD00);
if(tileEntity.structure.liquidStored != null)
if(tileEntity.structure.fluidStored != null)
{
fontRenderer.drawString(tileEntity.structure.liquidStored.amount + "mB", 53, 53, 0x00CD00);
fontRenderer.drawString(tileEntity.structure.fluidStored.amount + "mB", 53, 53, 0x00CD00);
}
if(xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.structure.liquidStored != null ? LiquidDictionary.findLiquidName(tileEntity.structure.liquidStored) + ": " + tileEntity.structure.liquidStored.amount + "mB" : "Empty", xAxis, yAxis);
drawCreativeTabHoveringText(tileEntity.structure.fluidStored != null ? FluidRegistry.getFluidName(tileEntity.structure.fluidStored) + ": " + tileEntity.structure.fluidStored.amount + "mB" : "Empty", xAxis, yAxis);
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiDynamicTank.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiDynamicTank.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
guiWidth = (width - xSize) / 2;
guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
if(tileEntity.getScaledLiquidLevel(58) > 0)
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(guiWidth, guiHeight, 7, 14, tileEntity.getScaledLiquidLevel(58), tileEntity.structure.liquidStored, 0);
displayGauge(guiWidth, guiHeight, 23, 14, tileEntity.getScaledLiquidLevel(58), tileEntity.structure.liquidStored, 1);
displayGauge(guiWidth, guiHeight, 7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 0);
displayGauge(guiWidth, guiHeight, 23, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 1);
}
}
/*
* Credit to BuildCraft for both the gauge texture and parts of the code.
*/
public void displayGauge(int width, int height, int xPos, int yPos, int scale, LiquidStack liquid, int side /*0-left, 1-right*/)
public void displayGauge(int width, int height, int xPos, int yPos, int scale, FluidStack fluid, int side /*0-left, 1-right*/)
{
if(liquid == null)
if(fluid == null)
{
return;
}
@ -91,8 +94,8 @@ public class GuiDynamicTank extends GuiContainer
scale = 0;
}
mc.renderEngine.bindTexture(liquid.canonical().getTextureSheet());
drawTexturedModelRectFromIcon(width + xPos, height + yPos + 58 - renderRemaining - start, liquid.canonical().getRenderingIcon(), 16, 16 - (16 - renderRemaining));
mc.renderEngine.func_110577_a(MekanismRenderer.getLiquidTexture());
drawTexturedModelRectFromIcon(width + xPos, height + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
start+=16;
if(renderRemaining == 0 || scale == 0)
@ -101,7 +104,7 @@ public class GuiDynamicTank extends GuiContainer
}
}
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiDynamicTank.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiDynamicTank.png"));
drawTexturedModalRect(width + xPos, height + yPos, 176, side == 0 ? 0 : 54, 16, 54);
}

View file

@ -6,6 +6,8 @@ import mekanism.api.Object3D;
import mekanism.common.ContainerElectricChest;
import mekanism.common.IElectricChest;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.TileEntityElectricChest;
@ -127,7 +129,7 @@ public class GuiElectricChest extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiElectricChest.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricChest.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -58,7 +58,7 @@ public class GuiElectricMachine extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture(tileEntity.guiTexturePath);
mc.renderEngine.func_110577_a(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -1,10 +1,14 @@
package mekanism.client;
import mekanism.common.ContainerElectricPump;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.TileEntityElectricPump;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
@ -36,12 +40,12 @@ public class GuiElectricPump extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 94) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString(tileEntity.liquidTank.getLiquid() != null ? tileEntity.liquidTank.getLiquidName() + ": " + tileEntity.liquidTank.getLiquid().amount : "No liquid.", 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.fluidTank.getFluid() != null ? FluidRegistry.getFluidName(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount : "No fluid.", 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.liquidTank.getLiquid() != null ? tileEntity.liquidTank.getLiquidName() + ": " + tileEntity.liquidTank.getLiquid().amount + "mB" : "Empty", xAxis, yAxis);
drawCreativeTabHoveringText(tileEntity.fluidTank.getFluid() != null ? FluidRegistry.getFluidName(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount + "mB" : "Empty", xAxis, yAxis);
}
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
@ -53,7 +57,7 @@ public class GuiElectricPump extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiElectricPump.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
guiWidth = (width - xSize) / 2;
guiHeight = (height - ySize) / 2;
@ -63,18 +67,18 @@ public class GuiElectricPump extends GuiContainer
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
if(tileEntity.getScaledLiquidLevel(58) > 0)
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(guiWidth, guiHeight, 14, 7, tileEntity.getScaledLiquidLevel(58), tileEntity.liquidTank.getLiquid());
displayGauge(guiWidth, guiHeight, 14, 7, tileEntity.getScaledFluidLevel(58), tileEntity.fluidTank.getFluid());
}
}
/*
* Credit to BuildCraft for both the gauge texture and parts of the code.
*/
public void displayGauge(int width, int height, int xPos, int yPos, int scale, LiquidStack liquid)
public void displayGauge(int width, int height, int xPos, int yPos, int scale, FluidStack fluid)
{
if(liquid == null)
if(fluid == null)
{
return;
}
@ -95,8 +99,8 @@ public class GuiElectricPump extends GuiContainer
scale = 0;
}
mc.renderEngine.bindTexture(liquid.canonical().getTextureSheet());
drawTexturedModelRectFromIcon(width + yPos, height + xPos + 58 - renderRemaining - start, liquid.canonical().getRenderingIcon(), 16, 16 - (16 - renderRemaining));
mc.renderEngine.func_110577_a(MekanismRenderer.getLiquidTexture());
drawTexturedModelRectFromIcon(width + yPos, height + xPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
start+=16;
if(renderRemaining == 0 || scale == 0)
@ -105,7 +109,7 @@ public class GuiElectricPump extends GuiContainer
}
}
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiElectricPump.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"));
drawTexturedModalRect(width + yPos, height + xPos, 176, 52, 16, 60);
}
}

View file

@ -1,9 +1,12 @@
package mekanism.client;
import mekanism.common.ContainerEnergyCube;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityEnergyCube;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@ -42,7 +45,7 @@ public class GuiEnergyCube extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiEnergyCube.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
guiWidth = (width - xSize) / 2;

View file

@ -61,7 +61,7 @@ public class GuiFactory extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/factory/" + tileEntity.tier.guiTexturePath);
mc.renderEngine.func_110577_a(tileEntity.tier.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -1,9 +1,12 @@
package mekanism.client;
import mekanism.common.ContainerGasTank;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityGasTank;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@ -38,7 +41,7 @@ public class GuiGasTank extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiGasTank.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
guiWidth = (width - xSize) / 2;

View file

@ -4,12 +4,15 @@ import java.util.ArrayList;
import mekanism.api.Object3D;
import mekanism.common.ContainerMetallurgicInfuser;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.TileEntityMetallurgicInfuser;
import mekanism.common.network.PacketTileEntity;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -74,7 +77,7 @@ public class GuiMetallurgicInfuser extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiMetallurgicInfuser.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
guiWidth = (width - xSize) / 2;
guiHeight = (height - ySize) / 2;
@ -94,7 +97,7 @@ public class GuiMetallurgicInfuser extends GuiContainer
if(tileEntity.type != null)
{
displayInt = tileEntity.getScaledInfuseLevel(52);
mc.renderEngine.bindTexture(tileEntity.type.texture);
mc.renderEngine.func_110577_a(tileEntity.type.texture);
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.type.texX, tileEntity.type.texY + 52 - displayInt, 4, displayInt);
}
}

View file

@ -4,7 +4,9 @@ import mekanism.api.EnumColor;
import mekanism.api.IEnergizedItem;
import mekanism.api.Object3D;
import mekanism.common.IElectricChest;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.TileEntityElectricChest;
import mekanism.common.network.PacketElectricChest;
@ -13,6 +15,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@ -156,7 +159,7 @@ public class GuiPasswordEnter extends GuiScreen
public void drawScreen(int i, int j, float f)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiPasswordEnter.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordEnter.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -3,7 +3,9 @@ package mekanism.client;
import mekanism.api.EnumColor;
import mekanism.api.Object3D;
import mekanism.common.IElectricChest;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.TileEntityElectricChest;
import mekanism.common.network.PacketElectricChest;
@ -12,6 +14,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@ -187,7 +190,7 @@ public class GuiPasswordModify extends GuiScreen
public void drawScreen(int i, int j, float f)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiPasswordEnter.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordModify.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -1,7 +1,9 @@
package mekanism.client;
import mekanism.common.ItemPortableTeleporter;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketDigitUpdate;
import mekanism.common.network.PacketPortableTeleport;
@ -9,6 +11,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -45,7 +48,7 @@ public class GuiPortableTeleporter extends GuiScreen
itemStack = mc.thePlayer.getCurrentEquippedItem();
}
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiPortableTeleporter.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiPortableTeleporter.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -2,12 +2,15 @@ package mekanism.client;
import mekanism.common.ContainerRobitCrafting;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@ -38,7 +41,7 @@ public class GuiRobitCrafting extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitCrafting.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiRobitCrafting.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);

View file

@ -3,12 +3,15 @@ package mekanism.client;
import mekanism.common.ContainerRobitInventory;
import mekanism.common.EntityRobit;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -38,7 +41,7 @@ public class GuiRobitInventory extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitInventory.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiRobitInventory.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);

View file

@ -3,7 +3,9 @@ package mekanism.client;
import mekanism.common.ContainerRobitMain;
import mekanism.common.EntityRobit;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
@ -11,6 +13,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@ -143,7 +146,7 @@ public class GuiRobitMain extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitMain.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiRobitMain.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -4,7 +4,9 @@ import java.util.List;
import mekanism.common.ContainerRobitRepair;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
@ -16,6 +18,7 @@ import net.minecraft.inventory.ContainerRepair;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@ -183,7 +186,7 @@ public class GuiRobitRepair extends GuiContainer implements ICrafting
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitRepair.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiRobitRepair.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);

View file

@ -3,12 +3,15 @@ package mekanism.client;
import mekanism.common.ContainerRobitSmelting;
import mekanism.common.EntityRobit;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketRobit;
import mekanism.common.network.PacketRobit.RobitPacketType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -34,7 +37,7 @@ public class GuiRobitSmelting extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiRobitSmelting.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiRobitSmelting.png"));
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);

View file

@ -2,11 +2,13 @@ package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketTime;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -39,7 +41,7 @@ public class GuiStopwatch extends GuiScreen
public void drawScreen(int i, int j, float f)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiStopwatch.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiStopwatch.png"));
drawTexturedModalRect(width / 2 - 100, height / 2 - 100, 0, 0, 176, 166);
drawString(fontRenderer, "Steve's Stopwatch", width / 2 - 60, height / 2 - 95, 0xffffff);
super.drawScreen(i, j, f);

View file

@ -4,12 +4,15 @@ import java.util.ArrayList;
import mekanism.api.Object3D;
import mekanism.common.ContainerTeleporter;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.TileEntityTeleporter;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketTileEntity;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -97,7 +100,7 @@ public class GuiTeleporter extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiTeleporter.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;

View file

@ -2,12 +2,14 @@ package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.PacketHandler;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketWeather;
import mekanism.common.network.PacketWeather.WeatherType;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -40,7 +42,7 @@ public class GuiWeatherOrb extends GuiScreen
public void drawScreen(int i, int j, float f)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture("/mods/mekanism/gui/GuiWeatherOrb.png");
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiWeatherOrb.png"));
drawTexturedModalRect(width / 2 - 100, height / 2 - 100, 0, 0, 176, 166);
drawString(fontRenderer, "Weather Orb", width / 2 - 45, height / 2 - 95, 0xffffff);
super.drawScreen(i, j, f);

View file

@ -6,6 +6,8 @@ import mekanism.common.IEnergyCube;
import mekanism.common.ItemBlockMachine;
import mekanism.common.ItemRobit;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.Tier.EnergyCubeTier;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@ -63,9 +65,10 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glTranslatef(0, 1.0F, 1.0F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricChest.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "ElectricChest.png"));
float lidangle = chest.getPrevLidAngle(item) + (chest.getLidAngle(item) - chest.getPrevLidAngle(item)) * Minecraft.getMinecraft().timer.renderPartialTicks;
float lidangle = chest.getPrevLidAngle(item) + (chest.getLidAngle(item) - chest.getPrevLidAngle(item)) * MekanismRenderer.getPartialTicks();
lidangle = 1.0F - lidangle;
lidangle = 1.0F - lidangle * lidangle * lidangle;
electricChest.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);
@ -77,7 +80,7 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -1.5F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/Robit.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "Robit.png"));
robit.render(0.08F);
}
else {

View file

@ -1,8 +1,11 @@
package mekanism.client;
import mekanism.common.BlockMachine.MachineType;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
@ -41,7 +44,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.8F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/TheoreticalElementizer.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "TheoreticalElementizer.png"));
theoreticalElementizer.render(0.0560F);
}
else if(metadata == MachineType.ELECTRIC_PUMP.meta)
@ -49,7 +52,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricPump.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
electricPump.render(0.0560F);
}
else if(metadata == MachineType.METALLURGIC_INFUSER.meta)
@ -57,22 +60,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/MetallurgicInfuser.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "MetallurgicInfuser.png"));
metallurgicInfuser.render(0.0625F);
}
else if(metadata == MachineType.ELECTRIC_CHEST.meta)
{
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glTranslatef(0, 1.0F, 1.0F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricChest.png"));
electricChest.renderAll();
}
else if(metadata == MachineType.CHARGEPAD.meta)
{
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -1.1F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/Chargepad.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "Chargepad.png"));
chargepad.render(0.0625F);
}
else {

View file

@ -1,16 +1,23 @@
package mekanism.client;
import java.util.Arrays;
import java.util.List;
import mekanism.common.ISpecialBounds;
import mekanism.common.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Timer;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.Fluid;
import org.lwjgl.opengl.GL11;
@ -215,9 +222,9 @@ public class MekanismRenderer
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
public static void colorLiquid(LiquidStack liquidStack)
public static void colorFluid(Fluid fluid)
{
int color = liquidStack.asItemStack().getItem().getColorFromItemStack(liquidStack.asItemStack(), 0);
int color = fluid.getColor();
float cR = (color >> 16 & 0xFF) / 255.0F;
float cG = (color >> 8 & 0xFF) / 255.0F;
@ -244,4 +251,39 @@ public class MekanismRenderer
return obj instanceof DisplayInteger && ((DisplayInteger)obj).display == display;
}
}
public static TextureMap getTextureMap(int type)
{
try {
List l = (List)MekanismUtils.getPrivateValue(Minecraft.getMinecraft().renderEngine, TextureManager.class, "field_110583_b");
for(Object obj : l)
{
if(obj instanceof TextureMap)
{
if(((TextureMap)obj).textureType == type)
{
return (TextureMap)obj;
}
}
}
} catch(Exception e) {}
return null;
}
public static float getPartialTicks()
{
try {
Timer t = (Timer)MekanismUtils.getPrivateValue(Minecraft.getMinecraft(), Minecraft.class, "timer");
return t.renderPartialTicks;
} catch(Exception e) {}
return 0;
}
public static ResourceLocation getLiquidTexture()
{
return TextureMap.field_110575_b;
}
}

View file

@ -5,7 +5,9 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityChargepad;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -24,7 +26,7 @@ public class RenderChargepad extends TileEntitySpecialRenderer
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTextureByName("/mods/mekanism/render/Chargepad.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "Chargepad.png"));
switch(tileEntity.facing)
{

View file

@ -9,6 +9,7 @@ import mekanism.client.MekanismRenderer.DisplayInteger;
import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.ItemConfigurator;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
@ -44,7 +45,7 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
{
coloredOverlays = new Icon[16];
TextureMap registrar = mc.renderEngine.textureMapBlocks;
TextureMap registrar = MekanismRenderer.getTextureMap(0);
coloredOverlays[0] = registrar.registerIcon("mekanism:OverlayBlack");
coloredOverlays[1] = registrar.registerIcon("mekanism:OverlayDarkBlue");
@ -95,7 +96,7 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
bindTextureByName("/mods/mekanism/textures/blocks/Overlay" + color.friendlyName.replace(" ", "") + ".png");
func_110628_a(MekanismUtils.getResource(ResourceType.TEXTURE_BLOCKS, "Overlay" + color.friendlyName.replace(" ", "") + ".png"));
GL11.glTranslatef((float)x, (float)y, (float)z);
int display = getOverlayDisplay(world, ForgeDirection.getOrientation(pos.sideHit), color).display;

View file

@ -12,14 +12,11 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.Fluid;
import org.lwjgl.opengl.GL11;
@ -29,8 +26,8 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderDynamicTank extends TileEntitySpecialRenderer
{
private static Map<RenderData, HashMap<LiquidStack, int[]>> cachedCenterLiquids = new HashMap<RenderData, HashMap<LiquidStack, int[]>>();
private static Map<ValveRenderData, HashMap<LiquidStack, DisplayInteger>> cachedValveLiquids = new HashMap<ValveRenderData, HashMap<LiquidStack, DisplayInteger>>();
private static Map<RenderData, HashMap<Fluid, int[]>> cachedCenterFluids = new HashMap<RenderData, HashMap<Fluid, int[]>>();
private static Map<ValveRenderData, HashMap<Fluid, DisplayInteger>> cachedValveFluids = new HashMap<ValveRenderData, HashMap<Fluid, DisplayInteger>>();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
@ -40,7 +37,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityDynamicTank tileEntity, double x, double y, double z, float partialTick)
{
if(tileEntity.clientHasStructure && tileEntity.isRendering && tileEntity.structure != null && tileEntity.structure.liquidStored != null && tileEntity.structure.liquidStored.amount != 0)
if(tileEntity.clientHasStructure && tileEntity.isRendering && tileEntity.structure != null && tileEntity.structure.fluidStored != null && tileEntity.structure.fluidStored.amount != 0)
{
RenderData data = new RenderData();
@ -49,16 +46,16 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
data.length = tileEntity.structure.volLength;
data.width = tileEntity.structure.volWidth;
bindTextureByName(tileEntity.structure.liquidStored.canonical().getTextureSheet());
func_110628_a(MekanismRenderer.getLiquidTexture());
if(data.location != null && data.height > 0 && Item.itemsList[tileEntity.structure.liquidStored.itemID] != null)
if(data.location != null && data.height > 0 && tileEntity.structure.fluidStored.getFluid() != null)
{
push();
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
int[] displayList = getListAndRender(data, tileEntity.structure.liquidStored.canonical(), tileEntity.worldObj);
GL11.glCallList(displayList[(int)(((float)tileEntity.structure.liquidStored.amount/(float)tileEntity.clientCapacity)*((float)getStages(data.height)-1))]);
int[] displayList = getListAndRender(data, tileEntity.structure.fluidStored.getFluid(), tileEntity.worldObj);
GL11.glCallList(displayList[(int)(((float)tileEntity.structure.fluidStored.amount/(float)tileEntity.clientCapacity)*((float)getStages(data.height)-1))]);
pop();
@ -70,7 +67,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
int display = getValveDisplay(ValveRenderData.get(data, valveData), tileEntity.structure.liquidStored, tileEntity.worldObj).display;
int display = getValveDisplay(ValveRenderData.get(data, valveData), tileEntity.structure.fluidStored.getFluid(), tileEntity.worldObj).display;
GL11.glCallList(display);
pop();
@ -96,36 +93,31 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
private int[] getListAndRender(RenderData data, LiquidStack stack, World world)
private int[] getListAndRender(RenderData data, Fluid fluid, World world)
{
if(cachedCenterLiquids.containsKey(data) && cachedCenterLiquids.get(data).containsKey(stack))
if(cachedCenterFluids.containsKey(data) && cachedCenterFluids.get(data).containsKey(fluid))
{
return cachedCenterLiquids.get(data).get(stack);
return cachedCenterFluids.get(data).get(fluid);
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.waterStill;
toReturn.setTexture(stack.getRenderingIcon());
if(stack.itemID < Block.blocksList.length && Block.blocksList[stack.itemID] != null)
{
toReturn.baseBlock = Block.blocksList[stack.itemID];
}
toReturn.setTexture(fluid.getIcon());
final int stages = getStages(data.height);
int[] displays = new int[stages];
if(cachedCenterLiquids.containsKey(data))
if(cachedCenterFluids.containsKey(data))
{
cachedCenterLiquids.get(data).put(stack, displays);
cachedCenterFluids.get(data).put(fluid, displays);
}
else {
HashMap<LiquidStack, int[]> map = new HashMap<LiquidStack, int[]>();
map.put(stack, displays);
cachedCenterLiquids.put(data, map);
HashMap<Fluid, int[]> map = new HashMap<Fluid, int[]>();
map.put(fluid, displays);
cachedCenterFluids.put(data, map);
}
MekanismRenderer.colorLiquid(stack);
MekanismRenderer.colorFluid(fluid);
for(int i = 0; i < stages; i++)
{
@ -149,60 +141,30 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
return displays;
}
private void setFlowingTexture(LiquidStack liquidStack, Model3D model)
private DisplayInteger getValveDisplay(ValveRenderData data, Fluid fluid, World world)
{
if((liquidStack == null) || (liquidStack.amount <= 0) || (liquidStack.itemID <= 0))
if(cachedValveFluids.containsKey(data) && cachedValveFluids.get(data).containsKey(fluid))
{
return;
}
ItemStack itemStack = liquidStack.asItemStack();
String texturePath = liquidStack.canonical().getTextureSheet();
Icon flatIcon = liquidStack.canonical().getRenderingIcon();
Icon sideIcon = flatIcon;
if((itemStack.getItem() instanceof ItemBlock))
{
flatIcon = Block.blocksList[itemStack.itemID].getIcon(0, 0);
sideIcon = Block.blocksList[itemStack.itemID].getIcon(2, 0);
texturePath = "/terrain.png";
}
model.setTextures(flatIcon, flatIcon, sideIcon, sideIcon, sideIcon, sideIcon);
bindTextureByName(texturePath);
}
private DisplayInteger getValveDisplay(ValveRenderData data, LiquidStack stack, World world)
{
if(cachedValveLiquids.containsKey(data) && cachedValveLiquids.get(data).containsKey(stack))
{
return cachedValveLiquids.get(data).get(stack);
return cachedValveFluids.get(data).get(fluid);
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.waterStill;
setFlowingTexture(stack, toReturn);
if(stack.itemID < Block.blocksList.length && Block.blocksList[stack.itemID] != null)
{
toReturn.baseBlock = Block.blocksList[stack.itemID];
}
toReturn.setTexture(fluid.getFlowingIcon());
DisplayInteger display = new DisplayInteger();
if(cachedValveLiquids.containsKey(data))
if(cachedValveFluids.containsKey(data))
{
cachedValveLiquids.get(data).put(stack, display);
cachedValveFluids.get(data).put(fluid, display);
}
else {
HashMap<LiquidStack, DisplayInteger> map = new HashMap<LiquidStack, DisplayInteger>();
map.put(stack, display);
cachedValveLiquids.put(data, map);
HashMap<Fluid, DisplayInteger> map = new HashMap<Fluid, DisplayInteger>();
map.put(fluid, display);
cachedValveFluids.put(data, map);
}
MekanismRenderer.colorLiquid(stack);
MekanismRenderer.colorFluid(fluid);
display.display = GLAllocation.generateDisplayLists(1);
GL11.glNewList(display.display, 4864);
@ -234,7 +196,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
case NORTH:
{
toReturn.minX = .3;
toReturn.minY = -(getValveLiquidHeight(data)) + .01;
toReturn.minY = -(getValveFluidHeight(data)) + .01;
toReturn.minZ = 1 + .02;
toReturn.maxX = .7;
@ -245,7 +207,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
case SOUTH:
{
toReturn.minX = .3;
toReturn.minY = -(getValveLiquidHeight(data)) + .01;
toReturn.minY = -(getValveFluidHeight(data)) + .01;
toReturn.minZ = -.4;
toReturn.maxX = .7;
@ -256,7 +218,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
case WEST:
{
toReturn.minX = 1 + .02;
toReturn.minY = -(getValveLiquidHeight(data)) + .01;
toReturn.minY = -(getValveFluidHeight(data)) + .01;
toReturn.minZ = .3;
toReturn.maxX = 1.4;
@ -267,7 +229,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
case EAST:
{
toReturn.minX = -.4;
toReturn.minY = -(getValveLiquidHeight(data)) + .01;
toReturn.minY = -(getValveFluidHeight(data)) + .01;
toReturn.minZ = .3;
toReturn.maxX = -.02;
@ -289,7 +251,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
return display;
}
private int getValveLiquidHeight(ValveRenderData data)
private int getValveFluidHeight(ValveRenderData data)
{
return data.valveLocation.yCoord - data.location.yCoord;
}

View file

@ -1,5 +1,7 @@
package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.TileEntityElectricChest;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -26,7 +28,7 @@ public class RenderElectricChest extends TileEntitySpecialRenderer
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y + 1.0F, (float)z);
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
bindTextureByName("/mods/mekanism/render/ElectricChest.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "ElectricChest.png"));
switch(tileEntity.facing)
{

View file

@ -5,7 +5,9 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityElectricPump;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -24,7 +26,8 @@ public class RenderElectricPump extends TileEntitySpecialRenderer
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTextureByName("/mods/mekanism/render/ElectricPump.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F);

View file

@ -3,14 +3,18 @@ package mekanism.client;
import java.util.HashMap;
import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PipeUtils;
import mekanism.common.TileEntityMechanicalPipe;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.lwjgl.opengl.GL11;
@ -22,7 +26,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
private HashMap<ForgeDirection, HashMap<LiquidStack, int[]>> cachedLiquids = new HashMap<ForgeDirection, HashMap<LiquidStack, int[]>>();
private HashMap<ForgeDirection, HashMap<Fluid, int[]>> cachedLiquids = new HashMap<ForgeDirection, HashMap<Fluid, int[]>>();
private static final int stages = 40;
@ -36,7 +40,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityMechanicalPipe tileEntity, double x, double y, double z, float partialTick)
{
bindTextureByName("/mods/mekanism/render/MechanicalPipe" + (tileEntity.isActive ? "Active" : "") + ".png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "MechanicalPipe" + (tileEntity.isActive ? "Active" : "") + ".png"));
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -50,39 +54,39 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
GL11.glPopMatrix();
if(tileEntity.liquidScale > 0 && tileEntity.refLiquid != null)
if(tileEntity.fluidScale > 0 && tileEntity.refFluid != null)
{
push();
if(tileEntity.refLiquid.itemID == Block.lavaStill.blockID)
if(tileEntity.refFluid.getFluid() == FluidRegistry.LAVA)
{
MekanismRenderer.glowOn();
}
bindTextureByName(tileEntity.refLiquid.getTextureSheet());
func_110628_a(MekanismRenderer.getLiquidTexture());
GL11.glTranslatef((float)x, (float)y, (float)z);
for(int i = 0; i < 6; i++)
{
if(connectable[i])
{
int[] displayList = getListAndRender(ForgeDirection.getOrientation(i), tileEntity.refLiquid);
int[] displayList = getListAndRender(ForgeDirection.getOrientation(i), tileEntity.refFluid.getFluid());
if(displayList != null)
{
GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.liquidScale*(stages-1)))]);
GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.fluidScale*(stages-1)))]);
}
}
}
int[] displayList = getListAndRender(ForgeDirection.UNKNOWN, tileEntity.refLiquid);
int[] displayList = getListAndRender(ForgeDirection.UNKNOWN, tileEntity.refFluid.getFluid());
if(displayList != null)
{
GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.liquidScale*(stages-1)))]);
GL11.glCallList(displayList[Math.max(3, (int)((float)tileEntity.fluidScale*(stages-1)))]);
}
if(tileEntity.refLiquid.itemID == Block.lavaStill.blockID)
if(tileEntity.refFluid.getFluid() == FluidRegistry.LAVA)
{
MekanismRenderer.glowOff();
}
@ -107,40 +111,35 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
private int[] getListAndRender(ForgeDirection side, LiquidStack stack)
private int[] getListAndRender(ForgeDirection side, Fluid fluid)
{
if(side == null || stack == null || stack.getRenderingIcon() == null)
if(side == null || fluid == null || fluid.getIcon() == null)
{
return null;
}
if(cachedLiquids.containsKey(side) && cachedLiquids.get(side).containsKey(stack))
if(cachedLiquids.containsKey(side) && cachedLiquids.get(side).containsKey(fluid))
{
return cachedLiquids.get(side).get(stack);
return cachedLiquids.get(side).get(fluid);
}
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.waterStill;
toReturn.setTexture(stack.getRenderingIcon());
if(stack.itemID < Block.blocksList.length && Block.blocksList[stack.itemID] != null)
{
toReturn.baseBlock = Block.blocksList[stack.itemID];
}
toReturn.setTexture(fluid.getIcon());
int[] displays = new int[stages];
if(cachedLiquids.containsKey(side))
{
cachedLiquids.get(side).put(stack, displays);
cachedLiquids.get(side).put(fluid, displays);
}
else {
HashMap<LiquidStack, int[]> map = new HashMap<LiquidStack, int[]>();
map.put(stack, displays);
HashMap<Fluid, int[]> map = new HashMap<Fluid, int[]>();
map.put(fluid, displays);
cachedLiquids.put(side, map);
}
MekanismRenderer.colorLiquid(stack);
MekanismRenderer.colorFluid(fluid);
for(int i = 0; i < stages; i++)
{

View file

@ -1,6 +1,8 @@
package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityMetallurgicInfuser;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -24,7 +26,7 @@ public class RenderMetallurgicInfuser extends TileEntitySpecialRenderer
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTextureByName("/mods/mekanism/render/MetallurgicInfuser.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "MetallurgicInfuser.png"));
switch(tileEntity.facing)
{

View file

@ -4,7 +4,9 @@ import mekanism.common.EntityObsidianTNT;
import mekanism.common.Mekanism;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -54,7 +56,7 @@ public class RenderObsidianTNT extends Render
}
float f3 = (1.0F - ((entityobsidiantnt.fuse - f1) + 1.0F) / 100F) * 0.8F;
loadTexture("/terrain.png");
func_110777_b(entityobsidiantnt);
blockRenderer.renderBlockAsItem(Mekanism.ObsidianTNT, 0, entityobsidiantnt.getBrightness(f1));
if(entityobsidiantnt.fuse / 5 % 2 == 0)
@ -73,4 +75,10 @@ public class RenderObsidianTNT extends Render
GL11.glPopMatrix();
}
@Override
protected ResourceLocation func_110775_a(Entity entity)
{
return TextureMap.field_110575_b;
}
}

View file

@ -9,8 +9,10 @@ import mekanism.api.ITubeConnection;
import mekanism.api.Object3D;
import mekanism.client.MekanismRenderer.DisplayInteger;
import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityGasTank;
import mekanism.common.TileEntityPressurizedTube;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -40,7 +42,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
@SuppressWarnings("incomplete-switch")
public void renderAModelAt(TileEntityPressurizedTube tileEntity, double x, double y, double z, float partialTick)
{
bindTextureByName("/mods/mekanism/render/PressurizedTube.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedTube.png"));
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -109,7 +111,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
push();
GL11.glColor4f(1.0F, 1.0F, 1.0F, tileEntity.gasScale);
bindTextureByName(tileEntity.refGas.texturePath);
func_110628_a(tileEntity.refGas.texturePath);
GL11.glTranslatef((float)x, (float)y, (float)z);
if(tileEntity.canTransferGas())

View file

@ -1,6 +1,10 @@
package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -11,4 +15,10 @@ public class RenderRobit extends RenderLiving
{
super(new ModelRobit(), 0.5F);
}
@Override
protected ResourceLocation func_110775_a(Entity entity)
{
return MekanismUtils.getResource(ResourceType.RENDER, "Robit.png");
}
}

View file

@ -1,6 +1,8 @@
package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityTheoreticalElementizer;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -24,7 +26,7 @@ public class RenderTheoreticalElementizer extends TileEntitySpecialRenderer
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTextureByName("/mods/mekanism/render/TheoreticalElementizer.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "TheoreticalElementizer.png"));
switch(tileEntity.facing)
{

View file

@ -3,7 +3,9 @@ package mekanism.client;
import mekanism.client.MekanismRenderer.Model3D;
import mekanism.common.CableUtils;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import mekanism.common.TileEntityUniversalCable;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -21,7 +23,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
private Icon renderIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidEnergy");
private Icon renderIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidEnergy");
private static final double offset = 0.015;
@ -33,7 +35,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
public void renderAModelAt(TileEntityUniversalCable tileEntity, double x, double y, double z, float partialTick)
{
bindTextureByName("/mods/mekanism/render/UniversalCable.png");
func_110628_a(MekanismUtils.getResource(ResourceType.RENDER, "UniversalCable.png"));
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -52,7 +54,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
push();
MekanismRenderer.glowOn();
bindTextureByName("/mods/mekanism/textures/items/LiquidEnergy.png");
func_110628_a(MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidEnergy.png"));
GL11.glTranslatef((float)x, (float)y, (float)z);
for(int i = 0; i < 6; i++)

View file

@ -3,6 +3,7 @@ package mekanism.client;
import java.net.URL;
import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.client.FMLClientHandler;
@ -46,18 +47,18 @@ public class Sound
identifier = id;
tileEntity = tileentity;
URL url = getClass().getClassLoader().getResource("mods/mekanism/sound/" + sound);
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound/" + sound);
if(url == null)
{
System.out.println("[Mekanism] Invalid sound file: " + sound);
}
if(Mekanism.audioHandler.soundSystem != null)
if(SoundHandler.getSoundSystem() != null)
{
Mekanism.audioHandler.soundSystem.newSource(false, id, url, sound, true, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0, 16F);
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.activate(id);
SoundHandler.getSoundSystem().newSource(false, id, url, sound, true, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0, 16F);
updateVolume(Minecraft.getMinecraft().thePlayer);
SoundHandler.getSoundSystem().activate(id);
}
Mekanism.audioHandler.sounds.put(tileEntity, this);
@ -76,10 +77,10 @@ public class Sound
return;
}
if(Mekanism.audioHandler.soundSystem != null)
if(SoundHandler.getSoundSystem() != null)
{
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.play(identifier);
updateVolume(Minecraft.getMinecraft().thePlayer);
SoundHandler.getSoundSystem().play(identifier);
}
isPlaying = true;
@ -98,10 +99,10 @@ public class Sound
return;
}
if(Mekanism.audioHandler.soundSystem != null)
if(SoundHandler.getSoundSystem() != null)
{
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.stop(identifier);
updateVolume(Minecraft.getMinecraft().thePlayer);
SoundHandler.getSoundSystem().stop(identifier);
}
isPlaying = false;
@ -122,10 +123,10 @@ public class Sound
Mekanism.audioHandler.sounds.remove(tileEntity);
if(Mekanism.audioHandler.soundSystem != null)
if(SoundHandler.getSoundSystem() != null)
{
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.removeSource(identifier);
updateVolume(Minecraft.getMinecraft().thePlayer);
SoundHandler.getSoundSystem().removeSource(identifier);
}
}
}
@ -147,9 +148,9 @@ public class Sound
double distance = entityplayer.getDistance(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
volume = (float)Math.min(Math.max(masterVolume-((distance*.08F)*masterVolume), 0)*multiplier, 1);
if(Mekanism.audioHandler.soundSystem != null)
if(SoundHandler.getSoundSystem() != null)
{
Mekanism.audioHandler.soundSystem.setVolume(identifier, volume);
SoundHandler.getSoundSystem().setVolume(identifier, volume);
}
}
}

View file

@ -10,6 +10,7 @@ import java.util.Random;
import mekanism.api.Object3D;
import mekanism.common.IActiveState;
import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -17,6 +18,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.ChunkEvent;
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -30,9 +32,6 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class SoundHandler
{
/** The PaulsCode SoundSystem */
public SoundSystem soundSystem;
/** All the sound references in the Minecraft game. */
public Map<TileEntity, Sound> sounds = Collections.synchronizedMap(new HashMap<TileEntity, Sound>());
@ -44,7 +43,6 @@ public class SoundHandler
*/
public SoundHandler()
{
soundSystem = SoundManager.sndSystem;
MinecraftForge.EVENT_BUS.register(this);
System.out.println("[Mekanism] Successfully set up SoundHandler.");
}
@ -56,12 +54,7 @@ public class SoundHandler
{
synchronized(sounds)
{
if(soundSystem == null)
{
soundSystem = SoundManager.sndSystem;
}
if(soundSystem != null)
if(getSoundSystem() != null)
{
if(!Mekanism.proxy.isPaused())
{
@ -196,15 +189,20 @@ public class SoundHandler
*/
public void quickPlay(String soundPath, World world, Object3D object)
{
URL url = getClass().getClassLoader().getResource("mods/mekanism/sound/" + soundPath);
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound/" + soundPath);
if(url == null)
{
System.out.println("[Mekanism] Invalid sound file: " + soundPath);
}
String s = soundSystem.quickPlay(false, url, soundPath, false, object.xCoord, object.yCoord, object.zCoord, 0, 16F);
soundSystem.setVolume(s, masterVolume);
String s = getSoundSystem().quickPlay(false, url, soundPath, false, object.xCoord, object.yCoord, object.zCoord, 0, 16F);
getSoundSystem().setVolume(s, masterVolume);
}
public static SoundSystem getSoundSystem()
{
return Minecraft.getMinecraft().sndManager.sndSystem;
}
@ForgeSubscribe

View file

@ -45,7 +45,7 @@ public class ThreadClientUpdate extends Thread
@Override
public void run()
{
File download = new File(new StringBuilder().append(Minecraft.getMinecraftDir()).append(File.separator + "mods" + File.separator + "Mekanism" + moduleName + "-v" + Mekanism.latestVersionNumber + ".jar").toString());
File download = new File(new StringBuilder().append(Mekanism.proxy.getMinecraftDir()).append(File.separator + "mods" + File.separator + "Mekanism" + moduleName + "-v" + Mekanism.latestVersionNumber + ".jar").toString());
try {
prepareForDownload();
download.createNewFile();
@ -82,7 +82,7 @@ public class ThreadClientUpdate extends Thread
*/
public void prepareForDownload()
{
File[] modsList = new File(new StringBuilder().append(Minecraft.getMinecraftDir()).append(File.separator + "mods").toString()).listFiles();
File[] modsList = new File(new StringBuilder().append(Mekanism.proxy.getMinecraftDir()).append(File.separator + "mods").toString()).listFiles();
for(File file : modsList)
{

View file

@ -1,6 +1,9 @@
package mekanism.client;
import mekanism.common.MekanismUtils;
import mekanism.common.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
@ -26,13 +29,13 @@ public class TransmitterRenderer implements ISimpleBlockRenderingHandler
switch(metadata)
{
case 0:
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/PressurizedTube.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedTube.png"));
break;
case 1:
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/UniversalCable.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "UniversalCable.png"));
break;
case 2:
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/MechanicalPipe.png"));
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "MechanicalPipe.png"));
break;
}

View file

@ -11,7 +11,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -21,8 +21,8 @@ import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -203,11 +203,11 @@ public class BlockBasic extends Block
if(itemStack != null && tileEntity.structure != null)
{
if(LiquidContainerRegistry.isEmptyContainer(itemStack))
if(FluidContainerRegistry.isEmptyContainer(itemStack))
{
if(tileEntity.structure.liquidStored != null && tileEntity.structure.liquidStored.amount >= LiquidContainerRegistry.BUCKET_VOLUME)
if(tileEntity.structure.fluidStored != null && tileEntity.structure.fluidStored.amount >= FluidContainerRegistry.BUCKET_VOLUME)
{
ItemStack filled = LiquidContainerRegistry.fillLiquidContainer(tileEntity.structure.liquidStored, itemStack);
ItemStack filled = FluidContainerRegistry.fillFluidContainer(tileEntity.structure.fluidStored, itemStack);
if(filled != null)
{
@ -220,11 +220,11 @@ public class BlockBasic extends Block
player.inventory.mainInventory[i] = filled;
itemStack.stackSize--;
tileEntity.structure.liquidStored.amount -= LiquidContainerRegistry.getLiquidForFilledItem(filled).amount;
tileEntity.structure.fluidStored.amount -= FluidContainerRegistry.getFluidForFilledItem(filled).amount;
if(tileEntity.structure.liquidStored.amount == 0)
if(tileEntity.structure.fluidStored.amount == 0)
{
tileEntity.structure.liquidStored = null;
tileEntity.structure.fluidStored = null;
}
return true;
@ -236,11 +236,11 @@ public class BlockBasic extends Block
player.inventory.mainInventory[i].stackSize++;
itemStack.stackSize--;
tileEntity.structure.liquidStored.amount -= LiquidContainerRegistry.getLiquidForFilledItem(filled).amount;
tileEntity.structure.fluidStored.amount -= FluidContainerRegistry.getFluidForFilledItem(filled).amount;
if(tileEntity.structure.liquidStored.amount == 0)
if(tileEntity.structure.fluidStored.amount == 0)
{
tileEntity.structure.liquidStored = null;
tileEntity.structure.fluidStored = null;
}
return true;
@ -252,11 +252,11 @@ public class BlockBasic extends Block
{
player.setCurrentItemOrArmor(0, filled);
tileEntity.structure.liquidStored.amount -= LiquidContainerRegistry.getLiquidForFilledItem(filled).amount;
tileEntity.structure.fluidStored.amount -= FluidContainerRegistry.getFluidForFilledItem(filled).amount;
if(tileEntity.structure.liquidStored.amount == 0)
if(tileEntity.structure.fluidStored.amount == 0)
{
tileEntity.structure.liquidStored = null;
tileEntity.structure.fluidStored = null;
}
return true;
@ -264,21 +264,21 @@ public class BlockBasic extends Block
}
}
}
else if(LiquidContainerRegistry.isFilledContainer(itemStack))
else if(FluidContainerRegistry.isFilledContainer(itemStack))
{
LiquidStack itemLiquid = LiquidContainerRegistry.getLiquidForFilledItem(itemStack);
FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(itemStack);
int max = tileEntity.structure.volume*16000;
if(tileEntity.structure.liquidStored == null || (tileEntity.structure.liquidStored.amount+itemLiquid.amount <= max))
if(tileEntity.structure.fluidStored == null || (tileEntity.structure.fluidStored.amount+itemFluid.amount <= max))
{
if(LiquidContainerRegistry.isBucket(itemStack))
if(FluidContainerRegistry.isBucket(itemStack))
{
if(tileEntity.structure.liquidStored == null)
if(tileEntity.structure.fluidStored == null)
{
tileEntity.structure.liquidStored = itemLiquid;
tileEntity.structure.fluidStored = itemFluid;
}
else {
tileEntity.structure.liquidStored.amount += itemLiquid.amount;
tileEntity.structure.fluidStored.amount += itemFluid.amount;
}
player.setCurrentItemOrArmor(0, new ItemStack(Item.bucketEmpty));
@ -292,12 +292,12 @@ public class BlockBasic extends Block
player.setCurrentItemOrArmor(0, null);
}
if(tileEntity.structure.liquidStored == null)
if(tileEntity.structure.fluidStored == null)
{
tileEntity.structure.liquidStored = itemLiquid;
tileEntity.structure.fluidStored = itemFluid;
}
else {
tileEntity.structure.liquidStored.amount += itemLiquid.amount;
tileEntity.structure.fluidStored.amount += itemFluid.amount;
}
return true;
@ -371,7 +371,7 @@ public class BlockBasic extends Block
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack itemstack)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
{
world.markBlockForRenderUpdate(x, y, z);
world.updateAllLightTypes(x, y, z);

View file

@ -9,7 +9,7 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -82,7 +82,7 @@ public class BlockEnergyCube extends BlockContainer
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack itemstack)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

View file

@ -2,13 +2,10 @@ package mekanism.common;
import java.util.Random;
import universalelectricity.prefab.implement.IToolConfigurator;
import buildcraft.api.tools.IToolWrench;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -19,6 +16,8 @@ import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import universalelectricity.prefab.implement.IToolConfigurator;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -46,7 +45,7 @@ public class BlockGasTank extends BlockContainer
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack itemstack)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);

View file

@ -16,7 +16,7 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -111,7 +111,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving, ItemStack itemstack)
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@ -722,9 +722,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
{
if(tileEntity instanceof ISustainedTank)
{
if(((ISustainedTank)tileEntity).getLiquidStack() != null)
if(((ISustainedTank)tileEntity).getFluidStack() != null)
{
((ISustainedTank)itemStack.getItem()).setLiquidStack(((ISustainedTank)tileEntity).getLiquidStack(), itemStack);
((ISustainedTank)itemStack.getItem()).setFluidStack(((ISustainedTank)tileEntity).getFluidStack(), itemStack);
}
}
}

View file

@ -7,6 +7,7 @@ import mekanism.api.EnumColor;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatMessageComponent;
public class CommandMekanism extends CommandBase
{
@ -33,26 +34,26 @@ public class CommandMekanism extends CommandBase
{
if(params.length < 1)
{
sender.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------");
sender.sendChatToPlayer(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber);
sender.sendChatToPlayer(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber);
sender.sendChatToPlayer(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion");
sender.sendChatToPlayer(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady");
sender.sendChatToPlayer(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews);
sender.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion"));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady"));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
}
else if(params.length == 1)
{
if(params[0].equalsIgnoreCase("help"))
{
sender.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk" + EnumColor.GREY + " -- displays the main page.");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk help" + EnumColor.GREY + " -- displays this guide.");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk version" + EnumColor.GREY + " -- displays the version number.");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk latest" + EnumColor.GREY + " -- displays the latest version number.");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk news" + EnumColor.GREY + " -- displays most recent recent news.");
sender.sendChatToPlayer(EnumColor.INDIGO + " /mk debug" + EnumColor.GREY + " -- toggles Mekanism's debug mode.");
sender.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk" + EnumColor.GREY + " -- displays the main page."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk help" + EnumColor.GREY + " -- displays this guide."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk version" + EnumColor.GREY + " -- displays the version number."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk latest" + EnumColor.GREY + " -- displays the latest version number."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk news" + EnumColor.GREY + " -- displays most recent recent news."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.INDIGO + " /mk debug" + EnumColor.GREY + " -- toggles Mekanism's debug mode."));
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
}
else if(params[0].equalsIgnoreCase("version"))
{
@ -60,28 +61,28 @@ public class CommandMekanism extends CommandBase
{
if(Mekanism.updateNotifications || Mekanism.latestVersionNumber == null || Mekanism.recentNews == null || Mekanism.latestVersionNumber.equals("null"))
{
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Minecraft is in offline mode, could not check for updates.");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Minecraft is in offline mode, could not check for updates."));
}
else {
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Your client is up to date.");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Your client is up to date."));
}
}
}
else if(params[0].equalsIgnoreCase("news"))
{
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Most recent news: " + EnumColor.INDIGO + Mekanism.recentNews);
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Most recent news: " + EnumColor.INDIGO + Mekanism.recentNews));
}
else if(params[0].equalsIgnoreCase("latest"))
{
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + ".");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + "."));
}
else if(params[0].equalsIgnoreCase("debug"))
{
Mekanism.debug = !Mekanism.debug;
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Debug mode set to " + EnumColor.DARK_GREY + Mekanism.debug);
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Debug mode set to " + EnumColor.DARK_GREY + Mekanism.debug));
}
else {
sender.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Unknown command. Type '" + EnumColor.INDIGO + "/mk help" + EnumColor.GREY + "' for help.");
sender.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Unknown command. Type '" + EnumColor.INDIGO + "/mk help" + EnumColor.GREY + "' for help."));
}
}
}

View file

@ -1,5 +1,7 @@
package mekanism.common;
import java.io.File;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.tileentity.TileEntity;
@ -241,4 +243,13 @@ public class CommonProxy
return null;
}
/**
* Gets the Minecraft base directory.
* @return base directory
*/
public File getMinecraftDir()
{
return null;
}
}

View file

@ -76,7 +76,7 @@ public class CommonWorldTickHandler implements ITickHandler
if(dynamicTank != null)
{
dynamicTank.cachedLiquid = null;
dynamicTank.cachedFluid = null;
dynamicTank.inventory = new ItemStack[2];
dynamicTank.inventoryID = -1;
}

View file

@ -43,9 +43,9 @@ public class ContainerAdvancedElectricMachine extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -7,7 +7,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry;
import universalelectricity.core.item.IItemElectric;
public class ContainerDynamicTank extends Container
@ -39,9 +39,9 @@ public class ContainerDynamicTank extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.playersUsing.remove(entityplayer);
tileEntity.closeChest();
}
@ -80,7 +80,7 @@ public class ContainerDynamicTank extends Container
}
}
}
else if(LiquidContainerRegistry.isEmptyContainer(slotStack) || LiquidContainerRegistry.isFilledContainer(slotStack))
else if(FluidContainerRegistry.isEmptyContainer(slotStack) || FluidContainerRegistry.isFilledContainer(slotStack))
{
if(slotID != 0 && slotID != 1)
{

View file

@ -70,9 +70,9 @@ public class ContainerElectricChest extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
if(isBlock)
{

View file

@ -41,9 +41,9 @@ public class ContainerElectricMachine extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -8,7 +8,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry;
import universalelectricity.core.item.IItemElectric;
public class ContainerElectricPump extends Container
@ -41,9 +41,9 @@ public class ContainerElectricPump extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}
@ -82,7 +82,7 @@ public class ContainerElectricPump extends Container
}
}
}
else if(LiquidContainerRegistry.isEmptyContainer(slotStack))
else if(FluidContainerRegistry.isEmptyContainer(slotStack))
{
if(slotID != 0)
{

View file

@ -41,9 +41,9 @@ public class ContainerEnergyCube extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -95,9 +95,9 @@ public class ContainerFactory extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -38,9 +38,9 @@ public class ContainerGasTank extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -45,9 +45,9 @@ public class ContainerMetallurgicInfuser extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -88,9 +88,9 @@ public class ContainerRobitInventory extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
robit.closeChest();
}
}

View file

@ -35,9 +35,9 @@ public class ContainerRobitMain extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
robit.closeChest();
}

View file

@ -178,9 +178,9 @@ public class ContainerRobitSmelting extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
robit.closeChest();
}
}

View file

@ -38,9 +38,9 @@ public class ContainerTeleporter extends Container
}
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
super.onContainerClosed(entityplayer);
tileEntity.closeChest();
tileEntity.playersUsing.remove(entityplayer);
}

View file

@ -2,22 +2,23 @@ package mekanism.common;
import mekanism.api.Object3D;
import mekanism.common.SynchronizedTankData.ValveData;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidTank;
public class DynamicLiquidTank implements ILiquidTank
public class DynamicFluidTank implements IFluidTank
{
public TileEntityDynamicTank dynamicTank;
public DynamicLiquidTank(TileEntityDynamicTank tileEntity)
public DynamicFluidTank(TileEntityDynamicTank tileEntity)
{
dynamicTank = tileEntity;
}
@Override
public LiquidStack getLiquid()
public FluidStack getFluid()
{
return dynamicTank.structure != null ? dynamicTank.structure.liquidStored : null;
return dynamicTank.structure != null ? dynamicTank.structure.fluidStored : null;
}
@Override
@ -27,22 +28,22 @@ public class DynamicLiquidTank implements ILiquidTank
}
@Override
public int fill(LiquidStack resource, boolean doFill)
public int fill(FluidStack resource, boolean doFill)
{
if(dynamicTank.structure != null && !dynamicTank.worldObj.isRemote)
{
if(resource == null || resource.itemID <= 0)
if(resource == null || resource.fluidID <= 0)
{
return 0;
}
if(dynamicTank.structure.liquidStored == null || dynamicTank.structure.liquidStored.itemID <= 0)
if(dynamicTank.structure.fluidStored == null || dynamicTank.structure.fluidStored.fluidID <= 0)
{
if(resource.amount <= getCapacity())
{
if(doFill)
{
dynamicTank.structure.liquidStored = resource.copy();
dynamicTank.structure.fluidStored = resource.copy();
}
if(resource.amount > 0 && doFill)
@ -57,8 +58,8 @@ public class DynamicLiquidTank implements ILiquidTank
else {
if(doFill)
{
dynamicTank.structure.liquidStored = resource.copy();
dynamicTank.structure.liquidStored.amount = getCapacity();
dynamicTank.structure.fluidStored = resource.copy();
dynamicTank.structure.fluidStored.amount = getCapacity();
}
if(getCapacity() > 0 && doFill)
@ -72,18 +73,18 @@ public class DynamicLiquidTank implements ILiquidTank
}
}
if(!dynamicTank.structure.liquidStored.isLiquidEqual(resource))
if(!dynamicTank.structure.fluidStored.isFluidEqual(resource))
{
return 0;
}
int space = getCapacity() - dynamicTank.structure.liquidStored.amount;
int space = getCapacity() - dynamicTank.structure.fluidStored.amount;
if(resource.amount <= space)
{
if(doFill)
{
dynamicTank.structure.liquidStored.amount += resource.amount;
dynamicTank.structure.fluidStored.amount += resource.amount;
}
if(resource.amount > 0 && doFill)
@ -98,7 +99,7 @@ public class DynamicLiquidTank implements ILiquidTank
else {
if(doFill)
{
dynamicTank.structure.liquidStored.amount = getCapacity();
dynamicTank.structure.fluidStored.amount = getCapacity();
}
if(space > 0 && doFill)
@ -123,44 +124,44 @@ public class DynamicLiquidTank implements ILiquidTank
{
if(data.location.equals(Object3D.get(dynamicTank)))
{
data.serverLiquid = value;
data.serverFluid = value;
}
}
}
}
@Override
public LiquidStack drain(int maxDrain, boolean doDrain)
public FluidStack drain(int maxDrain, boolean doDrain)
{
if(dynamicTank.structure != null && !dynamicTank.worldObj.isRemote)
{
if(dynamicTank.structure.liquidStored == null || dynamicTank.structure.liquidStored.itemID <= 0)
if(dynamicTank.structure.fluidStored == null || dynamicTank.structure.fluidStored.fluidID <= 0)
{
return null;
}
if(dynamicTank.structure.liquidStored.amount <= 0)
if(dynamicTank.structure.fluidStored.amount <= 0)
{
return null;
}
int used = maxDrain;
if(dynamicTank.structure.liquidStored.amount < used)
if(dynamicTank.structure.fluidStored.amount < used)
{
used = dynamicTank.structure.liquidStored.amount;
used = dynamicTank.structure.fluidStored.amount;
}
if(doDrain)
{
dynamicTank.structure.liquidStored.amount -= used;
dynamicTank.structure.fluidStored.amount -= used;
}
LiquidStack drained = new LiquidStack(dynamicTank.structure.liquidStored.itemID, used, dynamicTank.structure.liquidStored.itemMeta);
FluidStack drained = new FluidStack(dynamicTank.structure.fluidStored.fluidID, used);
if(dynamicTank.structure.liquidStored.amount <= 0)
if(dynamicTank.structure.fluidStored.amount <= 0)
{
dynamicTank.structure.liquidStored = null;
dynamicTank.structure.fluidStored = null;
}
if(drained.amount > 0 && doDrain)
@ -175,8 +176,19 @@ public class DynamicLiquidTank implements ILiquidTank
}
@Override
public int getTankPressure()
public int getFluidAmount()
{
if(dynamicTank.structure != null)
{
return dynamicTank.structure.fluidStored.amount;
}
return 0;
}
@Override
public FluidTankInfo getInfo()
{
return new FluidTankInfo(this);
}
}

View file

@ -4,12 +4,12 @@ import java.util.HashSet;
import mekanism.api.Object3D;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
public class DynamicTankCache
{
public ItemStack[] inventory = new ItemStack[2];
public LiquidStack liquid;
public FluidStack fluid;
public HashSet<Object3D> locations = new HashSet<Object3D>();
}

View file

@ -12,6 +12,7 @@ import mekanism.api.IEnergizedItem;
import mekanism.api.Object3D;
import micdoodle8.mods.galacticraft.API.IEntityBreathable;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWatchClosest;
@ -49,17 +50,15 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
super(world);
setSize(0.5F, 0.5F);
moveSpeed = 0.3F;
texture = "/mods/mekanism/render/Robit.png";
getNavigator().setAvoidsWater(true);
tasks.addTask(1, new RobitAIFollow(this, moveSpeed, 5.0F, 2.0F));
tasks.addTask(1, new RobitAIFollow(this, 0.3F, 5.0F, 2.0F));
tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
tasks.addTask(2, new EntityAILookIdle(this));
tasks.addTask(3, new EntityAISwimming(this));
func_94061_f(true);
setAlwaysRenderNameTag(true);
}
public EntityRobit(World world, double x, double y, double z)
@ -73,6 +72,15 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
prevPosZ = z;
}
@Override
protected void func_110147_ax()
{
super.func_110147_ax();
func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.3);
func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(1);
}
@Override
public boolean isAIEnabled()
{
@ -461,7 +469,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
}
@Override
protected void damageEntity(DamageSource damageSource, int amount)
protected void damageEntity(DamageSource damageSource, float amount)
{
amount = ForgeHooks.onLivingHurt(this, damageSource, amount);
@ -472,10 +480,10 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
amount = applyArmorCalculations(damageSource, amount);
amount = applyPotionDamageCalculations(damageSource, amount);
int j = getHealth();
float j = func_110143_aJ();
setEnergy(Math.max(0, getEnergy() - (amount*1000)));
field_94063_bt.func_94547_a(damageSource, j, amount);
func_110142_aN().func_94547_a(damageSource, j, amount);
}
@Override
@ -547,12 +555,6 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
dataWatcher.updateObject(15, pickup ? (byte)1 : (byte)0);
}
@Override
public int getMaxHealth()
{
return 1;
}
@Override
public int getSizeInventory()
{
@ -653,7 +655,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
public void closeChest() {}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack)
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return true;
}

View file

@ -10,8 +10,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import cpw.mods.fml.common.FMLCommonHandler;
import mekanism.api.Object3D;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -20,40 +18,41 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.FMLCommonHandler;
public class LiquidNetwork
public class FluidNetwork
{
public Set<IMechanicalPipe> pipes = new HashSet<IMechanicalPipe>();
public Set<ITankContainer> possibleAcceptors = new HashSet<ITankContainer>();
public Map<ITankContainer, ForgeDirection> acceptorDirections = new HashMap<ITankContainer, ForgeDirection>();
public Set<IFluidHandler> possibleAcceptors = new HashSet<IFluidHandler>();
public Map<IFluidHandler, ForgeDirection> acceptorDirections = new HashMap<IFluidHandler, ForgeDirection>();
public LiquidNetwork(IMechanicalPipe... varPipes)
public FluidNetwork(IMechanicalPipe... varPipes)
{
pipes.addAll(Arrays.asList(varPipes));
}
public int emit(LiquidStack liquidToSend, boolean doTransfer, TileEntity emitter)
public int emit(FluidStack fluidToSend, boolean doTransfer, TileEntity emitter)
{
List availableAcceptors = Arrays.asList(getLiquidAcceptors(liquidToSend).toArray());
List availableAcceptors = Arrays.asList(getFluidAcceptors(fluidToSend).toArray());
Collections.shuffle(availableAcceptors);
int liquidSent = 0;
int fluidSent = 0;
if(!availableAcceptors.isEmpty())
{
int divider = availableAcceptors.size();
int remaining = liquidToSend.amount % divider;
int sending = (liquidToSend.amount-remaining)/divider;
int remaining = fluidToSend.amount % divider;
int sending = (fluidToSend.amount-remaining)/divider;
for(Object obj : availableAcceptors)
{
if(obj instanceof ITankContainer && obj != emitter)
if(obj instanceof IFluidHandler && obj != emitter)
{
ITankContainer acceptor = (ITankContainer)obj;
IFluidHandler acceptor = (IFluidHandler)obj;
int currentSending = sending;
if(remaining > 0)
@ -62,30 +61,33 @@ public class LiquidNetwork
remaining--;
}
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, currentSending, liquidToSend.itemMeta), doTransfer);
fluidSent += acceptor.fill(acceptorDirections.get(acceptor), new FluidStack(fluidToSend.fluidID, currentSending), doTransfer);
}
}
}
if(doTransfer && liquidSent > 0 && FMLCommonHandler.instance().getEffectiveSide().isServer())
if(doTransfer && fluidSent > 0 && FMLCommonHandler.instance().getEffectiveSide().isServer())
{
LiquidStack sendStack = liquidToSend.copy();
sendStack.amount = liquidSent;
MinecraftForge.EVENT_BUS.post(new LiquidTransferEvent(this, sendStack));
FluidStack sendStack = fluidToSend.copy();
sendStack.amount = fluidSent;
MinecraftForge.EVENT_BUS.post(new FluidTransferEvent(this, sendStack));
}
return liquidSent;
return fluidSent;
}
public Set<ITankContainer> getLiquidAcceptors(LiquidStack liquidToSend)
public Set<IFluidHandler> getFluidAcceptors(FluidStack fluidToSend)
{
Set<ITankContainer> toReturn = new HashSet<ITankContainer>();
Set<IFluidHandler> toReturn = new HashSet<IFluidHandler>();
for(ITankContainer acceptor : possibleAcceptors)
for(IFluidHandler acceptor : possibleAcceptors)
{
if(acceptor.fill(acceptorDirections.get(acceptor).getOpposite(), liquidToSend, false) > 0)
if(acceptor.canFill(acceptorDirections.get(acceptor).getOpposite(), fluidToSend.getFluid()))
{
toReturn.add(acceptor);
if(acceptor.fill(acceptorDirections.get(acceptor).getOpposite(), fluidToSend, false) > 0)
{
toReturn.add(acceptor);
}
}
}
@ -118,9 +120,9 @@ public class LiquidNetwork
for(IMechanicalPipe pipe : pipes)
{
ITankContainer[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)pipe);
IFluidHandler[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)pipe);
for(ITankContainer acceptor : acceptors)
for(IFluidHandler acceptor : acceptors)
{
if(acceptor != null && !(acceptor instanceof IMechanicalPipe))
{
@ -131,11 +133,11 @@ public class LiquidNetwork
}
}
public void merge(LiquidNetwork network)
public void merge(FluidNetwork network)
{
if(network != null && network != this)
{
LiquidNetwork newNetwork = new LiquidNetwork();
FluidNetwork newNetwork = new FluidNetwork();
newNetwork.pipes.addAll(pipes);
newNetwork.pipes.addAll(network.pipes);
newNetwork.refresh();
@ -190,7 +192,7 @@ public class LiquidNetwork
}
}
else {
LiquidNetwork newNetwork = new LiquidNetwork();
FluidNetwork newNetwork = new FluidNetwork();
for(Object3D node : finder.iterated)
{
@ -266,16 +268,16 @@ public class LiquidNetwork
}
}
public static class LiquidTransferEvent extends Event
public static class FluidTransferEvent extends Event
{
public final LiquidNetwork liquidNetwork;
public final FluidNetwork fluidNetwork;
public final LiquidStack liquidSent;
public final FluidStack fluidSent;
public LiquidTransferEvent(LiquidNetwork network, LiquidStack liquid)
public FluidTransferEvent(FluidNetwork network, FluidStack fluid)
{
liquidNetwork = network;
liquidSent = liquid;
fluidNetwork = network;
fluidSent = fluid;
}
}
@ -305,6 +307,6 @@ public class LiquidNetwork
@Override
public String toString()
{
return "[LiquidNetwork] " + pipes.size() + " pipes, " + possibleAcceptors.size() + " acceptors.";
return "[FluidNetwork] " + pipes.size() + " pipes, " + possibleAcceptors.size() + " acceptors.";
}
}

View file

@ -0,0 +1,39 @@
package mekanism.common;
/**
* Used to manage a slot that stores fluid. Has 3 main values: a stored amount of fluid,
* maximum fluid, and fluid ID.
* @author AidanBrady
*
*/
public class FluidSlot
{
/** The amount of fluid this slot is currently holding. */
public int fluidStored;
/** The maximum amount of fluid this slot can handle. */
public int MAX_FLUID;
/** The fluid's ID. */
public int fluidID;
/**
* Creates a FluidSlot with a defined fluid ID and max fluid. The fluid stored starts at 0.
* @param max - max fluid
* @param id - fluid id
*/
public FluidSlot(int max, int id)
{
MAX_FLUID = max;
fluidID = id;
}
/**
* Sets the fluid to a new amount.
* @param fluid - amount to store
*/
public void setFluid(int amount)
{
fluidStored = Math.max(Math.min(amount, MAX_FLUID), 0);
}
}

View file

@ -1,34 +1,34 @@
package mekanism.common;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Implement this in your TileEntity class if the block can transfer liquid as a Mechanical Pipe.
* Implement this in your TileEntity class if the block can transfer fluid as a Mechanical Pipe.
* @author AidanBrady
*
*/
public interface IMechanicalPipe
{
/**
* Called when liquid is transferred through this pipe.
* @param liquidStack - the liquid transferred
* Called when fluid is transferred through this pipe.
* @param fluidStack - the fluid transferred
*/
public void onTransfer(LiquidStack liquidStack);
public void onTransfer(FluidStack fluidStack);
/**
* Gets the LiquidNetwork currently in use by this cable segment.
* @return LiquidNetwork this cable is using
* Gets the FluidNetwork currently in use by this cable segment.
* @return FluidNetwork this cable is using
*/
public LiquidNetwork getNetwork();
public FluidNetwork getNetwork();
/**
* Sets this cable segment's LiquidNetwork to a new value.
* @param network - LiquidNetwork to set to
* Sets this cable segment's FluidNetwork to a new value.
* @param network - FluidNetwork to set to
*/
public void setNetwork(LiquidNetwork network);
public void setNetwork(FluidNetwork network);
/**
* Refreshes the cable's LiquidNetwork.
* Refreshes the cable's FluidNetwork.
*/
public void refreshNetwork();
}

View file

@ -1,6 +1,6 @@
package mekanism.common;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Internal interface used in blocks and items that are capable of storing sustained tanks.
@ -14,14 +14,14 @@ public interface ISustainedTank
* @param nbtTags - NBTTagList value to set
* @param data - ItemStack parameter if using on item
*/
public void setLiquidStack(LiquidStack liquidStack, Object... data);
public void setFluidStack(FluidStack fluidStack, Object... data);
/**
* Gets the tank tag list from an item or block.
* @param data - ItemStack parameter if using on item
* @return inventory tag list
*/
public LiquidStack getLiquidStack(Object... data);
public FluidStack getFluidStack(Object... data);
/**
* Whether or not this block or item has an internal tank.

View file

@ -4,7 +4,7 @@ import java.util.List;
import mekanism.api.EnumColor;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -34,7 +34,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
@Override
public boolean hitEntity(ItemStack itemstack, EntityLiving hitEntity, EntityLiving player)
public boolean hitEntity(ItemStack itemstack, EntityLivingBase hitEntity, EntityLivingBase player)
{
if(getEnergy(itemstack) > 0)
{
@ -54,7 +54,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
@Override
public boolean onBlockDestroyed(ItemStack itemstack, World world, int id, int x, int y, int z, EntityLiving entityliving)
public boolean onBlockDestroyed(ItemStack itemstack, World world, int id, int x, int y, int z, EntityLivingBase entityliving)
{
if(Block.blocksList[id].getBlockHardness(world, x, y, z) != 0.0D)
{

View file

@ -54,7 +54,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, II
else {
list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + ElectricityDisplay.getDisplayShort(getJoules(itemstack), ElectricUnit.JOULES));
list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + getVoltage(itemstack) + "v");
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagList != null && !getInventory(itemstack).tagList.isEmpty()));
list.add(EnumColor.AQUA + "Inventory: " + EnumColor.GREY + (getInventory(itemstack) != null && getInventory(itemstack).tagCount() != 0));
}
}

View file

@ -21,8 +21,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.input.Keyboard;
@ -156,9 +156,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
if(hasTank(itemstack))
{
if(getLiquidStack(itemstack) != null)
if(getFluidStack(itemstack) != null)
{
list.add(EnumColor.PINK + LiquidDictionary.findLiquidName(getLiquidStack(itemstack)) + ": " + EnumColor.GREY + getLiquidStack(itemstack).amount + "mB");
list.add(EnumColor.PINK + FluidRegistry.getFluidName(getFluidStack(itemstack)) + ": " + EnumColor.GREY + getFluidStack(itemstack).amount + "mB");
}
}
@ -253,9 +253,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
if(tileEntity instanceof ISustainedTank)
{
if(hasTank(stack) && getLiquidStack(stack) != null)
if(hasTank(stack) && getFluidStack(stack) != null)
{
((ISustainedTank)tileEntity).setLiquidStack(getLiquidStack(stack));
((ISustainedTank)tileEntity).setFluidStack(getFluidStack(stack));
}
}
@ -554,9 +554,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
}
@Override
public void setLiquidStack(LiquidStack liquidStack, Object... data)
public void setFluidStack(FluidStack fluidStack, Object... data)
{
if(liquidStack == null || liquidStack.amount == 0 || liquidStack.itemID == 0)
if(fluidStack == null || fluidStack.amount == 0 || fluidStack.fluidID == 0)
{
return;
}
@ -570,12 +570,12 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
itemStack.setTagCompound(new NBTTagCompound());
}
itemStack.stackTagCompound.setTag("liquidTank", liquidStack.writeToNBT(new NBTTagCompound()));
itemStack.stackTagCompound.setTag("fluidTank", fluidStack.writeToNBT(new NBTTagCompound()));
}
}
@Override
public LiquidStack getLiquidStack(Object... data)
public FluidStack getFluidStack(Object... data)
{
if(data[0] instanceof ItemStack)
{
@ -586,9 +586,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
return null;
}
if(itemStack.stackTagCompound.hasKey("liquidTank"))
if(itemStack.stackTagCompound.hasKey("fluidTank"))
{
return LiquidStack.loadLiquidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("liquidTank"));
return FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("fluidTank"));
}
}

View file

@ -58,7 +58,7 @@ public class ItemBlockTransmitter extends ItemBlock
else if(itemstack.getItemDamage() == 2)
{
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "mB " + EnumColor.GREY + "(Liquid Dictionary)");
list.add("- " + EnumColor.PURPLE + "mB " + EnumColor.GREY + "(FluidRegistry)");
}
}
}

View file

@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityPack;
@ -55,7 +56,7 @@ public class ItemConfigurator extends ItemEnergized
tileEntity.recurringNodes.clear();
tileEntity.cleaningNodes.clear();
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Reset Electric Pump calculation.");
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Reset Electric Pump calculation."));
return true;
}
}
@ -68,7 +69,7 @@ public class ItemConfigurator extends ItemEnergized
if(!player.isSneaking())
{
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Current color: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Current color: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
return true;
}
else {
@ -76,7 +77,7 @@ public class ItemConfigurator extends ItemEnergized
{
setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName());
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Color bumped to: " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
if(config instanceof TileEntityBasicBlock)
{

View file

@ -9,6 +9,7 @@ import mekanism.api.EnumColor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World;
public class ItemEnergyMeter extends ItemEnergized
@ -35,12 +36,12 @@ public class ItemEnergyMeter extends ItemEnergized
IUniversalCable cable = (IUniversalCable)tileEntity;
player.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------");
player.sendChatToPlayer(EnumColor.GREY + " *Cables: " + EnumColor.DARK_GREY + cable.getNetwork().cables.size());
player.sendChatToPlayer(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + cable.getNetwork().possibleAcceptors.size());
player.sendChatToPlayer(EnumColor.GREY + " *Needed energy: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay(cable.getNetwork().getEnergyNeeded(new ArrayList()), ElectricUnit.JOULES));
player.sendChatToPlayer(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay(cable.getNetwork().getPower(), ElectricUnit.WATT));
player.sendChatToPlayer(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------");
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Cables: " + EnumColor.DARK_GREY + cable.getNetwork().cables.size()));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + cable.getNetwork().possibleAcceptors.size()));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Needed energy: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay(cable.getNetwork().getEnergyNeeded(new ArrayList()), ElectricUnit.JOULES)));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + ElectricityDisplay.getDisplay(cable.getNetwork().getPower(), ElectricUnit.WATT)));
player.sendChatToPlayer(ChatMessageComponent.func_111066_d(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
}
}
}

View file

@ -4,6 +4,7 @@ import java.util.List;
import mekanism.api.EnumColor;
import mekanism.api.Object3D;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -20,6 +21,10 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
super(id, 100000, 120);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) {}
@Override
public ElectricityPack getProvideRequest(ItemStack itemStack)
{

View file

@ -17,8 +17,9 @@ import mekanism.api.InfuseType;
import mekanism.api.InfusionInput;
import mekanism.api.Object3D;
import mekanism.client.SoundHandler;
import mekanism.common.FluidNetwork.FluidTransferEvent;
import mekanism.common.IFactory.RecipeType;
import mekanism.common.LiquidNetwork.LiquidTransferEvent;
import mekanism.common.MekanismUtils.ResourceType;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier;
@ -52,12 +53,8 @@ import rebelkeithy.mods.metallurgy.api.IOreInfo;
import rebelkeithy.mods.metallurgy.api.MetallurgyAPI;
import thermalexpansion.api.crafting.CraftingManagers;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.Mod.ServerStarting;
import cpw.mods.fml.common.Mod.ServerStopping;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@ -428,7 +425,7 @@ public class Mekanism
RecipeHandler.addCombinerRecipe(new ItemStack(Item.dyePowder, 16, 4), new ItemStack(Block.oreLapis));
//Osmium Compressor Recipes
RecipeHandler.addOsmiumCompressorRecipe(new ItemStack(Item.lightStoneDust), new ItemStack(Ingot, 1, 3));
RecipeHandler.addOsmiumCompressorRecipe(new ItemStack(Item.glowstone), new ItemStack(Ingot, 1, 3));
//Crusher Recipes
RecipeHandler.addCrusherRecipe(new ItemStack(Item.diamond), new ItemStack(Dust, 1, 4));
@ -722,7 +719,7 @@ public class Mekanism
CraftingManagers.pulverizerManager.addRecipe(40, new ItemStack(Mekanism.Ingot, 1, 1), new ItemStack(Mekanism.Dust, 1, 2), false);
CraftingManagers.pulverizerManager.addRecipe(40, new ItemStack(Mekanism.Ingot, 1, 0), new ItemStack(Mekanism.Dust, 1, 3), false);
CraftingManagers.pulverizerManager.addRecipe(40, new ItemStack(Mekanism.Ingot, 1, 3), new ItemStack(Item.lightStoneDust), false);
CraftingManagers.pulverizerManager.addRecipe(40, new ItemStack(Mekanism.Ingot, 1, 3), new ItemStack(Item.glowstone), false);
CraftingManagers.pulverizerManager.addRecipe(40, new ItemStack(Mekanism.Ingot, 1, 4), new ItemStack(Mekanism.Dust, 1, 5), false);
CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 0), new ItemStack(DirtyDust, 1, 0), false);
@ -888,7 +885,7 @@ public class Mekanism
for(ItemStack ore : OreDictionary.getOres("ingotRefinedGlowstone"))
{
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Item.lightStoneDust));
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Item.glowstone));
}
try {
@ -1095,20 +1092,20 @@ public class Mekanism
proxy.registerSpecialTileEntities();
}
@ServerStarting
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(new CommandMekanism());
}
@ServerStopping
@EventHandler
public void serverStopping(FMLServerStoppingEvent event)
{
teleporters.clear();
dynamicInventories.clear();
}
@PreInit
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
File config = event.getSuggestedConfigurationFile();
@ -1126,12 +1123,12 @@ public class Mekanism
}
//Register infuses
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", "/mods/mekanism/infuse/Infusions.png", 0, 0));
InfuseRegistry.registerInfuseType(new InfuseType("TIN", "/mods/mekanism/infuse/Infusions.png", 4, 0));
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", "/mods/mekanism/infuse/Infusions.png", 8, 0));
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 0, 0));
InfuseRegistry.registerInfuseType(new InfuseType("TIN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 4, 0));
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 8, 0));
}
@PostInit
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
hooks = new MekanismHooks();
@ -1144,7 +1141,7 @@ public class Mekanism
proxy.loadSoundHandler();
}
@Init
@EventHandler
public void init(FMLInitializationEvent event)
{
//Register the mod's ore handler
@ -1163,7 +1160,7 @@ public class Mekanism
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new IC2EnergyHandler());
MinecraftForge.EVENT_BUS.register(new EnergyNetwork.NetworkLoader());
MinecraftForge.EVENT_BUS.register(new LiquidNetwork.NetworkLoader());
MinecraftForge.EVENT_BUS.register(new FluidNetwork.NetworkLoader());
//Register with GasTransmission
GasTransmission.register();
@ -1218,10 +1215,10 @@ public class Mekanism
}
@ForgeSubscribe
public void onLiquidTransferred(LiquidTransferEvent event)
public void onLiquidTransferred(FluidTransferEvent event)
{
try {
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.LIQUID, event.liquidNetwork.pipes.iterator().next(), event.liquidSent));
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTransmitterTransferUpdate().setParams(TransmitterTransferType.FLUID, event.fluidNetwork.pipes.iterator().next(), event.fluidSent));
} catch(Exception e) {}
}
}

View file

@ -60,7 +60,7 @@ public final class MekanismHooks
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Ingot, 1, 1), new ItemStack(Mekanism.Dust, 1, 2));
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Ingot, 1, 0), new ItemStack(Mekanism.Dust, 1, 3));
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Ingot, 1, 3), new ItemStack(Item.lightStoneDust));
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Ingot, 1, 3), new ItemStack(Item.glowstone));
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Ingot, 1, 4), new ItemStack(Mekanism.Dust, 1, 5));
Recipes.macerator.addRecipe(new ItemStack(Mekanism.Clump, 1, 0), new ItemStack(Mekanism.DirtyDust, 1, 0));

View file

@ -141,8 +141,10 @@ public class MekanismRecipe implements IRecipe
{
double energyFound = 0;
for(ItemStack itemstack : inv.stackList)
for(int i = 0; i < 9; i++)
{
ItemStack itemstack = inv.getStackInSlot(i);
if(itemstack != null)
{
if(itemstack.getItem() instanceof IEnergizedItem)
@ -160,8 +162,10 @@ public class MekanismRecipe implements IRecipe
int speedUpgrades = 0;
int energyUpgrades = 0;
for(ItemStack itemstack : inv.stackList)
for(int i = 0; i < 9; i++)
{
ItemStack itemstack = inv.getStackInSlot(i);
if(itemstack != null)
{
if(itemstack.getItem() instanceof IUpgradeManagement && ((IUpgradeManagement)itemstack.getItem()).supportsUpgrades(toReturn))

View file

@ -5,6 +5,7 @@ import ic2.api.Direction;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
@ -26,12 +27,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.network.packet.Packet3Chat;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquid;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.network.PacketDispatcher;
@ -596,27 +600,27 @@ public final class MekanismUtils
}
/**
* Whether or not a certain block is considered a liquid.
* Whether or not a certain block is considered a fluid.
* @param world - world the block is in
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
* @return if the block is a liquid
* @return if the block is a fluid
*/
public static boolean isLiquid(World world, int x, int y, int z)
public static boolean isFluid(World world, int x, int y, int z)
{
return getLiquid(world, x, y, z) != null;
return getFluid(world, x, y, z) != null;
}
/**
* Gets a liquid from a certain location.
* Gets a fluid from a certain location.
* @param world - world the block is in
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
* @return the liquid at the certain location, null if it doesn't exist
* @return the fluid at the certain location, null if it doesn't exist
*/
public static LiquidStack getLiquid(World world, int x, int y, int z)
public static FluidStack getFluid(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
@ -628,23 +632,19 @@ public final class MekanismUtils
if((id == Block.waterStill.blockID || id == Block.waterMoving.blockID) && meta == 0)
{
return new LiquidStack(Block.waterStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 0);
return new FluidStack(Block.waterStill.blockID, FluidContainerRegistry.BUCKET_VOLUME);
}
else if((id == Block.lavaStill.blockID || id == Block.lavaMoving.blockID) && meta == 0)
{
return new LiquidStack(Block.lavaStill.blockID, LiquidContainerRegistry.BUCKET_VOLUME, 0);
return new FluidStack(Block.lavaStill.blockID, FluidContainerRegistry.BUCKET_VOLUME);
}
else if(Block.blocksList[id] instanceof ILiquid)
else if(Block.blocksList[id] instanceof IFluidBlock)
{
ILiquid liquid = (ILiquid)Block.blocksList[id];
IFluidBlock fluid = (IFluidBlock)Block.blocksList[id];
if(liquid.isMetaSensitive())
if(meta == 0)
{
return new LiquidStack(liquid.stillLiquidId(), LiquidContainerRegistry.BUCKET_VOLUME, liquid.stillLiquidMeta());
}
else if(meta == 0)
{
return new LiquidStack(liquid.stillLiquidId(), LiquidContainerRegistry.BUCKET_VOLUME, 0);
return new FluidStack(fluid.getFluid(), FluidContainerRegistry.BUCKET_VOLUME);
}
}
@ -652,14 +652,14 @@ public final class MekanismUtils
}
/**
* Gets the liquid ID at a certain location, 0 if there isn't one
* Gets the fluid ID at a certain location, 0 if there isn't one
* @param world - world the block is in
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
* @return liquid ID
* @return fluid ID
*/
public static int getLiquidId(World world, int x, int y, int z)
public static int getFluidId(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
@ -669,33 +669,35 @@ public final class MekanismUtils
return 0;
}
if(id == Block.waterStill.blockID || id == Block.waterMoving.blockID)
if(id == Block.waterMoving.blockID)
{
return Block.waterStill.blockID;
return FluidRegistry.WATER.getID();
}
else if(id == Block.lavaStill.blockID || id == Block.lavaMoving.blockID)
else if(id == Block.lavaMoving.blockID)
{
return Block.lavaStill.blockID;
return FluidRegistry.LAVA.getID();
}
else if(Block.blocksList[id] instanceof ILiquid)
{
ILiquid liquid = (ILiquid)Block.blocksList[id];
return liquid.stillLiquidId();
for(Fluid fluid : FluidRegistry.getRegisteredFluids().values())
{
if(fluid.getBlockID() == id)
{
return fluid.getID();
}
}
return 0;
}
/**
* Whether or not a block is a dead liquid.
* Whether or not a block is a dead fluid.
* @param world - world the block is in
* @param x - x coordinate
* @param y - y coordinate
* @param z - z coordinate
* @return if the block is a dead liquid
* @return if the block is a dead fluid
*/
public static boolean isDeadLiquid(World world, int x, int y, int z)
public static boolean isDeadFluid(World world, int x, int y, int z)
{
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
@ -713,15 +715,11 @@ public final class MekanismUtils
{
return true;
}
else if(Block.blocksList[id] instanceof ILiquid)
else if(Block.blocksList[id] instanceof IFluidBlock)
{
ILiquid liquid = (ILiquid)Block.blocksList[id];
IFluidBlock fluid = (IFluidBlock)Block.blocksList[id];
if(liquid.isMetaSensitive())
{
return liquid.stillLiquidMeta() != meta || liquid.stillLiquidId() != id;
}
else if(meta != 0)
if(meta != 0)
{
return true;
}
@ -741,7 +739,7 @@ public final class MekanismUtils
public static void openElectricChestGui(EntityPlayerMP player, TileEntityElectricChest tileEntity, IInventory inventory, boolean isBlock)
{
player.incrementWindowID();
player.closeInventory();
player.closeContainer();
int id = player.currentWindowId;
if(isBlock)
@ -773,7 +771,7 @@ public final class MekanismUtils
if(tileEntity != null)
{
tileEntity.cachedLiquid = null;
tileEntity.cachedFluid = null;
tileEntity.inventory = new ItemStack[2];
tileEntity.inventoryID = -1;
}
@ -787,17 +785,17 @@ public final class MekanismUtils
/**
* Updates a dynamic tank cache with the defined inventory ID with the parameterized values.
* @param inventoryID - inventory ID of the dynamic tank
* @param liquid - cached liquid of the dynamic tank
* @param fluid - cached fluid of the dynamic tank
* @param inventory - inventory of the dynamic tank
* @param tileEntity - dynamic tank TileEntity
*/
public static void updateCache(int inventoryID, LiquidStack liquid, ItemStack[] inventory, TileEntityDynamicTank tileEntity)
public static void updateCache(int inventoryID, FluidStack fluid, ItemStack[] inventory, TileEntityDynamicTank tileEntity)
{
if(!Mekanism.dynamicInventories.containsKey(inventoryID))
{
DynamicTankCache cache = new DynamicTankCache();
cache.inventory = inventory;
cache.liquid = liquid;
cache.fluid = fluid;
cache.locations.add(Object3D.get(tileEntity));
Mekanism.dynamicInventories.put(inventoryID, cache);
@ -806,7 +804,7 @@ public final class MekanismUtils
}
Mekanism.dynamicInventories.get(inventoryID).inventory = inventory;
Mekanism.dynamicInventories.get(inventoryID).liquid = liquid;
Mekanism.dynamicInventories.get(inventoryID).fluid = fluid;
Mekanism.dynamicInventories.get(inventoryID).locations.add(Object3D.get(tileEntity));
}
@ -843,4 +841,51 @@ public final class MekanismUtils
{
return OreDictionary.getOreName(OreDictionary.getOreID(itemStack));
}
public static Object getPrivateValue(Object obj, Class c, String field)
{
try {
Field f = c.getDeclaredField(field);
f.setAccessible(true);
return f.get(obj);
} catch(Exception e) {
return null;
}
}
public static void setPrivateValue(Object obj, Object value, Class c, String field)
{
try {
Field f = c.getDeclaredField(field);
f.setAccessible(true);
f.set(obj, value);
} catch(Exception e) {}
}
public static ResourceLocation getResource(ResourceType type, String name)
{
return new ResourceLocation("mekanism", type.getPrefix() + name);
}
public static enum ResourceType
{
GUI("gui"),
SOUND("sound"),
RENDER("render"),
TEXTURE_BLOCKS("textures/blocks"),
TEXTURE_ITEMS("textures/items"),
INFUSE("infuse");
private String prefix;
private ResourceType(String s)
{
prefix = s;
}
public String getPrefix()
{
return prefix + "/";
}
}
}

View file

@ -5,8 +5,8 @@ import java.util.Arrays;
import mekanism.api.Object3D;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
public final class PipeUtils
{
@ -42,19 +42,15 @@ public final class PipeUtils
boolean[] connectable = new boolean[] {false, false, false, false, false, false};
TileEntity[] connectedPipes = PipeUtils.getConnectedPipes(tileEntity);
ITankContainer[] connectedAcceptors = PipeUtils.getConnectedAcceptors(tileEntity);
IFluidHandler[] connectedAcceptors = PipeUtils.getConnectedAcceptors(tileEntity);
for(ITankContainer container : connectedAcceptors)
for(IFluidHandler container : connectedAcceptors)
{
if(container != null)
{
int side = Arrays.asList(connectedAcceptors).indexOf(container);
if(container.getTanks(ForgeDirection.getOrientation(side).getOpposite()) != null && container.getTanks(ForgeDirection.getOrientation(side).getOpposite()).length != 0)
{
connectable[side] = true;
}
else if(container.getTank(ForgeDirection.getOrientation(side).getOpposite(), new LiquidStack(-1, 1000)) != null)
if(container.getTankInfo(ForgeDirection.getOrientation(side).getOpposite()) != null && container.getTankInfo(ForgeDirection.getOrientation(side).getOpposite()).length > 0)
{
connectable[side] = true;
}
@ -77,19 +73,19 @@ public final class PipeUtils
/**
* Gets all the acceptors around a tile entity.
* @param tileEntity - center tile entity
* @return array of ITankContainers
* @return array of IFluidHandlers
*/
public static ITankContainer[] getConnectedAcceptors(TileEntity tileEntity)
public static IFluidHandler[] getConnectedAcceptors(TileEntity tileEntity)
{
ITankContainer[] acceptors = new ITankContainer[] {null, null, null, null, null, null};
IFluidHandler[] acceptors = new IFluidHandler[] {null, null, null, null, null, null};
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity acceptor = Object3D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.worldObj);
if(acceptor instanceof ITankContainer && !(acceptor instanceof IMechanicalPipe))
if(acceptor instanceof IFluidHandler && !(acceptor instanceof IMechanicalPipe))
{
acceptors[orientation.ordinal()] = (ITankContainer)acceptor;
acceptors[orientation.ordinal()] = (IFluidHandler)acceptor;
}
}

View file

@ -6,7 +6,7 @@ import java.util.Set;
import mekanism.api.Object3D;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.fluids.FluidStack;
public class SynchronizedTankData
{
@ -20,7 +20,7 @@ public class SynchronizedTankData
public int volume;
public LiquidStack liquidStored;
public FluidStack fluidStored;
public ItemStack[] inventory = new ItemStack[2];
@ -76,7 +76,7 @@ public class SynchronizedTankData
{
public ForgeDirection side;
public Object3D location;
public boolean serverLiquid;
public boolean serverFluid;
@Override
public int hashCode()

View file

@ -396,7 +396,7 @@ public class TankUpdateProtocol
idFound = MekanismUtils.getUniqueInventoryID();
}
structureFound.liquidStored = cache.liquid;
structureFound.fluidStored = cache.fluid;
structureFound.inventory = cache.inventory;
for(Object3D obj : structureFound.locations)
@ -405,7 +405,7 @@ public class TankUpdateProtocol
tileEntity.inventoryID = idFound;
tileEntity.structure = structureFound;
tileEntity.cachedLiquid = cache.liquid;
tileEntity.cachedFluid = cache.fluid;
tileEntity.inventory = cache.inventory;
}
}

View file

@ -1,5 +1,7 @@
package mekanism.common;
import net.minecraft.util.ResourceLocation;
/**
* Tier information for Mekanism. This currently includes tiers for Energy Cubes and Smelting Factories.
* @author aidancbrady
@ -54,12 +56,12 @@ public final class Tier
*/
public static enum FactoryTier
{
BASIC("Basic", 3, "GuiBasicFactory.png"),
ADVANCED("Advanced", 5, "GuiAdvancedFactory.png"),
ELITE("Elite", 7, "GuiEliteFactory.png");
BASIC("Basic", 3, new ResourceLocation("mekanism", "gui/GuiBasicFactory.png")),
ADVANCED("Advanced", 5, new ResourceLocation("mekanism", "gui/GuiAdvancedFactory.png")),
ELITE("Elite", 7, new ResourceLocation("mekanism", "gui/GuiEliteFactory.png"));
public int processes;
public String guiTexturePath;
public ResourceLocation guiLocation;
public String name;
public static FactoryTier getFromName(String tierName)
@ -76,11 +78,11 @@ public final class Tier
return BASIC;
}
private FactoryTier(String s, int process, String gui)
private FactoryTier(String s, int process, ResourceLocation gui)
{
name = s;
processes = process;
guiTexturePath = gui;
guiLocation = gui;
}
}
}

View file

@ -11,6 +11,7 @@ import mekanism.api.SideData;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import universalelectricity.core.item.IItemElectric;
import com.google.common.io.ByteArrayDataInput;
@ -35,23 +36,23 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
*
* @param soundPath - location of the sound effect
* @param name - full name of this machine
* @param path - GUI texture path of this machine
* @param location - GUI texture path of this machine
* @param perTick - how much energy this machine uses per tick.
* @param secondaryPerTick - how much secondary energy (fuel) this machine uses per tick.
* @param ticksRequired - how many ticks it takes to smelt an item.
* @param maxEnergy - maximum amount of energy this machine can hold.
* @param maxSecondaryEnergy - maximum amount of secondary energy (fuel) this machine can hold.
*/
public TileEntityAdvancedElectricMachine(String soundPath, String name, String path, double perTick, int secondaryPerTick, int ticksRequired, double maxEnergy, int maxSecondaryEnergy)
public TileEntityAdvancedElectricMachine(String soundPath, String name, ResourceLocation location, double perTick, int secondaryPerTick, int ticksRequired, double maxEnergy, int maxSecondaryEnergy)
{
super(soundPath, name, path, perTick, ticksRequired, maxEnergy);
super(soundPath, name, location, perTick, ticksRequired, maxEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 0, 1, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.PURPLE, 1, 1, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 2, 1, new int[] {2}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 3, 1, new int[] {3}));
sideOutputs.add(new SideData(EnumColor.ORANGE, 4, 1, new int[] {4}));
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {2}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {3}));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {4}));
sideConfig = new byte[] {2, 1, 0, 4, 5, 3};
@ -186,7 +187,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
}
@Override
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{
if(slotID == 2)
{

View file

@ -11,11 +11,11 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
{
super(FactoryTier.ADVANCED, MachineType.ADVANCED_FACTORY);
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 4, 5, new int[] {4, 5, 6, 7, 8}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 9, 5, new int[] {9, 10, 11, 12, 13}));
sideOutputs.add(new SideData(EnumColor.GREY, new int[0]));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {4, 5, 6, 7, 8}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {9, 10, 11, 12, 13}));
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
}

View file

@ -15,6 +15,7 @@ import mekanism.common.PacketHandler.Transmission;
import mekanism.common.network.PacketTileEntity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
@ -61,7 +62,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
public boolean prevActive;
/** The GUI texture path for this machine. */
public String guiTexturePath;
public ResourceLocation guiLocation;
/**
* The foundation of all machines - a simple tile entity with a facing, active state, initialized state, sound effect, and animated texture.
@ -72,13 +73,13 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
* @param ticksRequired - how many ticks it takes to run a cycle
* @param maxEnergy - how much energy this machine can store
*/
public TileEntityBasicMachine(String soundPath, String name, String path, double perTick, int ticksRequired, double maxEnergy)
public TileEntityBasicMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy)
{
super(name, maxEnergy);
ENERGY_PER_TICK = perTick;
TICKS_REQUIRED = ticksRequired;
soundURL = soundPath;
guiTexturePath = path;
guiLocation = location;
isActive = false;
}
@ -212,18 +213,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
return true;
}
@Override
public int getStartInventorySide(ForgeDirection side)
{
return sideOutputs.get(sideConfig[MekanismUtils.getBaseOrientation(side.ordinal(), facing)]).slotStart;
}
@Override
public int getSizeInventorySide(ForgeDirection side)
{
return sideOutputs.get(sideConfig[MekanismUtils.getBaseOrientation(side.ordinal(), facing)]).slotAmount;
}
/**
* Gets the scaled energy level for the GUI.
* @param i - multiplier

Some files were not shown because too many files have changed in this diff Show more