Merge branch '1.8.9' of github.com:aidancbrady/Mekanism into 1.8.9

This commit is contained in:
Ben Spiers committed 2016-05-04 12:46:06 +01:00
commit 995d85d26f
19 files changed
+117 -49

No files matched your search

@@ -113,6 +113,7 @@ import mekanism.common.entity.EntityRobit;
import mekanism.common.inventory.InventoryPersonalChest;
import mekanism.common.item.ItemPortableTeleporter;
import mekanism.common.item.ItemSeismicReader;
import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.multiblock.MultiblockManager;
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
@@ -450,6 +451,13 @@ public class ClientProxy extends CommonProxy
registerItemRender(MekanismItems.GaugeDropper);
registerItemRender(MekanismItems.FactoryInstaller);
registerItemRender(MekanismItems.OtherDust);
ModelBakery.registerItemVariants(MekanismItems.WalkieTalkie, ItemWalkieTalkie.OFF);
for(int i = 0; i <= 9; i++)
{
ModelBakery.registerItemVariants(MekanismItems.WalkieTalkie, ItemWalkieTalkie.getModel(i));
}
Mekanism.logger.info("Render registrations complete.");
}
@@ -471,8 +479,6 @@ public class ClientProxy extends CommonProxy
ModelBakery.addVariantName(item, "mekanism:" + metaItem.getTexture(i));
}
//ModelBakery.registerItemVariants(item, variants.toArray(new ModelResourceLocation[] {}));
return;
}
@@ -30,9 +30,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import org.lwjgl.input.Keyboard;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
@@ -41,6 +38,8 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
@SideOnly(Side.CLIENT)
public class MekanismKeyHandler extends MekKeyHandler
{
@@ -3,7 +3,6 @@ package mekanism.client.render.tileentity;
import java.util.HashMap;
import java.util.Map;
import mekanism.api.EnumColor;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.MekanismClient;
import mekanism.client.model.ModelEnergyCube;
@@ -26,6 +25,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderEnergyCube extends TileEntitySpecialRenderer<TileEntityEnergyCube>
{
public static int[][] COLORS = new int[][] {new int[] {100, 210, 125}, new int[] {215, 85, 70}, new int[] {80, 125, 230},
new int[] {154, 120, 200}, new int[] {0, 0, 0}};
private ModelEnergyCube model = new ModelEnergyCube();
private ModelEnergyCore core = new ModelEnergyCore();
@@ -95,11 +97,11 @@ public class RenderEnergyCube extends TileEntitySpecialRenderer<TileEntityEnergy
MekanismRenderer.blendOn();
MekanismRenderer.glowOn();
EnumColor c = tileEntity.tier.getBaseTier().getColor();
int[] c = COLORS[tileEntity.tier.getBaseTier().ordinal()];
GL11.glPushMatrix();
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glColor4f(c.getColor(0), c.getColor(1), c.getColor(2), (float)(tileEntity.getEnergy() / tileEntity.getMaxEnergy()));
GL11.glColor4f((float)c[0]/255F, (float)c[1]/255F, (float)c[2]/255F, (float)(tileEntity.getEnergy() / tileEntity.getMaxEnergy()));
GL11.glTranslatef(0, (float)Math.sin(Math.toRadians((MekanismClient.ticksPassed + partialTick) * 3)) / 7, 0);
GL11.glRotatef((MekanismClient.ticksPassed + partialTick) * 4, 0, 1, 0);
GL11.glRotatef(36F + (MekanismClient.ticksPassed + partialTick) * 4, 0, 1, 1);
@@ -10,12 +10,4 @@ public class ItemMekanism extends Item
super();
setCreativeTab(Mekanism.tabMekanism);
}
/*
@Override
public void registerIcons(IIconRegister register)
{
itemIcon = register.registerIcon("mekanism:" + getUnlocalizedName().replace("item.", ""));
}
*/
}
@@ -1,16 +1,25 @@
package mekanism.common.item;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mekanism.api.EnumColor;
import mekanism.common.util.LangUtils;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemWalkieTalkie extends ItemMekanism
{
public static ModelResourceLocation OFF = new ModelResourceLocation("mekanism:WalkieTalkie", "inventory");
public static Map<Integer, ModelResourceLocation> models = new HashMap<Integer, ModelResourceLocation>();
public ItemWalkieTalkie()
{
super();
@@ -25,30 +34,22 @@ public class ItemWalkieTalkie extends ItemMekanism
list.add((getOn(itemstack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.localize("gui." + (getOn(itemstack) ? "on" : "off")));
list.add(EnumColor.DARK_AQUA + LangUtils.localize("tooltip.channel") + ": " + EnumColor.GREY + getChannel(itemstack));
}
/*
@Override
public IIcon getIconIndex(ItemStack itemStack)
public static ModelResourceLocation getModel(int channel)
{
if(!getOn(itemStack))
if(models.get(channel) == null)
{
return icons[0];
models.put(channel, new ModelResourceLocation("mekanism:WalkieTalkie_ch" + channel, "inventory"));
}
return icons[getChannel(itemStack)];
return models.get(channel);
}
@Override
public void registerIcons(IIconRegister register)
{
icons[0] = register.registerIcon("mekanism:WalkieTalkieOff");
for(int i = 1; i <= 9; i++)
{
icons[i] = register.registerIcon("mekanism:WalkieTalkie_ch" + i);
}
}
*/
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
{
return getOn(stack) ? getModel(getChannel(stack)) : OFF;
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
@@ -60,6 +61,12 @@ public class ItemWalkieTalkie extends ItemMekanism
return itemStack;
}
@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
{
return !ItemStack.areItemsEqual(oldStack, newStack);
}
public void setOn(ItemStack itemStack, boolean on)
{
@@ -19,11 +19,11 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS);
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9}));
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.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2});
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
@@ -34,6 +34,6 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4));
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
}
}
@@ -43,11 +43,6 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {3, 1, 0, 0, 0, 2});
configComponent.setInputConfig(TransmissionType.ENERGY);
@@ -19,11 +19,11 @@ public class TileEntityEliteFactory extends TileEntityFactory
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS);
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {5, 6, 7, 8, 9, 10, 11}));
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.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2});
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
@@ -34,6 +34,6 @@ public class TileEntityEliteFactory extends TileEntityFactory
upgradeComponent = new TileComponentUpgrade(this, 0);
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(4));
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
}
}
@@ -149,6 +149,10 @@ public class TileComponentConfig implements ITileComponent
{
return EMPTY;
}
else if(index > getOutputs(type).size()-1)
{
index = getConfig(type)[side.ordinal()] = 0;
}
return getOutputs(type).get(index);
}