Jump to content

perromercenary00

Members
  • Posts

    849
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by perromercenary00

  1. i get some kind of work around but it has its issues i also see your post in git hub https://github.com/MinecraftForge/MinecraftForge/issues/3915 the forge people has been working on this for what i understand the bug is solved and the issue is cause by something else in mi code, i dissable all mi entities renders mi sounds and mi events keybinds but i still having the issues and could not pinpoint what in mi code is messing mi first person view render anyway the trick i found is to leave shouldCauseReequipAnimation always returning true no matther what, but this causes the item to allways remain under the hotbar, mi solution: i change all the item models for this gun (like 73) to draw the item 9 points up this set it where is in the video and from there i can change the nbt values in the itemstack whatever i want, "firstperson_righthand": { "rotation": [ 0.0, -90.0, 0.0 ], "translation": [ 3.5, 2.0, 0.0], "scale": [ 1.0, 1.0, 1.0 ] }, "firstperson_lefthand": { "rotation": [ 0.0, 90.0, 0.0 ], "translation": [ 3.5, 2.0, 0.0], "scale": [ 1.0, 1.0, 1.0 ] }, to "firstperson_righthand": { "rotation": [ 0.0, -90.0, 0.0 ], "translation": [ 3.5, 9.0, 0.0], "scale": [ 1.0, 1.0, 1.0 ] }, "firstperson_lefthand": { "rotation": [ 0.0, 90.0, 0.0 ], "translation": [ 3.5, 9.0, 0.0], "scale": [ 1.0, 1.0, 1.0 ] }, also whithout the burden of theReequipAnimation i write the code to make some kind of ActionResult<ItemStack> onItemLeftClick but in the onupdate() method now i have a betther control the offhand gun behaveour // #################################################################################################### @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return true; // cdalm xtold = getAlmacenamiento(oldStack); // cdalm xtnew = getAlmacenamiento(newStack); // if (xtnew != null && !xtnew.isEjecutar() ) //{ // System.out.println("shouldCauseReequipAnimation(true)"); // return false; //} // always true the item is down under the hotbar but seems animations // works // when always false the item is normal posicioned but animations dont // works and it swings on left click /* * oldStack = oldStack.copy(); oldStack.setTagCompound(null); newStack = * newStack.copy(); newStack.setTagCompound(null); return * ItemStack.areItemStacksEqual(oldStack, newStack); */ // EntityRenderer ER = mc.entityRenderer; // ER.itemRenderer.resetEquippedProgress(EnumHand.MAIN_HAND); // field_187469_f,equippedProgressMainHand,0, // field_187470_g,prevEquippedProgressMainHand,0, // field_187471_h,equippedProgressOffHand,0, // field_187472_i,prevEquippedProgressOffHand,0, // playerIRenderItem RI = mc.getRenderItem(); // IR.resetEquippedProgress(EnumHand.MAIN_HAND); // IR.updateEquippedItem(); // return false; /* * * Minecraft mc = Minecraft.getMinecraft(); EntityPlayer playerIn = * mc.player; * * ItemRenderer IR = mc.getItemRenderer(); * * if(IR!=null)try{ { * * Field field00 = * ItemRenderer.class.getDeclaredField("equippedProgressMainHand"); * field00.setAccessible(true); field00.setFloat(IR,1); * * Field field01 = * ItemRenderer.class.getDeclaredField("prevEquippedProgressMainHand"); * field01.setAccessible(true); field01.setFloat(IR,1); * * } { Field field00 = * ItemRenderer.class.getDeclaredField("equippedProgressOffHand"); * field00.setAccessible(true); field00.setFloat(IR,1); * * Field field01 = * ItemRenderer.class.getDeclaredField("prevEquippedProgressOffHand"); * field01.setAccessible(true); field01.setFloat(IR,1); } * }catch(Exception e){ e.printStackTrace(); } * * * //IR.resetEquippedProgress(EnumHand.MAIN_HAND); * //IR.resetEquippedProgress(EnumHand.OFF_HAND); //return false; } * * * * oldStack = oldStack.copy(); oldStack.setTagCompound(null); newStack = * newStack.copy(); newStack.setTagCompound(null); return * !ItemStack.areItemStacksEqual(oldStack, newStack); */ /* * * return false; * * // cdalm xtold = getAlmacenamiento(oldStack); cdalm xtnew = * getAlmacenamiento(newStack); * * if (xtnew != null && !xtnew.isEjecutar() ) { return false; } return * true; */ } // #########################################################################3 the next i thing a need is a easy way to hide one of the hands from the first view render thats all for now
  2. nop is not working but in 1.8 for a brief versions it does then they come whith 1.9 and its fuck again until now i having this issue for a long time this time i thougth than whith the new capabilityes system i could store held the data in other place without update the nbt in the item until im ready but seems like not
  3. !Por fin¡ Thanks to the forums i now have a funtional capabilitie class that allow me to store data and inventories and the data is synced whit client side whitout having to mess whith custom packets https://gist.github.com/anonymous/df2656774483a6f335c1fa4be4d1fff4 https://youtu.be/zi5hZE8K204 now i have another doub i set some system.out's in the code to understand when it reads and when it writtes i have an old little quarry whith the unequip animation and i like to have some control over when minecraft writes back the data to the nbt and to the item [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Client thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT() [19:21:16] [Server thread/INFO]: [STDOUT]: ### >>> serializeNBT()
  4. thanks for reply i been playing whit mods from 1.7 and i m a little complicated whit the results i like mi items has animations and sounds and lights and things until now i been controlling the animations making Excessive use of nbttags values in the long run i wanna update all mi items and entities to 1.11.2 but i siting here still stuck in the basic becoze i don't get how to use the new capability system and trying to make this items animations old nbttag style is not working ################## going back to the original question where i get the item nbtdata from the item in this part @Override public NBTBase serializeNBT() { //Retrieve data here return null; } Thanks for reading
  5. some more shoots in the dark https://gist.github.com/anonymous/b261636775b9d168454f864bf75d35cb Itemside code // ############################################################################################# public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); Capability<?> capacidaddealmacenamiento = null; if (itemstack.hasCapability(capacidaddealmacenamiento, EnumFacing.UP)) { capacidaddealmacenamiento xt = (capacidaddealmacenamiento) itemstack.getCapability(capacidaddealmacenamiento, EnumFacing.UP); int redstone = xt.getRedstone(); if (redstone < 1) { xt.setRedstone(1100); } } playerIn.setActiveHand(handIn); return new ActionResult(EnumActionResult.FAIL, itemstack); } // ###################################################################
  6. well i guest i need the two, the first the nbt is not to bother, is the same way im doing it from 1.8 is the capability workaround i don't get coze involve a lot of new code if i found i working example i could realize the whole thing by analyze the code
  7. good days guys really dont get what i doing m been just like here shooting in the dark lets make it more simple make aside for a while the chestplate/backpackk item inventory this pueba01 item has only an int Nbt tag named redstone storing the amoung of redstone "" how i get/set the value from the nbt ?? https://gist.github.com/anonymous/1db0b20c50fe1e6dca557a48a29e23be //############################################################################################# public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); playerIn.setActiveHand(handIn); //int redstone = util.getInttag(itemstack, "redstone"); //util.setInttag(itemstack, "redstone", redstone); //but how the heck i get the value from the capability ?? int redstone = capabilitywhath?? System.out.print("redstone="+redstone); if( redstone < 1 ){ capabilitywhath??.setRedstonetoneto(1100); } return new ActionResult(EnumActionResult.SUCCESS, itemstack); } //################################################################### [!code] a working example could be a very valuable aid Thanks for reading
  8. https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ its that documentation that i don't get they explain what its the capability and more or less what it needs to work but actually has no examples of how do the things or at least i don't understand it coze is write in English. Anyway i think this capability thing came whit the idea of not use in excess NBT to write and read info, but create and object to store temporally the data and just use it read/write the data fast and only read write the nbt one time at load the world and write one time ad close/save world first thing i don't understand, have I to create a class whit the code to store, in this case an inventory an some other nbt's variables, where i create this class, what classes have i to implement, where i must declare it for minecrafts to be aware how i attach it to the item class looking in the vainilla code for the entity player i made this https://gist.github.com/anonymous/1edf37742d0b4be02ba9b6574cdb5709 i suppose this class must have gets and sets to access all the data i need, well again now how i declare the existence of this class in the common proxy how i attach this capability class to mi costume item chestPlate/Backpack class ?? is something like tile-entities but whit getCapability and hasCapability well how i retrieve mi data whit this methods ?? for what i read this capability thing only works for server side and is not synced with the client side, i must rearrange mi package system to send to client side the data changes (serialize up and down everything ) anyway at least this guide is missing a working example whit that i could just see how everything is declare and where, what classes are using and what classes/interfaces are extended/implemented and avoid post must of this bobby question in the forum thanks for reading no en serio im little mad here to see how complex has become a single item in 1.11
  9. Good days im trying to fix something else exactly this post this time just a step at time actually i have a code that allow me to store a custom inventory in an item but using nbtTag's i made it coping code from the blockchest.class this is minecraft 11.2 i has been told its suppose you do this kind of things using capabilities i been reading things but really i don't get how to do this first steep ¿can someone lend mi a guide on how to read/store costume inventories in itemstack or a working mod code whit this feature to begin from o sea the code to do this same thing but with capabilities or i just Misunderstand the whole thing and this is done this way with nbttags // #########################################################################3 public static ArrayList<ItemStack> readInventariofromItem(ItemStack chestarmour) { // System.out.println("!leerInventarioItem!"); NBTTagCompound itemnbtcmp = chestarmour.getTagCompound(); int inventariosize = util.getInttag(chestarmour, "inventariosize"); ArrayList<ItemStack> chestInventory = new ArrayList<ItemStack>(inventariosize); // System.out.println("!inventariosize="+inventariosize); if (itemnbtcmp != null) { if (itemnbtcmp.hasKey("Inventario")) { NBTTagList nbttaglist = itemnbtcmp.getTagList("Inventario", 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound.getByte("Slot") & 255; ItemStack itemstack = new ItemStack(nbttagcompound); itemstack = (itemstack == null) ? itemstack.EMPTY : itemstack; // System.out.println(i+"!itemstack="+itemstack.getUnlocalizedName()+" // j="+j); if (j >= 0 && j < inventariosize) { // chestInventory.set(j, itemstack); chestInventory.add(itemstack); } } } } return chestInventory; } // #########################################################################3 public static ItemStack writeInventariotoItem(ItemStack chestarmour, ArrayList<ItemStack> inv) { // System.out.println("!escribirInventarioItem!"); int inventariosize = inv.size(); NBTTagCompound itemnbtcmp = chestarmour.getTagCompound(); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < inventariosize; ++i) { ItemStack itemstack = (ItemStack) inv.get(i); itemstack = (itemstack == null) ? itemstack.EMPTY : itemstack; NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setByte("Slot", (byte) i); itemstack.writeToNBT(nbttagcompound); nbttaglist.appendTag(nbttagcompound); } if (itemnbtcmp == null) { itemnbtcmp = new NBTTagCompound(); } itemnbtcmp.setTag("Inventario", nbttaglist); chestarmour.setTagCompound(itemnbtcmp); util.setInttag(chestarmour, "inventariosize", inventariosize); return chestarmour; } // #########################################################################3 public static void showInventariocontens(ArrayList<ItemStack> inv) { int invsize = inv.size(); ItemStack stack = ItemStack.EMPTY; for (int i = 0; i < invsize; ++i) { stack = inv.get(i); System.out.println("SLOT[" + i + "]=" + stack.getUnlocalizedName() + " > " + stack.getCount()); } } // #########################################################################3 public static void setInttag(ItemStack item, String tag, int value) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); } etiquetas.setInteger(tag, value); item.setTagCompound(etiquetas); } // #########################################################################3
  10. More or less i don't want to attach a new inventory to the entity but to the the custom chest-plate item and some costume backpacks but i need to read/write the entity inventories (main + hand's + costume) as whole as i plane to make mobs with guns and items i require this code to works also in that the trouble is that the inventories in entityPlayer "NonNullList<ItemStack>" are different from the inventories in entities like zombies villagers and cows "Iterable<ItemStack>" In nbttag-level they are more universal all is inside the tag "Inventory", 10 so just whit a pair of methods to read from and write to nbttagcompund i could spare a good piece of code what i want ? let's speak of the items i updating right now, Chainsaw this item uses "suspencionderedstone" as fuel to work soo if the chainsaw has no fuel the reload routine must be something like if ( the player has suspencion de redstone in main inventory ){ consume that and play reload animation } else if( the player has suspencion de redstone in chest|backpack|briefcase inventory ) { consume that and play reload animation } else{ don't du anything } and the the fireguns in mod you could unload munition from the guns to change it for another type of munition or load another gun i have normally three types of munition per gun steel, Redstone, obsidian lets say i have a big magazine with 53 bullets the unload routine would be something like int magazinemunition = "magazine bullets"; inventarioHandler invh = new inventarioHandler(EntityPlayer); int howmanybulletsfitinmaininventory = invh.howmanyfitinmain( modItems.bullet556 ); int howmanybulletsfitinchestinventory = invh.howmanyfitinchest( modItems.bullet556 ); if( magazinemunition >= ( howmanybulletsfitinmaininventory + howmanybulletsfitinchestinventory ) ) { play animation for all 53 bullets, set the munition to the player inventories and let zero bullets in the magazine } else { play animation for what fits bullets, set the munition to the player inventories only what is possible and let the remaining bullets in the magazine } this is mi code https://gist.github.com/anonymous/a1d3b1121d6c2da07dd21f043d252c1e Thanks for reading
  11. good days im solving some other trouble for i wanna create a custom inventory in chest|armours named "chestInventory" and add it to the entity and works with it like it was only one big inventory but without mess the vanilla for what im making a custom inventory helper the plan is to read and write the inventory directly from the entity compound but i don't find the method to get the vanilla nbttag i just get the custom nbt whit entity.getEntityData(); a little text to understand better i have this testing item on entity swing it create the object from mi class and it must show in the console output all the inventory from the entity
  12. good nights now i have the IItemHandler, I rememberer using this interface in the backpacks in 1.8 but its an interface and also its like empty and looks not like what i need let say i need to know how many botles of suspencionderedstone the entity has before doing anything or i want tu unload the bullets from a gun, i need to calculate how any bullets i could arrange in the inventory before unload coz i don't wanna drop nothing to the floor soo its like a have to make the code i need anyway better resign and begin to write code again thanks for answering @Override public int getSlots() { // TODO Auto-generated method stub return 0; } @Override public ItemStack getStackInSlot(int slot) { // TODO Auto-generated method stub return null; } @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { // TODO Auto-generated method stub return null; } @Override public ItemStack extractItem(int slot, int amount, boolean simulate) { // TODO Auto-generated method stub return null; } @Override public int getSlotLimit(int slot) { // TODO Auto-generated method stub return 0; }
  13. good nigths im update some pieces of code and found some changes now the inventories are NonNullList<ItemStack> so mi old code is now broken i been thinking about it and this time i wanna use the forge tools for managing inventories rater than create mi owns but thats the trouble where i find this tools what class i must search for ? in this inventories i need to *first check if there is room to put an item in inventory *check actually exactly how many of this specific item/metada i could store in this inventory or else *check if there is space in mi custom armours|backpacks to store the remaining itemStack so i could store a part in the main inventory and the rest in mi custome inventory i don't remember asking this before well also i don't remember at all , in 1.8 i just sit and write the code for this sorry foir bad english g
  14. thansk for answering but its little odd that is working xblk.isWood(world, xpos) is true only if the block is log but is false if the block is door fence ladder or plank anyway thats is exactly what i need ArrayList<BlockPos> list9 = new ArrayList<BlockPos>(); list9.add( new BlockPos( 1,0,-1 )); list9.add( new BlockPos( 1,0,0 )); list9.add( new BlockPos( 1,0,1 )); list9.add( new BlockPos( 0,0,-1 )); list9.add( new BlockPos( 0,0,0 )); list9.add( new BlockPos( 0,0,1 )); list9.add( new BlockPos( -1,0,-1 )); list9.add( new BlockPos( -1,0,0 )); list9.add( new BlockPos( -1,0,1 )); for( int l = 0 ; l < list9.size() ; l ++){ xpos = ypos.add(list9.get(l)); xbst = this.world.getBlockState(xpos); xblk = xbst.getBlock(); if( xblk.isWood(world, xpos) ){ System.out.println("Tronco ="+xpos); troncos.add(xpos); } if( xblk.isLeaves(xbst, world, xpos) ){ System.out.println("hojas ="+xpos); hojas.add(xpos); } }
  15. Good days Broken english alert! iM trying to fix mi chainsaw item for that i need to identified the target blocks i need to identified the log blocks from the tree but i don't wanna break Plank blocks or any other block by mistake so i can't use Material blkstate.getMaterial() in the old time i just do something like for( int l = 0 ; l < list9.size() ; l ++){ xpos = ypos.add(list9.get(l)); xbst = this.world.getBlockState(xpos); xblk = xbst.getBlock(); Block logblk1 = Blocks.LOG; Block logblk2 = Blocks.LOG2; // i remember doing it this way long time ago //but now throw error Blocks.LOG cannot be resolved to a type, blockLog is not instanciable anymore ?? if( xblk instanceof Blocks.LOG || xblk instanceof Blocks.LOG2 ){ System.out.println( "Is definitively a log block ="+xpos); } if( xbst.getMaterial() == Material.LEAVES){ System.out.println( "Is a leaves block ="+xpos); } if( xbst.getMaterial() == Material.WOOD){ System.out.println( "could be a log a fence a door or any other block made of wood ="+xpos); } }
  16. good nights with the hint of RenderSpecificHandEvent i find a way to solve mi issue but its needed some more complexity i need to inform the client side that it must be hide the main or the off-hand but if i do it via writing an nbt in the server side gonna fuck stackability for the items from vanilla and another mods sending a message to client side to write an nbt on the item to hide looks to much effort for the actual problem someone has a way to solve this problem ?? // ########################################################################################################################3 @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderHand(RenderSpecificHandEvent event) { if (isEnabled()) { ItemStack stack = event.getItemStack(); Item itm = stack.getItem(); boolean hideit = util.getBooleantag(stack, "hideit"); if(hideit){ event.setCanceled(true); } }
  17. please example of the first item map thing and the second event thing @SubscribeEvent public void RenderSpecificHandEvent(RenderSpecificHandEvent event) { if (event.getItemStack().getItem() instanceof arco){ EnumHand mano = event.getHand(); RenderSpecificHandEvent(mano, 0,0F, 0.0F, 0.0F, 1.0F, event.getItemStack()); } }
  18. good nighs thanks for answering. what is this map where i could get it and mod it the las time i was trying with some code like this if (worldIn.isRemote){ Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.player; ItemRenderer IR = mc.getItemRenderer(); Entity rve = mc.getRenderViewEntity(); EntityRenderer er = mc.entityRenderer; MapItemRenderer emap = er.getMapItemRenderer(); emap.something ??; } the map part is new i just write it but don't get what to do but where to put it a was punting this on the item OnUpdate() method but its feel more like an event
  19. i know i have been for long in this forum and at this point i'm afraid to ask but how df you delete/reset the arms of the playermodel whit the item held in first and third view mode ?? i been searching in Google and don't get it yet where i could find a working example ? i remember than in dayz mode they do something like this
  20. i do something like this but was because i do some complicated things whit mi mod in that time all mi structures was designed to occupy only one chunk and set the block whit the tile entity at the center of the chunk at y=0 so just check if at the center of the chunk is one of mi structure blocks and then also have the facing for the structure but this obviously wont works for vanilla or other mods structures
  21. Good days i have this issue whith custom bow https://s27.postimg.org/osliqosab/Captura_de_pantalla_de_2016_12_30_06_48_36.png[/img] i have this bow and this arrow now when i thigt the bow https://s23.postimg.org/vc2j0qymj/Captura_de_pantalla_de_2016_12_30_06_48_50.png[/img] the arrow in the right hand don't disapear it remains visible is the same if bow is in right hand and arrow in left #### ?? how do i hide the other hand when item is in use
  22. but trolling a side is good to know im remaking the mod and only have like 30 items and 10 blocks imagine you have all that items already made, and then they push this kind of rule and you have to redo change the name of everything to lowercase, and make it in windows im curious to know if they already fix that annoying feature whit the ReequipAnimation /** * Determine if the player switching between these two item stacks * @param oldStack The old stack that was equipped * @param newStack The new stack * @param slotChanged If the current equipped slot was changed, * Vanilla does not play the animation if you switch between two * slots that hold the exact same item. * @return True to play the item change animation */ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !oldStack.equals(newStack); //!ItemStack.areItemStacksEqual(oldStack, newStack); } this shit cause me to quit moding the last time im still far from the point i got enough code to test it
  23. good nights im updating mi updating of mi mod from 1.10 to 1.11 but for some reasons any of mi textures works and i fear something big change in the way you set textures for items and blocks probably entities too the thing is this, i have a generic class to create items https://gist.github.com/anonymous/3c7dca0bac0e0b4f702a82abae4e761d so i have mi items.init where i just set the names https://gist.github.com/anonymous/69391facf41c9abc91fcf21542579e4c ## notice i use names whit mixed lower and upper case then i have mi textures class https://gist.github.com/anonymous/7658649aadc175923beb1e65a45e5504 always mixed case names when i load the game and see the output i get this curiosity all the name and route is lowercased Caused by: java.io.FileNotFoundException: modmercenario:models/item/materiales/materialesredstonecompresa.json but item and texture are registered whit [lower|uppercased] names public static Item materialesRedstoneCompresa; materialesRedstoneCompresa = new modmercenario.items.materiales.materialGenerico("materialesRedstoneCompresa"); ModelLoader.setCustomModelResourceLocation(MMMateriales.materialesRedstoneCompresa,0 , new ModelResourceLocation("modmercenario:materiales/materialesRedstoneCompresa", "inventory")); #### soo i set everything to lowercase names, json and png everything and bam solved is this a new rule everything must be set lowercase to work or wtf bug is mi way of setting textures still valid?? ### and there is some more questions, this methods are market in mi code as error and i asked to remove @overrides so they are anymore in the main block class, they wass remove and now is different the way to make a block do something on right click ?? *public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { *public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,int meta, EntityLivingBase placer) *@Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) { list.add(new ItemStack(itemIn, 1, 0 )); } neither *public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) { can some captain point-me in account whit the resents changes or the locations of the latest update guide tutorial. very tankful mercenarydog
  24. good nights i wanna add some recipes to the Brewing Stand soo i been searching in Google but it says is not possible because Brewing Stand is really a tileEntity whit the recipes hardcore inside but is this 1.10.2 is possible that someone could already fix this or definitively i have to code some sore of costume alambique of mi own
×
×
  • Create New...

Important Information

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