Jump to content

Syndaryl

Members
  • Posts

    49
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Syndaryl

  1. Wow, doesn't look much like my build.gradle! I don't even have that section My file's basically been dragged forward from old versions, though. About time I updated I guess. Thanks, I'll pick it apart and see how to to do it.
  2. I'm a little ignorant of Gradle. How do I set up my build to be flagged as Java 1.7? I'm comfortable with blocking 1.6 users from my mod; I'll live with the consequences of that. I'm using a HashMap<> and the <> operator isn't supported in 1.6, according to my error: :compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.6 D:\Games\Forge_Eclipse_workspace\AnimalsDropBones\build\sources\java\org\syndaryl\animalsdropbones\handler\MaterialHandler.java:31: error: diamond operator is not supported in -source 1.6 private static HashMap<String,ADBMaterial> allMaterials = new HashMap<>(); ^ (use -source 7 or higher to enable diamond operator) 1 error 1 warning FAILED FAILURE: Build failed with an exception.
  3. Ding ding ding ding ding! SOLVED! That was indeed the last dang piece of the puzzle!
  4. So, I've apparently been sent to developer purgatory for my coding sins or something. I rebuilt yet again and this time my debug messages are as expected and my blocks have their textures again. I have no idea what happened, which annoys me because if I did, I could probably figure out why my items are broken. AND all my exceptions have gone away again, which just worries me - should it throw an exception for "can't find JSON" or "no rendering info at all"? Regardless, I'm back to where I started: blocks are fine, items are pink-and-black cubes. Sledgehammer JSON is sitting in "assets\animalsdropbones\models\item\animalsdropbones_stone_sledgehammer.json" (excuse windows path separators) and contains the following: The image is in "assets\animalsdropbones\textures\items\animalsdropbones_stone_sledgehammer.png" I used this image in 1.7.10 without modification and I haven't heard anything about 1.8 changing how it reads PNG files, so it "should" be a valid, working PNG file. I'd expect an exception in my log if Minecraft couldn't read it, anyways... UnLocalizedName set with: setUnlocalizedName( getName() ); so getName returns getUnlocalizedName() without the item. at the beginning, saving me from calling substr(5) if I don't need it. That sort of magic number thing just looks like I'll shoot myself in the foot with it later. Sledgehammer registered with: ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); String name = AnimalsDropBones.MODID + ":" + sledgehammerStone.getName(); AnimalsDropBones.LOG.warn("SYNDARYL: item " + name); mesher.register(sledgehammerStone, 0, new ModelResourceLocation(name)); Debug output: [10:54:37] [Client thread/WARN]: SYNDARYL: item animalsdropbones:animalsdropbones_stone_sledgehammer Which is exactly like my (working) block output - [10:54:37] [Client thread/WARN]: SYNDARYL: meshing block animalsdropbones:animalsdropbones_gravel_compressed I've come to the conclusion there's some sort of stupid typo that I can't see somewhere. Any suggestions?
  5. This is driving me completely crazy. I changed everything to use lowercase - modID, block names, item names. Since I'm not camel casing, I put underscores in the camel-cased block names. I cleaned out my old resource folder, regenerated all my JSONs reflecting the new naming scheme, and regenerated all my textures (yay scripting). Now NOTHING renders, not even my blocks. I'm getting texture-not-found exceptions for the blocks, and for my METADATA item, but not my SIMPLE items. But they're all pink-and-black cubes. :'( Now, getting texture-not-found exceptions for the blocks suggests my blocks are loading their JSONs correctly, thus getting told what texture to load - but I have NO CLUE why they'd not FIND the texture, cuz it's right there. *points in frustration at my screen, which you can't see* This was working on Friday. So, here's the thing I'm registering my blocks with the mesher with; I've got them all in a LinkedList<>. And then I get the following in the log: ... which is weird, because my MODID isn't in there and I can clearly see me cating it on to that variable I'm printing out. I'm not getting build errors. aaarg.
  6. Sorry, I should have been more specific: they show up in game with the pink and black checkered box. They all work in the sense that I can use them in game appropriately, but they're using the default model and texture. This is how I instantiate the object: ToolSledgehammer sledgehammerStone = new ToolSledgehammer(ToolMaterial.STONE); ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); mesher.register((Item)item, metadata, new ModelResourceLocation("animalsdropbones:Stone_Sledgehammer")); The object registers itself in the constructor. It builds its own name and unlocalized name based on the tool material. I want it to also register itself with the mesher, but I'm not worrying about that yet until I figure out HOW to. This is the tool constructor: and this is the relevant code from NamespaceManager: private static String modName = "AnimalsDropBones"; public static String GetModNameLC(){ return new String(modName.toLowerCase()); } public static String getUnLocalized(String key) { return NamespaceManager.GetModNameLC() + "_" + key; } So. That's NOT the unlocalized name - and it's mixed-case. Let me go adjust those two things - I still need to prefix the modID and a colon onto the unlocalized name, right?
  7. I've got my Blocks working properly, as blocks, in my inventory, in my hand, on the ground, whatever. They're great. What I can't seem to get working is my regular old Items, and it's driving me batty. I have a metadata item (each state should have a different JSON and texture), but I also have several normal items, and none of them are working. So, first things first, given the following resource setup for one of my simple items, what do I need to pass to the ItemModelMesher? If I get this figured out, I can probably puzzle out everything else, but I'm clearly doing something fundamentally wrong. So. My ModID is animalsdropbones (legacy, I'll end up refactoring it later) My slegehammer model is in assets\animalsdropbones\models\item\Stone_Sledgehammer.json It's code is as such: and my texture is in assets\animalsdropbones\textures\items\Stone_Sledgehammer.png Right now I'm doing ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); mesher.register((Item)item, metadata, new ModelResourceLocation("animalsdropbones:Stone_Sledgehammer")); What's wrong?
  8. Do you know the params? from googling around I can figure out that the first four are world, x, y, z, and the 7th is # of items to try to drop, but #5 (an int) and #6 (a float) are cryptic. I can hazard a guess from other functions that 5 might be fortune enchant level... but 6 is still cryptic. Useful things! Oh fabulous, fabulous obfuscation... *plays around with*
  9. I've been here before looking for a breakBlock(player, world, worldX, worldY, worldZ, fortune) type method. Basically, I want to break a block *exactly* as if the passed player had broken the block at those XYZ coordinates - drop items, drop XP, explode, whatever it does, I want it to do it. Haven't had a lot of luck, so I'm writing it myself. I've got the basic kind of thing done (break block, receive drop(s)) but I'm back looking for how to look up the correct XP drop (0 to many) and how to drop it, and how to trigger other things, like TNT exploding. private void breakBlock(World gameWorld_, BlockWithLocation blockXYZ) { //System.out.println(String.format("breakBlock() dropping at %d %d %d", blockXYZ.x, blockXYZ.y, blockXYZ.z)); int fortune = 0; // TODO: implement me ItemStack dropedItemStack = new ItemStack( blockXYZ.b.getItemDropped(0, new Random(), fortune)); EntityItem drop = new EntityItem(gameWorld_, blockXYZ.x, blockXYZ.y, blockXYZ.z, dropedItemStack); gameWorld_.spawnEntityInWorld(drop); gameWorld_.setBlockToAir(blockXYZ.x, blockXYZ.y, blockXYZ.z); } Things I've already tried and had absolutely no luck with: gameworld.setBlockWithNotify() gameworld.removedByPlayer() gameworld.destroyBlockInWorldPartially() Anyone know where I should look? Or can point to an opensource mod with a similar example?
  10. FWIW, I thought the subject line was funny Take your vacation - we'll all still be here when you come back, and silliness will have had time to blow over some more once people see the sky hasn't fallen. Every programmer needs vacations or we go screaming monkey mad and that's just bad.
  11. So I see! Unfortunately there's a lot of tutorials floating around still using it that claim to have been "updated" for 1.7 That indeed did the trick. Thank you sir!
  12. OK, that's weirder. If I make it server side only, it never gets called at all. And if I make it client side only, it STILL gets called twice and produces the "junk" ghost blocks. @SideOnly(Side.SERVER) public boolean onBlockDestroyed(ItemStack toolInstance, World gameWorld_, Block blockStruck, int worldX, int worldY, int worldZ, EntityLivingBase actor) { System.out.println(String.format("onBlockDestroyed() nuking block at %d %d %d", worldX, worldY, worldZ)); Deque<BlockWithLocation> blockDeck = new LinkedList<BlockWithLocation>(); getNeighboringBlocksToDeque(gameWorld_, blockStruck, worldX, worldY, worldZ, blockDeck); System.out.println(String.format("getNeighboringBlocksToDeque(): returned deck of %d", blockDeck.size())); hitManyBlocks(toolInstance, gameWorld_, worldX, worldY, worldZ, actor, blockDeck); return true; }
  13. Aha! That makes sense, I really need to remember about the client/server side split, for when I see "it's being done twice !?!" again. I haven't found the "proper" function so I wrote my own to serve until I get it. I can just sub in the real function call once I find it. private void breakBlock(World gameWorld_, BlockWithLocation blockXYZ) { // System.out.println(String.format("breakBlock() dropping at %d %d %d", blockXYZ.x, blockXYZ.y, blockXYZ.z)); int fortune = 0; // figure out how to get my Fortune enchant level later ItemStack dropedItemStack = new ItemStack( blockXYZ.b.getItemDropped(0, new Random(), fortune)); EntityItem drop = new EntityItem(gameWorld_, blockXYZ.x, blockXYZ.y, blockXYZ.z, dropedItemStack); gameWorld_.spawnEntityInWorld(drop); gameWorld_.setBlockToAir(blockXYZ.x, blockXYZ.y, blockXYZ.z); } BlockWithLocation is just a custom object that has 4 fields: a block, and an x, y, and z int.
  14. Welp. I'm baffled. onBlockDestroyed() is called twice every time I break a block, for reasons not obvious to me, meaning my home-rolled "drop item and destroy block" method is being called twice. Weirder still, for some reason the second set of objects dropped appear to be a bit derpy - I can see them, they react to having a block plonked down in their space, but I can't pick them up and they don't save with a server restart. I suppose it's good they're noninteractive since I'm not supposed to have 2x drops, but wut?
  15. Did you set your JAVA_HOME environment variable to point to your JDK?
  16. I've found gameWorld_.destroyBlockInWorldPartially(actor.getEntityId(), x, y, z, damage) but I can't seem to figure out how much damage to apply to explode anything but the block hit. EDIT: Like, I tried getBlockHardness * 5000 and THAT didn't do it. I'm having a poke at <block>.removedByPlayer() right now, but I can't get it to drop either, even when I set the last argument (canHarvest) to true;
  17. getIdFromBlock() should do the trick for the moment - you shouldn't create things with a set ID and otherwise muck about with it directly, but reading it seems to still be kosher for now. if (Block.getIdFromBlock(io) == Block.getIdFromBlock(Blocks.stone_pressure_plate) ) { // blah blah blah }
  18. Every "Make a new tool" tutorial I can find is about making an existing tool template out of a new material. Fie on that I say, why try something simple when I can try something I can't find any information about! I'm making a new tool type, a jackhammer or sledgehammer (haven't decided, currently calling it a sledgehammer), that works like an enhanced pick. When you break a block with it, it (ideally) breaks each block around that block that is of the same type. So if you break a stone, it only breaks adjacent stone blocks, not cobblestone or sandstone or ore or dirt or sand or whatever. It takes damage for each block broken - if only one, then x1, if 6, then x6, etc. The breakage is not a chain reaction - it doesn't explode an entire ore seam or mountain at once, just a maximum of a 3x3 cube (how you'd attack the centre block while having each block around it populated I don't know. I have most of the behaviour I'm looking for but I can't figure out how to break the adjacent blocks. I've been transforming them to air for testing purposes, but that's not really helpful - the blocks don't drop whatever if I do that. I want to trigger regular block breakage without firing off the onBlockDestroyed() event on my tool again (because I don't want the chain reaction, eep). What method(s) am I looking for, and where are they hiding?
  19. I can't swear to it, but this looks like the same kind of table-based weighting system I'm familiar with from other games; it's designed for extensibility. Basically, you have a stack/list/whatever of your possible options, each assigned a numeric weight (default 1). When the game needs something from the list, it generates a random number between 1 and $sum_of_weights, and counts up the list until it finds the item with that number. Simplest case: you have one item the table. Game generates a random number between 1 and 1, gets 1 (naturally), picks the only item off the table. Tada. Slightly more sophisticated case: you have three items on the table: Item Weight Grasslands 3 Forest 5 Ocean 8 The total for this table is 16, so the game generates a random number between 1 and 16 (inclusive). If it gets a 1, 2, or 3, it picks Grasslands. If it gets a 4, 5, 6, 7, or 8, it picks Forest. If it gets 9 or above, it picks Ocean. So you come along and add a new biome ("Jungle") and weight it at 1 (default). Now the table looks like this: Item Weight Grasslands 3 Forest 5 Ocean 8 Jungle 1 Now the sum is 17, and your biome only has a 1/17 chance of coming up. But if you change the jungle weight to 100, now your biome has a 100/116 chance of coming up, and is going to be showing up all over the freeking place. EDIT: The benefit of this system is that you don't need to know how many items are going to be on the list when you assign weights to different things; working with percentages directly means you always need to keep recalculating each item in the table to squeeze a new one into your table. Also, floating point numbers, ick. Instead, this table type lets you just keep pushing new items onto the table end, without editing any of the previous items. If you want to increase the weight of a previous item (say, you want more Jungles), you don't even have to edit it - just keep adding more copies of it to the table end.
  20. Doesn't seem to be related to my mod, because when I shut down and restarted it didn't reproduce... but hey. This is my minecraft crash-report, where do I find the forge one?
  21. Yes, I use the default setup exactly as you described. I haven't done Java development in a decade, baring a brief excursion a few years ago, so I'm just not touching anything unless I have to and until I know what I'm doing. Code, I can handle; everything else (build management, for example...) not so much My objects and resource are and the two proxies are just the generic ones from the Forge Wiki tutorial by Havvy et al; since I just have two recipes in there, there's nothing to actually DO in either one, but I'll go mess with those later once I know how to actually make my mod go. My build.gradle is (now) my SimpleString.java is And my mcmod.info is now Now, when I run "gradlew build" from D:\Games\forge-1.7.10-10.13.0.1170-src\ it makes D:\Games\forge-1.7.10-10.13.0.1170-src\build\libs\[1.7.10]SyndarylSimpleString-1.0.jar which looks coherent when I peek inside it and now it has my new mcmod.info, but it doesn't seem to do anything in Minecraft. At least it doesn't crash any more? I also tried manually zipping up the gradlew-produced class files and adding the mcmod.info by hand, as per the tutorial at http://www.minecraftforge.net/wiki/Releasing_Mods (as if the class files had been built by the MCP scripts instead) but no joy there, either. No crash, but no joy. EDIT: Oh hey. Of course after hitting send, I think I see something. I refactored my classes to a better namespace, and missed updating the @SidedProxy() - but the actual proxy objects DID go to the new namespace and so aren't where it's being told to look. I'm baffled why that doesn't generate errors, at build time or at run time, but LO AND BEHOLD it's in my mod list now! aaaand now Mincraft crashed again but it's not blaming me for once. ("Ticking memory connection"?)
  22. Aha! THAT's what changed from the old tutorials! Simple idea too, and I'm a big fan of simple. For the curious bystander, it puts your built packages in \forge\build\classes\main\ and it makes your .jar in \forge\build\libs\ Buuut my JAR doesn't get registered as a mod. At least it doesn't make minecraft crash? It does look like gradlew didn't pick up my mcmod.info and possibly not even the @Mod info from my mod class, since it made a .jar called modid-1.0.jar and the mcmod.info in it was a blank file. I'll look at my build.gradlew - I probably haven't set it up right.
  23. Caution: new to Minecraft modding. I've created a basic mod that works if I launch Minecraft through Eclipse, hurray. However, I'm lost for trying to package it up to put in my regular Minecraft installation or share with others. I tried File -> Export... -> Java-JAR -> and packaging up my .class files and the mcmod.info, and the structure inside the JAR file produced looks like (for instance) the one for ChickenShed, which works. But if I copy my JAR to my mod folder and run Minecraft, it barfs on loading with "Caused by: java.lang.NoSuchFieldError: wool" which is pretty basic... What do I need to do different in my mod to have it work outside the Forge/Gradle/Eclipse environment?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.