jabelar
Members-
Posts
3266 -
Joined
-
Last visited
-
Days Won
39
Everything posted by jabelar
-
[1.7.2]My throwable entity renders with no motion except falling
jabelar replied to jabelar's topic in Modder Support
That's what it looks like. I thought that basic entity fields would be synched automatically since presumably vanilla entities are synched. Oh well ill sync it. -
I was wondering the same thing (if it is related to security manager): when exiting the errors are now definitely different and related to the security manager stuff. Quitting the game now shows following console errors: [09:45:24] [Client thread/ERROR]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] Caused by: cpw.mods.fml.relauncher.FMLSecurityManager$ExitTrappedException at cpw.mods.fml.relauncher.FMLSecurityManager.checkPermission(FMLSecurityManager.java:23) ~[forgeSrc-1.7.2-10.12.2.1133.jar:?] at java.lang.SecurityManager.checkExit(SecurityManager.java:761) ~[?:1.7.0_51] at java.lang.Runtime.exit(Runtime.java:107) ~[?:1.7.0_51] at java.lang.System.exit(System.java:962) ~[?:1.7.0_51] at net.minecraft.client.Minecraft.shutdownMinecraftApplet(Minecraft.java:878) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:948) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) ~[Main.class:?] ... 6 more
-
Okay, I'm creating a "golden egg" throwable which behaves much like a regular egg -- i.e. you can throw it with chance to spawn. It all works, except that the rendering shows that the egg simply falls to the ground from my hand. However, the actual throwing works because the entity is spawned where I'm aiming. I'm only spawning on the server, and the entity does render and starts out at position of my hand, so that means that client is getting synced with the entity info. However, based on console statements I print out, the motion of the entity is not synced to the client. Here is the console debug output, and I output position and motion at the constructor, the spawning invocation, and during the render call. Also I'm testing the entity.worldObj.isRemote to determine if I'm on the client side in each section. You can see that on the server that the motion is correctly created, but it is not on the client. So the positions are synced but not the motion. You can see that on the client side it only has a Y motion which is exactly what it looks like when I play the mod. Any ideas? Some code that may be of interest. Constructor of throwable golden egg. Note that the super constructor adds motion based on player's facing direction and aim point: The point where I spawn the egg (in an ItemGoldenEgg class that is held in the hand): And the render class's doRender() method, which I copied from regular egg: Anyway, I thought motion would be automatically synced!
-
Okay, it seems like the JVM isn't exiting properly. I'm getting multiple copies of JVM running. Currently i see four running and they each take about 1.5GB. Note that I only have one Minecraft instance running on task bar, I'm sure of that. I'm also just quitting Minecraft using the standard "Quit Game" button. I think (can you guys confirm), that there should be two JVM tasks showing in the task manager -- one for Eclipse and one for the running mod. I can see that even after I exit Minecraft that a JVM task that says it is is the mod continues to run... It still doesn't happen 100% of the time though. I'll try to see if I can find a pattern. Anyone have any ideas on why this might happen (JVM continues to run even though Minecraft is quit)?
-
I should clarify that it doesn't happen to me every time. Actually it seems to happen over several consecutive runs. On average maybe on 10th run or so. It is like the JVM doesn't exit properly after running or something -- I think I saw the task manager with four or five JVMs running. I'll keep monitoring it to see if I can figure out any pattern to it.
-
Yes, to be clear: in Java many objects have a toString() method. This is NOT for returning a string related to the functionality of the object, rather it is meant to create a String description of the class itself. For more see: http://www.javapractices.com/topic/TopicAction.do?Id=55
-
Yeah I don't like it either style-wise. There are three cases I know of where you DO need the keyword this: 1. To be explicit that you're referring to an object field in the case where there is some other local or super variable with same name. Like if you had an int field in your object called counter and then you had a for loop with its own index also called counter and you needed to access the object's counter field from within that loop. 2. To refer to the current object as a parameter to a method you're calling. For example, if you're coding within a custom entity and adding ai tasks you would have: tasks.addTask(0, new EntityAISwimming(this)); 3. If you're calling a constructor of your object from within it. public ItemGoldenEgg() { this("Golden Goose", 0xF5E16F, 0xF5F56F); } public ItemGoldenEgg(String parEntityToSpawnName, int parPrimaryColor, int parSecondaryColor) { this.maxStackSize = 16; // same as regular egg this.setCreativeTab(CreativeTabs.tabMisc); colorBase = parPrimaryColor; colorSpots = parSecondaryColor; } The general use of "this" all over the place is, as TheGreyGhost notes, arguable. Some people think it makes it more readable, some like me and TGG think it makes it less readable (due to clutter). But shouldn't create any issue with your code either way.
-
[1.7.2] Apply Vertical Motion When Jumping (Double Jumping)
jabelar replied to TLHPoE's topic in Modder Support
How are you detecting that space bar is pressed (again) while in the air? -
I updated to 1133 and am getting several indications of memory leaks. JVM is regularly shutting down for being out of heap (even though I have run parameters set for mimimum of 4GB) and just now Windows warned it was getting dangerously low on memory (due to JVM process) and then promptly crashed all of Windows. It could be something I did, although the mod I'm running is very basic and doesn't seem to have anything I would consider problematic. It is probably me, but just wanted to see if anyone else saw similar issue?
-
[1.7.2] Apply Vertical Motion When Jumping (Double Jumping)
jabelar replied to TLHPoE's topic in Modder Support
I'm a little puzzled by your code. When are you call this code? If you're calling this on every tick while in the air then it would have a really odd effect. So I'll assume you're calling this from a key input handler for spacebar? Default jump (with no potion effect) is motionY = 0.42D Note that it is a positive value. It of course reduces during the course of the jump, and then becomes negative during the falling part of the jump. Since you're testing for negative motionY, I'm assuming you want the double jump effect to only operate if the player has already crested in the first jump, which is fairly typical. So let's say that the motionY = -0.2D when you run your code. amt value will become 1.2 then you'll add velocity where the 0.2 will cancel and you'll effectively add an upwards motionY = 1.0D. So the code makes sense to me. I just wanted to trace it through... Therefore, I believe it may be some other issue. Like maybe a client versus server thing. If you're handling the key input event I suspect that occurs on the client side, but the motion should be controlled by the server side. So maybe this is a client-server sync issue? Only thing I can think of. To test this, you might want to add some System.out.println() statements to indicate which side the code is running on and to print out the motionY value on each side. If the problem is indeed related to client-server sync, I think that what you would do is instead of running this code directly, your key input event would send packet to server and the server would run this code in response to receiving the packet. Just a suggestion. -
I'm using an IThrowable entity to allow for a ranged effect. Basically when I use an item it shoots out this entity and then does something when it hits a block. I noticed that it works even if I don't register the throwable entity to the game registry. I was wondering what harm, if any, it would do to not register it. It seems to me that registration is mostly to aid keeping track of the entity -- it presumably allows saving/loading and also client-server sync. But since I'm using this entity to almost instantaneously create an effect on the server side only, do I really need to register it? I don't need to save it (i.e. quitting game while this was "in the air" doesn't really need to save), and I don't need it on client side (effect will occur on client based on effect invoked on server). Should I just register it anyway? I just like to make sure I fully understand things, and this prompted some thinking about the registry.
-
Interesting bug that only affects me (everyone else on server is fine)
jabelar replied to Zer0HD2's topic in Modder Support
Memory and stack issues can exhibit quite different behavior on different computers. For example, maybe g11 clears out occasionally and depends on the timing -- on some computers they may not run into stack trouble as fast as on yours. What Forge version exactly are you using? I find that with the latest (1133) that I'm getting occasionally VM heap problems even though I've got 4GB heap paramters for the JVM and I'm also not doing much fancy. Is it possible that you're running slightly different Forge version than the other users? -
Interesting bug that only affects me (everyone else on server is fine)
jabelar replied to Zer0HD2's topic in Modder Support
I get a "blue screen" (it is a bit paler color than actual windows blue screen) sometimes when I screw up rendering. And your issue here seems to be some rendering scaling problem. I suggest that maybe you're not pushing/popping the g11 transforms properly. You probably are messing up the stack and some transform is affecting the next rendered element. I know you say you didn't modify your code, but sometimes I leave Eclipse open on my computer with something highlighted and then someone (maybe me) comes along later to wake up the computer and presses space bar. It can easily wipe out a line or section of code without you really noticing. Anyway, I'd look everywhere you do rendering and especially g11 transformations. -
[SOLVED][1.7.2]Eclipse wants me to cast my class to itself?
jabelar replied to jabelar's topic in Modder Support
Thanks guys. That makes sense. I guess I need to be slightly more conscious of my method chaining and control the order like recommended by diesieben07. -
[SOLVED][1.7.2]Eclipse wants me to cast my class to itself?
jabelar posted a topic in Modder Support
Sorry this is more of a Java question. But I have a custom item called ItemGoldenEgg that extends Item. I'm trying to create a new one and assign it to a static instance field. Anyway, Eclipse warns me that ItemGoldenEgg is an Item and needs to be cast into ItemGoldenEgg. I don't understand why I would ever have to cast something as itself, but I'm weak on some Java concepts.. Anyway here is the line of code (it complains if I don't have the cast in bold below): And the declaration for the instance itemGoldenEgg is in my main class and is: -
[SOLVED]Is there an event handling block drops?
jabelar replied to KeeperofMee's topic in Modder Support
BlockEvent.HarvestDropsEvent By the way, in my events tutorial I've tried to list every possible event I could find in the code, may be useful in the future when searching for events that may be useful. http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html -
The code for your bonemeal event seems pretty complicated. Not sure why you need such complicated code to simply grow your tree, but anyway I suggest you just add System.out.println() type console statements at each point in your code to output information that shows what's happening in the code logic. In other words, if you think a certain if statement should test true then you print out the value of the field before you test it to confirm that your assumptions are correct, and so forth. Usually if you trace the logic of your code step-by-step with console messages you'll quickly find out the exact problem with the code logic.
-
You would add player extended properties to keep track of each one. isTripleJumping, isQuadrupleJumping, etc. Then when you handle the key input for space, you'd check what it is already doing and then do the new thing. When player lands all these would be cleared.
-
@TotalyTaco The addInformation() method is defined in the Item class as: /** * allows items to add custom lines of information to the mouseover description */ @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} So if you're going to override it you need to: a) also make it only loaded on client side with the @SideOnly annotation b) use exactly the same parameter list -- otherwise in Java you've defined a different method that won't be called. Note that this method is called automatically by the showToolTip() method in ItemStack class, and is appended to the display name for the item.
-
Okay, but the reason I ask what you have tried is it helps determine what your modding skill level is, because the answer sometimes is different depending on your capability. Your answer indicates you don't have much programming background. That is okay, but may be a problem. Let's see. The way I'd do it is below. Like anything in programming there are probably many other ways, perhaps better ways, to do it. Like mentioned above, there is an event posted whenever a living entity jumps. In my tutorial on events I actually have a "fun" example at the bottom where the console prints "boing" every time the player jumps. Anyway, that tutorial should show you how to intercept the event. See: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html To do a double jump, in programming you have to keep track of the "state" of the player character. In otherwords, you can't do a double jump unless you know it is actually jumping. So you'll need a field, maybe an extended player property that keeps track of whether he's in the middle of a jump, as you'll need to know that in order to create a double jump. You should see CoolAlias' tutorial (http://www.minecraftforum.net/topic/1952901-172164-eventhandler-and-iextendedentityproperties/) on extended player properties (in his example he makes a mana property, but all you need one boolean property like isJumping that is true when jumping, and second boolean called isDoubleJumping). So once you have the field for keeping track, you would intercept the jumping event (as mentioned above) and set the isJumping field to true. And you would also need to detect when the player lands (probably by using LivingFallEvent but possibley by checking motionY) during PlayerTickEvent). When he lands you'll of course have to clear the isJumping to false. Lastly, you'll need to handl the key input event and when space is pressed, check the player extended properties to test if isJumping is true and test that isDoubleJumping is false (you don't want to allow "triple jumping" so have to test if he's already double jumping). If he's jumping but not double-jumping then you'd create the double jump, I believe by just adding some motionY. So in summary: 1) handle the LivingJumpEvent to set the isJumping variable 2) handle the LivingFallEvent to detect when he's landed to clear the isJumping and isDoubleJumping variables 3) handle the KeyInputEvent to detect space pressed, test if jumping but not already double jumping, and set motion for double jump and set the isDoubleJumping field to true. Get the idea? detect jumps, track when jumping, look for space pressed during jump to set double jump, clear when lands.
-
What have you tried so far? Post your code.
-
A custom mod will have a model class and also a renderer class. The renderer class is the one that associates the textures to the model. I think you would do your texture animation there. You probably don't even have to use meta data, but can control the change in texture any way you wish (use counter to cycle through), or use some state variable (for example wolf entities change the texture to blue eyes when isTamed() is true).
-
Actually I think you can override a block collision block to custom size, but it is done dynamically when the collision bounding boxes are set, it is not a fixed field for the block. You do this by @Overriding the addCollisionBoxesToList method and @Override public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { // change the parameters below to what you want super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } You can do interesting things with this, like changing the bounding box depending on entity type (this could create mod-resistant force field).
-
I think most of your troubles are just basic Java. You want the entity to make the sound right? You might want to check out my entity custom sounds tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-organizing-sound.html From within an entity class, you should be able to play a sound simply with: playSound("mob.bigCat.growl", getSoundVolume(), getSoundPitch()) And the if you extended wolf you'll want to replace the various sounds for whining and panting and such. I think my tutorial can give you the idea.
-
Would this make the gun semi-automatic? I don't want it to just fire slower, I want it to have one shot per click. If you're planning to use the mouse right click for the fire, you're actually in luck because there are already events that check for the start of an item's use: PlayerUseItemEvent.Start I think you can just handle that event to get what you want.