Everything posted by wog890
-
Need help understanding getWatchableObjectByte()
I also found it here public boolean isSitting() { return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } public void setSitting(boolean par1) { byte var2 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); } }
-
Need help understanding getWatchableObjectByte()
This code is in EntityWolf /** * Determines whether this wolf is angry or not. */ public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } /** * Sets whether this wolf is angry or not. */ public void setAngry(boolean par1) { byte var2 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -3))); } } And this code is in EntityTameable public boolean isTamed() { return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0; } public void setTamed(boolean par1) { byte var2 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 4))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -5))); } } I have looked this up online, and haven't been able to quite figure it out yet. I'm assuming that these functions are saving or loading a byte. Another assumption I'm making is that 16 is the number referencing to which byte to save or load. What really confuses me though, is that both taming and angry use 16, so wouldn't these override each other? I'm messing with this because I need to do the same thing as isTamed and isAngry do, to change the texture of my animal if you click it with a pink dye. Since this is how the game does it, I figured I should do it this way as well. If you can help me understand what this function does, I would really appreciate it.
-
Rendering issues and curiosity question
Woops, mixed up proxy and packet handler for some reason. I do know how to do a proxy and already have one set up, sorry for the stupid moment. P.S. That fixed it perfectly. Thank you so much, now I have to start working on the AI.
-
Rendering issues and curiosity question
Ah, thank you sir/mam, I forgot to remove that function from one of the extra tutorials I was trying. I will try that function, but first I'll have to look into making a proxy (I've avoided it for stupid reasons, hahahahaha) Thank you so much for the help. If you can help with the second question I would appreciate it, but it is no rush since I have to get this penguin working first anyways
-
Rendering issues and curiosity question
So I'm going to start off with my main issue. I'm working on adding a penguin into the game to begin learning basic AI and all that good stuff. I've been following the tutorial by Wuppy 29, but he has left out the last part about the actual Model file. I attempted to work this out myself (and checked out other tutorials and minecraft source code) but have not been able to figure it out. My entity is rendering, but it comes out as a humanoid (which I assume is the default and looks really weird since my penguin texture doesn't fit a humanoid model) I put some trace lines in my Model code, but it never gets triggered, so I'm assuming the ModelPenguin class isn't being used. If it isn't to much to ask for, I'd appreciate it if someone would check my code below and inform me of what I am missing. Thanks for your help! Main mod file EntityPenguin.class RenderPenguin.class ModelPenguin.class My second question is for a future idea, (if I ever get this penguin working). Simply put, I want to be able to breed sheep and creepers together. I know it sounds weird but it because of a friend. I know that editing the base files of Minecraft is generally frowned upon so is this even possible?
-
Tile entity saving weirdly when world is reloaded.
Dang, looking at your mod page, it looks pretty amazing! All your items look amazing! I'm going to have to try it out!
-
Tile entity saving weirdly when world is reloaded.
Thank you so much sir/mam. I will go look into fixing that right now :-). And I'm hoping to do a lot more then just gates for this mod, but I didn't want to talk about to much of it over the internet. I managed to finish up my gate yesterday and I'm working on the mechanics to raise on lower it, but I'll definitely go check out yours. And if ya don't mind letting me read your source code, that would be amazing, might help me with some of the issues I'd like to change/fix on my gate!
-
Tile entity saving weirdly when world is reloaded.
So I am currently working on a block that when placed drops a mid-evil style gate. Eventually it will be able to raise and lower, but currently I simply have the animation working for lowering the gate. I have an integer value called "position" that keeps track of where the gate should be, going from 0 to 16, (0 being not showing 16 being fully down). This all works amazingly well when the gate is first placed, but if I log of the world and then reload it, the blocks suddenly aren't showing. The hit box is still there, but nothing is being rendered. To try and figure this out I added this to the block - @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { TileEntityGate tile = (TileEntityGate)par1World.getBlockTileEntity(par2, par3, par4); par5EntityPlayer.addChatMessage("Postion: " + tile.getPosition()); return true; } With this I found out that this (along with other functions in minecraft) is running twice each time, I have no idea why, but when I right click the block the first time the world is loaded it says, (I waited for the gate to be fully down before right clicking it) "Position: 16" "Position: 16" Then I closed out of the world, reloaded it and right clicked on one of the gate blocks again. This time I got, "Position: 0" "Position: 16". Out of curiosity, I then added a breakpoint in the render tile entity for the gate to check the value of "position" there. When I checked that, it always registers it as 0 (the second time I load the world). I don't know why this function is running twice, I've seen it before on other things and it can be really annoying, but I can tell that even though the second time it says "16" that isn't being passed to the render. So with that very long introduction (very sorry about that, wanted to make sure my issue is understood) is out of the way. My questions are, 1. Any idea why position isn't coming up accurately after I reload a world 2. Why some functions are running multiple times and should I worry about it. Oh and just so everyone knows, I have saved position with writeToNBT(), but I'm not 100% sure I'm doing it right, so it is below - @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); position = par1NBTTagCompound.getInteger("Position"); extraPosition = par1NBTTagCompound.getInteger("ExtraPosition"); turnGate = par1NBTTagCompound.getBoolean("TurnGate"); } @Override public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("Position", position); par1NBTTagCompound.setInteger("ExtraPosition", extraPosition); par1NBTTagCompound.setBoolean("TurnGate", turnGate); }
IPS spam blocked by CleanTalk.