Merge branch 'development' into networkRefactor.

Hopefully I didn't miss anything

Conflicts:
	src/main/java/mekanism/api/gas/GasNetwork.java
	src/main/java/mekanism/client/render/RenderPartTransmitter.java
	src/main/java/mekanism/common/EnergyNetwork.java
	src/main/java/mekanism/common/FluidNetwork.java
	src/main/java/mekanism/common/InventoryNetwork.java
	src/main/java/mekanism/common/content/transporter/TransporterStack.java
	src/main/java/mekanism/common/multipart/PartHeatTransmitter.java
	src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java
	src/main/java/mekanism/common/multipart/PartMechanicalPipe.java
	src/main/java/mekanism/common/multipart/PartPressurizedTube.java
	src/main/java/mekanism/common/multipart/PartSidedPipe.java
	src/main/java/mekanism/common/multipart/PartUniversalCable.java
	src/main/java/mekanism/common/util/MekanismUtils.java
	src/main/java/mekanism/common/util/PipeUtils.java
This commit is contained in:
Ben Spiers 2015-04-03 19:45:25 +01:00
commit 7a2461540f
204 changed files with 3463 additions and 1587 deletions

View file

@ -4,4 +4,4 @@ FMP_version=1.1.1.320
CCLIB_version=1.1.1.110
NEI_version=1.0.4.83
CCC_version=1.0.4.35
mod_version=8.0.2
mod_version=8.1.0

View file

@ -12,11 +12,14 @@ import net.minecraft.item.ItemStack;
*/
public final class ItemRetriever
{
/** The 'Mekanism' class that items and blocks are retrieved from. */
private static Class Mekanism;
/** The 'MekanismItems' class that items are retrieved from. */
private static Class MekanismItems;
/** The 'MekanismBlocks' class that blocks are retrieved from. */
private static Class MekanismBlocks;
/**
* Attempts to retrieve an ItemStack of an item or block with the declared identifier.
* Attempts to retrieve an ItemStack of an item with the declared identifier.
*
* Mekanism identifiers follow an easy-to-remember pattern. All identifiers
* are identical to the String returned by 'getItemName().' None include spaces,
@ -26,10 +29,6 @@ public final class ItemRetriever
*
* ItemStack enrichedAlloy = ItemRetriever.getItem("EnrichedAlloy");
*
* The same also works for blocks.
*
* ItemStack refinedObsidian = ItemRetriever.getItem("RefinedObsidian");
*
* Note that for items or blocks that have specific metadata you will need to create
* a new ItemStack with that specified value, as this will only return an ItemStack
* with the meta value '0.'
@ -39,27 +38,23 @@ public final class ItemRetriever
* registered later in order to hook into other mods. In a rare circumstance you may
* have to add "after:Mekanism" in the @Mod 'dependencies' annotation.
*
* @param identifier - a String to be searched in the 'Mekanism' class
* @param identifier - a String to be searched in the 'MekanismItems' class
* @return an ItemStack of the declared identifier, otherwise null.
*/
public static ItemStack getItem(String identifier)
{
try {
if(Mekanism == null)
if(MekanismItems == null)
{
Mekanism = Class.forName("mekanism.common.Mekanism");
MekanismItems = Class.forName("mekanism.common.MekanismItems");
}
Object ret = Mekanism.getField(identifier).get(null);
Object ret = MekanismItems.getField(identifier).get(null);
if(ret instanceof Item)
{
return new ItemStack((Item)ret, 1);
}
else if(ret instanceof Block)
{
return new ItemStack((Block)ret, 1);
}
else {
return null;
}
@ -68,4 +63,50 @@ public final class ItemRetriever
return null;
}
}
/**
* Attempts to retrieve an ItemStack of a block with the declared identifier.
*
* Mekanism identifiers follow an easy-to-remember pattern. All identifiers
* are identical to the String returned by 'getItemName().' None include spaces,
* and all start with a capital letter. The name that shows up in-game can be
* stripped down to identifier form by removing spaces and all non-alphabetic
* characters (,./'=-_). Below is an example:
*
* ItemStack enrichedAlloy = ItemRetriever.getItem("EnrichedAlloy");
*
* Note that for items or blocks that have specific metadata you will need to create
* a new ItemStack with that specified value, as this will only return an ItemStack
* with the meta value '0.'
*
* Make sure you run this in or after FMLPostInitializationEvent runs, because most
* items are registered when FMLInitializationEvent runs. However, some items ARE
* registered later in order to hook into other mods. In a rare circumstance you may
* have to add "after:Mekanism" in the @Mod 'dependencies' annotation.
*
* @param identifier - a String to be searched in the 'MekanismBlocks' class
* @return an ItemStack of the declared identifier, otherwise null.
*/
public static ItemStack getBlock(String identifier)
{
try {
if(MekanismBlocks == null)
{
MekanismBlocks = Class.forName("mekanism.common.MekanismBlocks");
}
Object ret = MekanismBlocks.getField(identifier).get(null);
if(ret instanceof Block)
{
return new ItemStack((Block)ret, 1);
}
else {
return null;
}
} catch(Exception e) {
System.err.println("Error retrieving block with identifier '" + identifier + "': " + e.getMessage());
return null;
}
}
}

View file

@ -16,7 +16,6 @@ import mekanism.api.transmitters.IGridTransmitter;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
@ -71,7 +70,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
buffer = net.buffer.copy();
} else
{
if(buffer.getGas() == net.buffer.getGas())
if(buffer.isGasEqual(net.buffer))
{
buffer.amount += net.buffer.amount;
}

View file

@ -90,7 +90,7 @@ public class GasTank
{
if(stored == null)
{
stored = amount.copy();
stored = amount.copy().withAmount(getStored()+toFill);
}
else {
stored.amount = Math.min(getMaxGas(), getStored()+amount.amount);

View file

@ -1,8 +1,12 @@
package mekanism.api.gas;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.transmitters.TransmissionType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -138,4 +142,60 @@ public final class GasTransmission
return 0;
}
/**
* Emits gas from a central block by splitting the received stack among the sides given.
* @param sides - the list of sides to output from
* @param stack - the stack to output
* @param from - the TileEntity to output from
* @return the amount of gas emitted
*/
public static int emit(List<ForgeDirection> sides, GasStack stack, TileEntity from)
{
if(stack == null)
{
return 0;
}
List<IGasHandler> availableAcceptors = new ArrayList<IGasHandler>();
IGasHandler[] possibleAcceptors = getConnectedAcceptors(from);
for(int i = 0; i < possibleAcceptors.length; i++)
{
IGasHandler handler = possibleAcceptors[i];
if(handler != null && handler.canReceiveGas(ForgeDirection.getOrientation(i).getOpposite(), stack.getGas()))
{
availableAcceptors.add(handler);
}
}
Collections.shuffle(availableAcceptors);
int toSend = stack.amount;
int prevSending = toSend;
if(!availableAcceptors.isEmpty())
{
int divider = availableAcceptors.size();
int remaining = toSend % divider;
int sending = (toSend-remaining)/divider;
for(IGasHandler acceptor : availableAcceptors)
{
int currentSending = sending;
if(remaining > 0)
{
currentSending++;
remaining--;
}
ForgeDirection dir = ForgeDirection.getOrientation(Arrays.asList(possibleAcceptors).indexOf(acceptor)).getOpposite();
toSend -= acceptor.receiveGas(dir, new GasStack(stack.getGas(), currentSending), true);
}
}
return prevSending-toSend;
}
}

View file

@ -2,7 +2,7 @@ package mekanism.api.reactor;
import mekanism.api.IHeatTransfer;
import mekanism.api.gas.GasTank;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidTank;
public interface IFusionReactor extends IHeatTransfer
@ -60,4 +60,6 @@ public interface IFusionReactor extends IHeatTransfer
public int getSteamPerTick(boolean current);
public void updateTemperatures();
public ItemStack[] getInventory();
}

View file

@ -349,6 +349,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.EnergyCube), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.MachineBlock), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), handler);
MinecraftForgeClient.registerItemRenderer(MekanismItems.Robit, handler);
MinecraftForgeClient.registerItemRenderer(MekanismItems.WalkieTalkie, handler);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MekanismBlocks.GasTank), handler);

View file

@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSideConfigurationTab;

View file

@ -7,6 +7,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSideConfigurationTab;

View file

@ -15,6 +15,7 @@ import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSideConfigurationTab;

View file

@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;

View file

@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
@ -47,15 +48,8 @@ public class GuiChemicalInfuser extends GuiMekanism
@Override
public List<String> getInfo()
{
double usage = 0;
if(tileEntity.getRecipe() != null)
{
usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*tileEntity.energyPerTick;
}
String multiplier = MekanismUtils.getEnergyDisplay(usage);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + usage + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalInfuser.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {

View file

@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;

View file

@ -12,6 +12,7 @@ import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
@ -53,8 +54,8 @@ public class GuiChemicalWasher extends GuiMekanism
@Override
public List<String> getInfo()
{
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick*tileEntity.getUpgradedUsage());
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + usage + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler()

View file

@ -8,6 +8,7 @@ import mekanism.api.EnumColor;
import mekanism.api.util.ListUtils;
import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiVisualsTab;

View file

@ -3,6 +3,7 @@ package mekanism.client.gui;
import java.util.List;
import mekanism.api.util.ListUtils;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;

View file

@ -3,6 +3,7 @@ package mekanism.client.gui;
import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;

View file

@ -53,15 +53,8 @@ public class GuiElectrolyticSeparator extends GuiMekanism
@Override
public List<String> getInfo()
{
double usage = 0;
if(tileEntity.getRecipe() != null)
{
usage = tileEntity.getUpgradedUsage(tileEntity.getRecipe())*tileEntity.energyPerTick;
}
String multiplier = MekanismUtils.getEnergyDisplay(usage);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + usage + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png")));
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {

View file

@ -6,6 +6,7 @@ import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.api.util.ListUtils;
import mekanism.client.gui.element.GuiEnergyGauge;
import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;

View file

@ -4,24 +4,26 @@ import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.api.util.ListUtils;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiRecipeType;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiSortingTab;
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.inventory.container.ContainerFactory;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiFactory extends GuiMekanism
{
@ -58,7 +60,6 @@ public class GuiFactory extends GuiMekanism
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 4, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 93) + 2, 0x404040);
fontRendererObj.drawString(tileEntity.recipeType.getName(), 104, (ySize - 93) + 2, 0x404040);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{

View file

@ -3,6 +3,7 @@ package mekanism.client.gui;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerGasTank;

View file

@ -3,9 +3,11 @@ package mekanism.client.gui;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.client.gui.element.GuiNumberGauge;
import mekanism.client.gui.element.GuiDetectionTab;
import mekanism.client.gui.element.GuiGauge.Type;
import mekanism.client.gui.element.GuiNumberGauge;
import mekanism.client.gui.element.GuiNumberGauge.INumberInfoHandler;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerLaserAmplifier;
@ -16,12 +18,13 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiLaserAmplifier extends GuiMekanism
{
@ -63,6 +66,7 @@ public class GuiLaserAmplifier extends GuiMekanism
}
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 10));
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
guiElements.add(new GuiDetectionTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
}
@Override

View file

@ -9,6 +9,7 @@ import java.util.Set;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
@ -25,7 +26,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View file

@ -26,6 +26,7 @@ public class GuiMekanismConfig extends GuiConfig
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyCategoryElement(MekanismUtils.localize("mekanism.configgui.ctgy.general"), "mekanism.configgui.ctgy.general", GeneralEntry.class));
list.add(new DummyCategoryElement(MekanismUtils.localize("mekanism.configgui.ctgy.machines"), "mekanism.configgui.ctgy.machines", MachinesEntry.class));
list.add(new DummyCategoryElement(MekanismUtils.localize("mekanism.configgui.ctgy.tier"), "mekanism.configgui.ctgy.tier", TierEntry.class));
list.add(new DummyCategoryElement(MekanismUtils.localize("mekanism.configgui.ctgy.usage"), "mekanism.configgui.ctgy.usage", UsageEntry.class));
list.add(new DummyCategoryElement(MekanismUtils.localize("mekanism.configgui.ctgy.client"), "mekanism.configgui.ctgy.client", ClientEntry.class));
return list;
@ -64,6 +65,23 @@ public class GuiMekanismConfig extends GuiConfig
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
}
}
public static class TierEntry extends CategoryEntry
{
public TierEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
{
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen()
{
return new GuiConfig(owningScreen,
new ConfigElement(Mekanism.configuration.getCategory("tier")).getChildElements(),
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
}
}
public static class UsageEntry extends CategoryEntry
{

View file

@ -9,6 +9,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSideConfigurationTab;

View file

@ -134,6 +134,7 @@ public class GuiOredictionificator extends GuiMekanism
}
fontRendererObj.drawString(MekanismUtils.localize("gui.filter"), 32, yStart + 2, 0x404040);
renderScaledText(filter.filter, 32, yStart + 2 + 9, 0x404040, 117);
}
}

View file

@ -155,6 +155,32 @@ public class GuiOredictionificatorFilter extends GuiMekanism
GL11.glPopMatrix();
} catch(Exception e) {}
}
if(xAxis >= 31 && xAxis <= 43 && yAxis >= 21 && yAxis <= 33)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.lastItem"), xAxis, yAxis);
}
if(xAxis >= 63 && xAxis <= 75 && yAxis >= 21 && yAxis <= 33)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.nextItem"), xAxis, yAxis);
}
if(xAxis >= 33 && xAxis <= 129 && yAxis >= 48 && yAxis <= 60)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.oreDictCompat"), xAxis, yAxis);
}
if(xAxis >= 45 && xAxis <= 61 && yAxis >= 19 && yAxis <= 35)
{
if(renderStack != null)
{
String name = MekanismUtils.getMod(renderStack);
String extra = name.equals("null") ? "" : " (" + name + ")";
drawCreativeTabHoveringText(renderStack.getDisplayName() + extra, xAxis, yAxis);
}
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}

View file

@ -13,6 +13,7 @@ import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSideConfigurationTab;

View file

