diff --git a/common/mekanism/client/model/ModelJetpack.java b/common/mekanism/client/model/ModelJetpack.java new file mode 100644 index 000000000..20b009866 --- /dev/null +++ b/common/mekanism/client/model/ModelJetpack.java @@ -0,0 +1,201 @@ +package mekanism.client.model; + +import mekanism.client.render.MekanismRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +import org.lwjgl.opengl.GL11; + +public class ModelJetpack extends ModelBase +{ + ModelRenderer Packtop; + ModelRenderer Strapleft; + ModelRenderer Strapright; + ModelRenderer Packbottom; + ModelRenderer Thrusterleft; + ModelRenderer Thrusterright; + ModelRenderer Fueltuberight; + ModelRenderer Fueltubeleft; + ModelRenderer Packmid; + ModelRenderer Packcore; + ModelRenderer WingsupportL; + ModelRenderer WingsupportR; + ModelRenderer Packtoprear; + ModelRenderer ExtendosupportL; + ModelRenderer ExtendosupportR; + ModelRenderer WingbladeL; + ModelRenderer WingbladeR; + ModelRenderer Packdoodad2; + ModelRenderer Packdoodad3; + ModelRenderer Bottomthruster; + + public ModelJetpack() + { + textureWidth = 128; + textureHeight = 64; + + Packtop = new ModelRenderer(this, 92, 28); + Packtop.addBox(-4F, 0F, 4F, 8, 4, 1); + Packtop.setRotationPoint(0F, 0F, 0F); + Packtop.setTextureSize(128, 64); + Packtop.mirror = true; + setRotation(Packtop, 0.2094395F, 0F, 0F); + Strapleft = new ModelRenderer(this, 122, 35); + Strapleft.addBox(2.5F, 3.4F, 3.9F, 1, 2, 2); + Strapleft.setRotationPoint(0F, 0F, 0F); + Strapleft.setTextureSize(128, 64); + Strapleft.mirror = true; + setRotation(Strapleft, -0.0698132F, 0F, 0F); + Strapright = new ModelRenderer(this, 122, 35); + Strapright.addBox(-3.5F, 3.4F, 3.9F, 1, 2, 2); + Strapright.setRotationPoint(0F, 0F, 0F); + Strapright.setTextureSize(128, 64); + Strapright.mirror = true; + setRotation(Strapright, -0.0698132F, 0F, 0F); + Packbottom = new ModelRenderer(this, 92, 42); + Packbottom.addBox(-4F, 4.1F, 1.5F, 8, 4, 4); + Packbottom.setRotationPoint(0F, 0F, 0F); + Packbottom.setTextureSize(128, 64); + Packbottom.mirror = true; + setRotation(Packbottom, -0.0872665F, 0F, 0F); + Thrusterleft = new ModelRenderer(this, 69, 30); + Thrusterleft.addBox(7.8F, 1.5F, -3.5F, 3, 3, 3); + Thrusterleft.setRotationPoint(0F, 0F, 0F); + Thrusterleft.setTextureSize(128, 64); + Thrusterleft.mirror = true; + setRotation(Thrusterleft, 0.7853982F, -0.715585F, 0.3490659F); + Thrusterright = new ModelRenderer(this, 69, 30); + Thrusterright.addBox(-10.8F, 1.5F, -3.5F, 3, 3, 3); + Thrusterright.setRotationPoint(0F, 0F, 0F); + Thrusterright.setTextureSize(128, 64); + Thrusterright.mirror = true; + setRotation(Thrusterright, 0.7853982F, 0.715585F, -0.3490659F); + Fueltuberight = new ModelRenderer(this, 92, 23); + Fueltuberight.addBox(-11.2F, 2F, -3F, 8, 2, 2); + Fueltuberight.setRotationPoint(0F, 0F, 0F); + Fueltuberight.setTextureSize(128, 64); + Fueltuberight.mirror = true; + setRotation(Fueltuberight, 0.7853982F, 0.715585F, -0.3490659F); + Fueltubeleft = new ModelRenderer(this, 92, 23); + Fueltubeleft.addBox(3.2F, 2F, -3F, 8, 2, 2); + Fueltubeleft.setRotationPoint(0F, 0F, 0F); + Fueltubeleft.setTextureSize(128, 64); + Fueltubeleft.mirror = true; + setRotation(Fueltubeleft, 0.7853982F, -0.715585F, 0.3490659F); + Packmid = new ModelRenderer(this, 92, 34); + Packmid.addBox(-4F, 3.3F, 1.5F, 8, 1, 4); + Packmid.setRotationPoint(0F, 0F, 0F); + Packmid.setTextureSize(128, 64); + Packmid.mirror = true; + setRotation(Packmid, 0F, 0F, 0F); + Packcore = new ModelRenderer(this, 69, 2); + Packcore.addBox(-3.5F, 3F, 2F, 7, 1, 3); + Packcore.setRotationPoint(0F, 0F, 0F); + Packcore.setTextureSize(128, 64); + Packcore.mirror = true; + setRotation(Packcore, 0F, 0F, 0F); + WingsupportL = new ModelRenderer(this, 71, 55); + WingsupportL.addBox(3F, -1F, 2.2F, 7, 2, 2); + WingsupportL.setRotationPoint(0F, 0F, 0F); + WingsupportL.setTextureSize(128, 64); + WingsupportL.mirror = true; + setRotation(WingsupportL, 0F, 0F, 0.2792527F); + WingsupportR = new ModelRenderer(this, 71, 55); + WingsupportR.addBox(-10F, -1F, 2.2F, 7, 2, 2); + WingsupportR.setRotationPoint(0F, 0F, 0F); + WingsupportR.setTextureSize(128, 64); + WingsupportR.mirror = true; + setRotation(WingsupportR, 0F, 0F, -0.2792527F); + Packtoprear = new ModelRenderer(this, 106, 28); + Packtoprear.addBox(-4F, 1F, 1F, 8, 3, 3); + Packtoprear.setRotationPoint(0F, 0F, 0F); + Packtoprear.setTextureSize(128, 64); + Packtoprear.mirror = true; + setRotation(Packtoprear, 0.2094395F, 0F, 0F); + ExtendosupportL = new ModelRenderer(this, 94, 16); + ExtendosupportL.addBox(8F, -0.2F, 2.5F, 9, 1, 1); + ExtendosupportL.setRotationPoint(0F, 0F, 0F); + ExtendosupportL.setTextureSize(128, 64); + ExtendosupportL.mirror = true; + setRotation(ExtendosupportL, 0F, 0F, 0.2792527F); + ExtendosupportR = new ModelRenderer(this, 94, 16); + ExtendosupportR.addBox(-17F, -0.2F, 2.5F, 9, 1, 1); + ExtendosupportR.setRotationPoint(0F, 0F, 0F); + ExtendosupportR.setTextureSize(128, 64); + ExtendosupportR.mirror = true; + setRotation(ExtendosupportR, 0F, 0F, -0.2792527F); + WingbladeL = new ModelRenderer(this, 62, 5); + WingbladeL.addBox(3.3F, 1.1F, 3F, 14, 2, 0); + WingbladeL.setRotationPoint(0F, 0F, 0F); + WingbladeL.setTextureSize(128, 64); + WingbladeL.mirror = true; + setRotation(WingbladeL, 0F, 0F, 0.2094395F); + WingbladeR = new ModelRenderer(this, 62, 5); + WingbladeR.addBox(-17.3F, 1.1F, 3F, 14, 2, 0); + WingbladeR.setRotationPoint(0F, 0F, 0F); + WingbladeR.setTextureSize(128, 64); + WingbladeR.mirror = true; + setRotation(WingbladeR, 0F, 0F, -0.2094395F); + Packdoodad2 = new ModelRenderer(this, 116, 0); + Packdoodad2.addBox(1F, 0.5F, 4.2F, 2, 1, 1); + Packdoodad2.setRotationPoint(0F, 0F, 0F); + Packdoodad2.setTextureSize(128, 64); + Packdoodad2.mirror = true; + setRotation(Packdoodad2, 0.2094395F, 0F, 0F); + Packdoodad3 = new ModelRenderer(this, 116, 0); + Packdoodad3.addBox(1F, 2F, 4.2F, 2, 1, 1); + Packdoodad3.setRotationPoint(0F, 0F, 0F); + Packdoodad3.setTextureSize(128, 64); + Packdoodad3.mirror = true; + setRotation(Packdoodad3, 0.2094395F, 0F, 0F); + Bottomthruster = new ModelRenderer(this, 68, 26); + Bottomthruster.addBox(-3F, 8F, 2.333333F, 6, 1, 2); + Bottomthruster.setRotationPoint(0F, 0F, 0F); + Bottomthruster.setTextureSize(128, 64); + Bottomthruster.mirror = true; + setRotation(Bottomthruster, 0F, 0F, 0F); + } + + public void render(float size) + { + Packtop.render(size); + Strapleft.render(size); + Strapright.render(size); + Packbottom.render(size); + Thrusterleft.render(size); + Thrusterright.render(size); + Fueltuberight.render(size); + Fueltubeleft.render(size); + Packmid.render(size); + Packcore.render(size); + WingsupportL.render(size); + WingsupportR.render(size); + Packtoprear.render(size); + ExtendosupportL.render(size); + ExtendosupportR.render(size); + + GL11.glPushMatrix(); + MekanismRenderer.blendOn(); + MekanismRenderer.glowOn(); + GL11.glColor4f(1, 1, 1, 0.2F); + + WingbladeL.render(size); + WingbladeR.render(size); + + GL11.glColor4f(1, 1, 1, 1); + MekanismRenderer.glowOff(); + MekanismRenderer.blendOff(); + GL11.glPopMatrix(); + + Packdoodad2.render(size); + Packdoodad3.render(size); + Bottomthruster.render(size); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} \ No newline at end of file diff --git a/common/mekanism/client/render/MekanismRenderer.java b/common/mekanism/client/render/MekanismRenderer.java index 3329f5c70..77686db91 100644 --- a/common/mekanism/client/render/MekanismRenderer.java +++ b/common/mekanism/client/render/MekanismRenderer.java @@ -224,17 +224,16 @@ public class MekanismRenderer public static void blendOn() { - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } public static void blendOff() { - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_POLYGON_SMOOTH); - GL11.glDisable(GL11.GL_BLEND); + GL11.glPopAttrib(); } /** diff --git a/common/mekanism/client/render/ModelCustomArmor.java b/common/mekanism/client/render/ModelCustomArmor.java new file mode 100644 index 000000000..1b614ad83 --- /dev/null +++ b/common/mekanism/client/render/ModelCustomArmor.java @@ -0,0 +1,144 @@ +package mekanism.client.render; + +import mekanism.client.model.ModelJetpack; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class ModelCustomArmor extends ModelBiped +{ + public static ModelCustomArmor INSTANCE = new ModelCustomArmor(); + public static Minecraft mc = Minecraft.getMinecraft(); + + public ArmorModel modelType; + + public ModelCustomArmor() + { + resetPart(bipedHead, 0, 0, 0); + resetPart(bipedBody, 0, 0, 0); + resetPart(bipedRightArm, 5, 2, 0); + resetPart(bipedLeftArm, -5, 2, 0); + resetPart(bipedRightLeg, 2, 12, 0); + resetPart(bipedLeftLeg, -2, 12, 0); + + bipedHeadwear.cubeList.clear(); + bipedEars.cubeList.clear(); + bipedCloak.cubeList.clear(); + } + + public void init(Entity entity, float f, float f1, float f2, float f3, float f4, float size) + { + reset(); + + if(modelType.armorSlot == 0) + { + bipedHead.isHidden = false; + bipedHead.showModel = true; + } + else if(modelType.armorSlot == 1) + { + bipedBody.isHidden = false; + bipedBody.showModel = true; + } + else if(modelType.armorSlot == 2) + { + bipedRightLeg.showModel = true; + bipedLeftLeg.showModel = true; + } + + setRotationAngles(f, f1, f2, f3, f4, size, entity); + } + + public void reset() + { + bipedHead.isHidden = true; + bipedBody.isHidden = true; + bipedRightArm.isHidden = true; + bipedLeftArm.isHidden = true; + bipedRightLeg.isHidden = true; + bipedLeftLeg.isHidden = true; + + bipedHead.showModel = false; + bipedBody.showModel = false; + bipedRightArm.showModel = false; + bipedLeftArm.showModel = false; + bipedRightLeg.showModel = false; + bipedLeftLeg.showModel = false; + } + + public void resetPart(ModelRenderer renderer, float x, float y, float z) + { + renderer.cubeList.clear(); + ModelCustom model = new ModelCustom(this, renderer); + renderer.addChild(model); + setOffset(renderer, x, y, z); + } + + public void setOffset(ModelRenderer renderer, float x, float y, float z) + { + renderer.offsetX = x; + renderer.offsetY = y; + renderer.offsetZ = z; + } + + public class ModelCustom extends ModelRenderer + { + public ModelCustomArmor biped; + public ModelRenderer partRender; + + public ModelCustom(ModelCustomArmor base, ModelRenderer renderer) + { + super(base); + biped = base; + partRender = renderer; + } + + @Override + public void render(float size) + { + if(ModelCustomArmor.this.modelType != null) + { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0, 0.06F); + + mc.renderEngine.bindTexture(modelType.resource); + + if(ModelCustomArmor.this.modelType == ArmorModel.JETPACK && biped.bipedBody == partRender) + { + ArmorModel.jetpackModel.render(0.0625F); + } + + GL11.glPopMatrix(); + } + } + } + + @Override + public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + init(entity, par2, par3, par4, par5, par6, par7); + super.render(entity, par2, par3, par4, par5, par6, par7); + } + + public static enum ArmorModel + { + JETPACK(1, MekanismUtils.getResource(ResourceType.RENDER, "Jetpack.png")); + + public int armorSlot; + public ResourceLocation resource; + + public static ModelJetpack jetpackModel = new ModelJetpack(); + + private ArmorModel(int i, ResourceLocation r) + { + armorSlot = i; + resource = r; + } + } +} diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index 4d0f3d995..ebea35bde 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -241,6 +241,11 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork> { ForgeDirection side = acceptorDirections.get(acceptor); + if(side == null) + { + continue; + } + if(acceptor instanceof IStrictEnergyAcceptor) { IStrictEnergyAcceptor handler = (IStrictEnergyAcceptor)acceptor; diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index a9b072a4c..9e398b704 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -53,6 +53,7 @@ import mekanism.common.item.ItemDust; import mekanism.common.item.ItemElectricBow; import mekanism.common.item.ItemEnergized; import mekanism.common.item.ItemIngot; +import mekanism.common.item.ItemJetpack; import mekanism.common.item.ItemMachineUpgrade; import mekanism.common.item.ItemMekanism; import mekanism.common.item.ItemNetworkReader; @@ -206,6 +207,7 @@ public class Mekanism public static Item NetworkReader; public static Item WalkieTalkie; public static Item ItemProxy; + public static Item Jetpack; //Blocks public static Block BasicBlock; @@ -566,7 +568,7 @@ public class Mekanism DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256); Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator"); NetworkReader = new ItemNetworkReader(configuration.getItem("NetworkReader", 11222).getInt()).setUnlocalizedName("NetworkReader"); - //OPEN 11223 + Jetpack = new ItemJetpack(configuration.getItem("Jetpack", 11223).getInt()).setUnlocalizedName("Jetpack"); WalkieTalkie = new ItemWalkieTalkie(configuration.getItem("WalkieTalkie", 11224).getInt()).setUnlocalizedName("WalkieTalkie"); configuration.save(); @@ -592,6 +594,7 @@ public class Mekanism GameRegistry.registerItem(Configurator, "Configurator"); GameRegistry.registerItem(NetworkReader, "NetworkReader"); GameRegistry.registerItem(WalkieTalkie, "WalkieTalkie"); + GameRegistry.registerItem(Jetpack, "Jetpack"); } /** diff --git a/common/mekanism/common/item/ItemJetpack.java b/common/mekanism/common/item/ItemJetpack.java new file mode 100644 index 000000000..5a7e5f99c --- /dev/null +++ b/common/mekanism/common/item/ItemJetpack.java @@ -0,0 +1,45 @@ +package mekanism.common.item; + +import mekanism.client.render.ModelCustomArmor; +import mekanism.client.render.ModelCustomArmor.ArmorModel; +import mekanism.common.Mekanism; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.EnumHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemJetpack extends ItemArmor +{ + public ItemJetpack(int id) + { + super(id, EnumHelper.addArmorMaterial("JETPACK", 0, new int[] {0, 0, 0, 0}, 0), 0, 1); + //setCreativeTab(Mekanism.tabMekanism); + } + + @Override + public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) + { + return armorType == 1; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { + return "mekanism:render/NullArmor.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { + ModelCustomArmor model = ModelCustomArmor.INSTANCE; + model.modelType = ArmorModel.JETPACK; + return model; + } +} diff --git a/common/mekanism/common/util/CableUtils.java b/common/mekanism/common/util/CableUtils.java index aea100e76..160569b00 100644 --- a/common/mekanism/common/util/CableUtils.java +++ b/common/mekanism/common/util/CableUtils.java @@ -6,7 +6,6 @@ import ic2.api.energy.tile.IEnergySource; import java.util.ArrayList; import java.util.Arrays; -import java.util.EnumSet; import java.util.List; import mekanism.api.Object3D; @@ -49,7 +48,10 @@ public final class CableUtils (acceptor instanceof IPowerReceptor && !(acceptor instanceof ITransmitter) && MekanismUtils.useBuildcraft()) || acceptor instanceof IElectrical || acceptor instanceof IEnergyHandler) { - acceptors[orientation.ordinal()] = acceptor; + if(!(acceptor instanceof IConductor)) + { + acceptors[orientation.ordinal()] = acceptor; + } } } diff --git a/resources/assets/mekanism/render/Jetpack.png b/resources/assets/mekanism/render/Jetpack.png new file mode 100644 index 000000000..e6a3014c3 Binary files /dev/null and b/resources/assets/mekanism/render/Jetpack.png differ diff --git a/resources/assets/mekanism/render/NullArmor.png b/resources/assets/mekanism/render/NullArmor.png new file mode 100755 index 000000000..80fe21c94 Binary files /dev/null and b/resources/assets/mekanism/render/NullArmor.png differ