Merge, hopefully without screwing too much up.

This commit is contained in:
Ben Spiers 2013-12-12 01:56:05 +00:00
parent f982eb851c
commit c1318d998b
11 changed files with 204 additions and 30 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.mtl
*.blend1
*.blend2

View file

@ -9,6 +9,8 @@ public enum TransmissionType
FLUID,
GAS;
public static TransmissionType[] metaArray = {GAS, ENERGY, FLUID};
public static boolean checkTransmissionType(TileEntity sideTile, TransmissionType type)
{
return checkTransmissionType(sideTile, type, null);
@ -39,4 +41,11 @@ public enum TransmissionType
return false;
}
public static TransmissionType fromOldMeta(int meta)
{
if(meta <= metaArray.length)
return metaArray[meta];
return null;
}
}

View file

@ -10,6 +10,7 @@ import mekanism.client.model.ModelGasTank;
import mekanism.client.model.ModelJetpack;
import mekanism.client.model.ModelObsidianTNT;
import mekanism.client.model.ModelRobit;
import mekanism.client.model.ModelTransmitter;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.tileentity.RenderBin;
import mekanism.common.IElectricChest;
@ -24,6 +25,7 @@ import mekanism.common.item.ItemJetpack;
import mekanism.common.item.ItemRobit;
import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.tileentity.TileEntityBin;
import mekanism.common.multipart.ItemPartTransmitter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block;
@ -53,6 +55,8 @@ public class ItemRenderingHandler implements IItemRenderer
{
public ModelRobit robit = new ModelRobit();
public ModelChest electricChest = new ModelChest();
public ModelTransmitter transmitterSmall = new ModelTransmitter(ModelTransmitter.Size.SMALL);
public ModelTransmitter transmitterLarge = new ModelTransmitter(ModelTransmitter.Size.LARGE);
public ModelEnergyCube energyCube = new ModelEnergyCube();
public ModelEnergyCore energyCore = new ModelEnergyCore();
public ModelGasTank gasTank = new ModelGasTank();
@ -313,6 +317,36 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glTranslatef(0.2F, -0.35F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Jetpack.png"));
jetpack.render(0.0625F);
}
else if(item.getItem() instanceof ItemPartTransmitter)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F);
GL11.glTranslated(0.0F, -1.0F, 0.0F);
GL11.glDisable(GL11.GL_CULL_FACE);
switch(item.getItem().getDamage(item))
{
case 0:
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "UniversalCable.png"));
break;
case 1:
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "MechanicalPipe.png"));
break;
case 2:
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedTube.png"));
break;
case 3:
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalTransporter.png"));
break;
}
transmitterSmall.renderSide(ForgeDirection.UP, true);
transmitterSmall.renderSide(ForgeDirection.DOWN, true);
transmitterSmall.renderCenter(new boolean[]{true, true, false, false, false, false});
GL11.glEnable(GL11.GL_CULL_FACE);
}
else {
if(item.getItem() instanceof ItemBlockMachine)

View file

@ -166,6 +166,7 @@ public class CommonProxy
Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(true);
Mekanism.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(true);
Mekanism.allowBackCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Allow crafting multiparts back to block transmitters", false).getBoolean(false);
Mekanism.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean(true);
Mekanism.forceBuildcraft = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ForceBuildcraftPower", false).getBoolean(false);
Mekanism.overrideUERatios = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OverrideUERatios", true).getBoolean(true);

View file

@ -244,6 +244,7 @@ public class Mekanism
public static boolean controlCircuitOreDict = true;
public static boolean logPackets = false;
public static boolean dynamicTankEasterEgg = false;
public static boolean allowBackCrafting = false;
public static boolean voiceServerEnabled = true;
public static boolean forceBuildcraft = false;
public static boolean overrideUERatios = true;
@ -486,6 +487,28 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new BinRecipe());
//Transmitters
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 0), new Object[] {
"SRS", Character.valueOf('S'), "ingotSteel", Character.valueOf('R'), Item.redstone
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 1), new Object[] {
"SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Item.bucketEmpty
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(PartTransmitter, 8, 2), new Object[] {
"SGS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), Block.glass
}));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(PartTransmitter, 1, 0), new ItemStack(Transmitter, 1, 1));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(PartTransmitter, 1, 1), new ItemStack(Transmitter, 1, 2));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(PartTransmitter, 1, 2), new ItemStack(Transmitter, 1, 0));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(PartTransmitter, 1, 3), new ItemStack(Transmitter, 1, 3));
if(allowBackCrafting)
{
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Transmitter, 1, 1), new ItemStack(PartTransmitter, 1, 0));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Transmitter, 1, 2), new ItemStack(PartTransmitter, 1, 1));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Transmitter, 1, 0), new ItemStack(PartTransmitter, 1, 2));
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Transmitter, 1, 3), new ItemStack(PartTransmitter, 1, 3));
}
//Furnace Recipes
FurnaceRecipes.smelting().addSmelting(oreBlockID, 0, new ItemStack(Ingot, 1, 1), 1.0F);
FurnaceRecipes.smelting().addSmelting(oreBlockID, 1, new ItemStack(Ingot, 1, 5), 1.0F);
@ -1133,6 +1156,8 @@ public class Mekanism
InfuseRegistry.registerInfuseType(new InfuseType("TIN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 4, 0));
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 8, 0));
InfuseRegistry.registerInfuseType(new InfuseType("REDSTONE", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 16, 0));
new MultipartMekanism().init();
}
@EventHandler