@ -11,6 +11,7 @@ import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
@ -59,8 +60,8 @@ public class GuiRotaryCondensentrator extends GuiMekanism
@Override
public List<String> getInfo()
{
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick*tileEntity.getUpgradedUsage());
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + usage + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png")));
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {

View file

@ -1,6 +1,7 @@
package mekanism.client.gui;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;

View file

@ -1,6 +1,8 @@
package mekanism.client.gui;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mekanism.api.Coord4D;
@ -38,6 +40,8 @@ public class GuiSideConfiguration extends GuiMekanism
public ISideConfiguration configurable;
public TransmissionType currentType;
public List<GuiConfigTypeTab> configTabs = new ArrayList<GuiConfigTypeTab>();
public GuiSideConfiguration(EntityPlayer player, ISideConfiguration tile)
{
@ -49,7 +53,10 @@ public class GuiSideConfiguration extends GuiMekanism
for(TransmissionType type : configurable.getConfig().transmissions)
{
guiElements.add(new GuiConfigTypeTab(this, (TileEntity)configurable, type, MekanismUtils.getResource(ResourceType.GUI, "GuiConfiguration.png")));
GuiConfigTypeTab tab = new GuiConfigTypeTab(this, (TileEntity)configurable, type, MekanismUtils.getResource(ResourceType.GUI, "GuiConfiguration.png"));
guiElements.add(tab);
configTabs.add(tab);
}
currentType = getTopTransmission();
@ -73,22 +80,17 @@ public class GuiSideConfiguration extends GuiMekanism
{
int rendered = 0;
for(GuiElement element : guiElements)
for(GuiConfigTypeTab tab : configTabs)
{
if(element instanceof GuiConfigTypeTab)
tab.visible = currentType != tab.transmission;
if(tab.visible)
{
GuiConfigTypeTab tab = (GuiConfigTypeTab)element;
tab.visible = currentType != tab.transmission;
if(tab.visible)
{
tab.left = rendered >= 0 && rendered <= 2;
tab.setY(2+((rendered%3)*(26+2)));
}
rendered++;
tab.left = rendered >= 0 && rendered <= 2;
tab.setY(2+((rendered%3)*(26+2)));
}
rendered++;
}
}

View file

@ -4,6 +4,7 @@ import mekanism.api.gas.GasTank;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;

View file

@ -90,6 +90,11 @@ public class GuiTeleporter extends GuiMekanism
guiElements.add(new GuiSlot(SlotType.NORMAL, this, resource, 152, 6).with(SlotOverlay.POWER));
guiElements.add(scrollList = new GuiScrollList(this, resource, 28, 37, 120, 4));
if(tileEntity.frequency != null)
{
privateMode = !tileEntity.frequency.publicFreq;
}
ySize+=64;
}

View file

@ -0,0 +1,88 @@
package mekanism.client.gui.element;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.client.gui.IGuiWrapper;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityLaserAmplifier;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiDetectionTab extends GuiElement
{
public TileEntity tileEntity;
public GuiDetectionTab(IGuiWrapper gui, TileEntity tile, ResourceLocation def)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiDetectionTab.png"), gui, def);
tileEntity = tile;
}
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiWidth - 26, guiHeight + 138, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 138, 0, 0, 26, 26);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
{
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 142, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 142, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@Override
public void renderForeground(int xAxis, int yAxis)
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
{
String text = LangUtils.transOnOff(((TileEntityLaserAmplifier)tileEntity).entityDetection);
displayTooltip(MekanismUtils.localize("gui.entityDetection") + ": " + text, xAxis, yAxis);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@Override
public void preMouseClicked(int xAxis, int yAxis, int button) {}
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
if(button == 0)
{
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
{
ArrayList data = new ArrayList();
data.add(3);
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}
}
}

View file

@ -1,7 +1,7 @@
package mekanism.client.gui;
package mekanism.client.gui.element;
import mekanism.api.Coord4D;
import mekanism.client.gui.element.GuiElement;
import mekanism.client.gui.IGuiWrapper;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.base.IRedstoneControl;

View file

@ -1,5 +1,6 @@
package mekanism.client.render;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -25,6 +26,7 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
@ -61,8 +63,12 @@ public class MekanismRenderer
private static float lightmapLastY;
private static boolean optifineBreak = false;
public static int[] directionMap = new int[] {3, 0, 1, 2};
public static RenderConfigurableMachine machineRenderer = new RenderConfigurableMachine();
private static String[] simpleSides = new String[] {"Bottom", "Top", "Front", "Back", "Left", "Right"};
public static void init()
{
MinecraftForge.EVENT_BUS.register(new MekanismRenderer());
@ -132,6 +138,103 @@ public class MekanismRenderer
RenderPortableTank.resetDisplayInts();
}
}
public static boolean blockIconExists(String texture) //Credit to CoFHCore
{
String[] split = texture.split(":");
texture = split[0] + ":textures/blocks/" + split[1] + ".png";
try {
Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(texture));
return true;
} catch(Throwable t) {
return false;
}
}
public static void loadDynamicTextures(IIconRegister register, String name, IIcon[] textures, DefIcon... defaults)
{
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
String tex = "mekanism:" + name + simpleSides[side.ordinal()];
String texOn = tex + "On";
if(blockIconExists(tex))
{
textures[side.ordinal()] = register.registerIcon(tex);
if(blockIconExists(texOn))
{
textures[side.ordinal()+6] = register.registerIcon(texOn);
}
else {
boolean found = false;
for(DefIcon def : defaults)
{
if(def.icons.contains(side.ordinal()+6))
{
textures[side.ordinal()+6] = def.defIcon;
found = true;
}
}
if(!found)
{
textures[side.ordinal()+6] = register.registerIcon(tex);
}
}
}
else {
for(DefIcon def : defaults)
{
if(def.icons.contains(side.ordinal()))
{
textures[side.ordinal()] = def.defIcon;
}
if(def.icons.contains(side.ordinal()+6))
{
textures[side.ordinal()+6] = def.defIcon;
}
}
}
}
}
public static class DefIcon
{
public IIcon defIcon;
public List<Integer> icons = new ArrayList<Integer>();
public DefIcon(IIcon icon, int... is)
{
defIcon = icon;
for(int i : is)
{
icons.add(i);
}
}
public static DefIcon getAll(IIcon icon)
{
return new DefIcon(icon, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
}
public static DefIcon getActivePair(IIcon icon, int... is)
{
DefIcon ret = new DefIcon(icon, is);
for(int i : is)
{
ret.icons.add(i+6);
}
return ret;
}
}
public static class Model3D
{

View file

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.model.ModelTransporterBox;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D;
@ -23,7 +24,6 @@ import mekanism.common.multipart.TransmitterType.Size;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
@ -40,8 +40,6 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@ -57,6 +55,8 @@ import codechicken.lib.render.TextureUtils.IIconSelfRegister;
import codechicken.lib.render.uv.IconTransformation;
import codechicken.lib.vec.Translation;
import codechicken.lib.vec.Vector3;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPartTransmitter implements IIconSelfRegister
@ -146,7 +146,17 @@ public class RenderPartTransmitter implements IIconSelfRegister
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, type);
renderSide(side, type, false);
}
CCRenderState.draw();
CCRenderState.reset();
CCRenderState.startDrawing();
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, type, true);
}
CCRenderState.draw();
@ -169,7 +179,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
GL11.glPushMatrix();
entityItem.setEntityItemStack(stack.itemStack);
float[] pos = TransporterUtils.getStackPosition(transporter.getTransmitter(), stack, partialTick* MultipartTransporter.SPEED);
float[] pos = TransporterUtils.getStackPosition(transporter.getTransmitter(), stack, partialTick*transporter.getTransmitter().tier.speed);
GL11.glTranslated(vec.x + pos[0], vec.y + pos[1] - entityItem.yOffset, vec.z + pos[2]);
GL11.glScalef(0.75F, 0.75F, 0.75F);
@ -532,7 +542,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
pop();
}
public void renderStatic(PartSidedPipe transmitter)
public void renderStatic(PartSidedPipe transmitter, int pass)
{
CCRenderState.reset();
CCRenderState.hasColour = true;
@ -540,29 +550,49 @@ public class RenderPartTransmitter implements IIconSelfRegister
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, transmitter);
renderSide(side, transmitter, pass);
}
}
public void renderSide(ForgeDirection side, PartSidedPipe transmitter)
public void renderSide(ForgeDirection side, PartSidedPipe transmitter, int pass)
{
IIcon renderIcon = transmitter.getIconForSide(side);
Colour c = null;
if(transmitter.getRenderColor() != null)
if(pass == 1)
{
c = new ColourRGBA(transmitter.getRenderColor().getColor(0), transmitter.getRenderColor().getColor(1), transmitter.getRenderColor().getColor(2), 1);
if(transmitter.transparencyRender())
{
IIcon renderIcon = transmitter.getIconForSide(side, false);
EnumColor color = transmitter.getRenderColor(false);
Colour c = null;
if(color != null)
{
c = new ColourRGBA(color.getColor(0), color.getColor(1), color.getColor(2), 1);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
}
else {
IIcon renderIcon = transmitter.getIconForSide(side, true);
EnumColor color = transmitter.getRenderColor(true);
Colour c = null;
if(color != null)
{
c = new ColourRGBA(color.getColor(0), color.getColor(1), color.getColor(2), 1);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
public void renderSide(ForgeDirection side, TransmitterType type)
public void renderSide(ForgeDirection side, TransmitterType type, boolean opaque)
{
boolean out = side == ForgeDirection.UP || side == ForgeDirection.DOWN;
IIcon renderIcon = out ? type.getSideIcon() : type.getCenterIcon();
IIcon renderIcon = out ? type.getSideIcon(opaque) : type.getCenterIcon(opaque);
renderPart(renderIcon, getItemModel(side, type), 0, 0, 0, null);
}

View file

@ -3,16 +3,16 @@ package mekanism.client.render.block;
import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.MekanismBlocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
{
@ -29,6 +29,7 @@ public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
MekanismRenderer.blendOn();
}
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderItem(renderer, metadata, block);
if(block == MekanismBlocks.BasicBlock && metadata == 10)

View file

@ -5,10 +5,11 @@ import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.CTMData;
import mekanism.common.base.IBlockCTM;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.tile.TileEntityBasicBlock;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@ -54,6 +55,30 @@ public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
return rendererCTM.renderStandardBlock(block, x, y, z);
}
if(MachineType.get(block, meta) != null)
{
if(!MachineType.get(block, meta).hasModel)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityBasicBlock)
{
if(((TileEntityBasicBlock)tile).facing >= 2)
{
rendererOld.uvRotateTop = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
rendererOld.uvRotateBottom = MekanismRenderer.directionMap[((TileEntityBasicBlock)tile).facing-2];
}
}
rendererOld.renderStandardBlock(block, x, y, z);
rendererOld.setRenderBoundsFromBlock(block);
return true;
}
return false;
}
return rendererOld.renderStandardBlock(block, x, y, z);
}

View file

@ -20,11 +20,13 @@ import mekanism.client.model.ModelRotaryCondensentrator;
import mekanism.client.model.ModelSeismicVibrator;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.AdvancedModelLoader;
@ -225,6 +227,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
solarNeutronActivator.renderAll();
}
else {
GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderItem(renderer, metadata, block);
}
@ -234,18 +237,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
int metadata = world.getBlockMetadata(x, y, z);
if(MachineType.get(block, metadata) != null)
{
if(!MachineType.get(block, metadata).hasModel)
{
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBoundsFromBlock(block);
return true;
}
}
//Handled by CTMRenderingHandler
return false;
}

View file

@ -50,7 +50,6 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
@ -190,7 +189,7 @@ public class ItemRenderingHandler implements IItemRenderer
amount = Integer.toString(inv.getItemCount());
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
MekanismRenderer.glowOn();
if(itemStack != null)
{
@ -229,6 +228,8 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
MekanismRenderer.glowOff();
if(amount != "")
{
@ -519,7 +520,16 @@ public class ItemRenderingHandler implements IItemRenderer
else {
if(item.getItem() instanceof ItemBlockMachine)
{
RenderingRegistry.instance().renderInventoryBlock((RenderBlocks)data[0], Block.getBlockFromItem(item.getItem()), item.getItemDamage(), ClientProxy.MACHINE_RENDER_ID);
MachineType machine = MachineType.get(item);
if(machine == MachineType.BASIC_FACTORY || machine == MachineType.ADVANCED_FACTORY || machine == MachineType.ELITE_FACTORY)
{
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderCustomItem(((RenderBlocks)data[0]), item);
}
else {
RenderingRegistry.instance().renderInventoryBlock((RenderBlocks)data[0], Block.getBlockFromItem(item.getItem()), item.getItemDamage(), ClientProxy.MACHINE_RENDER_ID);
}
}
else if(item.getItem() instanceof ItemBlockBasic)
{

View file

@ -51,6 +51,7 @@ import mekanism.common.inventory.container.ContainerSolarEvaporationController;
import mekanism.common.inventory.container.ContainerSolarNeutronActivator;
import mekanism.common.inventory.container.ContainerTeleporter;
import mekanism.common.inventory.container.ContainerUpgradeManagement;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import mekanism.common.tile.TileEntityAdvancedFactory;
@ -107,6 +108,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
@ -219,15 +221,15 @@ public class CommonProxy
*/
public void loadConfiguration()
{
general.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true);
general.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
general.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(false);
general.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(false);
general.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean(true);
general.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean(true);
general.enableWorldRegeneration = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableWorldRegeneration", false).getBoolean(false);
general.creativeOverrideElectricChest = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CreativeOverrideElectricChest", true).getBoolean(true);
general.spawnBabySkeletons = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SpawnBabySkeletons", true).getBoolean(true);
general.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean();
general.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean();
general.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean();
general.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean();
general.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean();
general.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean();
general.enableWorldRegeneration = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableWorldRegeneration", false).getBoolean();
general.creativeOverrideElectricChest = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CreativeOverrideElectricChest", true).getBoolean();
general.spawnBabySkeletons = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SpawnBabySkeletons", true).getBoolean();
general.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
general.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
general.UPDATE_DELAY = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ClientUpdateDelay", 10).getInt();
@ -236,19 +238,19 @@ public class CommonProxy
general.tinPerChunk = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "TinPerChunk", 14).getInt();
general.saltPerChunk = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SaltPerChunk", 2).getInt();
general.userWorldGenVersion = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "WorldRegenVersion", 0).getInt();
general.FROM_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToEU", 10D).getDouble(10D);
general.TO_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EUToJoules", .1D).getDouble(.1D);
general.FROM_TE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToRF", 2.5D).getDouble(2.5D);
general.TO_TE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "RFToJoules", 0.4D).getDouble(0.4D);
general.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 200D, "Determines Electrolytic Separator usage").getDouble(200D);
general.ETHENE_BURN_TIME = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EthyleneBurnTime", 40).getInt(40);
general.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(10000D);
general.DISASSEMBLER_USAGE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisassemblerEnergyUsage", 10).getInt(10);
general.FROM_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToEU", 10D).getDouble();
general.TO_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EUToJoules", .1D).getDouble();
general.FROM_TE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToRF", 2.5D).getDouble();
general.TO_TE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "RFToJoules", 0.4D).getDouble();
general.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 200D, "Determines Electrolytic Separator usage").getDouble();
general.ETHENE_BURN_TIME = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EthyleneBurnTime", 40).getInt();
general.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble();
general.DISASSEMBLER_USAGE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisassemblerEnergyUsage", 10).getInt();
general.VOICE_PORT = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoicePort", 36123, null, 1, 65535).getInt();
//If this is less than 1, upgrades make machines worse. If less than 0, I don't even know.
general.maxUpgradeMultiplier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpgradeModifier", 10, null, 1, Integer.MAX_VALUE).getInt();
general.minerSilkMultiplier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MinerSilkMultiplier", 6).getDouble();
general.prefilledPortableTanks = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "PrefilledPortableTanks", true).getBoolean(true);
general.prefilledPortableTanks = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "PrefilledPortableTanks", true).getBoolean();
general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();
@ -301,42 +303,44 @@ public class CommonProxy
}
}
general.laserRange = Mekanism.configuration.get("general", "LaserRange", 64).getInt(64);
general.laserEnergyNeededPerHardness = Mekanism.configuration.get("general", "LaserDiggingEnergy", 100000).getInt(100000);
general.destroyDisabledBlocks = Mekanism.configuration.get("general", "DestroyDisabledBlocks", true).getBoolean(true);
general.enableAmbientLighting = Mekanism.configuration.get("general", "EnableAmbientLighting", true).getBoolean(true);
general.ambientLightingLevel = Mekanism.configuration.get("general", "AmbientLightingLevel", 15).getInt(15);
general.laserRange = Mekanism.configuration.get("general", "LaserRange", 64).getInt();
general.laserEnergyNeededPerHardness = Mekanism.configuration.get("general", "LaserDiggingEnergy", 100000).getInt();
general.destroyDisabledBlocks = Mekanism.configuration.get("general", "DestroyDisabledBlocks", true).getBoolean();
general.enableAmbientLighting = Mekanism.configuration.get("general", "EnableAmbientLighting", true).getBoolean();
general.ambientLightingLevel = Mekanism.configuration.get("general", "AmbientLightingLevel", 15).getInt();
for(MachineType type : MachineType.getValidMachines())
{
machines.setEntry(type.name, Mekanism.configuration.get("machines", type.name + "Enabled", true).getBoolean(true));
machines.setEntry(type.name, Mekanism.configuration.get("machines", type.name + "Enabled", true).getBoolean());
}
usage.enrichmentChamberUsage = Mekanism.configuration.get("usage", "EnrichmentChamberUsage", 50D).getDouble(50D);
usage.osmiumCompressorUsage = Mekanism.configuration.get("usage", "OsmiumCompressorUsage", 100D).getDouble(100D);
usage.combinerUsage = Mekanism.configuration.get("usage", "CombinerUsage", 50D).getDouble(50D);
usage.crusherUsage = Mekanism.configuration.get("usage", "CrusherUsage", 50D).getDouble(50D);
usage.factoryUsage = Mekanism.configuration.get("usage", "FactoryUsage", 50D).getDouble(50D);
usage.metallurgicInfuserUsage = Mekanism.configuration.get("usage", "MetallurgicInfuserUsage", 50D).getDouble(50D);
usage.purificationChamberUsage = Mekanism.configuration.get("usage", "PurificationChamberUsage", 200D).getDouble(200D);
usage.energizedSmelterUsage = Mekanism.configuration.get("usage", "EnergizedSmelterUsage", 50D).getDouble(50D);
usage.digitalMinerUsage = Mekanism.configuration.get("usage", "DigitalMinerUsage", 100D).getDouble(100D);
usage.electricPumpUsage = Mekanism.configuration.get("usage", "ElectricPumpUsage", 100D).getDouble(100D);
usage.rotaryCondensentratorUsage = Mekanism.configuration.get("usage", "RotaryCondensentratorUsage", 50D).getDouble(50D);
usage.oxidationChamberUsage = Mekanism.configuration.get("usage", "OxidationChamberUsage", 200D).getDouble(200D);
usage.chemicalInfuserUsage = Mekanism.configuration.get("usage", "ChemicalInfuserUsage", 200D).getDouble(200D);
usage.chemicalInjectionChamberUsage = Mekanism.configuration.get("usage", "ChemicalInjectionChamberUsage", 400D).getDouble(400D);
usage.precisionSawmillUsage = Mekanism.configuration.get("usage", "PrecisionSawmillUsage", 50D).getDouble(50D);
usage.chemicalDissolutionChamberUsage = Mekanism.configuration.get("usage", "ChemicalDissolutionChamberUsage", 400D).getDouble(400D);
usage.chemicalWasherUsage = Mekanism.configuration.get("usage", "ChemicalWasherUsage", 200D).getDouble(200D);
usage.chemicalCrystallizerUsage = Mekanism.configuration.get("usage", "ChemicalCrystallizerUsage", 400D).getDouble(400D);
usage.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble(50D);
usage.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D);
usage.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble(100D);
usage.laserUsage = Mekanism.configuration.get("usage", "LaserUsage", 5000D).getDouble(5000D);
usage.gasCentrifugeUsage = Mekanism.configuration.get("usage", "GasCentrifugeUsage", 100D).getDouble(100D);
usage.heavyWaterElectrolysisUsage = Mekanism.configuration.get("usage", "HeavyWaterElectrolysisUsage", 800D).getDouble(800D);
usage.enrichmentChamberUsage = Mekanism.configuration.get("usage", "EnrichmentChamberUsage", 50D).getDouble();
usage.osmiumCompressorUsage = Mekanism.configuration.get("usage", "OsmiumCompressorUsage", 100D).getDouble();
usage.combinerUsage = Mekanism.configuration.get("usage", "CombinerUsage", 50D).getDouble();
usage.crusherUsage = Mekanism.configuration.get("usage", "CrusherUsage", 50D).getDouble();
usage.factoryUsage = Mekanism.configuration.get("usage", "FactoryUsage", 50D).getDouble();
usage.metallurgicInfuserUsage = Mekanism.configuration.get("usage", "MetallurgicInfuserUsage", 50D).getDouble();
usage.purificationChamberUsage = Mekanism.configuration.get("usage", "PurificationChamberUsage", 200D).getDouble();
usage.energizedSmelterUsage = Mekanism.configuration.get("usage", "EnergizedSmelterUsage", 50D).getDouble();
usage.digitalMinerUsage = Mekanism.configuration.get("usage", "DigitalMinerUsage", 100D).getDouble();
usage.electricPumpUsage = Mekanism.configuration.get("usage", "ElectricPumpUsage", 100D).getDouble();
usage.rotaryCondensentratorUsage = Mekanism.configuration.get("usage", "RotaryCondensentratorUsage", 50D).getDouble();
usage.oxidationChamberUsage = Mekanism.configuration.get("usage", "OxidationChamberUsage", 200D).getDouble();
usage.chemicalInfuserUsage = Mekanism.configuration.get("usage", "ChemicalInfuserUsage", 200D).getDouble();
usage.chemicalInjectionChamberUsage = Mekanism.configuration.get("usage", "ChemicalInjectionChamberUsage", 400D).getDouble();
usage.precisionSawmillUsage = Mekanism.configuration.get("usage", "PrecisionSawmillUsage", 50D).getDouble();
usage.chemicalDissolutionChamberUsage = Mekanism.configuration.get("usage", "ChemicalDissolutionChamberUsage", 400D).getDouble();
usage.chemicalWasherUsage = Mekanism.configuration.get("usage", "ChemicalWasherUsage", 200D).getDouble();
usage.chemicalCrystallizerUsage = Mekanism.configuration.get("usage", "ChemicalCrystallizerUsage", 400D).getDouble();
usage.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble();
usage.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble();
usage.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble();
usage.laserUsage = Mekanism.configuration.get("usage", "LaserUsage", 5000D).getDouble();
usage.gasCentrifugeUsage = Mekanism.configuration.get("usage", "GasCentrifugeUsage", 100D).getDouble();
usage.heavyWaterElectrolysisUsage = Mekanism.configuration.get("usage", "HeavyWaterElectrolysisUsage", 800D).getDouble();
Tier.loadConfig();
if(Mekanism.configuration.hasChanged())
{
Mekanism.configuration.save();
@ -431,6 +435,13 @@ public class CommonProxy
return new ContainerMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity);
case 13:
return new ContainerTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
case 14:
ItemStack itemStack = player.getCurrentEquippedItem();
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
{
return new ContainerNull();
}
case 15:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 16:

