Everything posted by Black
-
[1.6.4] Trouble With Opacity/Backface Culling
Basically what the OP meant was that the faceculling didn't happen in the same way as the original block. E.g. if you look through both glasstypes to another glass of the same type, in one you'll see the texture of the glass behind it and in the other you won't. The solution is as Mitchelbrine said before you have to render the glass as if it is a full block so that only the sides you are directly seeing are being rendered with getRenderBlockPass
-
[1.7.10] Mod won't load. Minecraft says only 3 mods installed. [SOLVED]
I see no project whatsoever in that github you provided. Please look up a tutorial on how to set up a gradlew workspace at report back when that doesn't work. For now, all I can say, redo it and make a decent project with a src map, saves, crash-report map etc etc. There are enough tutorials.
-
Data Storage
Well, it certainly was worth asking this here. I had totally forgotten that you could make tileentities non-ticking. It is still a bit wasteful though, albeit there is probably little difference between saving it this way against another except the fact that it needs to save the fact that the block is a tileentity. It allready saves the coordinates so the only thing left to save is the entityid. But like you said, perhaps, just as a separate structure, the actual bytes gained aren't really worth it. I'll have a look into the ChunkDataEvent though, who knows what could come out of it. Thank you for your help.
-
Data Storage
Good Afternoon, I have a question for the people quite at home with minecraft & forge code. My mod contains, among other, a tree and wood items for every mob in the game, whether that mob is from a mod or not, as long as it has a spawnegg. So as an example, the creeper has a log, plank, leaf, sapling, stair, slab, button, craftingbench etc that belongs to him. These items have certain qualities depending on which mob they belong to, such as blastresistance, a redstone signal only when that mob walks over them etc. The textures are blended layers(with opengl) coloured by the primary and secondary colours of the mobs spawnegg. And naturally since it needs to be modular and for efficiency's sake every particular block is merely a subblock from its base(E.g. BaseSapling, BasePlank). (Yes, I realise, this is quite a silly premise but it is a fun project since there are a lot of things to flesh it out with like tree grafting, biomes etc.) In any case, you might have heard me coming from a long mile, but the metadata is insufficient to store the itemdamage from the egg(which is the same as the mob id). I need that to give the block its correct characteristics. Now I'm certainly not new to OOP, although I am to minecraft modding, so I wasn't really bothered with that. I am currently at the point where I have to implement it or I won't be able to move forward and I came up with a few solutions, the one prettier or uglier than the other. I am wondering however, if there are alternative solutions or methods that implement my solutions in a better way. I have looked through the code quite extensively but I have yet to find anything of the sort. (I might just have overlooked something though, that is always possible). Solutions: - Make of the block a tile entity, the easiest solution but also the most wasteful. I only need to store the blocks coordinates and a single number so to make blocks that can be plentiful in the word entities (e.g. the player can build his house out of it, there can be entire biomes) is saying goodbye to any frames per second you ever had. And since I also have a lot of other blocks being tile entities or models with polygons above the 200 I'd rather not do this. - Create one tile entity for all the blocks and save that tile entity in the first block of its kind created. The downside is that that chunk always need to be loaded then and you need to migrate the data if that block is broken. - The same as above but this time save it in the spawnchunks. The chunks are allready loaded but the chunks need to have a block that is either of that kind or override another block. And once again the problem of it having the chance of being broken. - Save the data in the chunk of the block. The problem being here that the way chunks save data is by its blocks and the same limitations with the metadata persist. - Override parts of the save classes so that they save the four numbers for each block in the level.dat and read it again when the game loads into a hashmap. There are no tile entities here but adjusting the level.dat would be quite a messy procedure. - Do the same as the above however save the data to a separate file next to level.dat The downside here is that the data is separate from the rest of the game(and can be forgotten or deleted) but it is a very easy implementation. - Bind an itemstack to the block to read the itemdamage. This however doubles the amount of things. Pardon the lack of a decent list but the buttons to add them here to add quotes, lists, code etc have never worked for me and I don't know the forumcode to add lists. So let me repeat my question. Does forge or minecraft implement one the methods above that make this a lot easier or do they have an alternative for storing 4 variables (or two if you add xyz in one string). And yes, I do know a lot of sighs will escape your mouths, I do not care. I thank you beforehand and hope that you will understand the above text. Friendly greetings, Black
-
[1.6.4] Config not working
Well, to begin with, you aren't registering your Items at all. Remember that you need to register all your items, blocks, tileentities, handlers etc if you actually want minecraft to know they exist.
-
[1.7.10] Finding Tile entitys?
It depends on where the tile entities exist but they can't populate one block more than once it would be better to go with a hashmap. No chance of duplicating a tileentity by accident and simply use the x,y,z as key. E.g. OP speaks of one particular tileentity so using the id with multiple values is redundant.
-
[1.7.10] Custom Modeled Block Queries
Well, what are you using then? The hardcoded way(tesselator)? Let me add some stuff since it seems that isn't the only place you are stuck. You can get the way the player is facing with int l = MathHelper.floor_double((double)(Player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int the onBlockPlacedBy method. Then write that value to metadata. In your renderclass just read the metadata again and rotate the object accordingly(e.g. 2 == 0°, 3 == 90°, 4 == 180° & 5 == 270° or something like that) and between your GL11.glpushMatrix() and gl11.glPopMatrix you just place GL11.rotatef(yourpreviouslycalculatedangle, 0.0, 1.0f, 0.0f); and this should actually work with whatever type of model you use.
-
[1.7.10] Custom Modeled Block Queries
Well, it is just a simple matter of rotating the model itself instead of the block. So for instance, if you're using an wavefront model you can just call GL11.glrotatef(angle, xvector, yvector, zvector); before you render your model.
-
[1.7.10] Adding external Libraries (libs folder or something)
I personally suggest making it a coremod, it seems to agree with most of the criteria that would make up a coremod. Have a look into that.
-
[1.7.10] [Unsolved] How to add Wavefront Armor?
Typed in google 'how to make custom 3D armor in minecraft forge first hit: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571595-1-7-2-how-to-code-custom-3d-armor-models-3d It's using techne but you should be able to use any other 3D program as long as you remove the techne code and render with opengl, of which there is by the way, a very good tutorial here http://www.minecraftforge.net/wiki/Using_wavefront_model
-
Raining, snowing, biomes?!
Rain and snow can be set when you are registering the biome because the BiomeGenBase class, e.g. the base class for biomes contains those methods. So if you want to disable rain you can call this.setDisableRain() and for snow you can use this.setEnableSnow(). And you might also want to set the temperature as this.setTemperatureRainfall(temperature float, rainfall float); And for how biomes are saved. The BiomeGenBase class has a list of biomes. public static final BiomeGenBase[] biomeList = new BiomeGenBase[256]; So to add one, simple add it to the list. E.g. It's just about the same as blocks.
-
[1.7.10] Help me develop my mod: Inventory Rules
Well, I do sound quite harsh in a lot of cases so ... I guess I'm partly at fault as well. In any case, do you know the newly 'hot topic' Hard Mode Questing mod? It does just about what you want to do except it doesn't set the rules in game but rather before hand. The quests there are divided in: 1. Craft an item or number of certain items or liquids 2. Have a number of certain items in your inventory 3. Submit, e.g. it gets deleted from the inventory, a certain item or liquid. So I suggest having a look around in that mod.
-
Entity mountable with passenger
That is an entirely different question. In any case this should help you: the EntityHorse class has this neat method which should help you update the rider position. public void updateRiderPosition() { super.updateRiderPosition(); if (this.prevRearingAmount > 0.0F) { float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); float f2 = 0.7F * this.prevRearingAmount; float f3 = 0.15F * this.prevRearingAmount; this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1)); if (this.riddenByEntity instanceof EntityLivingBase) { ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; } } } And the entity class(meant for the player) has these: /** * Returns the Y offset from the entity's position for any entity riding this one. */ public double getMountedYOffset() { return (double)this.height * 0.75D; } /** * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. */ public void mountEntity(Entity par1Entity) { this.entityRiderPitchDelta = 0.0D; this.entityRiderYawDelta = 0.0D; if (par1Entity == null) { if (this.ridingEntity != null) { this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch); this.ridingEntity.riddenByEntity = null; } this.ridingEntity = null; } else { if (this.ridingEntity != null) { this.ridingEntity.riddenByEntity = null; } this.ridingEntity = par1Entity; par1Entity.riddenByEntity = this; } } So basically just check if there is already someone on the horse and adjust the player position on that basis. Also, don't forget you will need to override the original /** The entity that is riding this entity */ public Entity riddenByEntity; in the horse class to an array or list to allow more than one entity to ride the same horse. Also don't forget to adjust any checks that happen if there is already someone riding the horse to allow two players instead of just one. I hope this helps.
-
[1.7.10] Help me develop my mod: Inventory Rules
Unfortunately we don't write mods for you here. This is a forum to help people with coding problem that find their origin in forge/minecraft related code. In fact, seeing things like this makes me even more reluctant to post any bits of code I would normally do. I realise it is a long tutorial but there are plenty of other tutorials on video, text or forums about all sorts of topics. To answer your question you posted below this but without writing code: I'd suggest dividing your 'rules'(or item that contains the rules) in to several subrules. 1. Rules that have application to having items in inventory -> you can just check the players inventory for that 2. Rules that have to do with crafting items -> you can just use a craftinghandler for that. 3. Rules to do with breaking or placing blocks -> check what is in front of player or something like that 4. Etc. As for your little list. Just check when the item is actived and whether an item is allready assigned to someone or not. E.g. You really don't know how to make a (semi) random number? This is not a java class. Go to google and type Random number between two values And I have already given you a lot more than you deserve for that kind of post. EDIT: I realise I sound, inadvertent, a bit rude here but I hope you understand writing a mod isn't so simple as having someone write the mod for you. The people here are all people working on or having their own mods or working on forge itself. People here just offer help because of various reasons such as wanting to help people, return the favour etc. Let me clarify a bit what you're trying to do with a simple example. You're walking in the middle of NY of a hot summer day and you come across times square. It is jampacked with people but you need to know the way to some place. What someone here would do is ask that person politely how to get there. And yes, sometimes that person would have to explain us how to walk(because not everyone asking here knows java, sadly). But you are walking to a random person you don't know and say, "Please guide me to this location. You won't get anything from it and you'll waste a lot of time but guide me anyway." So next time, think a bit about a logical problem before you give up on it. And don't even start with the "help developing with".
-
[1.7.10] Compiling the mod but no textures
Doing it the following always compiles correctly for me: Textures go in: your Modfile/src/main/resources/assets/yourmodid/textures & lang & models int textures then textures/blocks & items and simply place them appropriately.
-
Entity mountable with passenger
The best tutorial is located in the horse/pig/minecart classes. Furthermore you can even call from your entity this.ismountable(); so have a look through those classes, see what methods they call to place the player in what position (particular the right click since that's how a player interacts to mount) and you should be golden.
-
[1.7.10] Custom Model Question
I don't want to be annoying but try to find something out yourself, I too had to just look at the error logs and look up how things are done in minecraft. E.g. I've only been modding, like what? 2 weeks? Which also applies to java since I come from c++/vb.net and only got into that to mod minecraft. If you want to get further than this try to be a bit more proactive in finding your problems. I have noticed that the right click function, no matter where it is applied to in minecraft, triggers twice. I haven't bothered looking for a solution since if does that it could be an intended feature, and well, it's so easy to fix in the function itself that it really isn't bothersome at all. It might just be however that the basecode doesn't distinguish between a key-down and a key-up so two keysignals are sent. In any case, don't worry about it. You are changing a value in your tileentity class that isn't passed through to your tileentityrender class and secondly, you're trying to load textures in the middle of the runtime of your block, not really ideal if I may say so. A simple solution: Make a resourcelocation for every texture in your RenderAIBeacon class. In your Tileentity class(which doesn't seem to be included)create a new byte variable. If you want to load texture 1, set that var to 1, if you want to load texture 2 set it to 2 etc. In your render class again, cast your tileentity to your tileentityclass and simple go and get that value with a switch, and if it is 2 bind texture two, if it is 1 bind texture one etc. Thirdly, the block class is static, e.g. it persists for all blocks that are made of that type, if you would somehow succeed in changing its texture there it would change it for every single other block of that class in your world.
-
[1.7.10] Custom Model Question
You have at least a null pointer exception on right click. Did you actually check if the player is holding something before you're trying to check that illusive item? Minecraft doesn't check before it returns a method like a sensibly written program would do, instead it just throws the nulls everywhere and hopes you catch them. And then you have something about nbt which I do not wish to adress since I simply do not know what that is about? Nbt not being able to find its mapping, how? It would be nice if someone else could clarify that or otherwise I would definitely need to see the code about that.
-
[Solved] [1.7.10] Changing block size when game loads
Well, considering you completely ignored my suggestion about a tile entity I will conclude that you don't want that. How on earth you will pass data, because clearly whatever you're passing through that pipe will have to be saved too, that is if you want to make anything that somewhat resembles a pipe. So enough about tile entities and nbt, which is infinitely more convenient. And yes, both nbt and metadata load on blockload, wouldn't those be quite pointless otherwise? So metadata it is. If I had to find a solution for that I would do something like this(because honestly, saving three values in a number between 0 and 15 isn't quite so easy). Things to be passed: - Your direction - Your size - Your power/steam/... value What do we allready know? You direction is 3 values: up/down - left/right - front/back, this because a pipe doesn't have a front. So let us split the metadata into 3 parts: 0 to 4, 5 to 9 and 10 to 14 (with 15 being a restvalue, sadly this is a waste). So the next thing to look at is the size. Basically we know if we want to distinguish between the previous values we can only use 4 values and we need to be able to fit our power into that as well. Since size would be quite pointless to save if we only have 1 value we need at least two. And we can add another one if the number is 0, 5 or 10 since that would equal a zero for the size. Then for the power check whether a number is even or uneven. The only thing left is to reverse the last two between 5 and 9 since what is even between 0 and 4 and 10 and 14 is uneven there and vice versa. Let us look at a few examples: A pipe with the metadata 8: We can deduce that, since 8 is more than 5 and less than 10, the direction is Left/Right. We can deduce that, because 8 is an even number but lies between 5 and 10 there is no power flowing. We can deduce that, because 8 is an even number but lies between 5 and 10 the size is 2 on a scale of 0 to 2. A pipe with metadata 12. We can deduce that, since 12 is more than 10, the direction is Front/Back. We can deduce that, because 12 is an even number there is power flowing. We can deduce that, because 12 is an even number between 1 and 3(minus 10)the size is 1 on a scale of 0 to 2. A pipe with metadata 0. We can deduce that, since 0 is less than 5, the direction is Front/Back. We can deduce that, because 0 is an even number between 0 and 4 there is no power flowing. We can deduce that, because 0 is an even number between 0 and 4 the size is 0 on a scale of 0 to 2. That's about the best I can do. 0 - 5 - 10 is the directions. 1/3 - 6/8 - 11/13 is the size + previous values for zero. even and uneven excluding 0 - 5 - 10 are set to power. I hope you see now that, if you just use metadata you are incredibly limited. Look up tile entities and give it a go. If you see that your pipes don't need that, then you can always try the above.
-
Simple Block Model
This http://www.minecraftforge.net/wiki/Custom_Tile_Entity_Renderer and this http://www.minecraftforge.net/wiki/Using_wavefront_model and about several other googols of search results when you ask google anything about this.
-
Ticking every second
Actually I would like to add that you don't really need a tile entity in this case. Or rather you could just use the one next to you. Setting textures is as simple as setting metadata and reflecting that, as diesieben07 pointed out. Basically a tile entity update is somewhat equivalent of a block update except it uses other methods. Now I do not know how well this will work with blocks using RF. I haven't got the API setup for that so I can't test it but try the following method. @Override public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) { } Example: A block with this method next to a furnace will pickup when things are inputted or outputted and when an item is done cooking. The question here remains obviously how often a RF machine outputs a Tile entity update. And halving the number of tile entities is always a good idea. I'm somewhat curious how well this would work.
-
[1.7.10] how do i get the world name
Just to point out but those aren't worlds. Those are dimensions. Quite a different thing, so it is quite normal that we misunderstood you, especially when you were trying to get names on folders and such. Dimensions each have ids. Save those to the item and you're done. player.dimension player.worldObj.provider.dimensionId world.provider.dimensionId And if this is still not what you're looking for well, either you're on the wrong forum for the wrong game or I have completely lost you.
-
[1.7.10] how do i get the world name
So you are basically trying to save a compass/thing across worlds that holds no data in all worlds except one? Why not do the opposite, instead of trying to get names of saves, just set a boolean on the configured world to true and save that on the server. And if you're trying to share the item, e.g. pass it along with the player the same logic applies. Example: The player can take a compass on him to different saves. To do so you set a textfile that reads the playername and that he has a compass on him(or whatever other method you want to use to do this). Since the player needs to have the itemstack on him to take it with him he'll need to have it in his inventory. When exiting the save, save to the file the playername and the unique id's of each itemstack of that particular item. On loading, simply check whether the inventory of the player has those items with those id's and if he doesn't create those. And simply don't care about the configured thing. If it is, it'll read it from the server automatically and if isn't it'll be set to false on that particular server. Well, there might be easier ways, that what I came up with on the top of my head just now.
-
[1.7.10]Save data between minecraft saves
Well, the first solution that comes to mind would be to save that data to an external save, e.g. a textfile or bytefile just like you would do in a normal application and save it to the minecraft folder(much like a config file). Then when you need to load the object that needs the data just read the data you loaded back into the game on startup(to save on waiting time). That seems to be the most sensible. Otherwise going through the level.dat is complete and utter waste of computing time. The only downside(or plusside) is that if you delete a world it won't delete the folder unless you specifically modify what it has to delete, which I'll guess without looking at the code would be quite a challenge. And if there are build-in ways, which I do not know since I've never had to do such a thing, use those. Although to be honest I don't think there is, the only mod I can remember that does that is the one that has portals going from one world to another.
-
[1.7.2] How do you add a Brewing Recipe
Have a look here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2128914-1-7-2-forge-custom-potions-unsolved-closed and the linked thread from there: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1290485-brewing-api-for-minecraft-1-7-10 This should help you understand the situation
IPS spam blocked by CleanTalk.