Jump to content

Sin

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Sin

  1. Hey everyone, It's pretty late and I'm a tad tired so I'm sorry if I sound a little confusing. I'll amend this question in the morning. Anyway the question is simple, execution is a little more complex. I want to give an "Item" (not a block) extra variables which it can then save to NBT tags. Ultimately this will create a near unlimited amount of variations on an single type of item (though slightly more expensive in terms of memory). I'm am doing this because the item can be made using a ridiculous amount of different recipes, i.e different minerals used to create the item result in different materials the item possesses. My plan is to then calculate the variables in that item based on what materials it was made out of; hence why I need to save the data to the item for future use. Any ideas? Cheers.
  2. I had to write two new classes. Once my mod is complete I intend to give back to the community the things I have learnt along the way through intermediate/advanced tutorials.
  3. As Mazatar said, you really need to give us a better example of what you are trying to accomplish. Where would this model reside within the game? An entity isn't a mob or person it's an object within the space of the game world. Blocks are also entities . Sorry if I sound like I'm patronising you, I'm just imagining you may have gotten a little confused on the scope of an entity. TL;DR What is the model for?
  4. Why not just use NBT compounds to distinguish between entities? And just use an enumerator to calculate the various possibilities?
  5. Never mind fixed it. Thanks anyway. Hey forge community, yet another problem from me. So I've made a 4x4 crafting grid which on the most part works. Any crafting done within the 3x3 of the grid works. Here's the problem. Any crafting recipe utilizing the extra slots on the right most or bottom most slots (including shapeless 1 slot recipes) will not work. Even if I add a 3x3 recipe in the 3x3 part of the grid then add a block to the extension, the 3x3 will still show up, leaving me with the impression that the slots simply aren't being read to. I've struggled to find the problem for the past few days and attempted to fix it numerous times by reading through the code or looking for the rare similar problem over the net, but they are generally shots in the dark - logically speaking I can't find any interference with the 4x4. I'll post what code I have though I don't know if the problem actually resides in the custom classes. -snip- I gotta say, it's frustrating as hell asking for help like this but there's not a great deal of resources out there on this. Thanks again in advance.
  6. Thank you so much for your reply. I'll look into to setting this up when I get back from work.
  7. Still unresolved guys; appreciate any insight thanks
  8. Hey guys it's been a while, modding has been going pretty smooth until now. But to better explain my problem here is a small class which handles a few key bindings... note some lines including class name have been changed here. package <package>; import <all the right imports> public class KeyHandlerThingy extends KeyHandler { public static KeyBinding accendBinding = new KeyBinding("Accend", Keyboard.KEY_Z); public static KeyBinding decendBinding = new KeyBinding("Decend", Keyboard.KEY_X); public static KeyBinding forwardBinding = new KeyBinding("Thrust", Keyboard.KEY_W); public static KeyBinding brakeBinding = new KeyBinding("Air Brake", Keyboard.KEY_S); public static KeyBinding leftRotationBinding = new KeyBinding("Turn Left", Keyboard.KEY_A); public static KeyBinding rightRotationBinding = new KeyBinding("Turn Right", Keyboard.KEY_D); public static int keyLift = 0; public static int keyThrust = 0; public static int keyTurn = 0; public static KeyBinding[] arrayOfKeys = new KeyBinding[] {accendBinding, decendBinding, forwardBinding, brakeBinding, leftRotationBinding, rightRotationBinding}; public static boolean[] areRepeating = new boolean[] {true, true, true, true, true, true}; public KeyHandlerThingy() { super(arrayOfKeys, areRepeating); } @Override public String getLabel() { return "Mod KeyBindings"; } @Override public void keyDown(EnumSet<TickType> types, KeyBinding keyb, boolean tickEnd, boolean isRepeat) { if (FMLClientHandler.instance().getClient().currentScreen == null) { if(keyb.keyCode == accendBinding.keyCode) { keyLift = 1; } else if(keyb.keyCode == decendBinding.keyCode) { keyLift = 2; } else { keyLift = 0; } if(keyb.keyCode == forwardBinding.keyCode) { keyThrust = 1; } else if(keyb.keyCode == brakeBinding.keyCode) { keyThrust = 2; } else { keyThrust = 0; } if(keyb.keyCode == leftRotationBinding.keyCode) { keyTurn = 1; } else if(keyb.keyCode == rightRotationBinding.keyCode) { keyTurn = 2; } else { keyTurn = 0; } } } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.CLIENT); } } So once the vehicle is mounted by the player - everything works fine. The problem is, the key bindings override the "forward, backward, left and right" keys when in game (conflicts). So my intention was to simply find if the vanilla key has been pressed and work with that. Although crude my first attempt was to test for the following: if(keyb.keyCode == Minecraft.getMinecraft().gameSettings.forwardKeyBinding.keyCode) { //do stuff } But this was damned pretty quickly (the reverse happened, player could move, vehicle couldn't). Now here's (what I believe), the odd part. Printing the keyCode out reveals the correct value (in this case '17'), but I'm still unable to manipulate the aircraft which must mean one of two things, '17' is not being registered as being pressed when KeyDown is being called, or the key is being overwritten earlier on in the program each tick. TLDR; I need to access the keybinding for player movement so I may override it. Cheers everyone!
  9. Oh my god... it wasn't your code that fixed the problem - but the "lack of it" (bad way of explaining it I know). here was mine... public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { //Check Activation by player String var1 = par5EntityPlayer.username; par5EntityPlayer.sendChatToPlayer("Activated by: " + var1 + ""); //Make the player fly par5EntityPlayer.capabilities.allowFlying = true; par5EntityPlayer.fallDistance = 0; par5EntityPlayer.motionY += 1.0; par5EntityPlayer.capabilities.isFlying = true; return true; } } turns out it needs to return to both cases. Thanks - four days on such a silly problem!
  10. I can't give you the answer as I've never tried it myself. But you may get some ideas from looking at bspkr's mod "ArmorStatusHUD" code which has a HUD overlay updated in real time (I'm not saying copy his code; just learn from it).
  11. Hi forge community! I've been reluctant to ask for help in an attempt to figure out things for myself but it seems I'm a little stumped on something I figured would be rather simple. Goal: My goal is to get my player entity to right click on a block (onBlockActivated) and be automatically made to jump in the air and ready to fly. So far all I have been able to find throughout the API is to set the player entity's capabilities to allow them to fly in survival (allowFlying set to true), as well as tell the program that the entity is flying (isFlying set to true) even though it is not. Problem: So my problem is small but I'm still new to the forge API. I want the player to automatically jump into the air ready to move around in flight mode, but I simply do not have the expertise to make this happen. So I'm calling upon my fellow modders to lend me a hand! Thanks in advance.
×
×
  • Create New...

Important Information

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