View file

@ -2,6 +2,9 @@ package mekanism.common.multipart;
import java.util.List;
import org.lwjgl.input.Keyboard;
import mekanism.api.EnumColor;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.Mekanism;
@ -40,6 +43,45 @@ public class ItemPartTransmitter extends JItemMultiPart
return damage;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
}
else {
switch(itemstack.getItemDamage())
{
case 0:
{
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "EU " + EnumColor.GREY + "(IndustrialCraft)");
list.add("- " + EnumColor.PURPLE + "MJ " + EnumColor.GREY + "(BuildCraft)");
list.add("- " + EnumColor.PURPLE + "Joules " + EnumColor.GREY + "(Mekanism)");
}
case 1:
{
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "mB " + EnumColor.GREY + "(FluidRegistry)");
}
case 2:
{
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "O " + EnumColor.GREY + "(Oxygen)");
list.add("- " + EnumColor.PURPLE + "H " + EnumColor.GREY + "(Hydrogen)");
}
case 3:
{
list.add(EnumColor.DARK_GREY + "Capable of transferring:");
list.add("- " + EnumColor.PURPLE + "Items (universal)");
list.add("- " + EnumColor.PURPLE + "Blocks (universal)");
}
}
}
}
@Override
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) {
for (TransmissionType type : TransmissionType.values()) {

View file

@ -1,17 +1,30 @@
package mekanism.common.multipart;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.Mekanism;
import net.minecraft.world.World;
import codechicken.lib.vec.BlockCoord;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.MultiPartRegistry.IPartConverter;
import codechicken.multipart.MultiPartRegistry.IPartFactory;
import codechicken.multipart.MultipartGenerator;
import codechicken.multipart.TMultiPart;
public class MultipartMekanism implements IPartFactory
public class MultipartMekanism implements IPartFactory, IPartConverter
{
public MultipartMekanism()
{
init();
}
public void init()
{
MultiPartRegistry.registerConverter(this);
MultiPartRegistry.registerParts(this, new String[]{"mekanism:universal_cable", "mekanism:mechanical_pipe", "mekanism:pressurized_tube", "mekanism:logistical_transporter"});
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter");
MultipartGenerator.registerPassThroughInterface("ic2.api.energy.tile.IEnergySink");
}
@Override
public TMultiPart createPart(String name, boolean client)
{
@ -21,17 +34,25 @@ public class MultipartMekanism implements IPartFactory
return new PartMechanicalPipe();
if(name == "mekanism:pressurized_tube")
return new PartPressurizedTube();
// if(name == "mekanism:logistical_transporter")
// return new PartLogisticalTransporter();
return null;
}
public void init()
@Override
public boolean canConvert(int blockID)
{
MultiPartRegistry.registerParts(this, new String[]{"mekanism:universal_cable", "mekanism:mechanical_pipe", "mekanism:pressurized_tube"});
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter");
MultipartGenerator.registerPassThroughInterface("mekanism.common.ITileNetwork");
MultipartGenerator.registerPassThroughInterface("cofh.api.energy.IEnergyHandler");
MultipartGenerator.registerPassThroughInterface("universalelectricity.core.block.IElectrical");
MultipartGenerator.registerPassThroughInterface("ic2.api.energy.tile.IEnergySink");
return blockID == Mekanism.transmitterID;
}
@Override
public TMultiPart convert(World world, BlockCoord pos)
{
if(world.getBlockId(pos.x, pos.y, pos.z) == Mekanism.transmitterID)
{
int meta = world.getBlockMetadata(pos.x, pos.y, pos.z);
return PartTransmitter.getPartType(TransmissionType.fromOldMeta(meta));
}
return null;
}
}

View file

@ -134,6 +134,7 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
}
}
}
super.update();
}
}

