Jump to content

Tankwart

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Tankwart

  1. Hi Mew! Sorry for my mistake! As I said, I'm very new to modding Why I wrote an answer though?! I had a similar problem with a CustomKeyHandler. Everytime I pressed a Key, the function was called two times (I think so, cause the chatmessage appeared two times.). It seemed to be the "keypressed" and "keyreleased"-problem. To shiip around this, I created an toggle which allowed to set a control-variable only once to true and after that to false. Now the chatmessage only appears one time, like it should, only the gamemode is changing very randomly, but that's another story. Maybe it helps you, if you create a toggle like mine in the function you call. Would be something like: - Is (boolean)sent=true? if yes, do nothing or if not, sendChat... and set sent to false I hope you got what I mean Sorry, but my english is at the borderline If it helps you, here the link to my issue, with the toggle-part inside: Click Greets Tankwart
  2. Hi there! I'm very new to modding, but I have an idea. Have you tested "addChatMessage(message)" instead of "sendChatToPlayer(message)"? Maybe this helps. Greets Tankwart
  3. Hi there! I try to explain my Problem in short words: I'm playing around with KeyBindings. I took an old Item an added an "onUpdate(bla bla)". I also created the KeyHandler to get the Information if the specific Key is pressed. While playing around, I made the Key working as an toggle. This toggle should switch between Survival and Creative. Long story short: If I press the key with the item in my hand, the toggle works as it should. I can see this, cause I have a player.addChatMessage() in the onUpdate, too. The problem now is, that the gamemode doesn't change everytime I press the key (the ChatMessage appears!). I think it changes every 5 to 100 time I press the key. If someone please could watch the code and tell me what the fault is Thanks alot! Tankwart The part in the IconFile: boolean gameTypeCreative = false; boolean gameTypeSurvival = true; public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { EntityPlayer player = (EntityPlayer)par3Entity; if(KeyBindingHandler.keyPressed & par1ItemStack==player.getHeldItem()) { if(gameTypeSurvival==true) { player.setGameType(EnumGameType.CREATIVE); player.addChatMessage("Creative an! gTC=" + gameTypeCreative + " / gTS=" + gameTypeSurvival); gameTypeSurvival = false; gameTypeCreative = true; } else { player.setGameType(EnumGameType.SURVIVAL); player.addChatMessage("Survival an! gTC=" + gameTypeCreative + " / gTS=" + gameTypeSurvival); gameTypeSurvival = true; gameTypeCreative = false; } } } And the KeyBindingHandler: package ... public class KeyBindingHandler extends KeyHandler // implements ITickHandler { private EnumSet tickTypes = EnumSet.of(TickType.CLIENT); // With PLAYER it's the same issue. public static boolean keyPressed = false; public static boolean keyReleased = true; public KeyBindingHandler(KeyBinding[] keyBindings, boolean[] repeatings) { super(keyBindings, repeatings); } @Override public String getLabel() { return "CustomKey"; } @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if (keyReleased==true) { keyPressed = true; //System.out.println("pressed"); } else { keyPressed=false; } keyReleased = false; } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) { if (keyReleased==false){ keyPressed = false; keyReleased = true; //System.out.println("released"); } } @Override public EnumSet<TickType> ticks() { return tickTypes; } }
  4. Hi Draco18s! I haven't seen this before in any other forum and was a little bit afraid clicking on it. In this case, I will do! Thanks! Greets Tankwart
  5. Hi mnn! Damn, this easy... Sorry for the silly question! Yes exactly this is the problem! I forgot the setUnlocalizedName. Thank you very much for the help! With kind regards! Tankwart @ADMIN: Problem is solved and thread can be closed. Due to the fact, that it was a silly question, it's on you to delete it.
  6. Hi there! I'm new here and started modding for minecraft a few days ago. My first language is german but I can READ english very well. Writing is still very wired My Problem locates in the main mod-file. I created a few dummy-blocks and generated them in the ground. All works perfect. After that I came over to flowers. Adding them as Blocks looked somehow wired They show up as a normal block and not as a crosstexture. So I figured out, that there is a class called BlockFlower. Once I created my flowers as BlockFlowers, everything worked as it should work. The flowers generated all over the land. Next thing was: Adding a second flower... all worked nice... except: Now I have the problem, that I created 3 flowers and in creativeTab they all have the same name. I changed a lot and wanted to figure out what the problem is, but I got stuck. Would someone please help me out?! Would be nice! The important parts of the mod-file: With kind regards! Tankwart
×
×
  • Create New...

Important Information

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