View file

@ -69,11 +69,6 @@ public class CommonWorldTickHandler
{
if(!world.isRemote)
{
if(!MultiblockManager.loaded)
{
MultiblockManager.load(world);
}
if(!FrequencyManager.loaded)
{
FrequencyManager.load(world);

View file

@ -18,10 +18,10 @@ import mekanism.api.energy.IStrictEnergyAcceptor;
import mekanism.api.transmitters.DynamicNetwork;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.common.util.MekanismUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;

View file

@ -44,6 +44,11 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
for(Coord4D coord : possibleAcceptors.keySet())
{
if(coord == null)
{
continue;
}
EnumSet<ForgeDirection> sides = acceptorDirections.get(coord);
IInventory acceptor = (IInventory)coord.getTileEntity(getWorld());

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import mekanism.common.multipart.TransmitterType;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -15,8 +14,6 @@ public final class ItemAttacher
static
{
attachable.add(new ItemStack(Blocks.lever));
attachable.add(new ItemStack(Blocks.redstone_torch));
attachable.add(new ItemStack(Blocks.torch));
for(TransmitterType type : TransmitterType.values())
{

View file

@ -2,6 +2,8 @@ package mekanism.common;
import java.util.List;
import com.mojang.realmsclient.util.Pair;
import mekanism.api.Coord4D;
import mekanism.api.MekanismConfig.general;
import mekanism.api.Pos3D;
@ -18,12 +20,12 @@ import net.minecraftforge.common.util.ForgeDirection;
public class LaserManager
{
public static MovingObjectPosition fireLaser(TileEntity from, ForgeDirection direction, double energy, World world)
public static LaserInfo fireLaser(TileEntity from, ForgeDirection direction, double energy, World world)
{
return fireLaser(new Pos3D(from).centre().translate(direction, 0.501), direction, energy, world);
}
public static MovingObjectPosition fireLaser(Pos3D from, ForgeDirection direction, double energy, World world)
public static LaserInfo fireLaser(Pos3D from, ForgeDirection direction, double energy, World world)
{
Pos3D to = from.clone().translate(direction, general.laserRange - 0.002);
@ -46,17 +48,25 @@ public class LaserManager
from.translateExcludingSide(direction, -0.1);
to.translateExcludingSide(direction, 0.1);
boolean foundEntity = false;
for(Entity e : (List<Entity>)world.getEntitiesWithinAABB(Entity.class, Pos3D.getAABB(from, to)))
{
foundEntity = true;
if(!e.isImmuneToFire())
{
e.setFire((int)(energy / 1000));
e.attackEntityFrom(DamageSource.onFire, (float)energy/1000F);
if(energy > 256)
{
e.attackEntityFrom(DamageSource.onFire, (float)energy/1000F);
}
}
}
return mop;
return new LaserInfo(mop, foundEntity);
}
public static List<ItemStack> breakBlock(Coord4D blockCoord, boolean dropAtBlock, World world)
@ -96,6 +106,20 @@ public class LaserManager
from.translate(direction, -0.501);
Mekanism.proxy.renderLaser(world, from, to, direction, energy);
return mop;
}
public static class LaserInfo
{
public MovingObjectPosition movingPos;
public boolean foundEntity;
public LaserInfo(MovingObjectPosition mop, boolean b)
{
movingPos = mop;
foundEntity = b;
}
}
}

View file

@ -41,14 +41,11 @@ import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.chunkloading.ChunkManager;
import mekanism.common.content.boiler.BoilerManager;
import mekanism.common.content.boiler.SynchronizedBoilerData;
import mekanism.common.content.matrix.MatrixCache;
import mekanism.common.content.matrix.SynchronizedMatrixData;
import mekanism.common.content.tank.SynchronizedTankData;
import mekanism.common.content.tank.TankCache;
import mekanism.common.content.transporter.PathfinderCache;
import mekanism.common.content.transporter.TransporterManager;
import mekanism.common.content.turbine.SynchronizedTurbineData;
import mekanism.common.content.turbine.TurbineCache;
import mekanism.common.entity.EntityBabySkeleton;
import mekanism.common.entity.EntityBalloon;
import mekanism.common.entity.EntityFlame;
@ -140,7 +137,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author AidanBrady
*
*/
@Mod(modid = "Mekanism", name = "Mekanism", version = "8.0.2", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
@Mod(modid = "Mekanism", name = "Mekanism", version = "8.1.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
"after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore")
public class Mekanism
@ -169,12 +166,12 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(8, 0, 2);
public static Version versionNumber = new Version(8, 1, 0);
/** MultiblockManagers for various structrures */
public static MultiblockManager<SynchronizedTankData> tankManager = new MultiblockManager<SynchronizedTankData>("dynamicTank", TankCache.class);
public static MultiblockManager<SynchronizedMatrixData> matrixManager = new MultiblockManager<SynchronizedMatrixData>("inductionMatrix", MatrixCache.class);
public static MultiblockManager<SynchronizedTurbineData> turbineManager = new MultiblockManager<SynchronizedTurbineData>("industrialTurbine", TurbineCache.class);
public static MultiblockManager<SynchronizedTankData> tankManager = new MultiblockManager<SynchronizedTankData>("dynamicTank");
public static MultiblockManager<SynchronizedMatrixData> matrixManager = new MultiblockManager<SynchronizedMatrixData>("inductionMatrix");
public static MultiblockManager<SynchronizedTurbineData> turbineManager = new MultiblockManager<SynchronizedTurbineData>("industrialTurbine");
public static MultiblockManager<SynchronizedBoilerData> boilerManager = new BoilerManager("thermoelectricBoiler");
/** FrequencyManagers for various networks */
@ -495,7 +492,7 @@ public class Mekanism
"RE ", "RCD", "RE ", Character.valueOf('R'), "alloyElite", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('D'), "gemDiamond"
}));
MachineType.LASER_AMPLIFIER.addRecipe(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 14), new Object[] {
"SSS", "SED", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismUtils.getInductionCell(InductionCellTier.ADVANCED), Character.valueOf('D'), "gemDiamond"
"SSS", "SED", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), Character.valueOf('D'), "gemDiamond"
}));
MachineType.LASER_TRACTOR_BEAM.addRecipe(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 15), new Object[] {
"C", "F", Character.valueOf('C'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13), Character.valueOf('F'), new ItemStack(MekanismBlocks.MachineBlock2, 1, 14)
@ -600,12 +597,30 @@ public class Mekanism
"SGS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 9), new Object[] {
"TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 8)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 10), new Object[] {
"TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 9)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 11), new Object[] {
"TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 10)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 12), new Object[] {
"SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 10), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 13), new Object[] {
"TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 12)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 14), new Object[] {
"TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 13)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 15), new Object[] {
"TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 14)
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 16), new Object[] {
"SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 11), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 17), new Object[] {
"RRR", "SBS", "RRR", Character.valueOf('R'), "dustRedstone", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars
}));

View file

@ -1,7 +1,9 @@
package mekanism.common;
import io.netty.buffer.ByteBuf;
import mekanism.api.EnumColor;
import mekanism.common.multipart.TransmitterType;
import mekanism.common.util.MekanismUtils;
import net.minecraft.util.ResourceLocation;
/**
@ -27,6 +29,11 @@ public final class Tier
return name;
}
public String getLocalizedName()
{
return MekanismUtils.localize("tier." + getName());
}
public EnumColor getColor()
{
return color;
@ -60,8 +67,11 @@ public final class Tier
ULTIMATE(128000000, 51200),
CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE);
public double MAX_ELECTRICITY;
public double OUTPUT;
public double maxEnergy;
private double baseMaxEnergy;
public double output;
private double baseOutput;
public static EnergyCubeTier getFromName(String tierName)
{
@ -77,15 +87,33 @@ public final class Tier
return BASIC;
}
protected void loadConfig()
{
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeMaxEnergy", baseMaxEnergy).getDouble();
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeOutput", baseOutput).getDouble();
}
protected void readConfig(ByteBuf dataStream)
{
maxEnergy = dataStream.readDouble();
output = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(maxEnergy);
dataStream.writeDouble(output);
}
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
private EnergyCubeTier(double maxEnergy, double out)
private EnergyCubeTier(double max, double out)
{
MAX_ELECTRICITY = maxEnergy;
OUTPUT = out;
baseMaxEnergy = maxEnergy = max;
baseOutput = output = out;
}
}
@ -96,16 +124,32 @@ public final class Tier
ELITE(64E9D),
ULTIMATE(512E9D);
public double MAX_ELECTRICITY;
public double maxEnergy;
private double baseMaxEnergy;
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
private InductionCellTier(double maxEnergy)
protected void loadConfig()
{
MAX_ELECTRICITY = maxEnergy;
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionCellMaxEnergy", baseMaxEnergy).getDouble();
}
protected void readConfig(ByteBuf dataStream)
{
maxEnergy = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(maxEnergy);
}
private InductionCellTier(double max)
{
baseMaxEnergy = maxEnergy = max;
}
}
@ -116,16 +160,32 @@ public final class Tier
ELITE(4096000),
ULTIMATE(32768000);
public double OUTPUT;
public double output;
private double baseOutput;
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
protected void loadConfig()
{
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "InductionProviderOutput", baseOutput).getDouble();
}
protected void readConfig(ByteBuf dataStream)
{
output = dataStream.readDouble();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeDouble(output);
}
private InductionProviderTier(double out)
{
OUTPUT = out;
baseOutput = output = out;
}
}
@ -187,13 +247,44 @@ public final class Tier
}
public int cableCapacity;
private int baseCapacity;
public TransmitterType type;
private CableTier(int capacity, TransmitterType transmitterType)
{
cableCapacity = capacity;
baseCapacity = cableCapacity = capacity;
type = transmitterType;
}
protected void loadConfig()
{
cableCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "CableCapacity", baseCapacity).getInt();
}
protected void readConfig(ByteBuf dataStream)
{
cableCapacity = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(cableCapacity);
}
public static CableTier get(BaseTier tier)
{
for(CableTier transmitter : values())
{
if(transmitter.getBaseTier() == tier)
{
return transmitter;
}
}
return BASIC;
}
}
/**
@ -214,31 +305,294 @@ public final class Tier
}
public int pipeCapacity;
private int baseCapacity;
public int pipePullAmount;
private int basePull;
public TransmitterType type;
private PipeTier(int capacity, int pullAmount, TransmitterType transmitterType)
{
pipeCapacity = capacity;
pipePullAmount = pullAmount;
baseCapacity = pipeCapacity = capacity;
basePull = pipePullAmount = pullAmount;
type = transmitterType;
}
public static PipeTier getTierFromMeta(int meta)
protected void loadConfig()
{
switch(meta)
pipeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipeCapacity", baseCapacity).getInt();
pipePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "PipePullAmount", basePull).getInt();
}
protected void readConfig(ByteBuf dataStream)
{
pipeCapacity = dataStream.readInt();
pipePullAmount = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(pipeCapacity);
dataStream.writeInt(pipePullAmount);
}
public static PipeTier get(BaseTier tier)
{
for(PipeTier transmitter : values())
{
case 4:
return BASIC;
case 5:
return ADVANCED;
case 6:
return ELITE;
case 7:
return ULTIMATE;
default:
return BASIC;
if(transmitter.getBaseTier() == tier)
{
return transmitter;
}
}
return BASIC;
}
}
/**
* The tiers used by Pressurized Tubes and their corresponding values.
* @author AidanBrady
*
*/
public static enum TubeTier
{
BASIC(256, 64, TransmitterType.PRESSURIZED_TUBE_BASIC),
ADVANCED(1024, 256, TransmitterType.PRESSURIZED_TUBE_ADVANCED),
ELITE(4096, 1024, TransmitterType.PRESSURIZED_TUBE_ELITE),
ULTIMATE(16384, 4096, TransmitterType.PRESSURIZED_TUBE_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int tubeCapacity;
private int baseCapacity;
public int tubePullAmount;
private int basePull;
public TransmitterType type;
private TubeTier(int capacity, int pullAmount, TransmitterType transmitterType)
{
baseCapacity = tubeCapacity = capacity;
basePull = tubePullAmount = pullAmount;
type = transmitterType;
}
protected void loadConfig()
{
tubeCapacity = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubeCapacity", baseCapacity).getInt();
tubePullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TubePullAmount", basePull).getInt();
}
protected void readConfig(ByteBuf dataStream)
{
tubeCapacity = dataStream.readInt();
tubePullAmount = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(tubeCapacity);
dataStream.writeInt(tubePullAmount);
}
public static TubeTier get(BaseTier tier)
{
for(TubeTier transmitter : values())
{
if(transmitter.getBaseTier() == tier)
{
return transmitter;
}
}
return BASIC;
}
}
/**
* The tiers used by Logistical Transporters and their corresponding values.
* @author AidanBrady
*
*/
public static enum TransporterTier
{
BASIC(1, 5, TransmitterType.LOGISTICAL_TRANSPORTER_BASIC),
ADVANCED(16, 10, TransmitterType.LOGISTICAL_TRANSPORTER_ADVANCED),
ELITE(32, 20, TransmitterType.LOGISTICAL_TRANSPORTER_ELITE),
ULTIMATE(64, 50, TransmitterType.LOGISTICAL_TRANSPORTER_ULTIMATE);
public BaseTier getBaseTier()
{
return BaseTier.values()[ordinal()];
}
public int pullAmount;
private int basePull;
public int speed;
private int baseSpeed;
public TransmitterType type;
private TransporterTier(int pull, int s, TransmitterType transmitterType)
{
basePull = pullAmount = pull;
baseSpeed = speed = s;
type = transmitterType;
}
protected void loadConfig()
{
pullAmount = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterPullAmount", basePull).getInt();
speed = Mekanism.configuration.get("tier", getBaseTier().getName() + "TransporterSpeed", baseSpeed).getInt();
}
protected void readConfig(ByteBuf dataStream)
{
pullAmount = dataStream.readInt();
speed = dataStream.readInt();
}
protected void writeConfig(ByteBuf dataStream)
{
dataStream.writeInt(pullAmount);
dataStream.writeInt(speed);
}
public static TransporterTier get(BaseTier tier)
{
for(TransporterTier transmitter : values())
{
if(transmitter.getBaseTier() == tier)
{
return transmitter;
}
}
return BASIC;
}
}
public static void loadConfig()
{
for(CableTier tier : CableTier.values())
{
tier.loadConfig();
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.loadConfig();
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.loadConfig();
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.loadConfig();
}
for(PipeTier tier : PipeTier.values())
{
tier.loadConfig();
}
for(TubeTier tier : TubeTier.values())
{
tier.loadConfig();
}
for(TransporterTier tier : TransporterTier.values())
{
tier.loadConfig();
}
}
public static void readConfig(ByteBuf dataStream)
{
for(CableTier tier : CableTier.values())
{
tier.readConfig(dataStream);
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.readConfig(dataStream);
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.readConfig(dataStream);
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.readConfig(dataStream);
}
for(PipeTier tier : PipeTier.values())
{
tier.readConfig(dataStream);
}
for(TubeTier tier : TubeTier.values())
{
tier.readConfig(dataStream);
}
for(TransporterTier tier : TransporterTier.values())
{
tier.readConfig(dataStream);
}
}
public static void writeConfig(ByteBuf dataStream)
{
for(CableTier tier : CableTier.values())
{
tier.writeConfig(dataStream);
}
for(InductionCellTier tier : InductionCellTier.values())
{
tier.writeConfig(dataStream);
}
for(InductionProviderTier tier : InductionProviderTier.values())
{
tier.writeConfig(dataStream);
}
for(EnergyCubeTier tier : EnergyCubeTier.values())
{
tier.writeConfig(dataStream);
}
for(PipeTier tier : PipeTier.values())
{
tier.writeConfig(dataStream);
}
for(TubeTier tier : TubeTier.values())
{
tier.writeConfig(dataStream);
}
for(TransporterTier tier : TransporterTier.values())
{
tier.writeConfig(dataStream);
}
}
}

