
Althonos
Members-
Posts
23 -
Joined
-
Last visited
Everything posted by Althonos
-
[Solved] Can't access variables inside of java.util.Timer
Althonos replied to Althonos's topic in Modder Support
It works perfectly, many thanks my friend. Solved timer: -
[Solved] Can't access variables inside of java.util.Timer
Althonos replied to Althonos's topic in Modder Support
So it says 20 ticks is equivalent to one second, unless the computer is slower, then ticks happen at a slower rate. Is there a way to guarantee one second will pass? When twenty ticks isn't guaranteed to be one second. -
[Solved] Can't access variables inside of java.util.Timer
Althonos replied to Althonos's topic in Modder Support
Trying to make it so, if the conditions are set up, the itemStack.stackTagCompound has some values changed every second. If Minecraft does things in ticks, how would I do it using ticks? I thought that Minecraft could essentially use any ordinary Java method? -
So in an item class, I'm overriding the onItemUse like so The issue is, I have a java.util.timer declaration inside of it, and it refuses to allow me to edit the ItemStack itemStack variable since it is not final. However, if it is final, it doesn't let me edit it anyway. The java.util.Timer This is the error I get in the little lightbulb on the left: Cannot refer to the non-final local variable itemStack defined in an enclosing scope. I found a java forum that had the same issue, however their solution was of no use to me. http://stackoverflow.com/questions/21485590/the-final-local-variable-cannot-be-assigned-since-it-is-defined-in-an-enclosing There were several solutions to this problem at that page, however none that seemed to allow me to edit the itemStack variable as itself. I have been working on this for a few hours now, decided to ask you guys to see if there's a simple solution I'm missing. Thanks for reading. [/code]
-
That's.. Odd.. I set it so if you just hold right click it will break all the blocks you look at and drop them.. It works perfectly. Damages the item, drops the blocks which I can pickup, and removes the blocks.. But not if there's a timer? Edit: Nevermind with the timer thing. The other issue above is still.. An issue, though.
-
I do not call onItemUse manually, but let it happen normally through @Override. I have almost completely integrated NBTTagCompound as well. @Override public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int posX, int posY, int posZ, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
-
I have changed onItemUse(parameters) to onItemUseFirst(parameters) and now, when I set the block to air, it seems to work. That is, until I try to place a block touching the said block or remove a block touching it. When I interact with the removed block in any way, the broken block reappears. For instance, Method is called Block is replaced by air I try to place a block over air Old block reappears in same position I must really be missing something..
-
This is the output of the suggested println statement; [sTDOUT]: [com.zacharysturtz.items.OrangePickaxe:onItemUse:63]: onItemUse [Client]; isReady:true The timers I call reset the isReady boolean. I have tested that it does actually execute the if (isReady) statement at the desired time. The issue is with the first bit you said, how would I fix it so it renders server-side as well? Also, I will look in to the NBT status flags you were talking about.
-
I have a custom pickaxe that extends ItemPickaxe, the goal is for the onItemUse method to dig out a hole in front of it whenever the right click happens. What actually happens is for a second, it replaces the blocks with the desired block (air), then fixes it to it's original position. It also refuses to damage the item (inside of the same method) My hypothesis is that it's reverting any changes made during onItemUse. Does anyone know why, and how to fix it? Class for the pickaxe: One more thing -- The bit I have about the ItemEntity inside of the dropItem method, it never allows me to pickup the dropped block. Why? Any help is greatly appreciated.
-
How would I check for a type of block at a specific location?
Althonos replied to Althonos's topic in Modder Support
Ah, I hadn't thought of using the unlocalized name to check. I have the coordinates, my only issue is checking to see if it's a vanilla chest. Would the unlocalized name for a vanilla chest be tile.container.chest? -
As the title says, what I wish to do is check for a specific type of block at pre-defined coordinates. I have a custom block, I have the location setup to check for the block. What I wish to do is trigger an event whenever a TileEntityChest is placed next to my block (Adjacent to it's x or z axis). The only issue is I don't know how to check if it's a TileEntityChest. I thought of something like if (adjacentXPos != new TileEntityChest()){} Sadly, however, that didn't work. I can check if they're null just fine by doing if (adjacentXPos != null){} Any input is appreciated.
-
Question on registering custom doubleslabs [Solved]
Althonos replied to Althonos's topic in Modder Support
Solved, took me awhile because I am slightly retarded. Finished slab class: Finished ItemSlab class: Finished slab creation: Finished Registery (Inside of preinit): -
Question on registering custom doubleslabs [Solved]
Althonos replied to Althonos's topic in Modder Support
Okay, so, I implemented a class that extends ItemSlab. The issue is that I'm getting an ID overlap. (Two of the same Id, I think) So it crashes Minecraft upon startup. ItemSlab class: The use of the class: Error Log (Some of it): (Edit) For additional reference, here is the source GameData.class method where the error points to: -
Hello, I have a custom slab class, these custom slabs function normally. Aside from two things; One: The slabs do not stack, when I place them on each-other there's a big empty space. Two: When I click in with the scroll wheel of my mouse, it gives me a stone slab instead. It's the same thing with any custom block that extends a vanilla block, is there a method to fix this? Picture of my problem: http://postimg.org/image/g97zuc2fp/ I have also tried to register the "ItemSlab" in postInit from the following tutorial (Changing the syntax to 1.7.10 myself), but it was of no use, my blocks simply wouldn't stack. Here's my registry and slab class. Registering: Slab Class (Cut out import statements): To reiterate, the issue is not with texturing, but the fact the slabs do not change to doubleslabs when placed together, thank you for your time.
-
Custom door block, having trouble with texturing [SOLVED]
Althonos replied to Althonos's topic in Modder Support
Ah! I can't believe I made such a stupid mistake. Sorry, thanks for catching it. It works perfectly now, also, there were two reasons to me not renaming the variables; One: I didn't know what they meant (Now I do, thanks to you.) Two: I didn't see the need to at the time, but now that I think about it, my code looks so much prettier. Anyway, problem solved! -
Custom door block, having trouble with texturing [SOLVED]
Althonos replied to Althonos's topic in Modder Support
I added a few println statements to determine what values are used. I don't understand the meaning behind the order of the values, however. As per your suggestion, I renamed some variables, here's the updated code and console output: Updated Code: Console Output when I place a door: -
Custom door block, having trouble with texturing [SOLVED]
Althonos replied to Althonos's topic in Modder Support
I found the need to rename the pre-made variables useless, since the only thing I was doing was changing the icons. If I was editing more than just that, then I would invest the time to rename the variables. For now, I will look up what you had posted. -
I've created a custom door block, everything is working perfectly. Aside from the fact that, at the back side of the door, instead of loading the bottom and top textures, it loads two top textures. Also, occasionally it will be reverse, double-top on front and bot-top on back. Here's my base code for the new door block class (I copied their methods, overridden of course, and changed the values to just a new texture. Only showing the relevant code.) Here is some more information; Some pictures of my problem. http://postimg.org/image/ze4wvu5f5/ http://postimg.org/image/r9edkt2wf/
-
getIcon() for BlockDoor always returning NullPointerException [SOLVED]
Althonos replied to Althonos's topic in Modder Support
Solved. I decided to stop using someone else's code and add my own, the issue was his positioning was off. It works perfectly! Thanks for all the feedback, man. -
getIcon() for BlockDoor always returning NullPointerException [SOLVED]
Althonos replied to Althonos's topic in Modder Support
Here's my full door class for your reference. I tried several different locations of calling icons = new IIcon[2]; Full Item Class Also, any println statements in the getBlockTexture method are never called. This might be of use as well, here is the relevant BlockDoor class that gives the error. BlockDoor Relevant Methods -
getIcon() for BlockDoor always returning NullPointerException [SOLVED]
Althonos replied to Althonos's topic in Modder Support
I just realized something I have from another class.. How come this works But not this code? Also, I have tried to use console print, and it prints inside of the main, but whenever I place the block it auto-crashes Minecraft so it never shows anything inside of getIcons. However, if I place it in registerBlockIcon, it prints the statement during Minecraft startup. So why is it still null while passing the icons[0]? Edit: I printed text and icons[0] inside of registerIcons, it printed the name of the png file with some weird syntax, so I think it is assigned properly. -
getIcon() for BlockDoor always returning NullPointerException [SOLVED]
Althonos replied to Althonos's topic in Modder Support
I've tried just returning icons[0] as well, the code I posted was the alternative suggested. As I said in the first post, I believe the error lies in the fact it is calling getIcons() before anything else (Before registering them), therefore returning null. I also have no idea of changing the order of calling it. -
Hello, so this issue is, whenever I run my mod to generate a custom door, the getIcon() method is always called immediately, before the registerBlockIcons() method. Therefore returning a NullPointerException, I have tried to check if the icon I'm returning is equal to null by using if (icon != null). The issue was, nothing I was returning in the else statement was helping me. Another forum has had the same problem; https://github.com/Chicken-Bones/ForgeMultipart/issues/86#issuecomment-25778634 However, the suggested method of solving it, by checking for null and using a pointer if it was null, was not in any way helpful. Relevant Icon Code: Relevant Crash Report: If I missed out any additional code or information I should have added, please notify me. Thanks for reading.