View file

@ -53,6 +53,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
public byte currentAcceptorConnections = 0x00;
public byte currentTransmitterConnections = 0x00;
public boolean isActive = false;
public boolean sendDesc;
static
{
@ -93,6 +94,29 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
super.bind(t);
}
}
@Override
public void update()
{
if(world().isRemote)
{
if(delayTicks == 3)
{
delayTicks++;
refreshTransmitterNetwork();
}
else if(delayTicks < 3)
{
delayTicks++;
}
}
if(sendDesc)
{
sendDescUpdate();
sendDesc = false;
}
}
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
{
@ -187,7 +211,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
currentTransmitterConnections = possibleTransmitters;
currentAcceptorConnections = possibleAcceptors;
sendDescUpdate();
sendDesc = true;;
}
}
@ -423,6 +447,8 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{
if(item == null)
return false;
if(item.getItem() instanceof ItemConfigurator && player.isSneaking())
{
isActive ^= true;
@ -446,7 +472,13 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
@Override
public Iterable<ItemStack> getDrops()
{
return Collections.singletonList(new ItemStack(Mekanism.PartTransmitter, 1, getTransmissionType().ordinal()));
return Collections.singletonList(pickItem(null));
}
@Override
public ItemStack pickItem(MovingObjectPosition hit)
{
return new ItemStack(Mekanism.PartTransmitter, 1, getTransmissionType().ordinal());
}
@Override
@ -465,23 +497,6 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
super.preRemove();
}
@Override
public void update()
{
if(world().isRemote)
{
if(delayTicks == 3)
{
delayTicks++;
refreshTransmitterNetwork();
}
else if(delayTicks < 3)
{
delayTicks++;
}
}
}
@Override
public boolean doesTick()
{
@ -497,7 +512,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
super.onAdded();
refreshTransmitterNetwork();
}
@Override
public void onChunkLoad()
{
@ -511,7 +526,7 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends TM
super.onNeighborChanged();
refreshTransmitterNetwork();
}
@Override
public void onPartChanged(TMultiPart part)
{

View file

@ -2,13 +2,34 @@ package mekanism.common.multipart;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.TileMultipart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.core.block.IConductor;
import universalelectricity.core.block.IElectrical;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.grid.IElectricityNetwork;
import buildcraft.api.power.IPowerEmitter;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import mekanism.api.Object3D;
import mekanism.api.energy.ICableOutputter;
import mekanism.api.energy.IStrictEnergyAcceptor;
import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.RenderPartTransmitter;

View file

@ -162,6 +162,8 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
Mekanism.ic2Registered.add(Object3D.get(this));
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
}
getTransmitterNetwork().refresh();
}
}