View file

@ -5,7 +5,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IEjector
{
public void onOutput();
public void outputItems();
public EnumColor getOutputColor();

View file

@ -44,13 +44,13 @@ public interface IFactory
public static enum RecipeType
{
SMELTING("smelting", "smelter", MachineType.ENERGIZED_SMELTER.getStack(), false, false, Recipe.ENERGIZED_SMELTER),
ENRICHING("enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER.getStack(), false, false, Recipe.ENRICHMENT_CHAMBER),
CRUSHING("crushing", "crusher", MachineType.CRUSHER.getStack(), false, false, Recipe.CRUSHER),
COMPRESSING("compressing", "compressor", MachineType.OSMIUM_COMPRESSOR.getStack(), true, false, Recipe.OSMIUM_COMPRESSOR),
COMBINING("combining", "combiner", MachineType.COMBINER.getStack(), true, false, Recipe.COMBINER),
PURIFYING("purifying", "purifier", MachineType.PURIFICATION_CHAMBER.getStack(), true, true, Recipe.PURIFICATION_CHAMBER),
INJECTING("injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, true, Recipe.CHEMICAL_INJECTION_CHAMBER);
SMELTING("Smelting", "smelter", MachineType.ENERGIZED_SMELTER.getStack(), false, false, Recipe.ENERGIZED_SMELTER),
ENRICHING("Enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER.getStack(), false, false, Recipe.ENRICHMENT_CHAMBER),
CRUSHING("Crushing", "crusher", MachineType.CRUSHER.getStack(), false, false, Recipe.CRUSHER),
COMPRESSING("Compressing", "compressor", MachineType.OSMIUM_COMPRESSOR.getStack(), true, false, Recipe.OSMIUM_COMPRESSOR),
COMBINING("Combining", "combiner", MachineType.COMBINER.getStack(), true, false, Recipe.COMBINER),
PURIFYING("Purifying", "purifier", MachineType.PURIFICATION_CHAMBER.getStack(), true, true, Recipe.PURIFICATION_CHAMBER),
INJECTING("Injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, true, Recipe.CHEMICAL_INJECTION_CHAMBER);
private String name;
private ResourceLocation sound;
@ -185,8 +185,13 @@ public interface IFactory
{
return stack;
}
public String getUnlocalizedName()
{
return name;
}
public String getName()
public String getLocalizedName()
{
return MekanismUtils.localize("gui.factory." + name);
}

View file

@ -19,7 +19,7 @@ public interface ILogisticalTransporter extends IGridTransmitter<IInventory, Inv
public ItemStack insertRR(TileEntityLogisticalSorter outputter, ItemStack itemStack, EnumColor color, boolean doEmit, int min);
public void entityEntering(TransporterStack stack);
public void entityEntering(TransporterStack stack, int progress);
public EnumColor getColor();

View file

@ -9,6 +9,8 @@ import mekanism.api.Coord4D;
import mekanism.api.Range4D;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DefIcon;
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher;
@ -88,7 +90,7 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{
public IIcon[][] icons = new IIcon[16][6];
public IIcon[][] icons = new IIcon[16][16];
public CTMData[][] ctms = new CTMData[16][4];
@ -146,6 +148,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
switch(blockType)
{
case BASIC_BLOCK_1:
ctms[7][0] = new CTMData("ctm/TeleporterFrame", this, Arrays.asList(7)).addOtherBlockConnectivities(MekanismBlocks.MachineBlock, Arrays.asList(11)).registerIcons(register);
ctms[9][0] = new CTMData("ctm/DynamicTank", this, Arrays.asList(9, 11)).registerIcons(register);
ctms[10][0] = new CTMData("ctm/DynamicGlass", this, Arrays.asList(10)).registerIcons(register);
ctms[11][0] = new CTMData("ctm/DynamicValve", this, Arrays.asList(11, 9)).registerIcons(register);
@ -160,12 +163,11 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
icons[3][0] = register.registerIcon("mekanism:CoalBlock");
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5][0] = register.registerIcon("mekanism:SteelBlock");
icons[6][0] = register.registerIcon("mekanism:BinSide");
icons[6][1] = register.registerIcon("mekanism:BinTop");
icons[6][2] = register.registerIcon("mekanism:BinFront");
icons[6][3] = register.registerIcon("mekanism:BinTopOn");
icons[6][4] = register.registerIcon("mekanism:BinFrontOn");
icons[7][0] = register.registerIcon("mekanism:TeleporterFrame");
MekanismRenderer.loadDynamicTextures(register, "Bin", icons[6], DefIcon.getActivePair(register.registerIcon("mekanism:BinSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinTop"), 0), new DefIcon(register.registerIcon("mekanism:BinTopOn"), 6));
icons[7][0] = ctms[7][0].mainTextureData.icon;
icons[8][0] = register.registerIcon("mekanism:SteelCasing");
icons[9][0] = ctms[9][0].mainTextureData.icon;
icons[10][0] = ctms[10][0].mainTextureData.icon;
@ -190,7 +192,6 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
ctms[4][1] = new CTMData("ctm/InductionProviderAdvanced", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
ctms[4][2] = new CTMData("ctm/InductionProviderElite", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
ctms[4][3] = new CTMData("ctm/InductionProviderUltimate", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
//TODO @unpairedbracket, mind fixing this?
icons[0][0] = ctms[0][0].mainTextureData.icon;
icons[1][0] = ctms[1][0].mainTextureData.icon;
@ -204,6 +205,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
icons[4][1] = ctms[4][1].mainTextureData.icon;
icons[4][2] = ctms[4][2].mainTextureData.icon;
icons[4][3] = ctms[4][3].mainTextureData.icon;
break;
}
}
@ -222,17 +224,8 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case 6:
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
if(side == 0 || side == 1)
{
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][3] : icons[meta][1];
}
else if(side == tileEntity.facing)
{
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][4] : icons[meta][2];
}
else {
return icons[meta][0];
}
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
case 14:
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
@ -276,17 +269,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
switch(meta)
{
case 6:
if(side == 0 || side == 1)
{
return icons[meta][1];
}
else if(side == 3)
{
return icons[meta][2];
}
else {
return icons[meta][0];
}
return icons[meta][side];
case 14:
if(side == 3)
{

View file

@ -139,7 +139,7 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
list.add(discharged);
ItemStack charged = new ItemStack(this);
((ItemBlockEnergyCube)charged.getItem()).setEnergyCubeTier(charged, tier);
((ItemBlockEnergyCube)charged.getItem()).setEnergy(charged, tier.MAX_ELECTRICITY);
((ItemBlockEnergyCube)charged.getItem()).setEnergy(charged, tier.maxEnergy);
list.add(charged);
};
}

View file

@ -1,6 +1,7 @@
package mekanism.common.block;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
@ -14,10 +15,16 @@ import mekanism.api.MekanismConfig.machines;
import mekanism.api.MekanismConfig.usage;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DefIcon;
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.Tier.BaseTier;
import mekanism.common.base.IActiveState;
import mekanism.common.base.IBlockCTM;
import mekanism.common.base.IBoundingBlock;
import mekanism.common.base.IElectricChest;
import mekanism.common.base.IFactory;
@ -102,7 +109,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
@ -153,9 +159,12 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
*
*/
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft")
public class BlockMachine extends BlockContainer implements ISpecialBounds, IPeripheralProvider
public class BlockMachine extends BlockContainer implements ISpecialBounds, IPeripheralProvider, IBlockCTM, ICustomBlockIcon
{
public IIcon[][] icons = new IIcon[16][16];
public IIcon[][][] factoryIcons = new IIcon[4][16][16];
public CTMData[][] ctms = new CTMData[16][4];
public IIcon BASE_ICON;
@ -175,57 +184,73 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
public void registerBlockIcons(IIconRegister register)
{
BASE_ICON = register.registerIcon("mekanism:SteelCasing");
DefIcon def = DefIcon.getAll(BASE_ICON);
switch(blockType)
{
case MACHINE_BLOCK_1:
icons[0][0] = register.registerIcon("mekanism:EnrichmentChamberFrontOff");
icons[0][1] = register.registerIcon("mekanism:EnrichmentChamberFrontOn");
icons[0][2] = BASE_ICON;
icons[1][0] = register.registerIcon("mekanism:OsmiumCompressorFrontOff");
icons[1][1] = register.registerIcon("mekanism:OsmiumCompressorFrontOn");
icons[1][2] = BASE_ICON;
icons[2][0] = register.registerIcon("mekanism:CombinerFrontOff");
icons[2][1] = register.registerIcon("mekanism:CombinerFrontOn");
icons[2][2] = BASE_ICON;
icons[3][0] = register.registerIcon("mekanism:CrusherFrontOff");
icons[3][1] = register.registerIcon("mekanism:CrusherFrontOn");
icons[3][2] = BASE_ICON;
icons[5][0] = register.registerIcon("mekanism:BasicFactoryFront");
icons[5][1] = register.registerIcon("mekanism:BasicFactorySide");
icons[5][2] = register.registerIcon("mekanism:BasicFactoryTop");
icons[6][0] = register.registerIcon("mekanism:AdvancedFactoryFront");
icons[6][1] = register.registerIcon("mekanism:AdvancedFactorySide");
icons[6][2] = register.registerIcon("mekanism:AdvancedFactoryTop");
icons[7][0] = register.registerIcon("mekanism:EliteFactoryFront");
icons[7][1] = register.registerIcon("mekanism:EliteFactorySide");
icons[7][2] = register.registerIcon("mekanism:EliteFactoryTop");
icons[9][0] = register.registerIcon("mekanism:PurificationChamberFrontOff");
icons[9][1] = register.registerIcon("mekanism:PurificationChamberFrontOn");
icons[9][2] = BASE_ICON;
icons[10][0] = register.registerIcon("mekanism:EnergizedSmelterFrontOff");
icons[10][1] = register.registerIcon("mekanism:EnergizedSmelterFrontOn");
icons[10][2] = register.registerIcon("mekanism:SteelCasing");
icons[11][0] = register.registerIcon("mekanism:Teleporter");
ctms[11][0] = new CTMData("ctm/Teleporter", this, Arrays.asList(11)).addOtherBlockConnectivities(MekanismBlocks.BasicBlock, Arrays.asList(7)).registerIcons(register);
MekanismRenderer.loadDynamicTextures(register, MachineType.ENRICHMENT_CHAMBER.name, icons[0], def);
MekanismRenderer.loadDynamicTextures(register, MachineType.OSMIUM_COMPRESSOR.name, icons[1], def);
MekanismRenderer.loadDynamicTextures(register, MachineType.COMBINER.name, icons[2], def);
MekanismRenderer.loadDynamicTextures(register, MachineType.CRUSHER.name, icons[3], def);
for(RecipeType type : RecipeType.values())
{
MekanismRenderer.loadDynamicTextures(register, BaseTier.BASIC.getName() + type.getUnlocalizedName() + MachineType.BASIC_FACTORY.name, factoryIcons[0][type.ordinal()],
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryFront"), 2),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryTop"), 1),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryBottom"), 0),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactorySide"), 3, 4, 5));
MekanismRenderer.loadDynamicTextures(register, BaseTier.ADVANCED.getName() + type.getUnlocalizedName() + MachineType.ADVANCED_FACTORY.name, factoryIcons[1][type.ordinal()],
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryFront"), 2),
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryTop"), 1),
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryBottom"), 0),
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactorySide"), 3, 4, 5));
MekanismRenderer.loadDynamicTextures(register, BaseTier.ELITE.getName() + type.getUnlocalizedName() + MachineType.ELITE_FACTORY.name, factoryIcons[2][type.ordinal()],
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryFront"), 2),
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryTop"), 1),
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryBottom"), 0),
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactorySide"), 3, 4, 5));
}
MekanismRenderer.loadDynamicTextures(register, MachineType.PURIFICATION_CHAMBER.name, icons[9], def);
MekanismRenderer.loadDynamicTextures(register, MachineType.ENERGIZED_SMELTER.name, icons[10], def);
icons[11][0] = ctms[11][0].mainTextureData.icon;
break;
case MACHINE_BLOCK_2:
icons[3][0] = register.registerIcon("mekanism:ChemicalInjectionChamberFrontOff");
icons[3][1] = register.registerIcon("mekanism:ChemicalInjectionChamberFrontOn");
icons[3][2] = BASE_ICON;
icons[5][0] = register.registerIcon("mekanism:PrecisionSawmillFrontOff");
icons[5][1] = register.registerIcon("mekanism:PrecisionSawmillFrontOn");
icons[5][2] = BASE_ICON;
MekanismRenderer.loadDynamicTextures(register, MachineType.CHEMICAL_INJECTION_CHAMBER.name, icons[3], def);
MekanismRenderer.loadDynamicTextures(register, MachineType.PRECISION_SAWMILL.name, icons[5], def);
break;
case MACHINE_BLOCK_3:
icons[0][0] = register.registerIcon("mekanism:AmbientAccumulator");
icons[2][0] = BASE_ICON;
icons[3][0] = register.registerIcon("mekanism:OredictionificatorBack");
icons[3][1] = register.registerIcon("mekanism:OredictionificatorFront");
icons[3][2] = register.registerIcon("mekanism:OredictionificatorPort");
icons[3][3] = register.registerIcon("mekanism:OredictionificatorSide");
MekanismRenderer.loadDynamicTextures(register, MachineType.OREDICTIONIFICATOR.name, icons[3], DefIcon.getAll(register.registerIcon("mekanism:OredictionificatorSide")));
break;
}
}
@Override
public IIcon getIcon(ItemStack stack, int side)
{
MachineType type = MachineType.get(stack);
ItemBlockMachine item = (ItemBlockMachine)stack.getItem();
if(type == MachineType.BASIC_FACTORY)
{
return factoryIcons[0][item.getRecipeType(stack)][side];
}
else if(type == MachineType.ADVANCED_FACTORY)
{
return factoryIcons[1][item.getRecipeType(stack)][side];
}
else if(type == MachineType.ELITE_FACTORY)
{
return factoryIcons[2][item.getRecipeType(stack)][side];
}
return getIcon(side, stack.getItemDamage());
}
@Override
@ -388,27 +413,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
case 3:
case 9:
case 10:
if(side == 3)
{
return icons[meta][0];
}
else {
return icons[meta][2];
}
case 5:
case 6:
case 7:
if(side == 3)
{
return icons[meta][0];
}
else if(side == 0 || side == 1)
{
return icons[meta][2];
}
else {
return icons[meta][1];
}
return icons[meta][side];
default:
return icons[meta][0] != null ? icons[meta][0] : BASE_ICON;
}
@ -417,13 +422,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
{
case 3:
case 5:
if(side == 3)
{
return icons[meta][0];
}
else {
return icons[meta][2];
}
return icons[meta][side];
default:
return icons[meta][0] != null ? icons[meta][0] : BASE_ICON;
}
@ -431,21 +430,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
switch(meta)
{
case 3:
if(side == 3)
{
return icons[3][1];
}
else if(side == 4 || side == 5)
{
return icons[3][2];
}
else if(side == 2)
{
return icons[3][0];
}
else {
return icons[3][3];
}
return icons[meta][side];
default:
return icons[meta][0] != null ? icons[meta][0] : BASE_ICON;
}
@ -472,27 +457,15 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
case 3:
case 9:
case 10:
if(side == tileEntity.facing)
{
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][1] : icons[meta][0];
}
else {
return icons[meta][2];
}
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
case 5:
case 6:
case 7:
if(side == tileEntity.facing)
{
return icons[meta][0];
}
else if(side == 0 || side == 1)
{
return icons[meta][2];
}
else {
return icons[meta][1];
}
TileEntityFactory factory = (TileEntityFactory)tileEntity;
active = MekanismUtils.isActive(world, x, y, z);
return factoryIcons[factory.tier.ordinal()][factory.recipeType.ordinal()][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
default:
return icons[meta][0];
}
@ -501,13 +474,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
{
case 3:
case 5:
if(side == tileEntity.facing)
{
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][1] : icons[meta][0];
}
else {
return icons[meta][2];
}
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
default:
return icons[meta][0];
}
@ -515,21 +483,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
switch(meta)
{
case 3:
if(side == tileEntity.facing)
{
return icons[3][1];
}
else if(side == MekanismUtils.getLeft(tileEntity.facing).ordinal() || side == MekanismUtils.getRight(tileEntity.facing).ordinal())
{
return icons[3][2];
}
else if(side == ForgeDirection.OPPOSITES[tileEntity.facing])
{
return icons[3][0];
}
else {
return icons[3][3];
}
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
default:
return icons[meta][0];
}
@ -720,6 +675,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
return false;
}
}
return false;
}
@ -761,7 +717,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
@Override
public int getRenderType()
{
return Mekanism.proxy.MACHINE_RENDER_ID;
return Mekanism.proxy.CTM_RENDER_ID;
}
@Override
@ -1137,9 +1093,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
COMBINER(MachineBlock.MACHINE_BLOCK_1, 2, "Combiner", 5, TileEntityCombiner.class, true, false, true),
CRUSHER(MachineBlock.MACHINE_BLOCK_1, 3, "Crusher", 6, TileEntityCrusher.class, true, false, true),
DIGITAL_MINER(MachineBlock.MACHINE_BLOCK_1, 4, "DigitalMiner", 2, TileEntityDigitalMiner.class, true, true, true),
BASIC_FACTORY(MachineBlock.MACHINE_BLOCK_1, 5, "BasicFactory", 11, TileEntityFactory.class, true, false, true),
ADVANCED_FACTORY(MachineBlock.MACHINE_BLOCK_1, 6, "AdvancedFactory", 11, TileEntityAdvancedFactory.class, true, false, true),
ELITE_FACTORY(MachineBlock.MACHINE_BLOCK_1, 7, "EliteFactory", 11, TileEntityEliteFactory.class, true, false, true),
BASIC_FACTORY(MachineBlock.MACHINE_BLOCK_1, 5, "Factory", 11, TileEntityFactory.class, true, false, true),
ADVANCED_FACTORY(MachineBlock.MACHINE_BLOCK_1, 6, "Factory", 11, TileEntityAdvancedFactory.class, true, false, true),
ELITE_FACTORY(MachineBlock.MACHINE_BLOCK_1, 7, "Factory", 11, TileEntityEliteFactory.class, true, false, true),
METALLURGIC_INFUSER(MachineBlock.MACHINE_BLOCK_1, 8, "MetallurgicInfuser", 12, TileEntityMetallurgicInfuser.class, true, true, true),
PURIFICATION_CHAMBER(MachineBlock.MACHINE_BLOCK_1, 9, "PurificationChamber", 15, TileEntityPurificationChamber.class, true, false, true),
ENERGIZED_SMELTER(MachineBlock.MACHINE_BLOCK_1, 10, "EnergizedSmelter", 16, TileEntityEnergizedSmelter.class, true, false, true),
@ -1433,4 +1389,28 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
return false;
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileEntityLaserAmplifier)
{
return ((TileEntityLaserAmplifier)tile).emittingRedstone ? 15 : 0;
}
return 0;
}
@Override
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta)
{
if(ctms[meta][1] != null && MekanismUtils.isActive(world, x, y, z))
{
return ctms[meta][1];
}
return ctms[meta][0];
}
}

