Jump to content

perromercenary00

Members
  • Posts

    849
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by perromercenary00

  1. this is another feature /bug founded and the reason for many post on the forum say mi iteblock dont load texture. let say a create an item named unlocalizated name = "aceromercenario" and do create it in a class named aceroMercenario.java so i created a json named aceroMercenario.json to load aceromercenario.png as you can see now the spotable trouble are the names. minecraft base its search in the unlocalizated name, in this case it shall not load the texture because it is lokking for a json named exactly whit the unlocalizated name of the item but i name my json whith the item whith a case diferent name. the easy way to solve this is set everything to lowercase names the other thing you can do is register the wrong_named.json whith the item using ModelBakery class example my unlocalizated name is "aceromercenario" but my item is register in my modItems class like "aceroMercenario" aceroMercenario = new mercenarymod.items.materiales.aceroMercenario(); the wrong_named json is aceroMercenario.json so i do register the wrong_named json whith my item in the textures class or the preinit of main class using modelbakery ModelBakery.addVariantName(MercenaryModItems.aceroMercenario, new String[]{"modmercenario:aceroMercenario"}); then, Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.aceroMercenario, 0, new ModelResourceLocation("modmercenario:aceroMercenario" , "inventory")); and now the texture loads I must add for the blocks you can set manualy the texture to use in the inventory, for the block in the world il will always look for a json whit the unlocalizated name of the block so if a i do Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(MercenaryModBlocks.multicara), 0, new ModelResourceLocation("apple" , "inventory")); it loads the apple texture and shows the block in inventory whit the apple, but when you put the block on the world it still take the textures from models/block/multicara.json there must be somewhere a method to force the block to load a custom json whit diferent name.
  2. Good days this is a little long to explain to reach where mi questions are. first , the 1.8 is using a new and more simple system to change the orientation of the blocks , i gonna use the furnace to explain whath i have the Block state system it let you just define how to rotate all the faces of a block in just one single json file, this mean that i have not anymore to define manually where go all te faces of block on every case of rotation like in 1.7 whith getIcon _______________________________________________ @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { int tex=(meta*6)+(side); //System.out.println("side="+side+" meta="+meta+" tex="+tex); if (tex < icons.length ){return icons[tex];} else{return icons[0];} } // fin de IIcon getIcon _______________________________________________ now go forth to 1.8 the furnace Blockstate file define 4 posible rotations simply rotating textures on the Y axix ~/.minecraft/versions/1.8/1.8/assets/minecraft/blockstates/furnace.json { "variants": { "facing=north": { "model": "furnace" }, "facing=south": { "model": "furnace", "y": 180 }, "facing=west": { "model": "furnace", "y": 270 }, "facing=east": { "model": "furnace", "y": 90 } } } the mojan's store this Values in a custom Object named "IBlockState" and this is the center point of this post i create a custom multitexture block named girable looks like a red dice and i copy the furnace blockstate json for this block , ~/Modding/forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/blockstates/girable.json { "variants": { "facing=north": { "model": "modmercenario:girable" }, "facing=south": { "model": "modmercenario:girable", "y": 180 }, "facing=west": { "model": "modmercenario:girable", "y": 270 }, "facing=east": { "model": "modmercenario:girable", "y": 90 } } } the blocks load and all his textures are on place when i put it on the world and is a red dice iwant this block to behabe like te furnace seting the face number 2 looking to the player no mather if a look to south or to the east there comes again the Iblockstate object if i wanna set in the world a furnace looking to south i need the blocks.furnace object + the iblockstate of the furnace looking to south = "facing=south" thats the part i dont get and find hard to explain something i dont get if there is a furnace looking to south in the world i can do a IBlockState rot = worldIn.getBlockState(pos0); //i alredy have the coordenates of the furnace stored in pos0 whith this i have a objet named rot which contains the blocks.furnace + the iblockstate="facing=south" whit this i can put it wherever i wan whit worldIn.setBlockState(posX, rot); lets say i wanna put on world a furnace looking to east but there is not another east loking furnace in the world or mi girable block how i load the an object of iblockstate whit the value "facing=east" IBlockState east = "facing=east" ; dont work, it contains Strings but not behave like an String object soo idont find a suitable way to load IBlockState whit a custom value or it musb be like ¿ how i get the fourth IBlockState objets reprensenting the four states of mi customblock girable?
  3. damn your rigth the just skip the step of defining the block adjunting it to blockState public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { Block blk = Blocks.furnace; BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+1) , pos.getZ()); IBlockState state0=blk.getDefaultState(); System.out.println("BlockPos pos="+pos.toString()); System.out.println("BlockPos pos0="+pos0.toString()); worldIn.destroyBlock(pos, true); worldIn.setBlockState(pos0, state0); playerIn.addChatComponentMessage(new ChatComponentTranslation("destruyete Blockesitu", new Object[0])); return false;} and it dont like me this mean i must declare an object of eachtype of block and extract from it the Iblockstate
  4. good days this evening iwass loking for suitable method to spawn blocks in the world and accidentaly find this in bed class playerIn.addChatComponentMessage(new ChatComponentTranslation("mensajito", new Object[0])); time ago i was lokking for this is way more confort to send debug messages to the chat wen moding.
  5. I have the little impresion youar putting the recipe on init() , but must be in preinit() @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); MercenaryModBlocks.init(); MercenaryModItems.init(); MercenaryModRecipes.init(); FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyInputHandler()); mercenarymod.utilidades.KeyBindings.init(); //KeyInputHandler }
  6. well this is akwarks but is the same post named [1.8] world.setBlock(x, y, z, block , meta, mode); method has disapear in 1.8 ? i just change the name this morning loking for an answer to solve this the method i used to use to create blocks in the world is dissapear or maiby now has a diferent name ¿how do you create a especific block at especific coordinates at especific world? in the other hand worldIn.destroyBlock(pos, true); is back and works like old times searching for a suitable method to create blocks the more close to world.setBlock() is worldIn.func_180497_b(pos0, blk ,int ,int ); but or is not or idont know hot to se it work i have this theory. they change te name of world.setBlock(xyz block) to something else and i need this method to create custom estructures i do this in mi testBlock class public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { Block blk = Blocks.furnace; BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+3) , pos.getZ()); worldIn.func_180497_b(pos0, blk , 0 , 0); worldIn.destroyBlock(pos, true); } on rigth click the block must be destroy and it must create a furnace 3 blocks up but it destroy and drop the test block but no furnace has been created again ¿ what is the method in 1.8 to create blocks in the world ?
  7. And now the multitexture block to register textures in mi textures class Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(MercenaryModBlocks.multicara), 0, new ModelResourceLocation("modmercenario:multicara" , "inventory")); class forge-1.8-11.14.0.1261-1.8-src/src/main/java/mercenarymod/blocks/multitextura/multicara.java package mercenarymod.blocks.multitextura; import java.util.Random; import mercenarymod.Mercenary; import mercenarymod.blocks.MercenaryModBlocks; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class multicara extends Block { public static String name = "multicara"; public multicara() { super(Material.glass); setUnlocalizedName(Mercenary.MODID + "_" + name); GameRegistry.registerBlock(this, name); setCreativeTab(Mercenary.herramientas); //this.maxStackSize = 1; } public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(MercenaryModBlocks.multicara); } } blocke json forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/models/block/multicara.json { "parent": "modmercenario:block/cube", "textures": { "down": "modmercenario:blocks/metablockes/metablockemercenario12", "up": "modmercenario:blocks/metablockes/metablockemercenario13", "north": "modmercenario:blocks/metablockes/metablockemercenario14", "south": "modmercenario:blocks/metablockes/metablockemercenario15", "west": "modmercenario:blocks/metablockes/metablockemercenario16", "east": "modmercenario:blocks/metablockes/metablockemercenario17" } } json parental forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/models/block/cube.json { "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "texture": "#down", "cullface": "down" }, "up": { "texture": "#up", "cullface": "up" }, "north": { "texture": "#north", "cullface": "north" }, "south": { "texture": "#south", "cullface": "south" }, "west": { "texture": "#west", "cullface": "west" }, "east": { "texture": "#east", "cullface": "east" } } } ] } blocke json item forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/models/item/multicara.json { "parent": "modmercenario:block/cube", "textures": { "down": "modmercenario:blocks/metablockes/metablockemercenario12", "up": "modmercenario:blocks/metablockes/metablockemercenario13", "north": "modmercenario:blocks/metablockes/metablockemercenario14", "south": "modmercenario:blocks/metablockes/metablockemercenario15", "west": "modmercenario:blocks/metablockes/metablockemercenario16", "east": "modmercenario:blocks/metablockes/metablockemercenario17" } } json blockstates forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/blockstates/multicara.json { "variants": { "normal": { "model": "modmercenario:multicara" } } } still need to know how minecraft do to rotate blocks like the furnace
  8. thats wath i need https://github.com/clienthax/chococraft/blob/1.8/src/main/java/chococraft/client/ClientProxyChocoCraft.java#L64 and example of a working block and thats not my final missleading error there some more missing files. first to load block texture charcoal is need an Item.getItemFromBlock(blocke) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(MercenaryModBlocks.charcoal), 0, new ModelResourceLocation("modmercenario:charcoal" , "inventory")); then the jsons first json the blocks json modmercenario/models/block/charcoal.json { "parent": "modmercenario:block/cube_all", "textures": { "all": "modmercenario:blocks/charcoal" } } is not soo easy because in needs parental json tell it him how to set the sides textures secund json modmercenario/models/block/cube_all.json { "parent": "block/cube", "textures": { "particle": "#all", "down": "#all", "up": "#all", "north": "#all", "east": "#all", "south": "#all", "west": "#all" } } third json the item json modmercenario/models/item/charcoal.json { "parent": "modmercenario:block/cube_all", "textures": { "all": "modmercenario:blocks/charcoal" } } the last json it needs an blockState json file modmercenario/blockstates/charcoal.json { "variants": { "normal": { "model": "modmercenario:charcoal" } } } whit all this file plus the class now it loads the charcoal block whit all the sides same texture for what i see in the chococraft git https://github.com/clienthax/chococraft/tree/1.8 all this make easy to create custom forms like the cross.json and to rotate textures for a bed a furnace of a door but is hell when you need to create sigle blocks, the more cheap solution gonna be to create a bash scrit to set all the jason based on an given name.
  9. good days im working in a first block on 1.8 but dont get how to register the texture cuz mi block is charcoal.java Block if i wanna register the only texture whith Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModBlocks.charcoal, 0, new ModelResourceLocation("modmercenario:charcoal" , "inventory")); it gets error cos mi block is a block and this is for items and aparently is not a Minecraft.getMinecraft().getRenderBlock(), the guide in http://www.minecraftforge.net/forum/index.php/topic,24263.0.html speeks brifly about but it lets the idea that must create an item whith the name charcoal at the same time than the block named charcoal that part i dont get soo long thi is what i have /modmercenario/blockstates/charcoal.json /modmercenario/models/blocks/charcoal.json /modmercenario/models/items/charcoal.json /modmercenario/textures/blocks/charcoal.png //charcoal.java package mercenarymod.blocks.unatextura; import java.util.Random; import mercenarymod.Mercenary; import mercenarymod.blocks.MercenaryModBlocks; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class charcoal extends Block { public static String name = "charcoal"; public charcoal() { super(Material.rock); setUnlocalizedName(Mercenary.MODID + "_" + name); GameRegistry.registerBlock(this, name); setCreativeTab(Mercenary.herramientas); //this.maxStackSize = 1; } public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(MercenaryModBlocks.charcoal); } } how i do to register this block texture??
  10. aaa was that again
  11. good days there i came to step where i need to do blocks for mi mod, but like everybody i get frustrated for the way 1.8 work the render of the faces of blocks i been scavenging the vanilla classes the models and the blockstates folder ican't realize how to se textures for a single unitexture block someone has done a good guide yet ? where to find , gogle is no t clear .
  12. this the only item you have ?? if you register this item whith the texture from another of your items it loads? i
  13. ibelive understand how it works make this test item and set the nbttag code inside a try catch, if the nbt is emtpy or null it created one whith a ramdom number value soo fireup minecraft and take 3 of this testitem and put them on mi hotbar diferents slot, rigth click to the one on the slot 0 get an error cath cachit and set a ramdom value for it "433" the value remain whithout change on right click rigth click on the testitem in the slot 5 get error cath cachit and set a ramdom value for it "839" the value "433" in testitem slot 3 is not afected the same goes for the one in the sloth 9 it gets "127" close minecraft and refireup the values still I change positions of the items close minecraft and refireup the values still not care the order no care if minecraft restart soo i guest this solve the problem in the multiplayer of an item values of one player afecting the item from other player here is the code _________________________________ //testitem.java package mercenarymod.items; import mercenarymod.materialesMercenarios; import mercenarymod.Mercenary; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import mercenarymod.items.MercenaryModItems; import mercenarymod.utilidades.registrarTextura; import mercenarymod.utilidades.gearbox; import mercenarymod.items.sierras.tiempo0; import mercenarymod.utilidades.util; import java.lang.Math; import java.util.List; public class testitem extends Items{ public static String name = "testitem"; static NBTTagCompound ns = new NBTTagCompound(); public static boolean test=true; public testitem(){ setUnlocalizedName(Mercenary.MODID + "_" + name); GameRegistry.registerItem(this, name); setCreativeTab(Mercenary.herramientas); this.maxStackSize = 1; } public ItemStack onItemRightClick(ItemStack testitem, World worldIn, EntityPlayer playerIn){ worldIn.playSoundAtEntity(playerIn, "modmercenario:run", 1.0F, 1.0F); try { NBTTagCompound exi= testitem.getTagCompound(); int ex=exi.getInteger("gearbox"); System.out.println("contenido de nbttag gearbox ="+exi.getInteger("gearbox") ); } catch (Throwable any) { int ran=(int)((Math.random())*1000); ns.setInteger("gearbox", ran); testitem.setTagCompound(ns); System.out.println("Java ERROR: "+any); any.printStackTrace(); } return testitem; } }//fin de la classe
  14. ññaa i gona let it for an option for now wen i get another pc whith video card will test it in lan of two soo i realize something but must be another post
  15. i get something Minecraft mc = Minecraft.getMinecraft(); EntityPlayer playerIn= mc.thePlayer; World worldIn=mc.theWorld; World worldOn= playerIn.getEntityWorld(); System.out.println("es worldIn remoto ="+worldIn.isRemote); System.out.println("es worldIn remoto ="+worldOn.isRemote); System.out.println("Entity steve Nombre="+playerIn.getDisplayNameString() ); ItemStack hand=playerIn.getHeldItem(); System.out.println("Entity steve in hand="+hand.getUnlocalizedName()); if i create an object from the minecraft class i can extrac from there the user and the world but just the remote world and i need the local the other thinks is. here i just have mi player in the developmen environment if iuse Minecraft mc = Minecraft.getMinecraft(); EntityPlayer playerIn= mc.thePlayer; in a lan party it will always get mi user or gona get mixed whith the users of the other players?
  16. i just resolve how to play sounds yesterday how do you do that ? the method i been using play the sound over the head of steve for it needs the value of the world in which steve is and the entitityplayer representing steve entity to get the coordinates where steve is worldIn.playSoundAtEntity(playerIn, "modmercenario:neutro", 1.0F, 1.0F); is a method to play a sound all over the place (loaded chuncks) in all the worlds at the same time ?
  17. well mi mod has a keybindclass named KeyInputHandler wen press '+' or '-'in the keyboard it executes public static void up(){ gear++; mgear(); } or public static void down(){ gear--; mgear(); } thats execute mgear and mgear play a sound wen int gear is zero and call gearbox_display.settextura("numero"+gear); that class is an item an has a method to change the texture of the item based on the int gear value soo first go the keyhandler but keyhandler dont have world value or entityplayer value and i need those two to play a sound
  18. well i need to play a sound from a custom class, not an item or block class, to do dat i need the current world and the player EntityPlayer. worldIn.playSoundAtEntity(playerIn, "modmercenario:neutro", 1.0F, 1.0F); for that I need to extract the current EntityPlayer and the local world from somewhere else i was searching methods in minecraft class but nothing that could serve me like a clock or the compas must work in the inventory whithout need of click this class was created to change the texture of an indicator item and depend on mi keybindings class, iwanna make it give mi sounds ass well wen the gearbox value change //gearbox.java //_____________________________ package mercenarymod.utilidades; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import mercenarymod.items.display.gearbox_display; public class gearbox{ public static int gear = 0; public static int getgear(){return gear;} public static void setgear(int g){gear=g;} public static int limite = 5; public static int getlimite(){return limite;} public static void setlimite(int l){limite=l;gear=0;} public static World worldIn=null; public static EntityPlayer playerIn=null; public static void up(){ gear++;mgear(); } public static void down(){ gear--;mgear(); } public static String mgear(){ if (gear<=0){ gear=0; gearbox_display.settextura("numeron"); worldIn.playSoundAtEntity(playerIn, "modmercenario:neutro", 1.0F, 1.0F); return ""+gear;} if (gear>=limite){gear=limite;} gearbox_display.settextura("numero"+gear); System.out.println("gear="+gear); return ""+gear; } public gearbox(){;} } //_________________________________________
  19. good days im leaving this mini guide here for miself later retake wen ned. well first i wanna set a simple sound for an item nothing complicated soo i gonna take the sound file Rhapsody of Fire - Dark Wings of Steel [2013] 320/11 - Sad Mystic Moon.mp3 and i gona converit to ogg using the sound converter tool from linux and chop the name to sadmistickmoon.ogg this sadmistickmoon.ogg i gonna put in mi mod sounds folder forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/sounds/sadmistickmoon.ogg now the json file , this one is a little tricky there is this colon ', ' must be wached because it can fuck all the file forge-1.8-11.14.0.1261-1.8-src/src/main/resources/assets/modmercenario/sounds.json //__________________________________________________________ { "taladro": { "category": "player", "sounds": [ "taladro" ] }, "neutro": { "category": "player", "sounds": [ "n" ] }, "smm": { "category": "player", "sounds": [ "sadmistickmoon" ] } } //__________________________________________________________ there is only tree sounds files declarated in this json and now the colon thing is at the end of every sound line there must be a colon at the end but never in the last one if you let the colon in the last one or omit the colon in any other line minecraft wont gonna load the file and surprise no custom sounds just one one error and nothing works now to play the sound you must writte this in the item you wanna use whit, mi MODID name is "modmercenario" and this is in the onItemRightClick of mi testingItem public ItemStack onItemRightClick(ItemStack sierra, World worldIn, EntityPlayer playerIn){ //plays taladro worldIn.playSoundAtEntity(playerIn, "modmercenario:taladro", 1.0F, 1.0F); //plays neutro worldIn.playSoundAtEntity(playerIn, "modmercenario:neutro", 1.0F, 1.0F); //plays sad mistic moon worldIn.playSoundAtEntity(playerIn, "modmercenario:smm", 1.0F, 1.0F); } when i fireup minecraft take the testitem on mi hand and press rigth click it sounds first taladro then neutro and sadmistic moon is like all at the same time, but the sound dont gonna move whith steve is like a music box whit a disk if you move ten meters far there is no sound if you get close again there is again the sound .
  20. i just get this fixed in google i found another tutorial but this was complete the trouble is there is a mising line FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyInputHandler()); mercenarymod.utilidades.KeyBindings.init(); and the two lines must be in preinit. so first create KeyBindings.java then second create KeyInputHandler.java thirth put the two lines in the preinit of the principal class in my case Mercenary.java the other tutorial. http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2112337-1-7-2-forge-help-gui-tutorial and my principal class //________________________________________________________- // Mercenary.java package mercenarymod; import mercenarymod.blocks.MercenaryModBlocks; import mercenarymod.items.MercenaryModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraft.creativetab.CreativeTabs; @Mod(modid = Mercenary.MODID, version = Mercenary.VERSION) public class Mercenary { public static final String MODID = "modmercenario"; public static final String VERSION = "1.1"; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); MercenaryModBlocks.init(); MercenaryModItems.init(); MercenaryModRecipes.init(); FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyInputHandler()); mercenarymod.utilidades.KeyBindings.init(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { MercenaryModTexturas.init(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } public static CreativeTabs herramientas = new CreativeTabs("Herraminetas armas y armaduras mercenarias") { @Override @SideOnly(Side.CLIENT) public Item getTabIconItem() { return MercenaryModItems.aceroMercenario; } }; public static CreativeTabs materiales = new CreativeTabs("materiales mercenarios") { @Override @SideOnly(Side.CLIENT) public Item getTabIconItem() { return MercenaryModItems.nokiaMercenaria; } }; }//fin de la clase
  21. jumm i just folow this http://www.minecraftforge.net/wiki/Key_Binding soo in mi folder forge-1.8-11.14.0.1261-1.8-src/src/main/java/mercenarymod/utilidades/ i create //KeyBindings.java //__________________________________________________________ package mercenarymod.utilidades; import org.lwjgl.input.Keyboard; //import net.java.games.input.Keyboard; import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.fml.client.registry.ClientRegistry; public class KeyBindings { // Declare two KeyBindings, ping and pong public static KeyBinding ping; public static KeyBinding pong; public static void init() { // Define the "ping" binding, with (unlocalized) name "key.ping" and // the category with (unlocalized) name "key.categories.mymod" and // key code 24 ("O", LWJGL constant: Keyboard.KEY_O) ping = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.MercenaryMod"); // Define the "pong" binding, with (unlocalized) name "key.pong" and // the category with (unlocalized) name "key.categories.mymod" and // key code 25 ("P", LWJGL constant: Keyboard.KEY_P) pong = new KeyBinding("key.pong", Keyboard.KEY_P, "key.categories.MercenaryMod"); // Register both KeyBindings to the ClientRegistry ClientRegistry.registerKeyBinding(ping); ClientRegistry.registerKeyBinding(pong); } } //_____________________________________________________________ //and create too //KeyInputHandler.java //_____________________________________________________________ package mercenarymod.utilidades; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; //import cpw.mods.fml.common.eventhandler.SubscribeEvent; //import cpw.mods.fml.common.gameevent.InputEvent; public class KeyInputHandler { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if(KeyBindings.ping.isPressed()) System.out.println("ping"); if(KeyBindings.pong.isPressed()) System.out.println("pong"); } } //_____________________________________________________________ ¿but where the fucks goes this line? FMLCommonHandler.instance().bus().register(new mercenarymod.utilidades.KeyBindings()); putit in preinit, noting happen when press 'p' or 'o' nothing in the controls menu putit in init, noting happen when press 'p' or 'o' nothing in the controls menu putit in postinit, noting happen when press 'p' or 'o' nothing in the controls menu all the code seems to be rigth in eclipse.
  22. good in other days play whith applets i cand bind a keyboard key to some funcion in java using an actionListener like jump when hit spacebar but in minecraft what is the name of the class in charge of this, ? and there is this menu to change the keybinds that every mod uses how do you do for the mod to be settable in the options / controls menu
  23. good days i have create a item testitem whit a nbt tag static NBTTagCompound ns = new NBTTagCompound(); public static NBTTagCompound getNBT(){return ns;} ns.setInteger("gearbox", 0); lets say there is two user in a server player1 and player2 and the two have the testitem if the player2 change the value of gearbox to 5 ¿ the testitem from the player will change to ? es que idont have two pcs to make the test here .
×
×
  • Create New...

Important Information

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