
TheEpicTekkit
Members-
Posts
361 -
Joined
-
Last visited
Everything posted by TheEpicTekkit
-
EnumChatFormatting with .lang file names [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, that worked. Solved. -
EnumChatFormatting with .lang file names [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
So... public String getItemStackDisplayName(ItemStack stack) { return EnumChatFormatting.AQUA + super.getItemStackDisplayName(stack); } Using the super method. -
EnumChatFormatting with .lang file names [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Nevermind.... that caused a stackoverflow. I guess I should have seen that that was a recursive method. -
EnumChatFormatting with .lang file names [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Like this? public String getItemStackDisplayName(ItemStack stack) { return EnumChatFormatting.FormatCode + this.getItemStackDisplayName(stack); } -
Okay, well, I have got it working finally. Updated Code: package generator.net.theepictekkit.generator.client.renderer.blocks; import generator.net.theepictekkit.generator.Reference; import generator.net.theepictekkit.generator.common.blocks.advanced.BlockCable; import generator.net.theepictekkit.generator.common.tileentity.TileEntityCable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; public class RendererCable extends TileEntitySpecialRenderer { public final String modid = Reference.MODID; public final float px = 1.0F / 16.0F; public boolean drawSmootheConnection; public int subTypes = 4; public int resourcesPerType = 5; public ResourceLocation[][] resource = new ResourceLocation[subTypes][resourcesPerType]; public IModelCustom[][] model = new IModelCustom[subTypes][resourcesPerType]; public RendererCable() { this.resource[0][0] = new ResourceLocation(modid + ":" + "models/obj/LV-Insulated/Core.obj"); this.resource[0][1] = new ResourceLocation(modid + ":" + "models/obj/LV-Insulated/CoreStraight.obj"); this.resource[0][2] = new ResourceLocation(modid + ":" + "models/obj/LV-Insulated/ConnectionEnd.obj"); this.resource[0][3] = new ResourceLocation(modid + ":" + "models/obj/LV-Insulated/ConnectionStraight.obj"); this.resource[0][4] = new ResourceLocation(modid + ":" + "textures/models/cables/Cable_LV.png"); this.resource[1][0] = new ResourceLocation(modid + ":" + "models/obj/LV-Uninsulated/Core.obj"); this.resource[1][1] = new ResourceLocation(modid + ":" + "models/obj/LV-Uninsulated/Core.obj"); this.resource[1][2] = new ResourceLocation(modid + ":" + "models/obj/LV-Uninsulated/Connection.obj"); this.resource[1][3] = new ResourceLocation(modid + ":" + "models/obj/LV-Uninsulated/Connection.obj"); this.resource[1][4] = new ResourceLocation(modid + ":" + "textures/models/cables/Cable_LV_Uninsulated.png"); this.resource[2][0] = new ResourceLocation(modid + ":" + "models/obj/MV-Insulated/Core.obj"); this.resource[2][1] = new ResourceLocation(modid + ":" + "models/obj/MV-Insulated/CoreStraight.obj"); this.resource[2][2] = new ResourceLocation(modid + ":" + "models/obj/MV-Insulated/ConnectionEnd.obj"); this.resource[2][3] = new ResourceLocation(modid + ":" + "models/obj/MV-Insulated/ConnectionStraight.obj"); this.resource[2][4] = new ResourceLocation(modid + ":" + "textures/models/cables/Cable_MV.png"); this.resource[3][0] = new ResourceLocation(modid + ":" + "models/obj/MV-Uninsulated/Core.obj"); this.resource[3][1] = new ResourceLocation(modid + ":" + "models/obj/MV-Uninsulated/Core.obj"); this.resource[3][2] = new ResourceLocation(modid + ":" + "models/obj/MV-Uninsulated/Connection.obj"); this.resource[3][3] = new ResourceLocation(modid + ":" + "models/obj/MV-Uninsulated/Connection.obj"); this.resource[3][4] = new ResourceLocation(modid + ":" + "textures/models/cables/Cable_MV_Uninsulated.png"); //Set the appropriate model to the appropriate resource for (int i = 0; i < subTypes; i++) { for (int j = 0; j < resourcesPerType - 1; j++) { //Subtract 1 because .png will cause a crash in loading it as a .obj this.model[i][j] = AdvancedModelLoader.loadModel(resource[i][j]); } } } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { int meta = tileEntity.getBlockMetadata(); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(1.0F, 0.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); //Calling all the render methods from here with the model and texture specified above. if (this.resource[meta][4] != null) { this.bindTexture(resource[meta][4]); { if (tileEntity instanceof TileEntityCable) { TileEntityCable cable = (TileEntityCable) tileEntity; if ((!cable.hasOppositeConnection(cable.connections))) { if (this.model[meta][0] != null) this.drawCore(meta); } else if (this.model[meta][1] != null) { if (cable.connections[0] != null) this.drawStraightCore(meta, ForgeDirection.UP); if (cable.connections[2] != null) this.drawStraightCore(meta, ForgeDirection.NORTH); if (cable.connections[4] != null) this.drawStraightCore(meta, ForgeDirection.WEST); } for (int i = 0; i < cable.connections.length; i++) { if (cable.connections[i] != null) { if (this.model[meta][3] != null) drawConnection(meta, cable.connections[i]); //Drawing and rendering a new connection model for each connected side specified by the tileentity } } } } } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } /* * This method renders the core straight. So, instead of there being a core that you can see in every block, it renders a different core model that * matches the connection model, so it looks like there is no core. This is only rendered if there is an opposite connection. */ public void drawStraightCore(int meta, ForgeDirection dir) { GL11.glPushMatrix(); if ((dir.equals(ForgeDirection.UP)) || dir.equals(ForgeDirection.DOWN)) { GL11.glTranslatef(0.5F, 0.75F, 0.5F); GL11.glRotatef(0, 1, 0, 0); //Not Needed, just aesthetic. } else if ((dir.equals(ForgeDirection.NORTH)) || (dir.equals(ForgeDirection.SOUTH))) { GL11.glTranslatef(0.5F, 1.5F, 0.25F); GL11.glRotatef(-90, 1, 0, 0); } else if ((dir.equals(ForgeDirection.EAST)) || (dir.equals(ForgeDirection.WEST))) { GL11.glTranslatef(-0.25F, 0.5F, 0.5F); GL11.glRotatef(-90, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.75F, -0.5F); //Translate it back to where it is supposed to be. this.model[meta][1].renderAll(); GL11.glPopMatrix(); } /* * This method works by getting the direction to connect to, then translating the connection model to * the centre, then rotating it in the appropriate direction, then translating it back, and finally rendering it. */ public void drawConnection(int meta, ForgeDirection dir) { GL11.glPushMatrix(); if (dir.equals(ForgeDirection.UP)) { GL11.glTranslatef(0.5F, 1.75F, 0.5F); GL11.glRotatef(0, 1, 0, 0); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } else if (dir.equals(ForgeDirection.DOWN)) { GL11.glTranslatef(0.5F, 0.25F, -0.5F); GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } else if (dir.equals(ForgeDirection.NORTH)) { GL11.glTranslatef(0.5F, 1.5F, -0.75F); GL11.glRotatef(-90, 1, 0, 0); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } else if (dir.equals(ForgeDirection.SOUTH)) { GL11.glTranslatef(0.5F, 0.5F, 0.75F); GL11.glRotatef(90, 1, 0, 0); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } else if (dir.equals(ForgeDirection.EAST)) { GL11.glTranslatef(0.75F, 0.5F, 0.5F); GL11.glRotatef(-90, 0, 0, 1); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } else if (dir.equals(ForgeDirection.WEST)) { GL11.glTranslatef(-0.75F, 1.5F, 0.5F); GL11.glRotatef(90, 0, 0, 1); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); this.model[meta][3].renderAll(); } GL11.glPopMatrix(); } /* * This just renders the core as normal. No rotations. */ public void drawCore(int meta) { this.model[meta][0].renderAll(); } } And, just in case anyone reading this doesn't understand the model[][] and the resource[][], the first number represents the metadata, and the second represents the resource, so resource[2][3] for example is the straight connection model for metadata 2. resource[metadata][4] is the texture for the given metadata, that is why I subtract 1 when assigning these resourceLocations to the model, otherwise it would try to assign a .png file as a .obj file, then crash with a FileFormatException. Anyway, if you say I do it wrong, then I'll change it. Edit: Solved. But still don't understand why you say I did it wrong.
-
Okay. FLUFFY2, I'll consider changing to techne, or even tessellators, but for now, I want to get this working because I have put a lot of work into the models, and I want to see them functioning properly in the game. If I notice a considerable amount of lag, I will move away from obj models (and for the record, I have a really bad pc, so if it is even slightly laggy, I'll notice it) Wilz-, I know that is the reason that it is lagging. I just need an alternative way to assign the model to the metadata. Unfortunately, I cant load the model in the constructor, as the constructor is getting called before the tileentity exists, so therefore, it cant get the metadata. And, if it cant get the metadata, it chooses the default case for all the metadatas. I could and would have loaded the model in the constructor if there wasn't multiple metadatas as it wouldn't matter weather or not the tile existed yet.
-
Hello everyone. So, I have run into a problem. When looking at my cable block render for a cable, it is VERY laggy, I mean I am getting at most 1 FPS, whereas when looking away from the cable, I get 20 - 30 FPS. Now, I do know what is causing this, but I cant come up with a working solution. Another thing to note, is that I have 4 (actually 8, but that doesn't matter atm, I am testing this with 4) metadata sub-blocks for this cable. I am using one tileentity for my cable, as there is not much of a difference between them (only energy transfer rates and capacities), and so am also using one renderer class for all 4 (eventually 8 ). The reason for this, is I don't want to have duplicate classes that have minor differences, so do pretty much the same as each other. Also, for the renderer class, I found it to be a problem assigning multiple renderers to one tileentity. This is my code: The problem lies in the switch statement for metadata in the renderTileEntityAt(...) method, I know this because in removing this code (which broke all the models and textures, so it rendered the same model for all of them) my framerate was fine again. So, I believe that calling "AdvancedModelLoader.loadModel(resourceLocation)" every frame is causing all the lag. So, I have tried putting this switch statement in the constructor which only gets called once, but this didn't work because the constructor was getting called too early, and so the tileentity didn't exist, and so the metadata was -1 (or whatever it would be before it is assigned, because it was not 0, as that would have assigned the first model to all of them), so it was going to the default case. I don't know how I can only call this function once, but only after the tileentity exists. If not, how could I call this method when the block is added, or maybe once every so often. Thanks.
-
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, thanks. Surprisingly, I have never seen an un-named block. -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
In an array, am I right in thinking that the first object is at position 0, the second at position 1 etc. it starts at 0, not 1. This is what I always found the case to be. But, if I am wrong, then that might be the problem. Also, with the lang file, are un-named blocks that don't have a TileEntity "block.unLocalizedName.name" or "tile.unLocalizedName.name"? -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Weird. Oh well, I'll figure it out eventually. -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay. But, this still doesn't explain why metadata 0 selected the 8th string in the array, and metadata 7 selected the first. -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay. My cable names were in the code above. public static String[] names = new String[] { "LV Cable", "Uninsulated Tin Wire", "MV Cable", "Uninsulated Copper Wire", "HV Cable", "Uninsulated Gold Wire", "UV Cable", "Uninsulated Reactor Cable" }; Also, come to think of it, I am now noticing something.... this.getUnlocalizedName() + "." + BlockCable.names[stack.getItemDamage()]; in the getUnlocalizedName method in the itemblock seems to be what it is being named. getUnlocalizedName always returns its unlocalized name with the prefix "tile." then it is selecting the name from the array. and I'm guessing that this is in-properly naming it, as in-properly named things end with ".name" So, what is the proper way to name an ItemBlock. I know that I could add ".substring(11, 5)" to remove 11 characters from the front of the string; "tile.cable." and 5 characters from the end of the string; ".name" but, this is almost certainly in-properly naming it too. -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Sorry for the late reply. ItemBlockCable package generator.net.theepictekkit.generator.common.blocks.itemblocks; import java.util.List; import generator.net.theepictekkit.generator.common.blocks.BlockHandler; import generator.net.theepictekkit.generator.common.blocks.advanced.BlockCable; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemBlockCable extends ItemBlock { public ItemBlockCable(Block cable) { super(cable); cable = BlockHandler.cable; this.setHasSubtypes(true); this.setUnlocalizedName("itemBlockCable"); } @Override public int getMetadata (int meta) { return meta; } @Override public String getUnlocalizedName (ItemStack stack) { return this.getUnlocalizedName() + "." + BlockCable.names[stack.getItemDamage()]; } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { int meta = stack.getItemDamage(); list.add("ToolTip for metadata " + meta); //This was a tooltip test. } } And, how do I set up a language file? I know what they are, but haven't really bothered to use them when I probably should. Can you point me to a good tutorial for language files? -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, thanks, I have it working almost perfectly now, even the tooltips. Unfortunately, there is as always, another problem. The naming is weird. Now, what is happening is that metadata 0 is taking the 8th name in the array for some reason, ("Uninsulated Reactor Cable" this is without tile.myBlock.name), and the rest are taking the appropriate name from the array, so meta 1 is taking "Uninsulated Tin Wire" etc, but with tile.cable. and .name at the start and end. So... metadata 0: "Uninsulated Reactor Cable" metadata 1: "tile.cable.Uninsulated Tin Wire.name" metadata 2: "tile.cable.MV Cable.name" and the same for the rest, "tile.cable.NameFromArray.name" The way I am registering the names and block is like so: for (int i = 0; i < BlockCable.names.length; i++) { LanguageRegistry.addName(new ItemStack(cable, i), BlockCable.names[i]); //LanguageRegistry.addName(new ItemStack(BlockToName, metadata), name); } GameRegistry.registerBlock(cable, ItemBlockCable.class, "itemBlockCable"); //GameRegistry.registerBlock(BlockToRegister, BlocksItemBlockClass.class, "name"); And, this is where I am registering all my blocks. It is not in the block class it self. -
Naming metadata blocks, and block tooltips [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
I don't actually think I have done the metadata subblocks correctly then. The following is all of my metadata related methods. Names //This is static so that I can access it outside the class without needing to create an unnecessary instance of it. public static String[] names = new String[] { "LV Cable", "Uninsulated Tin Wire", "MV Cable", "Uninsulated Copper Wire", "HV Cable", "Uninsulated Gold Wire", "UV Cable", "Uninsulated Reactor Cable" }; Getting all subBlocks @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemStack, CreativeTabs tab, List list) { for (int i = 0; i < this.names.length; i++) { list.add(new ItemStack(itemStack, 1, i)); } } Get damage dropped @Override public int damageDropped(int meta) { return meta; } I don't know if this is relevant, or will affect anything, but my block extends BlockContainer. I wouldn't really expect this to make a difference, but, might be worth mentioning. Now, I don't know if I have missed any important methods here, so please tell me if I have missed a method. I don't know if I have an itemblock (well, I do have an itemblock, every block has one, but I don't have a custom one, and, at least, all the subblocks have the same itemblock.) Also, another thing that I don't know why is happening, is that if I pick up a block with one metadata, say, metadata 4, and then I pick up another of that block with a different metadata, they will stack, and get turned into the metadata of the first block I picked up, and this is a very strange bug, I haven't seen that before. -
Hello everyone. So, I would like to know how I can name metadata blocks. I currently cant figure it out at all, even after looking at vanilla things like wool, I cant find how they name them, I can find, and have made my own version of, a string array with all the names, and the name is located in the array at its metadata position. So I mean that for example, if the metadata is 2, then its name would be the third second string in the array (0, 1, 2...). Now, I will if there is no other way, but I don't want to have to do a languageRegistry.addName for each metadata, I would like to be able to use a for loop that loops through each metadata, and gets the corresponding name from the array, but the only place I can do that from is the block class, but I cant register the names in the block class, because by the time that method has been called, the block is already registered with the name tile.myBlock.name. Now, I would also like to know how to add tooltips for a block. I do know that this involves an ItemBlock, but I don't know how to set up an itemblock, and I cant find any tutorials anywhere. Thanks.
-
So, (yes I am using eclipse), I would go to "Run > Run Configuration > Java Application > Server > Arguments" and add --username myEmail and --pass myPass, with no quotation marks to surround my email and pass or anything? Now, I am not sure why, but I have two client tabs and two server tabs, I dont know if it is supposed to be like that. Also, this is a logical guess, but would I add these parameters in the server?
-
Okay, so the name pretty much says what I am asking. Is it possible for me to use my mc account when logging into minecraft in the dev workspace? I have wanted to do this for a while now, but I decided I was fine with ForgeDevName, but now for some reason, after updating Java, it has gone back to a a randomly generated username. Thanks.