View file

@ -1,5 +1,10 @@
package mekanism.common.content.boiler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.common.multiblock.MultiblockCache;
import mekanism.common.multiblock.MultiblockManager;
@ -8,11 +13,6 @@ import mekanism.common.tile.TileEntityMultiblock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/**
* Created by ben on 09/01/15.
*/
@ -20,7 +20,7 @@ public class BoilerManager extends MultiblockManager<SynchronizedBoilerData>
{
public BoilerManager(String s)
{
super(s, BoilerCache.class);
super(s);
}
public void tickSelf(World world)
@ -83,14 +83,12 @@ public class BoilerManager extends MultiblockManager<SynchronizedBoilerData>
for(Coord4D obj : entry.getValue())
{
inventories.get(entry.getKey()).locations.remove(obj);
dataHandler.markDirty();
}
}
for(int inventoryID : idsToKill)
{
inventories.remove(inventoryID);
dataHandler.markDirty();
}
}
}

View file

@ -82,12 +82,12 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
if(tile instanceof TileEntityInductionCell)
{
structureFound.cells.add(coord);
structureFound.storageCap += ((TileEntityInductionCell)tile).tier.MAX_ELECTRICITY;
structureFound.storageCap += ((TileEntityInductionCell)tile).tier.maxEnergy;
}
else if(tile instanceof TileEntityInductionProvider)
{
structureFound.providers.add(coord);
structureFound.outputCap += ((TileEntityInductionProvider)tile).tier.OUTPUT;
structureFound.outputCap += ((TileEntityInductionProvider)tile).tier.output;
}
}
}

View file

@ -52,17 +52,14 @@ public class SynchronizedMatrixData extends SynchronizedData<SynchronizedMatrixD
{
for(Coord4D coord : cells)
{
if(energy <= 0)
{
return;
}
TileEntity tile = coord.getTileEntity(world);
if(tile instanceof TileEntityInductionCell)
{
TileEntityInductionCell cell = (TileEntityInductionCell)tile;
cell.setEnergy(0);
double toAdd = Math.min(cell.getMaxEnergy(), energy);
cell.setEnergy(toAdd);
energy -= toAdd;

View file

@ -204,7 +204,7 @@ public final class TransporterPathfinder
}
public static List<Destination> getPaths(ILogisticalTransporter start, TransporterStack stack, int min)
{
{
InventoryNetwork network = start.getTransmitterNetwork();
List<AcceptorData> acceptors = network.calculateAcceptors(stack.itemStack, stack.color);
List<Destination> paths = new ArrayList<Destination>();

View file

@ -291,7 +291,7 @@ public class TransporterStack
TileEntity from = Coord4D.get(tileEntity).getFromSide(side.getOpposite()).getTileEntity(tileEntity.getWorldObj());
ILogisticalTransporter transporter = ((ITransporterTile)tileEntity).getTransmitter();
if(!((ITransporterTile)tileEntity).canConnectMutual(side.getOpposite()))
if(!((ITransporterTile)tileEntity).canConnectMutual(side))
{
return false;
}
@ -303,7 +303,7 @@ public class TransporterStack
{
TileEntity from = transporter.coord().getFromSide(side.getOpposite()).getTileEntity(transporter.world());
if(!transporter.canConnectMutual(side.getOpposite()))
if(!transporter.canConnectMutual(side))
{
return false;
}

View file

@ -188,7 +188,10 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
{
if(!smeltBlock(new Coord4D(mop.blockX, mop.blockY, mop.blockZ)))
{
worldObj.setBlock(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, Blocks.fire);
if(!worldObj.isRemote)
{
worldObj.setBlock(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, Blocks.fire);
}
}
}

View file

@ -7,6 +7,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mekanism.api.EnumColor;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionProvider;
import net.minecraft.entity.player.EntityPlayerMP;
@ -27,6 +28,7 @@ public class WailaDataProvider implements IWailaDataProvider
registrar.registerHeadProvider(provider, TileEntityInductionCell.class);
registrar.registerHeadProvider(provider, TileEntityInductionProvider.class);
registrar.registerHeadProvider(provider, TileEntityFactory.class);
}
@Override
@ -50,6 +52,10 @@ public class WailaDataProvider implements IWailaDataProvider
{
currenttip.set(0, EnumColor.WHITE + ((TileEntityInductionProvider)tile).getInventoryName());
}
else if(tile instanceof TileEntityFactory)
{
currenttip.set(0, EnumColor.WHITE + ((TileEntityFactory)tile).getInventoryName());
}
return currenttip;
}

View file

@ -11,7 +11,6 @@ import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.InductionCellTier;
import mekanism.common.Tier.InductionProviderTier;
import mekanism.common.inventory.InventoryBin;
@ -19,6 +18,7 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBin;
import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionProvider;
import mekanism.common.tile.TileEntityMultiblock;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@ -137,13 +137,13 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
{
InductionCellTier tier = InductionCellTier.values()[getTier(itemstack).ordinal()];
list.add(tier.getBaseTier().getColor() + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.MAX_ELECTRICITY));
list.add(tier.getBaseTier().getColor() + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.maxEnergy));
}
else if(itemstack.getItemDamage() == 4)
{
InductionProviderTier tier = InductionProviderTier.values()[getTier(itemstack).ordinal()];
list.add(tier.getBaseTier().getColor() + MekanismUtils.localize("tooltip.outputRate") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.OUTPUT));
list.add(tier.getBaseTier().getColor() + MekanismUtils.localize("tooltip.outputRate") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(tier.output));
}
}
@ -243,7 +243,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
TileEntity tileEntity = world.getTileEntity(x, y, z);
if(tileEntity instanceof IStrictEnergyStorage)
if(tileEntity instanceof IStrictEnergyStorage && !(tileEntity instanceof TileEntityMultiblock<?>))
{
((IStrictEnergyStorage)tileEntity).setEnergy(getEnergy(stack));
}
@ -374,7 +374,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
{
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock2 && itemStack.getItemDamage() == 3)
{
return InductionCellTier.values()[getTier(itemStack).ordinal()].MAX_ELECTRICITY;
return InductionCellTier.values()[getTier(itemStack).ordinal()].maxEnergy;
}
return 0;

View file

@ -1,5 +1,8 @@
package mekanism.common.item;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
import java.util.ArrayList;
import java.util.List;
@ -19,7 +22,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityEnergyCube;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.EntityPlayer;
@ -30,16 +32,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants.NBT;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cofh.api.energy.IEnergyContainerItem;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
@InterfaceList({
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHCore"),
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
@ -79,11 +78,11 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
stack.setItemDamage(100);
return stack;
}
@Override
public String getUnlocalizedName(ItemStack itemstack)
public String getItemStackDisplayName(ItemStack itemstack)
{
return getUnlocalizedName() + "." + getEnergyCubeTier(itemstack).getBaseTier().getName();
return MekanismUtils.localize("tile.EnergyCube" + getEnergyCubeTier(itemstack).getBaseTier().getName() + ".name");
}
@Override
@ -232,7 +231,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
@Override
public double getMaxEnergy(ItemStack itemStack)
{
return getEnergyCubeTier(itemStack).MAX_ELECTRICITY;
return getEnergyCubeTier(itemStack).maxEnergy;
}
@Override

View file

@ -1,5 +1,10 @@
package mekanism.common.item;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
import java.util.List;
import java.util.Map;
@ -11,12 +16,13 @@ import mekanism.api.energy.IEnergizedItem;
import mekanism.client.MekKeyHandler;
import mekanism.client.MekanismKeyHandler;
import mekanism.common.Mekanism;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Upgrade;
import mekanism.common.base.IElectricChest;
import mekanism.common.base.IFactory;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.IRedstoneControl.RedstoneControl;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.ISustainedData;
import mekanism.common.base.ISustainedInventory;
import mekanism.common.base.ISustainedTank;
@ -33,7 +39,6 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityPortableTank;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.settings.GameSettings;
@ -55,18 +60,13 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cofh.api.energy.IEnergyContainerItem;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
/**
* Item class for handling multiple machine block IDs.
* 0:0: Enrichment Chamber
@ -141,6 +141,22 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
return "null";
}
@Override
public String getItemStackDisplayName(ItemStack itemstack)
{
MachineType type = MachineType.get(itemstack);
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
{
String tier = type == MachineType.BASIC_FACTORY ? BaseTier.BASIC.getLocalizedName() : (type == MachineType.ADVANCED_FACTORY ?
BaseTier.ADVANCED.getLocalizedName() : BaseTier.ELITE.getLocalizedName());
return tier + " " + RecipeType.values()[getRecipeType(itemstack)].getLocalizedName() + " " + super.getItemStackDisplayName(itemstack);
}
return super.getItemStackDisplayName(itemstack);
}
@Override
@SideOnly(Side.CLIENT)
@ -153,6 +169,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(type == MachineType.PORTABLE_TANK)
{
FluidStack fluidStack = getFluidStack(itemstack);
if(fluidStack != null)
{
list.add(EnumColor.PINK + LangUtils.localizeFluidStack(fluidStack) + ": " + EnumColor.GREY + getFluidStack(itemstack).amount + "mB");
@ -166,7 +183,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
{
if(type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY)
{
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.recipeType") + ": " + EnumColor.GREY + RecipeType.values()[getRecipeType(itemstack)].getName());
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.recipeType") + ": " + EnumColor.GREY + RecipeType.values()[getRecipeType(itemstack)].getLocalizedName());
}
if(type == MachineType.ELECTRIC_CHEST)
@ -182,7 +199,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(type.isElectric)
{
list.add(EnumColor.BRIGHT_GREEN + MekanismUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergyStored(itemstack)));
list.add(EnumColor.BRIGHT_GREEN + MekanismUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
}
if(hasTank(itemstack) && type != MachineType.PORTABLE_TANK)
@ -245,19 +262,21 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
{
Block b = world.getBlock(xPos, yPos, zPos);
if(yPos > 255)
if(yPos > 255 || !b.isReplaceable(world, xPos, yPos, zPos))
{
place = false;
}
if(!b.isAir(world, xPos, yPos, zPos) && !b.isReplaceable(world, xPos, yPos, zPos))
{
return false;
}
}
}
}
}
else if(type == MachineType.SOLAR_NEUTRON_ACTIVATOR)
{
if(y+1 > 255 || !world.getBlock(x, y+1, z).isReplaceable(world, x, y+1, z))
{
place = false;
}
}
if(place && super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
{
@ -915,13 +934,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
@Override
public int getEnergyStored(ItemStack theItem)
{
return (int)(getEnergy(theItem)* general.TO_TE);
return (int)(getEnergy(theItem) * general.TO_TE);
}
@Override
public int getMaxEnergyStored(ItemStack theItem)
{
return (int)(getMaxEnergy(theItem)* general.TO_TE);
return (int)(getMaxEnergy(theItem) * general.TO_TE);
}
@Override

View file

@ -8,53 +8,22 @@ import java.util.Set;
import mekanism.api.Coord4D;
import mekanism.common.tile.TileEntityMultiblock;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
import net.minecraftforge.common.util.Constants.NBT;
public class MultiblockManager<T extends SynchronizedData<T>>
{
private static Set<MultiblockManager> managers = new HashSet<MultiblockManager>();
public static boolean loaded;
public Class<? extends MultiblockCache<T>> cacheClass;
public DataHandler dataHandler;
public String name;
/** A map containing references to all multiblock inventory caches. */
public Map<Integer, MultiblockCache<T>> inventories = new HashMap<Integer, MultiblockCache<T>>();
public MultiblockManager(String s, Class<? extends MultiblockCache<T>> cache)
public MultiblockManager(String s)
{
name = s;
managers.add(this);
cacheClass = cache;
}
public void createOrLoad(World world)
{
if(dataHandler == null)
{
dataHandler = (DataHandler)world.perWorldStorage.loadData(DataHandler.class, name);
if(dataHandler == null)
{
dataHandler = new DataHandler(name);
dataHandler.setManager(this);
world.perWorldStorage.setData(name, dataHandler);
}
else {
dataHandler.setManager(this);
dataHandler.syncManager();
}
}
}
/**
@ -65,50 +34,24 @@ public class MultiblockManager<T extends SynchronizedData<T>>
*/
public MultiblockCache<T> pullInventory(World world, int id)
{
if(!loaded)
{
load(world);
}
MultiblockCache<T> toReturn = inventories.get(id);
for(Coord4D obj : inventories.get(id).locations)
{
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.getTileEntity(world);
if(tileEntity != null)
{
tileEntity.cachedData = tileEntity.getNewCache();
tileEntity.cachedID = -1;
}
}
inventories.remove(id);
dataHandler.markDirty();
return toReturn;
}
/**
* Updates a multiblock cache with the defined inventory ID with the parameterized values.
* @param multiblock - multiblock TileEntity
*/
public void updateCache(IMultiblock<T> multiblock)
{
try {
if(!loaded)
{
load(((TileEntity)multiblock).getWorldObj());
}
if(!inventories.containsKey(multiblock.getSynchronizedData().inventoryID))
{
MultiblockCache<T> cache = cacheClass.newInstance();
cache.sync((T)multiblock.getSynchronizedData());
cache.locations.add(Coord4D.get((TileEntity)multiblock));
inventories.put(multiblock.getSynchronizedData().inventoryID, cache);
return;
}
inventories.get(multiblock.getSynchronizedData().inventoryID).sync((T)multiblock.getSynchronizedData());
inventories.get(multiblock.getSynchronizedData().inventoryID).locations.add(Coord4D.get((TileEntity)multiblock));
dataHandler.markDirty();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* Grabs a unique inventory ID for a multiblock.
* @return unique inventory ID
@ -134,11 +77,6 @@ public class MultiblockManager<T extends SynchronizedData<T>>
public static void tick(World world)
{
if(!loaded)
{
load(world);
}
for(MultiblockManager manager : managers)
{
manager.tickSelf(world);
@ -183,14 +121,12 @@ public class MultiblockManager<T extends SynchronizedData<T>>
for(Coord4D obj : entry.getValue())
{
inventories.get(entry.getKey()).locations.remove(obj);
dataHandler.markDirty();
}
}
for(int inventoryID : idsToKill)
{
inventories.remove(inventoryID);
dataHandler.markDirty();
}
}
@ -209,29 +145,17 @@ public class MultiblockManager<T extends SynchronizedData<T>>
return ((TileEntityMultiblock)tile1).getManager() == ((TileEntityMultiblock)tile2).getManager();
}
public int getInventoryId(TileEntityMultiblock<T> tile)
public void updateCache(TileEntityMultiblock<T> tile)
{
Coord4D coord = Coord4D.get(tile);
for(Map.Entry<Integer, MultiblockCache<T>> entry : inventories.entrySet())
if(!inventories.containsKey(tile.cachedID))
{
if(entry.getValue().locations.contains(coord))
{
return entry.getKey();
}
}
return -1;
}
public static void load(World world)
{
loaded = true;
for(MultiblockManager manager : managers)
{
manager.createOrLoad(world);
tile.cachedData.locations.add(Coord4D.get(tile));
inventories.put(tile.cachedID, tile.cachedData);
return;
}
inventories.get(tile.cachedID).locations.add(Coord4D.get(tile));
}
public static void reset()
@ -239,91 +163,6 @@ public class MultiblockManager<T extends SynchronizedData<T>>
for(MultiblockManager manager : managers)
{
manager.inventories.clear();
manager.dataHandler = null;
}
loaded = false;
}
public static class DataHandler extends WorldSavedData
{
public MultiblockManager manager;
public Map<Integer, MultiblockCache> loadedInventories;
public DataHandler(String tagName)
{
super(tagName);
}
public void setManager(MultiblockManager m)
{
manager = m;
}
public void syncManager()
{
if(loadedInventories != null)
{
manager.inventories = loadedInventories;
}
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
try {
String cacheClass = nbtTags.getString("cacheClass");
NBTTagList list = nbtTags.getTagList("invList", NBT.TAG_COMPOUND);
loadedInventories = new HashMap<Integer, MultiblockCache>();
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound compound = list.getCompoundTagAt(i);
MultiblockCache cache = (MultiblockCache)Class.forName(cacheClass).newInstance();
cache.load(compound);
NBTTagList coordsList = compound.getTagList("coordsList", NBT.TAG_COMPOUND);
for(int j = 0; j < coordsList.tagCount(); j++)
{
cache.locations.add(Coord4D.read(coordsList.getCompoundTagAt(j)));
}
loadedInventories.put(compound.getInteger("id"), cache);
}
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
nbtTags.setString("cacheClass", manager.cacheClass.getName());
NBTTagList list = new NBTTagList();
for(Map.Entry<Integer, MultiblockCache> entry : ((Map<Integer, MultiblockCache>)manager.inventories).entrySet())
{
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("id", entry.getKey());
entry.getValue().save(compound);
NBTTagList coordsList = new NBTTagList();
for(Coord4D coord : (Set<Coord4D>)entry.getValue().locations)
{
coordsList.appendTag(coord.write(new NBTTagCompound()));
}
compound.setTag("coordsList", coordsList);
list.appendTag(compound);
}
nbtTags.setTag("invList", list);
}
}
}

