
TheEpicTekkit
Members-
Posts
361 -
Joined
-
Last visited
Everything posted by TheEpicTekkit
-
Updating Block Texture [UNSOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
How would I do this? and how then would I switch between them? -
Hello everyone. So, I have another problem, I am making a machine class for my mod, this class will have all the generic methods that all my machines will have, one of which, being registering the textures. Now, unlike the vanilla furnace, which has 2 separate blocks for on/off state, I am using metadata to do this. Now my problem is that the front texture doesn't update when the machine is on, everything else except this works. And I have a theory as to why; The registerBlockIcons method is only called when the block is created, now this isn't a problem for the vanilla furnace, as it replaces the off block with the on block, and when it does this, it is technically creating a new block, and so is re registering the textures. With my block, in my updateMachineState method (my equivalent to updateFurnaceBlockState) I am adding 1 to the metadata to set the machines state to on, and this is working fine, even with the rotations, I made it print out the metadata, and it does what I need it to. Now I have also made it print out the resource location (in the updateMachineState method) and it does update the texture name properly. Now all I need to do and cant figure out is how to re call the registerBlockIcons method, if I can do that, then it should work. Any ideas on how to recall this method? Thanks.
-
Ahhhhh, now I understand, I was thinking that it was actually rotating the block, but it is just re ordering the textures.... makes more sense.
-
That didn't really help... now I am confused... I really really don't want to use 2 blocks for on/off state, and that is what I used to do, but I want to learn to do it the proper way, using metadata. Can we go back a few steps to my reply about the vanilla furnace, why do they use the values 2, 5, 3 and 4, in that order? what do they mean, and how and where in the code does that define the rotation? because in the furnace block class, they are just metadata values, how does this rotate it, there isn't anything in the tileentity, or anywhere else to define that. This is the code I am talking about: public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2); } if (l == 1) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 5, 2); } if (l == 2) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2); } if (l == 3) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2); } if (p_149689_6_.hasDisplayName()) { ((TileEntityFurnace)p_149689_1_.getTileEntity(p_149689_2_, p_149689_3_, p_149689_4_)).func_145951_a(p_149689_6_.getDisplayName()); } } I am talking about the setBlockMetadataWithNotify(...) the 4th variable is the metadata, and the 5th is the flag. Sorry if I am annoying you with me not understanding, I feel like I am starting to be annoying, but I really wanna learn this, so I dont keep asking for help.
-
Would it be possible / easier to use GL11 to rotate the block? or is this just a dumb question?
-
Okay, so i put isOn in the tileentity, and set it there, but reference it in the block from the onBlockPlacedBy... right? and is that a method you made? and where would I put it? in the tileentity again? This block rotation stuff is very much different from how I did it in 1.6, and a lot more complicated...
-
Oh... okay. Right, so I have been working on the rotation of the block, and I have done this before, with things like a custom furnace, but because before I was using 2 separate blocks, I could just use the same numbers as the vanilla furnace, but now that I am storing the on/off state in metadata (because as I was told before by diesieben07, I shouldn't do that because of limited block numbers), it is getting a bit more complex. So this is basically how I want to do it: there are 4 rotation values for the off state, and 4 for the on state, so 0, 2, 4, and 6 are the rotation values when it is off, and when it is on, I would like to add one to those values (I will get to why I have used even intervals in a minute) so the on rotation values are 1, 3, 5, and 7. Now I can easily use this to determine if the machine is on or off using modulo to find if it is even of odd (even being off, and odd being on. if (meta % 2 == 0) { //metadata is even (machine is off) this.isOn = false; } else { //metadata is odd (machine is on) this.isOn = true; } Now how do I set the rotation of the block from the metadata from the onBlockPlacedBy method? the vanilla furnace uses really confusing metadata values "2, 5, 3 and 4" (in that order) now I dont understand what these numbers mean, and why they aren't 0, 1, 2, and 3. Before I have just coppied this method into my block, and it worked fine, but as I said, before I was using 2 blocks for on/off state. So I want to be able to set a custom direction for the metadata, so how do I make it so when my metadata is 0, or 1, the machine faces north, 2, or 3, the machine faces east, 4, or 5, the machine faces south, and finally 6, or 7, the machine faces west? From here, I can get which direction the player is facing, and make the machine face the opposite direction.
-
Also, renaming the topic, as my original question was answered, and this is now irrelevant to the title. Ignore this actually.
-
Im reading about bitwise operators here. is this a good resource?
-
Okay, thanks. one question, what does the <...> do? I know that it is called a generic (I think) but even after some research, I still dont understand, I found things saying that they help debug, and stop compilement errors, but im not so sure.
-
Hello all. Okay, so I have a few questions on metadata, and couldn't find anything useful on Google. 1) I'm mostly sure about this, but is there only 16 possible metadata sub blocks? or can I make more than 16 blocks with the same id? 2) If I were to make several machines for my mod (I'm thinking about 10 - 12 machines) I would have 8 metadata types for each, 1 - 4 for the rotation directions with the machine off, and 5 - 8 for the rotation directions with the machine on. I would like to be able to make all these machines under the same block class, and have all of them with the same id (because there is still only 4096 block ids available) So how would I go about doing this? Thanks.
-
Multipart Intergration [1.7.10] [UNSOLVED]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Also, is it the only tutorial there? if not, what one? I have found this but if it isn't the only tutorial, than is this the right one? -
Multipart Intergration [1.7.10] [UNSOLVED]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, thanks, I didn't come across this in searching on Google, I'll have a look, and follow as much as I can, and then ask for help here if needed. Also by "unfinished" how unfinished do you mean? is there anything important missing that I might need? -
Hello everyone. So, as the title suggests, I am looking for a tutorial on how to integrate one of my models to forge multipart. So if you could give me some advice, or point me to a tutorial (I have found nothing on Google) I would appreciate it. Thanks.
-
Hello everyone. So I a playing with block bounds again, but this time, instead of bounds larger than 1x1x1, I am trying to add bounding boxes to a cable I am working on, so I have it rendering and connecting, but the block bounds aren't updating, and this is because I haven't made it do so yet (because I don't know how to do this, hence why I am coming here). So I would like to ADD bounding boxes when it is connected, don't confuse this, I want to ADD boxes, not extend the existing box. like what Buildcraft pipes do, they add boxes, and don't just extend the box existing. Now I have come across a method called addCollisionBoxesToList(world, x, y, z, AABB, list, entity) {...} and have filled it out: public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB block, List list, Entity entity) { float px = 1/16; this.setBlockBounds(px*6-2, px*6-2, px*6-2, px*6-2, px*6-2, px*6-2); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityCable) { TileEntityCable tileCable = (TileEntityCable) tileEntity; if (tileCable.connections[5] != null) { this.setBlockBounds(0.0F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[4] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[1] != null) { this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[0] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[2] != null) { this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[3] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } } this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F); } Now all this seems to do is set the collision boxes, not the actual bounds. so before this, I could clip through the sections of the cable without bounds, and the same with other entities, now with this, it seems to stop that, but still no bounding boxes. Also, just a little note, the "connections" is a ForgeDirection array in the tileentity used to store the connections. (0 = UP, 1 = DOWN, 2 = NORTH, 3 = SOUTH, 4 = EAST, 5 = WEST). The reason I want to do this, is because I would like to work my cables into forge multipart, so I can have a cable in the same block space as a multipart. So any help on the adding block bounds bit would be appreciated, I would also appreciate help with the multipart bit, but that isn't what this topic is about, and I haven't even got to starting that yet. Thanks
-
CreateNewTileEntity(...) parameters ?? [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, thanks -
So, this is just a simple question I have, and couldn't find anything on google about it, what are the parameters of createNewTileEntity, I know the world parameter, but what is the second one? Is it metadata? I hope so, because I have a metadata block, and would like to have a different tile for each one. If it isn't I have ways of working round it, and using one tileentity, I could use the getMetadata method in the tileentity. Thanks.
-
Loading Wavefront Obj models [UNSOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
*bump* ?? -
Hello everyone. So I would like to know how to load a wavefront obj model into minecraft, I have been using techne up until now, but techne is really limited, I would like to be able to make more complex models in 3D programs like Autodesk Maya or Autodesk 3DS max (you might use blender, I personally hate blender, but the process is still the same). I have found this but don't really understand, it really isn't clear. Another thing, would I be able to load the material of the model too? so if it is reflective, or specular etc would that get loaded into mc? Also, finally (not important yet); Would it be possible to load an actual animation into minecraft, so instead of having to use GL11.glRotateF(...) and GL11.glTtanslateF(...) and GL11.glScaleF(...), I can animate something in Maya, and load or somehow convert it into gl11? I'm aware that that would involve loading the actual format Maya saves in (.ma or .mb) and .ma is a format with info about the project, and so contains all the animation movements, rotations, sacle factors, vertexes, edges, and faces, and many more things, and it can be opened in a .txt format for fixing a corrupt project, and I also know that the way an obj model is loaded is because it does a similar thing, it just doesn't contain animation information. Thanks for the help.
-
Displaying world time in a MM:HH format [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Okay, thanks guys, this was very helpful, I got it working, and learned what math.abs is -
Displaying world time in a MM:HH format [SOLVED] [1.7.10]
TheEpicTekkit replied to TheEpicTekkit's topic in Modder Support
Can I please have a bit of explanation? I understand half of it, I sort of understand the % symbol, cant remember what it is called, but doesn't it check if a number is a multiple of another number? not entirely sure though, and I don't know what Math.abs(arg1); does though. -
[1.7.10] Items and Blocks creation advice / discussion
TheEpicTekkit replied to Deli_SK's topic in Modder Support
Actually you don't even need 7 different block texture names, just use the unlocalized name, and name the texture file that, that's what I do. I have pretty much every block in my mod in a blockHandler class (dont like making and initializing blocks in the main class) And I have a BlockRenderer class for all blocks that just look pretty and have no functionality other than crafting, e.g. metal blocks, ores, decorative blocks etc. Though I do have separate classes for all blocks with function or a tileentity (I would like to know how to have all those blocks in one class too, I know it is possible, I have seen things like mekanism on github, and they have like one main tileentity class, and machines with seperate functionality extend that class, or one main block class and functionality blocks extend it). -
Okay, so I am trying to display the world time in a gui, and I know that I can get the world time with world.getWorldTime() But I want to display the time in a HH:MM format. Now I know that an hour in mc is 1000 ticks, so I just devide the time by 1000 to get the hour, and I have a simple if statement to put a 0 on the front if it is less than 10 (if it is a single digit), now I am struggling with the MM bit though, I do know that one minute in mc is 16.666666667 ticks (after some calculations) and so I can also display that after the ":" and it looks fine up until it goes past 00:59, when it passes that point it is 01:60, then 01:61, then 01:62 etc, you get the point, I want it to go back to 0 after an hour has passed, and I have tried doing this by: if (time >= 60) { time == 0; } but the problem with that, is that it stays at 0. it doesn't tick up again. Also, I have noticed that minecrafts time system doesn't reset back to 0 after 23999 ticks, it goes on past 24000. And this is kind of a problem for my solar panel, because it checks if the time is > 0, and < 12000 it is day, and can generate, and if the time >= 12000 and less than 24000 and there is a lunar upgrade it can generate. and so this only works for the first mc day, or untill I relog the world. What can I do? Thanks.
-
I have done this for several blocks in my mod, was pretty hard to figure out, but now I know how, it is really easy. Now it is impossible to make a block larger than 1x1x1 without gag blocks, at least, I couldn't figure it out, and so used this method, but it works great, gui's work, dont have to break all the gag blocks individually etc. Now please for the sake of learning how to do this, don't copy and paste, you wont learn anything, and wont know how to fix any problems, or adapt my code to fit your code. For me, the only acception for copying and pasting code, is if you absolutely understand how it works, and what it all does, and wont learn anything you don't already know. Here I will show you how to make a block more than one meter high, and also, at the end, a trick to make it look like the blocks bounding box is all one, where in reality, it is several blocks. Method: Hope this helped. Ps- I noticed that you are setting the blocks rotation with metadata in the main block class, now if you have a model, this wont work, the block will rotate, but the model wont, so unless you have already done so, rotate the model with GL11.rotatef(amount, rotateX, rotateY, rotateZ); and do this based on the metadata in the main block. Just pointing that out.