Jump to content

WeiseGuy

Forge Modder
  • Posts

    43
  • Joined

  • Last visited

Everything posted by WeiseGuy

  1. I completely forgot about jabelar's site I've been out of the scene since 1.7.10, so I'm trying to get back in, haha.
  2. Hey all, I'm getting lost in vanilla code trying to figure out some info on a concept I have. I want to try to add an NPC to the game that I can send to automate some task like a player would. Let's say, go cut trees in a set area, or build a house (based off a schematic). They could basically do basic tasks of player, have an inventory, and I'll use a GUI system to assign tasks with a "home" block or some reference block that will be placed by player to designate their zones. I currently have so many classes opened from Villagers, to Villager registry, all the supers for those, the interfaces, etc. I'm getting so lost in the vanilla code. Is there any reference code I can take a look at that people know of or a good tutorial on entities in general? I don't think extending villager is really a good idea since that's going to add in so many things I really don't need. Maybe just extending off the base EntityLiving and making the rest myself? Any tips on where to start here?
  3. You can't open a json with Notepad++, or your IDE? What are you using to make your mod?
  4. Thank you! This helps so much....I've been making all 4 additions each time for simple cubes, holy crap. I know you guys get crap for being blunt, but I appreciate it!
  5. For a simple "normal cube" block you only need the blockstate json: http://mcforge.readthedocs.io/en/latest/blockstates/forgeBlockstates/ I thought you had to do: assets.modid.blockstates -json assets.modid.models.block -json assets.modid.models.item -json Then still the lang of course because you are naming it in game. Am I missing something here? I mean, you can use a base json file and copy/paste it over and over, but you still need to name the texture for it on a basic cube no? block/cube_all can be used, but you still need to say what the texture is, then link the model and the item to it I thought?
  6. Hah, right. I guess I worked in 1.7.10 last, now having to make 4 files for a block just bothers me, though I love how flexible it can be overall. I just don't like to hard code and then creating 4 hard coded references to the same string is cringing at times, completely understand the difference in a Java class, a JSON, and the lang but it would be nice if someone knew of a solution, hence the post 4 files - Lang, model, blockstate, block item.
  7. Thanks Lex! I figured as much, and may do the script for fun. I'm being stubborn and don't like having to go to three places for a block to paste the same string in, but I understand.
  8. I shouldn't change a registry name, as in you've never refactored before? Outside of refactoring, which I think is completely viable, the point still stands that I'm hard coding the value I have stored in a final String into the json and lang that I'd rather not hard code in case of typos (which is why we avoid hard coding to begin with, right programmers who can't type?).
  9. EDIT: Added screenshot to better explain, see bottom link. I think I know the answer to this is that it's not possible...however I figured I'd ask to make sure. I have a library/reference class with final String values of my items/blocks/etc for use with gameRegistry, unlocalized name, etc. I can use this class in all of my java classes of course, but when it comes to the json files and en_lang, I'm hard coding/typing the string value myself which I hate because if I change the name of a block in my reference library, I have to then find the 3 .json's, manually edit them, and then go into my lang and edit that. If I ever add more languages that's just going to continue the work. Anyone know of a solution by chance? EDIT: http://i.imgur.com/WueyFSt.png - Here is what I'm talking about for example.
  10. For IExtendedEntityProperties, check out coolAlias' tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and I would recommend that as well for storing the information for the reasons already stated (surprised you didn't link this yourself coolAlias, haha).
  11. That'll work thanks. I prefer the IDE, and I can get on mine from work, but the input lag from crap internet at work makes me miss click and sometimes things like ctrl + click to get into a class doesn't work so I figured I'd use that instead. Thanks!
  12. Hey all, This may be a dumb question, but I was curious if anyone knew a resource/repo that had all the vanilla code so I can reference vanilla when I'm away from my IDE (i.e. at work, haha). I can remote into my PC at home from work and all, but it would be a little easier if it was just on a repo somewhere to reference. I imagine it's not, but if it is it would be nice if someone could point me there. Googling failed me so I'm thinking it's not anywhere easily found and probably for good reason. If its a legal reason on why not to do this, what if I uploaded it to a private repo so I can reference it myself?
  13. So the concept is a "bench" where I can "socket" an item like you would in Diablo or many other RPGs/games. This is basically adding a modifier in Tinker's Construct. iron pick + empty socket = iron pick with NBT data that it has an empty socket iron pick with empty socket NBT + FierySocket = iron pick with NBT data that says it has a fiery socket, which in turn allows for auto-smelt on ores. I can make the ironPickWithEmptySocketNBT tool and use "onCrafted" to set NBT to say it has an empty socket every time its pulled out of a crafting table, as long as onCrafted allows me to use my socket bench and doesn't need to be in a workbench. But then on the input, how do I ask for item with only said NBT data? Would I have to do something like.... ItemStack toolInput = ironPickWithEmptySocketNBT(); toolInput.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setString("socket", ModItems.emptySocket.getUnlocalizedName()); if (itemStack.stackTagCompound != null) { addRecipe(new ItemStack (ModItems.ironPickWithFierySocket), " ", "IF", " ", 'I', toolInput, 'F', ModItems.FierySocket }
  14. @ DimensionsInTime - Thanks! It's actually REALLY similar to what I'm looking to do. @ coolAlias - I have a topic that is asking about this, but wasn't originally intended to look into NBT in input/output items used in a recipe. Additionally, proper forum etiquette should be "search before you post" and I found this topic that was asking what I'm asking. It's not a thread hijack to say "if you figure this out let me know as I'm doing something similar." Finally, I like your tutorials, thank you!
  15. I have a similar need, if you get it done please post the code or PM me. I have a custom IRecipe class but I don't think I did much outside vanilla except using my inventories on my container instead of IInventory, or something like that.
  16. Look into IIcon in regards to taking side/meta data parameters. Also, Depending on 1.7.x or 1.8 you may find BlockState or otherwise. Reference block code on this tutorial for example of 1.8 code: jabelarminecraft.blogspot.com/p/blog-page_31.html?m=1 For 1.7.10 I'd recommend: bedrockminer.jimdo.com/modding-tutorials/basic-modding-1-7/multi-texture-blocks/ You can also look at vanilla furnace or crafting table (work bench in class name) as they use front, side and top textures.
  17. Alright here is my container class, still can't get transferStackInSlot to work properly to get my items in there. Well, they all transfer properly to the right slots, but I can't figure out where to use my booleans to say if the item is valid or not. Got almost all of this from @BedrockMiner (http://bedrockminer.jimdo.com/modding-tutorials/advanced-modding/gui-container/) @Override public ItemStack transferStackInSlot(EntityPlayer player, int fromSlot) // Called when a player shift-clicks on a slots. You must override this or you will crash when someone does that. { ItemStack previous = null; Slot slot = (Slot) this.inventorySlots.get(fromSlot); if (slot != null && slot.getHasStack()) { ItemStack current = slot.getStack(); previous = current.copy(); boolean slot2Valid = (current.getItem() instanceof ItemTool || current.getItem() instanceof ItemArmor || current.getItem() instanceof ItemHoe); //Checks if item going to slots 0 is Tool or Armor (or Hoe) boolean slot135Valid = (current.getItem() instanceof ItemSocket); //Checks if item going to slots 1, 3, or 5 is a Socket if (fromSlot < 5) { // From TE Inventory to Player Inventory if (!this.mergeItemStack(current, 5, 41, true)) return null; } else if(fromSlot > 4) { // From Player Inventory to TE Inventory (not including output of course) if (!this.mergeItemStack(current, 0, 4, false)) return null; } if (current.stackSize == 0) slot.putStack((ItemStack) null); else slot.onSlotChanged(); if (current.stackSize == previous.stackSize) return null; slot.onPickupFromSlot(player, current); } return previous; } EDIT: Fixed it. Phew, all done. Now to figure out where to read the NBT when inputting the items to a recipe. How would you do it in vanilla? Let's say one of the components is an item that has to have specific NBT data. addRecipe(new ItemStack (ModItems.ModPick, 1), "XXX", " S ", " S ", 'X', ModItems.itemwithspecificNBT, 'S', Items.stick Like, how do you reference item with NBT?
  18. Yeah...what I did last night (well, this morning too I guess, was up until about 2:30 AM). Took my InputInventory that extends IInventory and mirrored vanilla's InventoryCrafting Took my OutputInventory that extends IInventory and mirrored vanilla's equivalent. Took my Input/Output slot and mirrored that of vanilla then went to Slot and ensured anything the vanilla extended wasn't causing issues. etc etc etc with Container, Block, Slots, Inventories, IRecipe, Crafting Manager, etc. Good news is, I have the ability to add a crafting recipe JUST like vanilla code which is badass IMO. Bad news is, vanilla is expecting 3x3 + output, which I changed to 2x3, but then only "draw" 1x 1x3 + output so the slot numbers are a little weird. I'm debugging with .getInventory() to count slot numbers (including null slots). Lots of fun! Also found out (researching GIT Hub at work, oh yeah) a bit more on ItemStack NBT in that on the item class I can addInformation (tooltip) based on said NBT and on the same class can use onCrafted to add the NBT when its pulled out of the table. Of course, this is all theory (in regards to NBT and onCraft) until I get home as remote desktop wants to lag my inputs and makes it hard to code from work when I remote into my home PC. I feel maybe I should make a tutorial on how I did all this junk once I comment everything better and such as I still have yet to see a tutorial on creating a custom crafting table that uses a non-standard matrix, that is I'm using this format: [item] [item] + [item] = [outputItem] [item]
  19. I am sorry. I had a busy day yesterday. Post your GUI container code. No worries, will do when I get home. I have to tweak one thing and I think I have it all actually. Since the post started, I've since made god knows how many commits/changes. I added custom IInventories, custom slots, custom everything it feels like, haha. One thing I'm not sure, just yet at least, is where I would add NBT data if I wanted the output itemStack to have NBT Data of like, which items were used in the 1x3 area. These will be used for enchantments. I'm doing research on that though, just haven't used NBT data yet so I'm working through source code to find it. I'll reply with my code later today though.
  20. I used to think to myself, man, these Forge guys on the forums are a bunch of a-holes to people trying to learn... But then I saw this post...I apologize for my previous assumptions.
  21. True, if the slots are all assigned to the same IInventory. this.addSlotToContainer(new Slot(IInventory, slotIndex, xPos, yPos)) Make the "enable slots" have their own IInventory? Or make a custom Slot called "enableSlot" and @Override onSlotClicked. I feel there are a few ways of doing what he wants, but its a little hard to understand the expected result. Or add an IF statement that checks the slotClicked on isUsableByPlayer (I can't recall if the slot is passed into this class or not).
  22. I have transferStackInSlot which handles moving items from slot to slot and split stacks (I believe it also does the click+drag) but I can't seem to find a way to call the containers onCraftMatrixChanged method from there, and don't see vanilla doing it either. That transferStackInSlot method does take the params of mouse button and such though. EDIT: Also, will be home from work in a couple hours and can post updates to all the code I have now, let me know which classes you would want to see and I'll get it done.
  23. Just to toss in a few cents to the equation... Do your research yourself. I've done YouTube for awhile as a hobby, and as paid voice/editing work for some channels as a side income. Not to say the above individuals aren't correct or aren't lawyers, but I don't think they are and unless you know they are I wouldn't take anything they say as law and would VERY HIGHLY recommend doing the research yourself. Bottom line, don't blame them if you run into an issue as they aren't giving legal advice (though their guidance and suggestions is what I would've recommended).
  24. Does anyone know what may call this or fix this? It's ONLY the click+drag functions of left/right click that cause it and I can't find anything in vanilla code either.
×
×
  • Create New...

Important Information

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