View file

@ -402,11 +402,10 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
for(Coord4D obj : structureFound.locations)
{
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.getTileEntity(pointer.getWorldObj());
int id = getManager().getInventoryId(tileEntity);
if(id != -1)
if(tileEntity.cachedID != -1)
{
idsFound.add(id);
idsFound.add(tileEntity.cachedID);
}
}

View file

@ -12,6 +12,7 @@ import mekanism.client.MekKeyHandler;
import mekanism.client.MekanismKeyHandler;
import mekanism.common.Mekanism;
import mekanism.common.Tier;
import mekanism.common.Tier.BaseTier;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.settings.GameSettings;
@ -87,15 +88,27 @@ public class ItemPartTransmitter extends JItemMultiPart
{
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
{
if(TransmitterType.values()[itemstack.getItemDamage()].getTransmission() == TransmissionType.ENERGY)
TransmissionType transmission = TransmitterType.values()[itemstack.getItemDamage()].getTransmission();
BaseTier tier = TransmitterType.values()[itemstack.getItemDamage()].getTier();
if(transmission == TransmissionType.ENERGY)
{
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(Tier.CableTier.values()[itemstack.getItemDamage()].cableCapacity) + "/t");
}
if(TransmitterType.values()[itemstack.getItemDamage()].getTransmission() == TransmissionType.FLUID)
else if(transmission == TransmissionType.FLUID)
{
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + Tier.PipeTier.getTierFromMeta(itemstack.getItemDamage()).pipeCapacity + "mB/t");
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.pumpRate") + ": " + EnumColor.GREY + Tier.PipeTier.getTierFromMeta(itemstack.getItemDamage()).pipePullAmount + "mB/t");
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + Tier.PipeTier.get(tier).pipeCapacity + "mB/t");
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.pumpRate") + ": " + EnumColor.GREY + Tier.PipeTier.get(tier).pipePullAmount + "mB/t");
}
else if(transmission == TransmissionType.GAS)
{
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + Tier.TubeTier.get(tier).tubeCapacity + "mB/t");
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.pumpRate") + ": " + EnumColor.GREY + Tier.TubeTier.get(tier).tubePullAmount + "mB/t");
}
else if(transmission == TransmissionType.ITEM)
{
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.speed") + ": " + EnumColor.GREY + (Tier.TransporterTier.get(tier).speed/(100/20)) + " m/s");
list.add(EnumColor.INDIGO + MekanismUtils.localize("tooltip.pumpRate") + ": " + EnumColor.GREY + Tier.TransporterTier.get(tier).pullAmount*2 + "/s");
}
list.add(MekanismUtils.localize("tooltip.hold") + " " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.forDetails"));
@ -117,20 +130,20 @@ public class ItemPartTransmitter extends JItemMultiPart
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.fluids") + " " + EnumColor.GREY + "(MinecraftForge)");
break;
}
case 8:
case 8: case 9: case 10: case 11:
{
list.add(EnumColor.DARK_GREY + MekanismUtils.localize("tooltip.capableTrans") + ":");
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.gasses") + " (Mekanism)");
break;
}
case 9:
case 12: case 13: case 14: case 15:
{
list.add(EnumColor.DARK_GREY + MekanismUtils.localize("tooltip.capableTrans") + ":");
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.items") + " (" + MekanismUtils.localize("tooltip.universal") + ")");
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.blocks") + " (" + MekanismUtils.localize("tooltip.universal") + ")");
break;
}
case 10:
case 16:
{
list.add(EnumColor.DARK_GREY + MekanismUtils.localize("tooltip.capableTrans") + ":");
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.items") + " (" + MekanismUtils.localize("tooltip.universal") + ")");
@ -138,7 +151,7 @@ public class ItemPartTransmitter extends JItemMultiPart
list.add("- " + EnumColor.DARK_RED + MekanismUtils.localize("tooltip.restrictiveDesc"));
break;
}
case 11:
case 17:
{
list.add(EnumColor.DARK_GREY + MekanismUtils.localize("tooltip.capableTrans") + ":");
list.add("- " + EnumColor.PURPLE + MekanismUtils.localize("tooltip.items") + " (" + MekanismUtils.localize("tooltip.universal") + ")");

View file

@ -31,10 +31,12 @@ public class MultipartMekanism implements IPartFactory
"mekanism:universal_cable_ultimate", "mekanism:mechanical_pipe",
"mekanism:mechanical_pipe_basic", "mekanism:mechanical_pipe_advanced",
"mekanism:mechanical_pipe_elite", "mekanism:mechanical_pipe_ultimate",
"mekanism:pressurized_tube", "mekanism:logistical_transporter",
"mekanism:restrictive_transporter", "mekanism:diversion_transporter",
"mekanism:heat_transmitter",
"mekanism:glow_panel"});
"mekanism:pressurized_tube_basic", "mekanism:pressurized_tube_advanced",
"mekanism:pressurized_tube_elite", "mekanism:pressurized_tube_ultimate",
"mekanism:logistical_transporter_basic", "mekanism:logistical_transporter_advanced",
"mekanism:logistical_transporter_elite", "mekanism:logistical_transporter_ultimate",
"mekanism:restrictive_transporter", "mekanism:diversion_transporter",
"mekanism:heat_transmitter", "mekanism:glow_panel"});
MultipartGenerator.registerPassThroughInterface("mekanism.api.IConfigurable");
MultipartGenerator.registerPassThroughInterface("mekanism.api.energy.IStrictEnergyAcceptor");
@ -93,13 +95,37 @@ public class MultipartMekanism implements IPartFactory
{
return new PartMechanicalPipe(Tier.PipeTier.ULTIMATE);
}
else if(name.equals("mekanism:pressurized_tube"))
else if(name.equals("mekanism:pressurized_tube_basic") || name.equals("mekanism:pressurized_tube"))
{
return new PartPressurizedTube();
return new PartPressurizedTube(Tier.TubeTier.BASIC);
}
else if(name.equals("mekanism:logistical_transporter"))
else if(name.equals("mekanism:pressurized_tube_advanced"))
{
return new PartLogisticalTransporter();
return new PartPressurizedTube(Tier.TubeTier.ADVANCED);
}
else if(name.equals("mekanism:pressurized_tube_elite"))
{
return new PartPressurizedTube(Tier.TubeTier.ELITE);
}
else if(name.equals("mekanism:pressurized_tube_ultimate"))
{
return new PartPressurizedTube(Tier.TubeTier.ULTIMATE);
}
else if(name.equals("mekanism:logistical_transporter_basic") || name.equals("mekanism:logistical_transporter"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.BASIC);
}
else if(name.equals("mekanism:logistical_transporter_advanced"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED);
}
else if(name.equals("mekanism:logistical_transporter_elite"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ELITE);
}
else if(name.equals("mekanism:logistical_transporter_ultimate"))
{
return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE);
}
else if(name.equals("mekanism:restrictive_transporter"))
{

View file

@ -35,9 +35,21 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(2);
return transporterIcons.getCenterIcon(5);
}
@Override
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 14 : (color != null ? 11 : 10));
}
@Override
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(opaque ? 15 : (color != null ? 13 : 12));
}
@Override
@ -128,6 +140,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
refreshConnections();
tile().notifyPartChange(this);
notifyTileChange();
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleDiverter") + ": " + EnumColor.RED + description));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tile()), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tile())));

View file

@ -67,19 +67,19 @@ public class PartHeatTransmitter extends PartTransmitter<IHeatTransfer, HeatNetw
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return heatIcons.getCenterIcon(0);
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return heatIcons.getSideIcon(0);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return heatIcons.getSideIcon(1);
}
@ -152,6 +152,7 @@ public class PartHeatTransmitter extends PartTransmitter<IHeatTransfer, HeatNetw
public void writeDesc(MCDataOutput packet)
{
packet.writeBoolean(false);
super.writeDesc(packet);
}
@ -162,8 +163,7 @@ public class PartHeatTransmitter extends PartTransmitter<IHeatTransfer, HeatNetw
{
getTransmitter().temperature = packet.readDouble();
}
else
{
else {
super.readDesc(packet);
}
}

View file

@ -11,6 +11,8 @@ import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.InventoryNetwork;
import mekanism.common.Mekanism;
import mekanism.common.Tier;
import mekanism.common.Tier.TransporterTier;
import mekanism.common.base.ILogisticalTransporter;
import mekanism.common.content.transporter.InvStack;
import mekanism.common.content.transporter.PathfinderCache;
@ -43,25 +45,28 @@ import codechicken.lib.vec.Vector3;
public class PartLogisticalTransporter extends PartTransmitter<IInventory, InventoryNetwork> implements ITransporterTile
{
public Tier.TransporterTier tier = Tier.TransporterTier.BASIC;
public static TransmitterIcons transporterIcons = new TransmitterIcons(3, 4);
public int pullDelay = 0;
public PartLogisticalTransporter()
public PartLogisticalTransporter(TransporterTier transporterTier)
{
tier = transporterTier;
transmitterDelegate = new MultipartTransporter(this);
}
@Override
public String getType()
{
return "mekanism:logistical_transporter";
return "mekanism:logistical_transporter_" + tier.name().toLowerCase();
}
@Override
public TransmitterType getTransmitterType()
{
return TransmitterType.LOGISTICAL_TRANSPORTER;
return tier.type;
}
@Override
@ -72,8 +77,12 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
public static void registerIcons(IIconRegister register)
{
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporter", "RestrictiveTransporter", "DiversionTransporter"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVertical", "LogisticalTransporterHorizontal", "RestrictiveTransporterVertical", "RestrictiveTransporterVertical"});
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporterBasic", "LogisticalTransporterAdvanced", "LogisticalTransporterElite", "LogisticalTransporterUltimate", "RestrictiveTransporter",
"DiversionTransporter", "LogisticalTransporterGlass", "LogisticalTransporterGlassColored"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVerticalBasic", "LogisticalTransporterVerticalAdvanced", "LogisticalTransporterVerticalElite", "LogisticalTransporterVerticalUltimate",
"LogisticalTransporterHorizontalBasic", "LogisticalTransporterHorizontalAdvanced", "LogisticalTransporterHorizontalElite", "LogisticalTransporterHorizontalUltimate", "RestrictiveTransporterVertical",
"RestrictiveTransporterHorizontal", "LogisticalTransporterVerticalGlass", "LogisticalTransporterVerticalGlassColored", "LogisticalTransporterHorizontalGlass", "LogisticalTransporterHorizontalGlassColored",
"DiversionTransporterVertical", "DiversionTransporterHorizontal"});
}
@Override
@ -111,21 +120,21 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(0);
return transporterIcons.getCenterIcon(opaque ? tier.ordinal() : (getTransmitter().color != null ? 7 : 6));
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(0);
return transporterIcons.getSideIcon(opaque ? tier.ordinal() : (getTransmitter().color != null ? 11 : 10));
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(1);
return transporterIcons.getSideIcon(opaque ? 4+tier.ordinal() : (getTransmitter().color != null ? 13 : 12));
}
@Override
@ -161,7 +170,7 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
if(tile instanceof IInventory)
{
IInventory inv = (IInventory)tile;
InvStack stack = InventoryUtils.takeTopItem(inv, side.ordinal());
InvStack stack = InventoryUtils.takeTopItem(inv, side.ordinal(), tier.pullAmount);
if(stack != null && stack.getStack() != null)
{
@ -314,6 +323,8 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
public void load(NBTTagCompound nbtTags)
{
super.load(nbtTags);
tier = TransporterTier.values()[nbtTags.getInteger("tier")];
if(nbtTags.hasKey("color"))
{
@ -338,6 +349,8 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
public void save(NBTTagCompound nbtTags)
{
super.save(nbtTags);
nbtTags.setInteger("tier", tier.ordinal());
if(getTransmitter().getColor() != null)
{
@ -381,9 +394,15 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
}
@Override
public EnumColor getRenderColor()
public EnumColor getRenderColor(boolean post)
{
return getTransmitter().getColor();
return post ? null : getTransmitter().getColor();
}
@Override
public boolean transparencyRender()
{
return true;
}
@Override

View file

@ -6,9 +6,9 @@ import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.FluidNetwork;
import mekanism.common.Tier;
import mekanism.common.Tier.PipeTier;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -156,27 +156,27 @@ public class PartMechanicalPipe extends PartTransmitter<IFluidHandler, FluidNetw
public static void registerIcons(IIconRegister register)
{
pipeIcons.registerCenterIcons(register, new String[]{"MechanicalPipeBasic", "MechanicalPipeAdvanced",
"MechanicalPipeElite", "MechanicalPipeUltimate"});
pipeIcons.registerSideIcons(register, new String[]{"MechanicalPipeVertical", "MechanicalPipeHorizontal"});
pipeIcons.registerCenterIcons(register, new String[] {"MechanicalPipeBasic", "MechanicalPipeAdvanced", "MechanicalPipeElite", "MechanicalPipeUltimate"});
pipeIcons.registerSideIcons(register, new String[] {"MechanicalPipeVerticalBasic", "MechanicalPipeVerticalAdvanced", "MechanicalPipeVerticalElite", "MechanicalPipeVerticalUltimate",
"MechanicalPipeHorizontalBasic", "MechanicalPipeHorizontalAdvanced", "MechanicalPipeHorizontalElite", "MechanicalPipeHorizontalUltimate"});
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return pipeIcons.getCenterIcon(tier.ordinal());
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return pipeIcons.getSideIcon(0);
return pipeIcons.getSideIcon(tier.ordinal());
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return pipeIcons.getSideIcon(1);
return pipeIcons.getSideIcon(4+tier.ordinal());
}
@Override

View file

@ -12,8 +12,9 @@ import mekanism.api.gas.IGasHandler;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.Tier;
import mekanism.common.Tier.TubeTier;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -27,13 +28,20 @@ import codechicken.lib.vec.Vector3;
public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork> implements IGasHandler
{
public static TransmitterIcons tubeIcons = new TransmitterIcons(1, 2);
public Tier.TubeTier tier = Tier.TubeTier.BASIC;
public static TransmitterIcons tubeIcons = new TransmitterIcons(4, 8);
public float currentScale;
public GasTank buffer = new GasTank(getCapacity());
public GasStack lastWrite;
public PartPressurizedTube(Tier.TubeTier tubeTier)
{
tier = tubeTier;
}
@Override
public void update()
@ -60,7 +68,7 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
if(container != null)
{
GasStack received = container.drawGas(side.getOpposite(), 100, false);
GasStack received = container.drawGas(side.getOpposite(), tier.tubePullAmount, false);
if(received != null && received.amount != 0)
{
@ -124,6 +132,8 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
public void load(NBTTagCompound nbtTags)
{
super.load(nbtTags);
tier = TubeTier.values()[nbtTags.getInteger("tier")];
if(nbtTags.hasKey("cacheGas"))
{
@ -135,6 +145,8 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
public void save(NBTTagCompound nbtTags)
{
super.save(nbtTags);
nbtTags.setInteger("tier", tier.ordinal());
int toSave = getSaveShare();
@ -149,31 +161,32 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
@Override
public String getType()
{
return "mekanism:pressurized_tube";
return "mekanism:pressurized_tube_" + tier.name().toLowerCase();
}
public static void registerIcons(IIconRegister register)
{
tubeIcons.registerCenterIcons(register, new String[] {"PressurizedTube"});
tubeIcons.registerSideIcons(register, new String[] {"SmallTransmitterVertical", "SmallTransmitterHorizontal"});
tubeIcons.registerCenterIcons(register, new String[] {"PressurizedTubeBasic", "PressurizedTubeAdvanced", "PressurizedTubeElite", "PressurizedTubeUltimate"});
tubeIcons.registerSideIcons(register, new String[] {"SmallTransmitterVerticalBasic", "SmallTransmitterVerticalAdvanced", "SmallTransmitterVerticalElite", "SmallTransmitterVerticalUltimate",
"SmallTransmitterHorizontalBasic", "SmallTransmitterHorizontalAdvanced", "SmallTransmitterHorizontalElite", "SmallTransmitterHorizontalUltimate"});
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return tubeIcons.getCenterIcon(0);
return tubeIcons.getCenterIcon(tier.ordinal());
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return tubeIcons.getSideIcon(0);
return tubeIcons.getSideIcon(tier.ordinal());
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return tubeIcons.getSideIcon(1);
return tubeIcons.getSideIcon(4+tier.ordinal());
}
@Override
@ -219,7 +232,7 @@ public class PartPressurizedTube extends PartTransmitter<IGasHandler, GasNetwork
@Override
public int getCapacity()
{
return 256;
return tier.tubeCapacity;
}
@Override

View file

@ -1,5 +1,6 @@
package mekanism.common.multipart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
public class PartRestrictiveTransporter extends PartLogisticalTransporter
@ -17,21 +18,21 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(1);
return transporterIcons.getCenterIcon(4);
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(2);
return transporterIcons.getSideIcon(8);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(3);
return transporterIcons.getSideIcon(9);
}
@Override
@ -39,4 +40,16 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
{
return 1000;
}
@Override
public boolean transparencyRender()
{
return false;
}
@Override
protected boolean onConfigure(EntityPlayer player, int part, int side)
{
return false;
}
}

View file

@ -111,10 +111,22 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return new PartMechanicalPipe(Tier.PipeTier.ELITE);
case MECHANICAL_PIPE_ULTIMATE:
return new PartMechanicalPipe(Tier.PipeTier.ULTIMATE);
case PRESSURIZED_TUBE:
return new PartPressurizedTube();
case LOGISTICAL_TRANSPORTER:
return new PartLogisticalTransporter();
case PRESSURIZED_TUBE_BASIC:
return new PartPressurizedTube(Tier.TubeTier.BASIC);
case PRESSURIZED_TUBE_ADVANCED:
return new PartPressurizedTube(Tier.TubeTier.ADVANCED);
case PRESSURIZED_TUBE_ELITE:
return new PartPressurizedTube(Tier.TubeTier.ELITE);
case PRESSURIZED_TUBE_ULTIMATE:
return new PartPressurizedTube(Tier.TubeTier.ULTIMATE);
case LOGISTICAL_TRANSPORTER_BASIC:
return new PartLogisticalTransporter(Tier.TransporterTier.BASIC);
case LOGISTICAL_TRANSPORTER_ADVANCED:
return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED);
case LOGISTICAL_TRANSPORTER_ELITE:
return new PartLogisticalTransporter(Tier.TransporterTier.ELITE);
case LOGISTICAL_TRANSPORTER_ULTIMATE:
return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE);
case RESTRICTIVE_TRANSPORTER:
return new PartRestrictiveTransporter();
case DIVERSION_TRANSPORTER:
@ -137,11 +149,11 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return (byte)((connections & ~(byte)(1 << side.ordinal())) | (byte)((toSet?1:0) << side.ordinal()));
}
public abstract IIcon getCenterIcon();
public abstract IIcon getCenterIcon(boolean opaque);
public abstract IIcon getSideIcon();
public abstract IIcon getSideIcon(boolean opaque);
public abstract IIcon getSideIconRotated();
public abstract IIcon getSideIconRotated(boolean opaque);
@Override
public void update()
@ -175,8 +187,13 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
return false;
}
public boolean transparencyRender()
{
return false;
}
public IIcon getIconForSide(ForgeDirection side)
public IIcon getIconForSide(ForgeDirection side, boolean opaque)
{
ConnectionType type = getConnectionType(side);
@ -184,29 +201,29 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
if(client.oldTransmitterRender || renderCenter())
{
return getCenterIcon();
return getCenterIcon(opaque);
}
else if(getAllCurrentConnections() == 3 && side != ForgeDirection.DOWN && side != ForgeDirection.UP)
{
return getSideIcon();
return getSideIcon(opaque);
}
else if(getAllCurrentConnections() == 12 && (side == ForgeDirection.DOWN || side == ForgeDirection.UP))
{
return getSideIcon();
return getSideIcon(opaque);
}
else if(getAllCurrentConnections() == 12 && (side == ForgeDirection.EAST || side == ForgeDirection.WEST))
{
return getSideIconRotated();
return getSideIconRotated(opaque);
}
else if(getAllCurrentConnections() == 48 && side != ForgeDirection.EAST && side != ForgeDirection.WEST)
{
return getSideIconRotated();
return getSideIconRotated(opaque);
}
return getCenterIcon();
return getCenterIcon(opaque);
}
else {
return getSideIcon();
return getSideIcon(opaque);
}
}
@ -214,7 +231,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
byte connections = 0x00;
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile())))
if(handlesRedstone() && redstoneReactive && redstonePowered)
{
return connections;
}
@ -289,7 +306,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
byte connections = 0x00;
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile())))
if(handlesRedstone() && redstoneReactive && redstonePowered)
{
return connections;
}
@ -387,13 +404,13 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
@Override
public IIcon getBreakingIcon(Object subPart, int side)
{
return getCenterIcon();
return getCenterIcon(true);
}
@Override
public IIcon getBrokenIcon(int side)
{
return getCenterIcon();
return getCenterIcon(true);
}
@Override
@ -421,7 +438,12 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
if(pass == 0)
{
RenderPartTransmitter.getInstance().renderStatic(this);
RenderPartTransmitter.getInstance().renderStatic(this, pass);
return true;
}
else if(pass == 1 && transparencyRender())
{
RenderPartTransmitter.getInstance().renderStatic(this, pass);
return true;
}
@ -454,9 +476,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
@Override
public boolean canConnect(ForgeDirection side)
{
boolean powered = MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
if(handlesRedstone() && redstoneReactive && powered)
if(handlesRedstone() && redstoneReactive && redstonePowered)
{
return false;
}
@ -564,20 +584,18 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return true;
}
public void redstoneRefresh()
{
boolean nowPowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
if(nowPowered != redstonePowered)
{
refreshConnections();
redstonePowered = nowPowered;
markDirtyTransmitters();
}
}
protected void onRefresh() {}
public void refreshConnections()
{
if(redstoneReactive)
{
redstonePowered = MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
}
else {
redstonePowered = false;
}
byte possibleTransmitters = getPossibleTransmitterConnections();
byte possibleAcceptors = getPossibleAcceptorConnections();
@ -595,6 +613,14 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
public void refreshConnections(ForgeDirection side)
{
if(redstoneReactive)
{
redstonePowered = MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
}
else {
redstonePowered = false;
}
boolean possibleTransmitter = getPossibleTransmitterConnection(side);
boolean possibleAcceptor = getPossibleAcceptorConnection(side);
@ -628,7 +654,6 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
super.onAdded();
redstonePowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
refreshConnections();
}
@ -637,7 +662,6 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
super.onChunkLoad();
redstonePowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
refreshConnections();
notifyTileChange();
}
@ -653,7 +677,12 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
if(handlesRedstone())
{
redstoneRefresh();
boolean prevPowered = redstonePowered;
refreshConnections();
if(prevPowered != redstonePowered)
{
markDirtyTransmitters();
}
}
}
@ -762,7 +791,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return false;
}
public EnumColor getRenderColor()
public EnumColor getRenderColor(boolean opaque)
{
return null;
}

View file

@ -16,7 +16,6 @@ import mekanism.common.EnergyNetwork;
import mekanism.common.Tier;
import mekanism.common.util.CableUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -27,7 +26,6 @@ import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import codechicken.lib.vec.Vector3;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
@ -40,13 +38,11 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
{
public Tier.CableTier tier;
public static TransmitterIcons cableIcons = new TransmitterIcons(4, 2);
public static TransmitterIcons cableIcons = new TransmitterIcons(4, 8);
public double currentPower = 0;
public double lastWrite = 0;
public double drawAmount = 100;
public EnergyStack buffer = new EnergyStack(0);
public PartUniversalCable(Tier.CableTier cableTier)
@ -84,6 +80,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
if(!sides.isEmpty())
{
TileEntity[] connectedOutputters = CableUtils.getConnectedOutputters(tile());
double canDraw = tier.cableCapacity/10F;
for(ForgeDirection side : sides)
{
@ -95,18 +92,19 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
{
if(((ICableOutputter)outputter).canOutputTo(side.getOpposite()))
{
double received = Math.min(((IStrictEnergyStorage)outputter).getEnergy(), drawAmount);
double received = Math.min(((IStrictEnergyStorage)outputter).getEnergy(), canDraw);
double toDraw = received;
if(received > 0)
{
toDraw -= takeEnergy(received, true);
}
((IStrictEnergyStorage)outputter).setEnergy(((IStrictEnergyStorage)outputter).getEnergy() - toDraw);
}
} else if(MekanismUtils.useRF() && outputter instanceof IEnergyProvider)
{
double received = ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)(drawAmount*general.TO_TE), true) * general.FROM_TE;
double received = ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)(canDraw*general.TO_TE), true) * general.FROM_TE;
double toDraw = received;
if(received > 0)
@ -115,9 +113,10 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
}
((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)(toDraw*general.TO_TE), false);
} else if(MekanismUtils.useIC2() && outputter instanceof IEnergySource)
}
else if(MekanismUtils.useIC2() && outputter instanceof IEnergySource)
{
double received = Math.min(((IEnergySource)outputter).getOfferedEnergy() * general.FROM_IC2, drawAmount);
double received = Math.min(((IEnergySource)outputter).getOfferedEnergy() * general.FROM_IC2, canDraw);
double toDraw = received;
if(received > 0)
@ -179,25 +178,26 @@ public class PartUniversalCable extends PartTransmitter<EnergyAcceptorWrapper, E
{
cableIcons.registerCenterIcons(register, new String[]{"UniversalCableBasic", "UniversalCableAdvanced",
"UniversalCableElite", "UniversalCableUltimate"});
cableIcons.registerSideIcons(register, new String[]{"SmallTransmitterVertical", "SmallTransmitterHorizontal"});
cableIcons.registerSideIcons(register, new String[] {"SmallTransmitterVerticalBasic", "SmallTransmitterVerticalAdvanced", "SmallTransmitterVerticalElite", "SmallTransmitterVerticalUltimate",
"SmallTransmitterHorizontalBasic", "SmallTransmitterHorizontalAdvanced", "SmallTransmitterHorizontalElite", "SmallTransmitterHorizontalUltimate"});
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return cableIcons.getCenterIcon(tier.ordinal());
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return cableIcons.getSideIcon(0);
return cableIcons.getSideIcon(tier.ordinal());
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return cableIcons.getSideIcon(1);
return cableIcons.getSideIcon(4+tier.ordinal());
}
@Override

View file

@ -1,40 +1,53 @@
package mekanism.common.multipart;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.Tier.BaseTier;
import net.minecraft.util.IIcon;
public enum TransmitterType
{
UNIVERSAL_CABLE_BASIC("BasicUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 0, 0),
UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 1, 0),
UNIVERSAL_CABLE_ELITE("EliteUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 2, 0),
UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 3, 0),
MECHANICAL_PIPE_BASIC("BasicMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ADVANCED("AdvancedMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, 0, 0),
LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 0, 0),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 1, 1),
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 2, 0),
HEAT_TRANSMITTER("HeatTransmitter", Size.SMALL, TransmissionType.HEAT, PartHeatTransmitter.heatIcons, 0, 0);
UNIVERSAL_CABLE_BASIC("BasicUniversalCable", BaseTier.BASIC, Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 0, 0),
UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", BaseTier.ADVANCED, Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 1, 1),
UNIVERSAL_CABLE_ELITE("EliteUniversalCable", BaseTier.ELITE, Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 2, 2),
UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", BaseTier.ULTIMATE, Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 3, 3),
MECHANICAL_PIPE_BASIC("BasicMechanicalPipe", BaseTier.BASIC, Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
MECHANICAL_PIPE_ADVANCED("AdvancedMechanicalPipe", BaseTier.ADVANCED, Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 1, 1),
MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", BaseTier.ELITE, Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 2, 2),
MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", BaseTier.ULTIMATE, Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 3, 3),
PRESSURIZED_TUBE_BASIC("BasicPressurizedTube", BaseTier.BASIC, Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 0, 0),
PRESSURIZED_TUBE_ADVANCED("AdvancedPressurizedTube", BaseTier.ADVANCED, Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 1, 1),
PRESSURIZED_TUBE_ELITE("ElitePressurizedTube", BaseTier.ELITE, Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 2, 2),
PRESSURIZED_TUBE_ULTIMATE("UltimatePressurizedTube", BaseTier.ULTIMATE, Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 3, 3),
LOGISTICAL_TRANSPORTER_BASIC("BasicLogisticalTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 0, 0, 6, 10),
LOGISTICAL_TRANSPORTER_ADVANCED("AdvancedLogisticalTransporter", BaseTier.ADVANCED, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 1, 1, 6, 10),
LOGISTICAL_TRANSPORTER_ELITE("EliteLogisticalTransporter", BaseTier.ELITE, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 2, 2, 6, 10),
LOGISTICAL_TRANSPORTER_ULTIMATE("UltimateLogisticalTransporter", BaseTier.ULTIMATE, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 3, 3, 6, 10),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, false, 4, 8),
DIVERSION_TRANSPORTER("DiversionTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 5, 14, 6, 10),
HEAT_TRANSMITTER("HeatTransmitter", BaseTier.BASIC, Size.SMALL, TransmissionType.HEAT, PartHeatTransmitter.heatIcons, false, 0, 0);
private String unlocalizedName;
private Size size;
private TransmissionType transmissionType;
private TransmitterIcons transmitterIcons;
private int centerIndex;
private int sideIndex;
private boolean transparencyRender;
private int[] indexes;
private BaseTier tier;
private TransmitterType(String name, Size s, TransmissionType type, TransmitterIcons icons, int center, int side)
private TransmitterType(String name, BaseTier t, Size s, TransmissionType type, TransmitterIcons icons, boolean transparency, int... is)
{
unlocalizedName = name;
tier = t;
size = s;
transmissionType = type;
transmitterIcons = icons;
centerIndex = center;
sideIndex = side;
transparencyRender = transparency;
indexes = is;
}
public BaseTier getTier()
{
return tier;
}
public String getName()
@ -46,20 +59,37 @@ public enum TransmitterType
{
return size;
}
public boolean hasTransparency()
{
return transparencyRender;
}
public TransmissionType getTransmission()
{
return transmissionType;
}
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transmitterIcons.getCenterIcon(centerIndex);
if(!transparencyRender)
{
return transmitterIcons.getCenterIcon(indexes[0]);
}
else {
return transmitterIcons.getCenterIcon(opaque ? indexes[0] : indexes[2]);
}
}
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transmitterIcons.getSideIcon(sideIndex);
if(!transparencyRender)
{
return transmitterIcons.getSideIcon(indexes[1]);
}
else {
return transmitterIcons.getSideIcon(opaque ? indexes[1] : indexes[3]);
}
}
public static enum Size

View file

@ -6,6 +6,7 @@ import mekanism.api.MekanismConfig.machines;
import mekanism.api.MekanismConfig.usage;
import mekanism.api.util.UnitDisplayUtils.EnergyType;
import mekanism.common.Mekanism;
import mekanism.common.Tier;
import mekanism.common.base.IModule;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketConfigSync.ConfigSyncMessage;
@ -81,6 +82,8 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(usage.fluidicPlenisherUsage);
dataStream.writeDouble(usage.gasCentrifugeUsage);
dataStream.writeDouble(usage.heavyWaterElectrolysisUsage);
Tier.writeConfig(dataStream);
try {
for(IModule module : Mekanism.modulesLoaded)
@ -148,6 +151,8 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
usage.fluidicPlenisherUsage = dataStream.readDouble();
usage.gasCentrifugeUsage = dataStream.readDouble();
usage.heavyWaterElectrolysisUsage = dataStream.readDouble();
Tier.readConfig(dataStream);
try {
for(IModule module : Mekanism.modulesLoaded)

View file

@ -220,7 +220,9 @@ public class MekanismRecipe implements IRecipe
{
if(entry != null && entry.getKey() != null && entry.getValue() != null)
{
upgrades.put(entry.getKey(), Math.min(entry.getKey().getMax(), upgrades.get(entry.getKey()) + entry.getValue()));
Integer val = upgrades.get(entry.getKey());
upgrades.put(entry.getKey(), Math.min(entry.getKey().getMax(), (val != null ? val : 0) + entry.getValue()));
}
}
}

View file

@ -91,7 +91,8 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
secondaryEnergyPerTick = secondaryPerTick;
upgradeComponent = upgradeableSecondaryEfficiency() ? new TileComponentAdvancedUpgrade(this, 4) : new TileComponentUpgrade(this, 4);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(3));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3));
}
public void upgrade(RecipeType type)
@ -123,13 +124,10 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
factory.clientActive = clientActive;
factory.controlType = controlType;
factory.prevEnergy = prevEnergy;
factory.upgradeComponent = upgradeComponent;
factory.upgradeComponent.readFrom(upgradeComponent);
factory.upgradeComponent.setUpgradeSlot(0);
factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
factory.ejectorComponent.readFrom(ejectorComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4));
factory.recipeType = type;
factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades());
@ -142,7 +140,7 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
factory.inventory[1] = inventory[3];
factory.inventory[0] = inventory[4];
for(Upgrade upgrade : upgradeComponent.getSupportedTypes())
for(Upgrade upgrade : factory.upgradeComponent.getSupportedTypes())
{
factory.recalculateUpgradables(upgrade);
}
@ -296,7 +294,7 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
recipe.operate(inventory, 0, 2, gasTank, secondaryEnergyThisTick);
markDirty();
ejectorComponent.onOutput();
ejectorComponent.outputItems();
}
@Override

View file

@ -25,7 +25,6 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {10, 11, 12, 13, 14}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.addSupported(TransmissionType.GAS);
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
configComponent.fillConfig(TransmissionType.GAS, 1);
@ -34,6 +33,7 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4));
}
}

View file

@ -1,5 +1,7 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -9,6 +11,7 @@ import mekanism.api.IHeatTransfer;
import mekanism.api.Range4D;
import mekanism.common.Mekanism;
import mekanism.common.base.IFluidContainerManager;
import mekanism.common.content.boiler.BoilerCache;
import mekanism.common.content.boiler.BoilerUpdateProtocol;
import mekanism.common.content.boiler.SynchronizedBoilerData;
import mekanism.common.content.boiler.SynchronizedBoilerData.ValveData;
@ -17,7 +20,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.FluidContainerUtils;
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
import mekanism.common.util.HeatUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -25,8 +27,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import io.netty.buffer.ByteBuf;
public class TileEntityBoiler extends TileEntityMultiblock<SynchronizedBoilerData> implements IFluidContainerManager, IHeatTransfer
{
/** A client-sided and server-sided map of valves on this tank's structure, used on the client for rendering fluids. */
@ -278,6 +278,12 @@ public class TileEntityBoiler extends TileEntityMultiblock<SynchronizedBoilerDat
{
return new SynchronizedBoilerData();
}
@Override
public BoilerCache getNewCache()
{
return new BoilerCache();
}
@Override
protected BoilerUpdateProtocol getProtocol()

View file

@ -42,7 +42,8 @@ public abstract class TileEntityChanceMachine<RECIPE extends ChanceMachineRecipe
inventory = new ItemStack[5];
upgradeComponent = new TileComponentUpgrade(this, 3);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(3));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3));
}
@Override
@ -119,7 +120,7 @@ public abstract class TileEntityChanceMachine<RECIPE extends ChanceMachineRecipe
recipe.operate(inventory);
markDirty();
ejectorComponent.onOutput();
ejectorComponent.outputItems();
}
@Override
@ -147,10 +148,12 @@ public abstract class TileEntityChanceMachine<RECIPE extends ChanceMachineRecipe
public RECIPE getRecipe()
{
ItemStackInput input = getInput();
if(cachedRecipe == null || !input.testEquality(cachedRecipe.getInput()))
{
cachedRecipe = RecipeHandler.getChanceRecipe(input, getRecipes());
}
return cachedRecipe;
}

View file

@ -104,7 +104,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
inventory = new ItemStack[4];
upgradeComponent = new TileComponentUpgrade(this, 3);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(2));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
}
@Override
@ -202,7 +203,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
recipe.operate(inputTank, inventory);
markDirty();
ejectorComponent.onOutput();
ejectorComponent.outputItems();
}
@Override

View file

@ -49,7 +49,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
public int updateDelay;
public int gasOutput = 16;
public int gasOutput = 256;
public boolean isActive;
@ -63,6 +63,8 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
public ChemicalInfuserRecipe cachedRecipe;
public double clientEnergyUsed;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4);
/** This machine's current RedstoneControl type. */
@ -126,7 +128,10 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
setActive(true);
int operations = operate(recipe);
double prev = getEnergy();
setEnergy(getEnergy() - energyPerTick*operations);
clientEnergyUsed = prev-getEnergy();
}
else {
if(prevEnergy >= getEnergy())
@ -235,6 +240,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
isActive = dataStream.readBoolean();
controlType = RedstoneControl.values()[dataStream.readInt()];
clientEnergyUsed = dataStream.readDouble();
if(dataStream.readBoolean())
{
@ -271,6 +277,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
data.add(isActive);
data.add(controlType.ordinal());
data.add(clientEnergyUsed);
if(leftTank.getGas() != null)
{

View file

@ -19,9 +19,9 @@ import mekanism.api.gas.ITubeConnection;
import mekanism.common.Mekanism;
import mekanism.common.Upgrade;
import mekanism.common.Upgrade.IUpgradeInfoHandler;
import mekanism.common.base.ITankManager;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISustainedData;
import mekanism.common.base.ITankManager;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -76,6 +76,8 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public WasherRecipe cachedRecipe;
public double clientEnergyUsed;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4);
/** This machine's current RedstoneControl type. */
@ -130,8 +132,10 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
setActive(true);
int operations = operate(recipe);
double prev = getEnergy();
setEnergy(getEnergy() - energyPerTick*operations);
clientEnergyUsed = prev-getEnergy();
}
else {
if(prevEnergy >= getEnergy())
@ -295,6 +299,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
isActive = dataStream.readBoolean();
controlType = RedstoneControl.values()[dataStream.readInt()];
clientEnergyUsed = dataStream.readDouble();
if(dataStream.readBoolean())
{
@ -330,6 +335,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
data.add(isActive);
data.add(controlType.ordinal());
data.add(clientEnergyUsed);
if(fluidTank.getFluid() != null)
{

View file

@ -79,13 +79,13 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl
@Override
public int getSizeInventory()
{
return inventory.length;
return inventory != null ? inventory.length : 0;
}
@Override
public ItemStack getStackInSlot(int slotID)
{
return inventory[slotID];
return inventory != null ? inventory[slotID] : null;
}
@Override

View file

@ -370,7 +370,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
else {
MinerFilter filter = replaceMap.get(index);
if(filter.replaceStack == null || !filter.requireStack)
if(filter == null || (filter.replaceStack == null || !filter.requireStack))
{
worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord);

View file

@ -12,6 +12,7 @@ import mekanism.common.Mekanism;
import mekanism.common.base.IFluidContainerManager;
import mekanism.common.content.tank.SynchronizedTankData;
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
import mekanism.common.content.tank.TankCache;
import mekanism.common.content.tank.TankUpdateProtocol;
import mekanism.common.multiblock.MultiblockManager;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
@ -92,6 +93,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
if(structure.fluidStored != null && structure.fluidStored.amount <= 0)
{
structure.fluidStored = null;
markDirty();
}
manageInventory();
@ -265,6 +267,12 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
return new SynchronizedTankData();
}
@Override
public TankCache getNewCache()
{
return new TankCache();
}
@Override
protected TankUpdateProtocol getProtocol()
{

View file

@ -137,6 +137,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
public void handlePacketData(ByteBuf dataStream)
{
super.handlePacketData(dataStream);
setEnergy(dataStream.readDouble());
}
@ -144,7 +145,9 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
public ArrayList getNetworkedData(ArrayList data)
{
super.getNetworkedData(data);
data.add(getEnergy());
return data;
}

View file

@ -59,7 +59,8 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
inventory = new ItemStack[4];
upgradeComponent = new TileComponentUpgrade(this, 3);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(3));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3));
}
public void upgrade(RecipeType type)
@ -83,22 +84,18 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
//Noisy
factory.soundURL = soundURL;
//Machine
factory.progress[0] = operatingTicks;
factory.updateDelay = updateDelay;
factory.isActive = isActive;
factory.clientActive = clientActive;
factory.isActive = isActive;
factory.updateDelay = updateDelay;
factory.controlType = controlType;
factory.prevEnergy = prevEnergy;
factory.upgradeComponent = upgradeComponent;
factory.upgradeComponent.readFrom(upgradeComponent);
factory.upgradeComponent.setUpgradeSlot(0);
factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
factory.ejectorComponent.readFrom(ejectorComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4));
factory.recipeType = type;
factory.upgradeComponent.setSupported(Upgrade.GAS, type.fuelEnergyUpgrades());
@ -107,7 +104,7 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
factory.inventory[5+3] = inventory[2];
factory.inventory[0] = inventory[3];
for(Upgrade upgrade : upgradeComponent.getSupportedTypes())
for(Upgrade upgrade : factory.upgradeComponent.getSupportedTypes())
{
factory.recalculateUpgradables(upgrade);
}
@ -209,7 +206,7 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
recipe.operate(inventory, 0, 2);
markDirty();
ejectorComponent.onOutput();
ejectorComponent.outputItems();
}
@Override

View file

@ -15,9 +15,9 @@ import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.MekanismConfig.usage;
import mekanism.common.Upgrade;
import mekanism.common.base.ITankManager;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISustainedTank;
import mekanism.common.base.ITankManager;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
@ -39,8 +39,15 @@ import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, ITankManager
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, ITankManager, IPeripheral
{
/** This pump's tank */
public FluidTank fluidTank = new FluidTank(10000);
@ -260,6 +267,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
else {
fluidTank.setFluid(null);
}
controlType = RedstoneControl.values()[dataStream.readInt()];
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
@ -279,6 +287,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
else {
data.add(0);
}
data.add(controlType.ordinal());
return data;
@ -519,4 +528,47 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
return new Object[] {fluidTank};
}
@Override
@Method(modid = "ComputerCraft")
public String getType()
{
return getInventoryName();
}
@Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames()
{
return new String[] {"reset"};
}
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
switch(method)
{
case 0:
recurringNodes.clear();
return new Object[] {"Pump calculation reset."};
default:
return new Object[] {"Unknown command."};
}
}
@Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {}
@Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {}
@Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other)
{
return this == other;
}
}

View file

@ -85,6 +85,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
public SeparatorRecipe cachedRecipe;
public double clientEnergyUsed;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4);
public TileEntityElectrolyticSeparator()
@ -162,8 +164,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
setActive(true);
int operations = operate(recipe);
double prev = getEnergy();
setEnergy(getEnergy() - energyPerTick*operations);
clientEnergyUsed = prev-getEnergy();
}
else {
setActive(false);
@ -197,9 +201,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
}
}
if(dumpRight == GasMode.DUMPING_EXCESS && leftTank.getNeeded() < output)
if(dumpLeft == GasMode.DUMPING_EXCESS && leftTank.getNeeded() < output)
{
leftTank.draw(output, true);
leftTank.draw(output-leftTank.getNeeded(), true);
if(worldObj.rand.nextInt(3) == 2)
{
@ -236,15 +240,14 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
if(dumpRight == GasMode.DUMPING_EXCESS && rightTank.getNeeded() < output)
{
rightTank.draw(output, true);
rightTank.draw(output-rightTank.getNeeded(), true);
if(worldObj.rand.nextInt(3) == 2)
{
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getParticlePacket(0, new ArrayList())), new Range4D(Coord4D.get(this)));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getParticlePacket(1, new ArrayList())), new Range4D(Coord4D.get(this)));
}
}
}
}
}
@ -315,7 +318,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
double z = zCoord + (side.offsetZ == 0 ? 0.5 : Math.max(side.offsetZ, 0));
worldObj.spawnParticle("smoke", x, yCoord + 0.5, z, 0.0D, 0.0D, 0.0D);
}
else if(type == 1)
{
@ -395,16 +397,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return InventoryUtils.EMPTY;
}
/**
* Gets the scaled energy level for the GUI.
* @param i - multiplier
* @return
*/
public int getScaledEnergyLevel(int i)
{
return (int)(electricityStored*i / BASE_MAX_ENERGY);
}
@Override
public void handlePacketData(ByteBuf dataStream)
{
@ -457,6 +449,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
dumpLeft = GasMode.values()[dataStream.readInt()];
dumpRight = GasMode.values()[dataStream.readInt()];
isActive = dataStream.readBoolean();
clientEnergyUsed = dataStream.readDouble();
}
else if(type == 1)
{
@ -504,6 +497,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
data.add(dumpLeft.ordinal());
data.add(dumpRight.ordinal());
data.add(isActive);
data.add(clientEnergyUsed);
return data;
}
@ -511,10 +505,18 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
public ArrayList getParticlePacket(int type, ArrayList data)
{
super.getNetworkedData(data);
data.add(1);
data.add(type);
return data;
}
@Override
public boolean canSetFacing(int side)
{
return side != 0 && side != 1;
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)

View file

@ -25,7 +25,6 @@ public class TileEntityEliteFactory extends TileEntityFactory
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {12, 13, 14, 15, 16, 17, 18}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.addSupported(TransmissionType.GAS);
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
configComponent.fillConfig(TransmissionType.GAS, 1);
@ -34,6 +33,7 @@ public class TileEntityEliteFactory extends TileEntityFactory
configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4));
}
}

View file

@ -82,13 +82,13 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
@Override
public String getInventoryName()
{
return MekanismUtils.localize(getBlockType().getUnlocalizedName() + "." + tier.getBaseTier().getName() + ".name");
return MekanismUtils.localize("tile.EnergyCube" + tier.getBaseTier().getName() + ".name");
}
@Override
public double getMaxOutput()
{
return tier.OUTPUT;
return tier.output;
}
@Override
@ -131,7 +131,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
@Override
public double getMaxEnergy()
{
return tier.MAX_ELECTRICITY;
return tier.maxEnergy;
}
@Override
@ -178,7 +178,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IPe
case 0:
return new Object[] {getEnergy()};
case 1:
return new Object[] {tier.OUTPUT};
return new Object[] {tier.output};
case 2:
return new Object[] {getMaxEnergy()};
case 3:

View file

@ -132,7 +132,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {8, 9, 10}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 3, 0, 2, 1, 0});
configComponent.addSupported(TransmissionType.GAS);
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
configComponent.fillConfig(TransmissionType.GAS, 1);
@ -141,12 +140,13 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
configComponent.setInputEnergyConfig();
upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this, configComponent.getOutputs(TransmissionType.ITEM).get(4));
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4));
}
public TileEntityFactory(FactoryTier type, MachineType machine)
{
super("null", type.getBaseTier().getName() + "Factory", machine.baseEnergy);
super("null", machine.name, machine.baseEnergy);
tier = type;
inventory = new ItemStack[5+type.processes*2];
@ -189,17 +189,16 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
factory.clientActive = clientActive;
factory.isActive = isActive;
factory.updateDelay = updateDelay;
factory.recipeType = recipeType;
factory.prevEnergy = prevEnergy;
factory.gasTank.setGas(gasTank.getGas());
factory.sorting = sorting;
factory.controlType = controlType;
factory.upgradeComponent = upgradeComponent;
factory.upgradeComponent.tileEntity = factory;
factory.ejectorComponent = ejectorComponent;
factory.ejectorComponent.tileEntity = factory;
factory.ejectorComponent.sideData = factory.configComponent.getOutputs(TransmissionType.ITEM).get(4);
factory.ejectorComponent.trackers = new int[factory.ejectorComponent.sideData.availableSlots.length];
factory.upgradeComponent.readFrom(upgradeComponent);
factory.ejectorComponent.readFrom(ejectorComponent);
factory.configComponent.readFrom(configComponent);
factory.ejectorComponent.setOutputData(TransmissionType.ITEM, factory.configComponent.getOutputs(TransmissionType.ITEM).get(4));
factory.recipeType = recipeType;
factory.upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
for(int i = 0; i < tier.processes+5; i++)
{
@ -218,7 +217,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
}
}
for(Upgrade upgrade : upgradeComponent.getSupportedTypes())
for(Upgrade upgrade : factory.upgradeComponent.getSupportedTypes())
{
factory.recalculateUpgradables(upgrade);
}
@ -646,7 +645,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
}
markDirty();
ejectorComponent.onOutput();
ejectorComponent.outputItems();
}
@Override
@ -792,6 +791,12 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
{
return 5+tier.processes+operation;
}
@Override
public String getInventoryName()
{
return tier.getBaseTier().getLocalizedName() + " " + recipeType.getLocalizedName() + " " + super.getInventoryName();
}
@Override
@Method(modid = "ComputerCraft")

View file

@ -1,5 +1,7 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet;
@ -15,7 +17,6 @@ import mekanism.common.util.ChargeUtils;
import mekanism.common.util.FluidContainerUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -30,10 +31,15 @@ import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import io.netty.buffer.ByteBuf;
public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implements IConfigurable, IFluidHandler, ISustainedTank
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implements IPeripheral, IConfigurable, IFluidHandler, ISustainedTank
{
public Set<Coord4D> activeNodes = new HashSet<Coord4D>();
public Set<Coord4D> usedNodes = new HashSet<Coord4D>();
@ -508,4 +514,50 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
{
return false;
}
@Override
@Method(modid = "ComputerCraft")
public String getType()
{
return getInventoryName();
}
@Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames()
{
return new String[] {"reset"};
}
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
switch(method)
{
case 0:
activeNodes.clear();
usedNodes.clear();
finishedCalc = false;
return new Object[] {"Plenisher calculation reset."};
default:
return new Object[] {"Unknown command."};
}
}
@Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {}
@Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {}
@Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other)
{
return this == other;
}
}

View file

@ -93,7 +93,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
if(!worldObj.isRemote && dumping == GasMode.DUMPING_EXCESS && gasTank.getNeeded() < output)
{
gasTank.draw(output, true);
gasTank.draw(output-gasTank.getNeeded(), true);
}
if(!worldObj.isRemote)

View file

@ -6,6 +6,7 @@ import java.util.ArrayList;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.common.Mekanism;
import mekanism.common.content.matrix.MatrixCache;
import mekanism.common.content.matrix.MatrixUpdateProtocol;
import mekanism.common.content.matrix.SynchronizedMatrixData;
import mekanism.common.multiblock.MultiblockManager;
@ -96,6 +97,12 @@ public class TileEntityInductionCasing extends TileEntityMultiblock<Synchronized
{
return new SynchronizedMatrixData();
}
@Override
public MatrixCache getNewCache()
{
return new MatrixCache();
}
@Override
protected MatrixUpdateProtocol getProtocol()

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